Bug 1205913 - Differentiate YCbCr, NV12 and RGB textures when drawing layer borders. r=nical
authorMatt Woodrow <mwoodrow@mozilla.com>
Fri, 23 Oct 2015 12:51:20 +1300
changeset 270380 dd17095b6b10b621e286c4dff3dce9b62af72c3d
parent 270379 0b903f78f2ce6f0bf7f387483538943c99a979ed
child 270381 65e251b9db240f7cd1019e48729c7694299b692c
push id29612
push userkwierso@gmail.com
push dateFri, 30 Oct 2015 23:36:00 +0000
treeherdermozilla-central@1596ab6985cb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1205913
milestone45.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 1205913 - Differentiate YCbCr, NV12 and RGB textures when drawing layer borders. r=nical
gfx/layers/Compositor.cpp
gfx/layers/CompositorTypes.h
gfx/layers/composite/ImageHost.cpp
--- a/gfx/layers/Compositor.cpp
+++ b/gfx/layers/Compositor.cpp
@@ -106,17 +106,23 @@ Compositor::DrawDiagnosticsInternal(Diag
 
   gfx::Color color;
   if (aFlags & DiagnosticFlags::CONTENT) {
     color = gfx::Color(0.0f, 1.0f, 0.0f, 1.0f); // green
     if (aFlags & DiagnosticFlags::COMPONENT_ALPHA) {
       color = gfx::Color(0.0f, 1.0f, 1.0f, 1.0f); // greenish blue
     }
   } else if (aFlags & DiagnosticFlags::IMAGE) {
-    color = gfx::Color(1.0f, 0.0f, 0.0f, 1.0f); // red
+    if (aFlags & DiagnosticFlags::NV12) {
+      color = gfx::Color(1.0f, 1.0f, 0.0f, 1.0f); // yellow
+    } else if (aFlags & DiagnosticFlags::YCBCR) {
+      color = gfx::Color(1.0f, 0.55f, 0.0f, 1.0f); // orange
+    } else {
+      color = gfx::Color(1.0f, 0.0f, 0.0f, 1.0f); // red
+    }
   } else if (aFlags & DiagnosticFlags::COLOR) {
     color = gfx::Color(0.0f, 0.0f, 1.0f, 1.0f); // blue
   } else if (aFlags & DiagnosticFlags::CONTAINER) {
     color = gfx::Color(0.8f, 0.0f, 0.8f, 1.0f); // purple
   }
 
   // make tile borders a bit more transparent to keep layer borders readable.
   if (aFlags & DiagnosticFlags::TILE ||
--- a/gfx/layers/CompositorTypes.h
+++ b/gfx/layers/CompositorTypes.h
@@ -102,17 +102,19 @@ enum class DiagnosticFlags : uint16_t {
   IMAGE           = 1 << 0,
   CONTENT         = 1 << 1,
   CANVAS          = 1 << 2,
   COLOR           = 1 << 3,
   CONTAINER       = 1 << 4,
   TILE            = 1 << 5,
   BIGIMAGE        = 1 << 6,
   COMPONENT_ALPHA = 1 << 7,
-  REGION_RECT     = 1 << 8
+  REGION_RECT     = 1 << 8,
+  NV12            = 1 << 9,
+  YCBCR           = 1 << 10
 };
 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(DiagnosticFlags)
 
 /**
  * See gfx/layers/Effects.h
  */
 enum class EffectTypes : uint8_t {
   MASK,
--- a/gfx/layers/composite/ImageHost.cpp
+++ b/gfx/layers/composite/ImageHost.cpp
@@ -311,16 +311,23 @@ ImageHost::Composite(LayerComposite* aLa
     if (!effect) {
       return;
     }
 
     if (!GetCompositor()->SupportsEffect(effect->mType)) {
       return;
     }
 
+    DiagnosticFlags diagnosticFlags = DiagnosticFlags::IMAGE;
+    if (effect->mType == EffectTypes::NV12) {
+      diagnosticFlags |= DiagnosticFlags::NV12;
+    } else if (effect->mType == EffectTypes::YCBCR) {
+      diagnosticFlags |= DiagnosticFlags::YCBCR;
+    }
+
     if (mLastFrameID != img->mFrameID || mLastProducerID != img->mProducerID) {
       if (mImageContainer) {
         aLayer->GetLayerManager()->
             AppendImageCompositeNotification(ImageCompositeNotification(
                 mImageContainer, nullptr,
                 img->mTimeStamp, GetCompositor()->GetCompositionTime(),
                 img->mFrameID, img->mProducerID));
       }
@@ -358,38 +365,38 @@ ImageHost::Composite(LayerComposite* aLa
                                       Float(rect.width) / tileRect.width,
                                       Float(rect.height) / tileRect.height);
         if (img->mFrontBuffer->GetFlags() & TextureFlags::ORIGIN_BOTTOM_LEFT) {
           effect->mTextureCoords.y = effect->mTextureCoords.YMost();
           effect->mTextureCoords.height = -effect->mTextureCoords.height;
         }
         GetCompositor()->DrawQuad(rect, aClipRect, aEffectChain,
                                   aOpacity, aTransform);
-        GetCompositor()->DrawDiagnostics(DiagnosticFlags::IMAGE | DiagnosticFlags::BIGIMAGE,
+        GetCompositor()->DrawDiagnostics(diagnosticFlags | DiagnosticFlags::BIGIMAGE,
                                          rect, aClipRect, aTransform, mFlashCounter);
       } while (it->NextTile());
       it->EndBigImageIteration();
       // layer border
-      GetCompositor()->DrawDiagnostics(DiagnosticFlags::IMAGE, pictureRect,
+      GetCompositor()->DrawDiagnostics(diagnosticFlags, pictureRect,
                                        aClipRect, aTransform, mFlashCounter);
     } else {
       IntSize textureSize = img->mTextureSource->GetSize();
       effect->mTextureCoords = Rect(Float(img->mPictureRect.x) / textureSize.width,
                                     Float(img->mPictureRect.y) / textureSize.height,
                                     Float(img->mPictureRect.width) / textureSize.width,
                                     Float(img->mPictureRect.height) / textureSize.height);
 
       if (img->mFrontBuffer->GetFlags() & TextureFlags::ORIGIN_BOTTOM_LEFT) {
         effect->mTextureCoords.y = effect->mTextureCoords.YMost();
         effect->mTextureCoords.height = -effect->mTextureCoords.height;
       }
 
       GetCompositor()->DrawQuad(pictureRect, aClipRect, aEffectChain,
                                 aOpacity, aTransform);
-      GetCompositor()->DrawDiagnostics(DiagnosticFlags::IMAGE,
+      GetCompositor()->DrawDiagnostics(diagnosticFlags,
                                        pictureRect, aClipRect,
                                        aTransform, mFlashCounter);
     }
   }
 
   // Update mBias last. This can change which frame ChooseImage(Index) would
   // return, and we don't want to do that until we've finished compositing
   // since callers of ChooseImage(Index) assume the same image will be chosen