[Mesa-dev] [PATCH] mesa/main: return GL_BGRA as the preferred color read format more often

Ilia Mirkin imirkin at alum.mit.edu
Sun Jan 13 18:57:28 UTC 2019


Currently we were only returning it for BGRA8. But it makes sense to
return it for all the BGR[AX] variants. This was discovered when
figuring out why wlroots was sending a RGBX instead of BGRX image when
screenshotting.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---

Not sure that this can really matter for performance -- I guess in some
cases it means we can memcpy a mapped RB. But we might also fall off
some optimized imageBuffer pbo download path. On average, probably
"meh", but seems more consistent.

 src/mesa/main/framebuffer.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 10dd2fde446..09059a11cbd 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -850,6 +850,11 @@ _mesa_get_color_read_format(struct gl_context *ctx,
       case MESA_FORMAT_RGBA_UINT8:
          return GL_RGBA_INTEGER;
       case MESA_FORMAT_B8G8R8A8_UNORM:
+      case MESA_FORMAT_B8G8R8X8_UNORM:
+      case MESA_FORMAT_B5G5R5A1_UNORM:
+      case MESA_FORMAT_B5G5R5X1_UNORM:
+      case MESA_FORMAT_B4G4R4A4_UNORM:
+      case MESA_FORMAT_B4G4R4X4_UNORM:
          return GL_BGRA;
       case MESA_FORMAT_B5G6R5_UNORM:
       case MESA_FORMAT_R11G11B10_FLOAT:
-- 
2.19.2



More information about the mesa-dev mailing list