Bug 1073252. Part 2: Store opaque flag in LayerRenderState. r=nical
authorRobert O'Callahan <robert@ocallahan.org>
Thu, 30 Oct 2014 15:32:41 +1300
changeset 213371 a0c83883d8afda760bd02e534e77696dd905e1ba
parent 213370 7e70901416d98089f5a136ed492a4d5e5e52e7cf
child 213372 36a17c5ca3dbd8c7c461af9eb884e360eeb7ec9a
push id27748
push userryanvm@gmail.com
push dateFri, 31 Oct 2014 20:14:33 +0000
treeherdermozilla-central@12ac66e2c016 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1073252
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1073252. Part 2: Store opaque flag in LayerRenderState. r=nical
gfx/layers/LayersTypes.h
gfx/layers/opengl/GrallocTextureHost.cpp
--- a/gfx/layers/LayersTypes.h
+++ b/gfx/layers/LayersTypes.h
@@ -77,17 +77,21 @@ MOZ_END_ENUM_CLASS(SurfaceMode)
 // LayerRenderState for Composer2D
 // We currently only support Composer2D using gralloc. If we want to be backed
 // by other surfaces we will need a more generic LayerRenderState.
 MOZ_BEGIN_ENUM_CLASS(LayerRenderStateFlags, int8_t)
   LAYER_RENDER_STATE_DEFAULT = 0,
   Y_FLIPPED = 1 << 0,
   BUFFER_ROTATION = 1 << 1,
   // Notify Composer2D to swap the RB pixels of gralloc buffer
-  FORMAT_RB_SWAP = 1 << 2
+  FORMAT_RB_SWAP = 1 << 2,
+  // We record opaqueness here alongside the actual surface we're going to
+  // render. This avoids confusion when a layer might return different kinds
+  // of surfaces over time (e.g. video frames).
+  OPAQUE = 1 << 3
 MOZ_END_ENUM_CLASS(LayerRenderStateFlags)
 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(LayerRenderStateFlags)
 
 // The 'ifdef MOZ_WIDGET_GONK' sadness here is because we don't want to include
 // android::sp unless we have to.
 struct LayerRenderState {
   LayerRenderState()
 #ifdef MOZ_WIDGET_GONK
--- a/gfx/layers/opengl/GrallocTextureHost.cpp
+++ b/gfx/layers/opengl/GrallocTextureHost.cpp
@@ -358,16 +358,19 @@ GrallocTextureHostOGL::DeallocateDeviceD
 
 LayerRenderState
 GrallocTextureHostOGL::GetRenderState()
 {
   android::GraphicBuffer* graphicBuffer = GetGraphicBufferFromDesc(mGrallocHandle).get();
 
   if (graphicBuffer) {
     LayerRenderStateFlags flags = LayerRenderStateFlags::LAYER_RENDER_STATE_DEFAULT;
+    if (mIsOpaque) {
+      flags |= LayerRenderStateFlags::OPAQUE;
+    }
     if (mFlags & TextureFlags::NEEDS_Y_FLIP) {
       flags |= LayerRenderStateFlags::Y_FLIPPED;
     }
     if (mFlags & TextureFlags::RB_SWAPPED) {
       flags |= LayerRenderStateFlags::FORMAT_RB_SWAP;
     }
     return LayerRenderState(graphicBuffer,
                             gfx::ThebesIntSize(mDescriptorSize),