Mesa (10.4): r300g: fix sRGB->sRGB blits

Emil Velikov evelikov at kemper.freedesktop.org
Thu Mar 12 13:11:38 UTC 2015


Module: Mesa
Branch: 10.4
Commit: 977626f10a591f46f800378563e35ae6cc655e1e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=977626f10a591f46f800378563e35ae6cc655e1e

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Mon Mar  9 21:20:03 2015 +0100

r300g: fix sRGB->sRGB blits

Cc: 10.5 10.4 <mesa-stable at lists.freedesktop.org>
(cherry picked from commit c939231e7223510408a446400ad23b8b5ce2922e)

---

 src/gallium/drivers/r300/r300_blit.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
index 4e7efc5..baf05ce 100644
--- a/src/gallium/drivers/r300/r300_blit.c
+++ b/src/gallium/drivers/r300/r300_blit.c
@@ -803,6 +803,15 @@ static void r300_blit(struct pipe_context *pipe,
         (struct pipe_framebuffer_state*)r300->fb_state.state;
     struct pipe_blit_info info = *blit;
 
+    /* The driver supports sRGB textures but not framebuffers. Blitting
+     * from sRGB to sRGB should be the same as blitting from linear
+     * to linear, so use that, This avoids incorrect linearization.
+     */
+    if (util_format_is_srgb(info.src.format)) {
+      info.src.format = util_format_linear(info.src.format);
+      info.dst.format = util_format_linear(info.dst.format);
+    }
+
     /* MSAA resolve. */
     if (info.src.resource->nr_samples > 1 &&
         !util_format_is_depth_or_stencil(info.src.resource->format)) {




More information about the mesa-commit mailing list