Bug 1540581 - P1. Fix NV12 image with OGL compositor. r=mattwoodrow
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 11 Apr 2019 12:35:41 +0000
changeset 469129 a6a6f88b71c7294faf8b21492a5f3ac6c904aa58
parent 469128 f2eda1d5abb8bb5a73dc91d18ae0654272d0518c
child 469130 61c265181c16b1e0208bbafb6c6aa7acb6a33216
push id35856
push usercsabou@mozilla.com
push dateFri, 12 Apr 2019 03:19:48 +0000
treeherdermozilla-central@940684cd1065 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1540581
milestone68.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 1540581 - P1. Fix NV12 image with OGL compositor. r=mattwoodrow Differential Revision: https://phabricator.services.mozilla.com/D26054
gfx/layers/opengl/CompositorOGL.cpp
gfx/layers/opengl/OGLShaderProgram.cpp
--- a/gfx/layers/opengl/CompositorOGL.cpp
+++ b/gfx/layers/opengl/CompositorOGL.cpp
@@ -1489,16 +1489,17 @@ void CompositorOGL::DrawGeometry(const G
         // This is used by IOSurface that use 0,0...w,h coordinate rather then
         // 0,0..1,1.
         program->SetCbCrTexCoordMultiplier(sourceCbCr->GetSize().width,
                                            sourceCbCr->GetSize().height);
       }
 
       program->SetNV12TextureUnits(Y, CbCr);
       program->SetTextureTransform(Matrix4x4());
+      program->SetYUVColorSpace(gfx::YUVColorSpace::BT601);
 
       if (maskType != MaskType::MaskNone) {
         BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE2,
                            maskQuadTransform);
       }
       if (mixBlendBackdrop) {
         BindBackdrop(program, mixBlendBackdrop, LOCAL_GL_TEXTURE3);
       }
--- a/gfx/layers/opengl/OGLShaderProgram.cpp
+++ b/gfx/layers/opengl/OGLShaderProgram.cpp
@@ -397,16 +397,17 @@ ProgramProfileOGL ProgramProfileOGL::Get
   if (aConfig.mFeatures & ENABLE_TEXTURE_YCBCR) {
     fs << "uniform " << sampler2D << " uYTexture;" << endl;
     fs << "uniform " << sampler2D << " uCbTexture;" << endl;
     fs << "uniform " << sampler2D << " uCrTexture;" << endl;
     fs << "uniform mat3 uYuvColorMatrix;" << endl;
   } else if (aConfig.mFeatures & ENABLE_TEXTURE_NV12) {
     fs << "uniform " << sampler2D << " uYTexture;" << endl;
     fs << "uniform " << sampler2D << " uCbTexture;" << endl;
+    fs << "uniform mat3 uYuvColorMatrix;" << endl;
   } else if (aConfig.mFeatures & ENABLE_TEXTURE_COMPONENT_ALPHA) {
     fs << "uniform " << sampler2D << " uBlackTexture;" << endl;
     fs << "uniform " << sampler2D << " uWhiteTexture;" << endl;
     fs << "uniform bool uTexturePass2;" << endl;
   } else {
     fs << "uniform " << sampler2D << " uTexture;" << endl;
   }