Mesa (master): i965: Bail on the BLT path if BlitFramebuffer requires sRGB conversion.

Kenneth Graunke kwg at kemper.freedesktop.org
Mon Aug 8 21:12:22 UTC 2016


Module: Mesa
Branch: master
Commit: b1586526e84ab6eab2023b589da8e153f70dda50
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b1586526e84ab6eab2023b589da8e153f70dda50

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Aug  2 20:58:30 2016 -0700

i965: Bail on the BLT path if BlitFramebuffer requires sRGB conversion.

Modern OpenGL BlitFramebuffer require sRGB encode/decode when
GL_FRAMEBUFFER_SRGB is enabled.  The blitter can't handle this,
so we need to bail.  On Gen4-5, this means falling back to Meta,
which should handle it.

We allow sRGB <-> sRGB blits, as decode then encode ought to be a noop
(other than potential precision loss, which nobody wants anyway).

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/mesa/drivers/dri/i965/intel_blit.c | 4 ++--
 src/mesa/drivers/dri/i965/intel_fbo.c  | 8 ++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_blit.c b/src/mesa/drivers/dri/i965/intel_blit.c
index 23e1ab6..8df5b48 100644
--- a/src/mesa/drivers/dri/i965/intel_blit.c
+++ b/src/mesa/drivers/dri/i965/intel_blit.c
@@ -211,8 +211,8 @@ intel_miptree_blit(struct brw_context *brw,
       return false;
 
    /* No sRGB decode or encode is done by the hardware blitter, which is
-    * consistent with what we want in the callers (glCopyTexSubImage(),
-    * glBlitFramebuffer(), texture validation, etc.).
+    * consistent with what we want in many callers (glCopyTexSubImage(),
+    * texture validation, etc.).
     */
    mesa_format src_format = _mesa_get_srgb_format_linear(src_mt->format);
    mesa_format dst_format = _mesa_get_srgb_format_linear(dst_mt->format);
diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c
index 707a9d2..573c3a8 100644
--- a/src/mesa/drivers/dri/i965/intel_fbo.c
+++ b/src/mesa/drivers/dri/i965/intel_fbo.c
@@ -828,6 +828,14 @@ intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
             return mask;
          }
 
+         if (ctx->Color.sRGBEnabled &&
+             _mesa_get_format_color_encoding(src_irb->mt->format) !=
+             _mesa_get_format_color_encoding(dst_irb->mt->format)) {
+            perf_debug("glBlitFramebuffer() with sRGB conversion cannot be "
+                       "handled by BLT path.\n");
+            return mask;
+         }
+
          if (!intel_miptree_blit(brw,
                                  src_irb->mt,
                                  src_irb->mt_level, src_irb->mt_layer,




More information about the mesa-commit mailing list