diff options
author | sievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-16 01:43:11 +0000 |
---|---|---|
committer | sievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-16 01:43:11 +0000 |
commit | 3af832f9c543e7866d375ba326fe659b6f3df939 (patch) | |
tree | 186aa2702ef0a9b9a3747e5418c739795e6e2feb | |
parent | 53f69d34794123f3bf3bc88698b665bfcb78ab29 (diff) | |
download | chromium_src-3af832f9c543e7866d375ba326fe659b6f3df939.zip chromium_src-3af832f9c543e7866d375ba326fe659b6f3df939.tar.gz chromium_src-3af832f9c543e7866d375ba326fe659b6f3df939.tar.bz2 |
Android: Make surface texture transport cmdbuffer-compatible.
NOTRY=True
However, running WebView (which uses single-process mode) with the browser compositor still seems to not work with cmdbuffer clients. (For example, there are problems with having multiple service threads in the same process, i.e. from render and browser compositor). Not investigating further for now, since this codepath will be deprecated shortly in favor of merged threads (no browser compositor).
BUG=224665,166777
Review URL: https://chromiumcodereview.appspot.com/14256014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@200411 0039d316-1c4b-4281-b951-d872f2087c98
4 files changed, 16 insertions, 6 deletions
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc index d06eb8b..f605b8a 100644 --- a/content/browser/renderer_host/compositor_impl_android.cc +++ b/content/browser/renderer_host/compositor_impl_android.cc @@ -50,7 +50,9 @@ class DirectOutputSurface : public cc::OutputSurface { virtual void Reshape(gfx::Size size) OVERRIDE {} virtual void PostSubBuffer(gfx::Rect rect, const cc::LatencyInfo&) OVERRIDE {} - virtual void SwapBuffers(const cc::LatencyInfo&) OVERRIDE {} + virtual void SwapBuffers(const cc::LatencyInfo&) OVERRIDE { + context3d()->shallowFlushCHROMIUM(); + } }; static bool g_initialized = false; diff --git a/content/browser/renderer_host/surface_texture_transport_client_android.cc b/content/browser/renderer_host/surface_texture_transport_client_android.cc index 03056c0..94b199e 100644 --- a/content/browser/renderer_host/surface_texture_transport_client_android.cc +++ b/content/browser/renderer_host/surface_texture_transport_client_android.cc @@ -13,6 +13,8 @@ #include "content/browser/renderer_host/image_transport_factory_android.h" #include "content/public/browser/browser_thread.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h" +#include "third_party/khronos/GLES2/gl2.h" +#include "third_party/khronos/GLES2/gl2ext.h" #include "ui/gl/android/surface_texture_bridge.h" namespace content { @@ -99,7 +101,9 @@ scoped_refptr<media::VideoFrame> SurfaceTextureTransportClient:: ImageTransportFactoryAndroid::GetInstance()->GetContext3D(); context->makeContextCurrent(); texture_id_ = context->createTexture(); - surface_texture_->AttachToGLContext(texture_id_); + context->bindTexture(GL_TEXTURE_EXTERNAL_OES, texture_id_); + context->flush(); + surface_texture_->AttachToGLContext(); } if (!video_frame_) { const gfx::Size size = video_layer_->bounds(); diff --git a/ui/gl/android/surface_texture_bridge.cc b/ui/gl/android/surface_texture_bridge.cc index cd9d9e5..19ce2a7 100644 --- a/ui/gl/android/surface_texture_bridge.cc +++ b/ui/gl/android/surface_texture_bridge.cc @@ -13,6 +13,7 @@ #include "jni/SurfaceTexture_jni.h" #include "ui/gl/android/scoped_java_surface.h" #include "ui/gl/android/surface_texture_listener.h" +#include "ui/gl/gl_bindings.h" using base::android::AttachCurrentThread; using base::android::CheckException; @@ -123,8 +124,11 @@ void SurfaceTextureBridge::SetDefaultBufferSize(int width, int height) { } } -void SurfaceTextureBridge::AttachToGLContext(int texture_id) { +void SurfaceTextureBridge::AttachToGLContext() { if (GlContextMethodsAvailable()) { + int texture_id; + glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &texture_id); + DCHECK(texture_id); JNIEnv* env = AttachCurrentThread(); // Note: This method is only available on JB and greater. JNI_SurfaceTexture::Java_SurfaceTexture_attachToGLContext( diff --git a/ui/gl/android/surface_texture_bridge.h b/ui/gl/android/surface_texture_bridge.h index 9363483..f3f3bcf 100644 --- a/ui/gl/android/surface_texture_bridge.h +++ b/ui/gl/android/surface_texture_bridge.h @@ -40,9 +40,9 @@ class GL_EXPORT SurfaceTextureBridge // Set the default size of the image buffers. void SetDefaultBufferSize(int width, int height); - // Attach the SurfaceTexture to the given texture in the GL context that is - // current on the calling thread. - void AttachToGLContext(int texture_id); + // Attach the SurfaceTexture to the texture currently bound to + // GL_TEXTURE_EXTERNAL_OES. + void AttachToGLContext(); // Detaches the SurfaceTexture from the context that owns its current GL // texture. Must be called with that context current on the calling thread. |