[virglrenderer-devel] [PATCH 1/1] Fixes an issue with blitting of sRGB buffers

Robert Tarasov tutankhamen at chromium.org
Mon Mar 26 22:07:17 UTC 2018


Forces using vrend_render_blit_gl if one of framebuffers is in sRGB
colorspace. Fixes following tests:
dEQP-GLES3.functional.fbo.blit.conversion.srgb8_alpha8_to_rgba8
dEQP-GLES3.functional.fbo.blit.conversion.srgb8_alpha8_to_rgb10_a2
dEQP-GLES3.functional.fbo.blit.conversion.srgb8_alpha8_to_rgba4
dEQP-GLES3.functional.fbo.blit.conversion.srgb8_alpha8_to_rgb5_a1
dEQP-GLES3.functional.fbo.blit.conversion.srgb8_alpha8_to_rgb8
dEQP-GLES3.functional.fbo.blit.conversion.srgb8_alpha8_to_rgb565
dEQP-GLES3.functional.fbo.blit.conversion.srgb8_alpha8_to_rg8
dEQP-GLES3.functional.fbo.blit.conversion.srgb8_alpha8_to_r8
---
 src/vrend_renderer.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 02d26be..d76c93d 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -438,6 +438,14 @@ static inline bool vrend_format_can_render(enum virgl_formats format)
    return tex_conv_table[format].bindings & VREND_BIND_RENDER;
 }
 
+static inline bool vrend_format_is_srgb(enum virgl_formats format)
+{
+   return (format == VIRGL_FORMAT_L8_SRGB ||
+           format == VIRGL_FORMAT_L8A8_SRGB ||
+           format == VIRGL_FORMAT_B8G8R8A8_SRGB ||
+           format == VIRGL_FORMAT_B8G8R8X8_SRGB);
+}
+
 static inline bool vrend_format_is_ds(enum virgl_formats format)
 {
    return tex_conv_table[format].bindings & VREND_BIND_DEPTHSTENCIL;
@@ -5872,6 +5880,10 @@ static void vrend_renderer_blit_int(struct vrend_context *ctx,
        !vrend_format_is_ds(dst_res->base.format))
       use_gl = true;
 
+   if (vrend_format_is_srgb(src_res->base.format) ||
+       vrend_format_is_srgb(dst_res->base.format))
+      use_gl = true;
+
    /* different depth formats */
    if (vrend_format_is_ds(src_res->base.format) &&
        vrend_format_is_ds(dst_res->base.format)) {
-- 
2.17.0.rc0.231.g781580f067-goog



More information about the virglrenderer-devel mailing list