Mesa (master): svga: implement sRGB rendering for imported surfaces

Brian Paul brianp at kemper.freedesktop.org
Sat Apr 29 03:07:38 UTC 2017


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

Author: Neha Bhende <bhenden at vmware.com>
Date:   Thu Apr 27 10:05:35 2017 -0700

svga: implement sRGB rendering for imported surfaces

If texture is imported and templ format is sRGB, use compatible sRGB format
to the imported texture format while creating surface view.

tested with MTT piglit, glretrace, viewperf and conform

Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Charmaine Lee <charmainel at vmware.com>

---

 src/gallium/drivers/svga/svga_surface.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_surface.c b/src/gallium/drivers/svga/svga_surface.c
index fdc6ba4e4d..04173266ff 100644
--- a/src/gallium/drivers/svga/svga_surface.c
+++ b/src/gallium/drivers/svga/svga_surface.c
@@ -305,10 +305,17 @@ svga_create_surface_view(struct pipe_context *pipe,
       bind = PIPE_BIND_RENDER_TARGET;
    }
 
-   if (tex->imported)
+   if (tex->imported) {
+      /* imported resource (a window) */
       format = tex->key.format;
-   else
+      if (util_format_is_srgb(surf_tmpl->format)) {
+         /* sRGB rendering to window */
+         format = svga_linear_to_srgb(format);
+      }
+   }
+   else {
       format = svga_translate_format(ss, surf_tmpl->format, bind);
+   }
 
    assert(format != SVGA3D_FORMAT_INVALID);
 




More information about the mesa-commit mailing list