Bug 1449352 - always composite 24 depth WindowSurfaceX11 as BGRX. r=jrmuizel a=jcristau
authorLee Salzman <lsalzman@mozilla.com>
Tue, 10 Apr 2018 12:43:59 -0400
changeset 463201 36b90debcd465bc6c7af1c3b01ba73aef7647611
parent 463200 7617bd6c7f2c215fcdd344af2cad8b0a6b1537b6
child 463202 84d5902b3a0276cf83cb0d3fa742d2721935f59b
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel, jcristau
bugs1449352
milestone60.0
Bug 1449352 - always composite 24 depth WindowSurfaceX11 as BGRX. r=jrmuizel a=jcristau MozReview-Commit-ID: 3xeE3EEttR6
widget/gtk/WindowSurfaceX11.cpp
widget/gtk/WindowSurfaceX11Image.cpp
--- a/widget/gtk/WindowSurfaceX11.cpp
+++ b/widget/gtk/WindowSurfaceX11.cpp
@@ -31,26 +31,20 @@ WindowSurfaceX11::GetVisualFormat(const 
   case 32:
     if (aVisual->red_mask == 0xff0000 &&
         aVisual->green_mask == 0xff00 &&
         aVisual->blue_mask == 0xff) {
       return gfx::SurfaceFormat::B8G8R8A8;
     }
     break;
   case 24:
-    // Only support the BGRX layout, and report it as BGRA to the compositor.
-    // The alpha channel will be discarded when we put the image.
-    // Cairo/pixman lacks some fast paths for compositing BGRX onto BGRA, so
-    // just report it as BGRX directly in that case.
     if (aVisual->red_mask == 0xff0000 &&
         aVisual->green_mask == 0xff00 &&
         aVisual->blue_mask == 0xff) {
-      gfx::BackendType backend = gfxPlatform::GetPlatform()->GetDefaultContentBackend();
-      return backend == gfx::BackendType::CAIRO ? gfx::SurfaceFormat::B8G8R8X8
-                                                : gfx::SurfaceFormat::B8G8R8A8;
+      return gfx::SurfaceFormat::B8G8R8X8;
     }
     break;
   case 16:
     if (aVisual->red_mask == 0xf800 &&
         aVisual->green_mask == 0x07e0 &&
         aVisual->blue_mask == 0x1f) {
       return gfx::SurfaceFormat::R5G6B5_UINT16;
     }
--- a/widget/gtk/WindowSurfaceX11Image.cpp
+++ b/widget/gtk/WindowSurfaceX11Image.cpp
@@ -53,16 +53,20 @@ WindowSurfaceX11Image::Lock(const Layout
     mImageSurface = new gfxImageSurface(size, format);
     if (mImageSurface->CairoStatus()) {
       return nullptr;
     }
   }
 
   gfxImageFormat format = mImageSurface->Format();
   // Cairo prefers compositing to BGRX instead of BGRA where possible.
+  // Cairo/pixman lacks some fast paths for compositing BGRX onto BGRA, so
+  // just report it as BGRX directly in that case.
+  // Otherwise, for Skia, report it as BGRA to the compositor. The alpha
+  // channel will be discarded when we put the image.
   if (format == gfx::SurfaceFormat::X8R8G8B8_UINT32) {
     gfx::BackendType backend = gfxVars::ContentBackend();
     if (!gfx::Factory::DoesBackendSupportDataDrawtarget(backend)) {
 #ifdef USE_SKIA
       backend = gfx::BackendType::SKIA;
 #else
       backend = gfx::BackendType::CAIRO;
 #endif