Bug 1613364 [Wayland] Update RenderWaylandDMABUFTextureHostOGL to work with NV12 texture format, r=sotaro
authorMartin Stransky <stransky@redhat.com>
Wed, 12 Feb 2020 22:34:42 +0000
changeset 513635 66cc62933540a2071ca024894ead927cd137c836
parent 513634 64592d09f5e4373af76c6dec291e2bb99fd538f4
child 513636 cdab069b9ed9530c5bf018288dcf6ff69c175aa4
push id37118
push userrmaries@mozilla.com
push dateThu, 13 Feb 2020 03:57:45 +0000
treeherdermozilla-central@2f6870dd1b99 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1613364
milestone75.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 1613364 [Wayland] Update RenderWaylandDMABUFTextureHostOGL to work with NV12 texture format, r=sotaro Differential Revision: https://phabricator.services.mozilla.com/D62003
gfx/webrender_bindings/RenderWaylandDMABUFTextureHostOGL.cpp
--- a/gfx/webrender_bindings/RenderWaylandDMABUFTextureHostOGL.cpp
+++ b/gfx/webrender_bindings/RenderWaylandDMABUFTextureHostOGL.cpp
@@ -22,62 +22,62 @@ RenderWaylandDMABUFTextureHostOGL::Rende
 RenderWaylandDMABUFTextureHostOGL::~RenderWaylandDMABUFTextureHostOGL() {
   MOZ_COUNT_DTOR_INHERITED(RenderWaylandDMABUFTextureHostOGL,
                            RenderTextureHostOGL);
   DeleteTextureHandle();
 }
 
 GLuint RenderWaylandDMABUFTextureHostOGL::GetGLHandle(
     uint8_t aChannelIndex) const {
-  return mSurface->GetGLTexture();
+  return mSurface->GetTexture(aChannelIndex);
 }
 
 gfx::IntSize RenderWaylandDMABUFTextureHostOGL::GetSize(
     uint8_t aChannelIndex) const {
-  return gfx::IntSize(mSurface->GetWidth(), mSurface->GetHeight());
+  return gfx::IntSize(mSurface->GetWidth(aChannelIndex),
+                      mSurface->GetHeight(aChannelIndex));
 }
 
 wr::WrExternalImage RenderWaylandDMABUFTextureHostOGL::Lock(
     uint8_t aChannelIndex, gl::GLContext* aGL, wr::ImageRendering aRendering) {
-  MOZ_ASSERT(aChannelIndex == 0);
-
   if (mGL.get() != aGL) {
     if (mGL) {
       // This should not happen. EGLImage is created only in
       // parent process.
       MOZ_ASSERT_UNREACHABLE("Unexpected GL context");
       return InvalidToWrExternalImage();
     }
     mGL = aGL;
   }
 
   if (!mGL || !mGL->MakeCurrent()) {
     return InvalidToWrExternalImage();
   }
 
   bool bindTexture = IsFilterUpdateNecessary(aRendering);
 
-  if (!mSurface->GetGLTexture()) {
-    if (!mSurface->CreateEGLImage(mGL)) {
+  if (!mSurface->GetTexture(aChannelIndex)) {
+    if (!mSurface->CreateTexture(mGL, aChannelIndex)) {
       return InvalidToWrExternalImage();
     }
     bindTexture = true;
   }
 
   if (bindTexture) {
     // Cache new rendering filter.
     mCachedRendering = aRendering;
     ActivateBindAndTexParameteri(mGL, LOCAL_GL_TEXTURE0, LOCAL_GL_TEXTURE_2D,
-                                 mSurface->GetGLTexture(), aRendering);
+                                 mSurface->GetTexture(aChannelIndex),
+                                 aRendering);
   }
 
-  return NativeTextureToWrExternalImage(mSurface->GetGLTexture(), 0, 0,
-                                        mSurface->GetWidth(),
-                                        mSurface->GetHeight());
+  return NativeTextureToWrExternalImage(mSurface->GetTexture(aChannelIndex), 0,
+                                        0, mSurface->GetWidth(aChannelIndex),
+                                        mSurface->GetHeight(aChannelIndex));
 }
 
 void RenderWaylandDMABUFTextureHostOGL::Unlock() {}
 
 void RenderWaylandDMABUFTextureHostOGL::DeleteTextureHandle() {
-  mSurface->ReleaseEGLImage();
+  mSurface->ReleaseTextures();
 }
 
 }  // namespace mozilla::wr