Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(392)

Unified Diff: content/browser/renderer_host/image_transport_factory_android.cc

Issue 11194042: Implement TextureImageTransportSurface using texture mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win_aura DCHECK() Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/image_transport_factory_android.cc
diff --git a/content/browser/renderer_host/image_transport_factory_android.cc b/content/browser/renderer_host/image_transport_factory_android.cc
index a2b8f10edb2b22dff152ed1cffa5ed420539a402..558e4857704ef67e6fdf52c28f7836f2ef0d1879 100644
--- a/content/browser/renderer_host/image_transport_factory_android.cc
+++ b/content/browser/renderer_host/image_transport_factory_android.cc
@@ -11,6 +11,7 @@
#include "content/common/gpu/client/gl_helper.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
+#include "third_party/khronos/GLES2/gl2.h"
#include "webkit/gpu/webgraphicscontext3d_in_process_impl.h"
namespace content {
@@ -30,6 +31,16 @@ class DirectGLImageTransportFactory : public ImageTransportFactoryAndroid {
virtual void DestroySharedSurfaceHandle(
const gfx::GLSurfaceHandle& handle) OVERRIDE {}
virtual uint32_t InsertSyncPoint() OVERRIDE { return 0; }
+ virtual uint32_t CreateTexture() OVERRIDE {
+ return context_->createTexture();
+ }
+ virtual void DeleteTexture(uint32_t id) OVERRIDE {
+ context_->deleteTexture(id);
+ }
+ virtual void AcquireTexture(
+ uint32 texture_id, const signed char* mailbox_name) OVERRIDE {}
+ virtual void ReleaseTexture(
+ uint32 texture_id, const signed char* mailbox_name) OVERRIDE {}
virtual WebKit::WebGraphicsContext3D* GetContext3D() OVERRIDE {
return context_.get();
}
@@ -64,6 +75,12 @@ class CmdBufferImageTransportFactory : public ImageTransportFactoryAndroid {
virtual void DestroySharedSurfaceHandle(
const gfx::GLSurfaceHandle& handle) OVERRIDE;
virtual uint32_t InsertSyncPoint() OVERRIDE;
+ virtual uint32_t CreateTexture() OVERRIDE;
+ virtual void DeleteTexture(uint32_t id) OVERRIDE;
+ virtual void AcquireTexture(
+ uint32 texture_id, const signed char* mailbox_name) OVERRIDE;
+ virtual void ReleaseTexture(
+ uint32 texture_id, const signed char* mailbox_name) OVERRIDE;
virtual WebKit::WebGraphicsContext3D* GetContext3D() OVERRIDE {
return context_.get();
}
@@ -105,11 +122,6 @@ CmdBufferImageTransportFactory::CreateSharedSurfaceHandle() {
gfx::GLSurfaceHandle handle = gfx::GLSurfaceHandle(
gfx::kNullPluginWindow, true);
handle.parent_gpu_process_id = context_->GetGPUProcessID();
- handle.parent_client_id = context_->GetChannelID();
- handle.parent_context_id = context_->GetContextID();
- handle.parent_texture_id[0] = context_->createTexture();
- handle.parent_texture_id[1] = context_->createTexture();
- handle.sync_point = context_->insertSyncPoint();
context_->flush();
return handle;
}
@@ -120,16 +132,33 @@ void CmdBufferImageTransportFactory::DestroySharedSurfaceHandle(
NOTREACHED() << "Failed to make shared graphics context current";
return;
}
-
- context_->deleteTexture(handle.parent_texture_id[0]);
- context_->deleteTexture(handle.parent_texture_id[1]);
- context_->finish();
}
uint32_t CmdBufferImageTransportFactory::InsertSyncPoint() {
return context_->insertSyncPoint();
}
+uint32_t CmdBufferImageTransportFactory::CreateTexture() {
+ return context_->createTexture();
+}
+
+void CmdBufferImageTransportFactory::DeleteTexture(uint32_t id) {
+ context_->deleteTexture(id);
+}
+
+void CmdBufferImageTransportFactory::AcquireTexture(
+ uint32 texture_id, const signed char* mailbox_name) {
+ context_->bindTexture(GL_TEXTURE_2D, texture_id);
+ context_->consumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox_name);
+ context_->flush();
+}
+
+void CmdBufferImageTransportFactory::ReleaseTexture(
+ uint32 texture_id, const signed char* mailbox_name) {
+ context_->bindTexture(GL_TEXTURE_2D, texture_id);
+ context_->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox_name);
+}
+
GLHelper* CmdBufferImageTransportFactory::GetGLHelper() {
if (!gl_helper_.get())
gl_helper_.reset(new GLHelper(GetContext3D(), NULL));

Powered by Google App Engine
This is Rietveld 408576698