summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharmaine Lee <charmainel@vmware.com>2017-04-18 15:55:59 -0700
committerBrian Paul <brianp@vmware.com>2017-04-26 11:37:59 -0600
commit5bd5ec6a0f1821a8ac5e1d4ee59b324588adc2d5 (patch)
treec82852d6ae1825842b5aa996b95a46c192bfcf70 /src
parent3626112214d25738411d8577f485fe51e9f8c96a (diff)
svga: fix format for screen target
This patch revises the fix in commit 606f13afa31c9f041a68eb22cc32112ce813f944 to properly translate the surface format for screen target. Instead of changing the svga format for PIPE_FORMAT_B5G6R5_UNORM to SVGA3D_R5G6B5 for all texture surfaces, this patch only restricts SVGA3D_R5G6B5 for screen target surfaces. This avoids rendering failures when specify a non-vgpu10 format in a vgpu10 context with software renderer. Fixes piglit failures spec@!opengl 1.1@draw-pixels, spec@!opengl 1.1@teximage-colors gl_r3_g3_b2 spec@!opengl 1.1@texwrap formats Tested Xorg with 16bits depth. Also tested with MTT piglit, MTT glretrace. Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/svga/svga_format.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/gallium/drivers/svga/svga_format.c b/src/gallium/drivers/svga/svga_format.c
index 29692599f686..7d970be4e5e7 100644
--- a/src/gallium/drivers/svga/svga_format.c
+++ b/src/gallium/drivers/svga/svga_format.c
@@ -376,6 +376,29 @@ svga_translate_vertex_format_vgpu10(enum pipe_format format,
}
+/**
+ * Translate a gallium scanout format to a svga format valid
+ * for screen target surface.
+ */
+static SVGA3dSurfaceFormat
+svga_translate_screen_target_format_vgpu10(enum pipe_format format)
+{
+ switch (format) {
+ case PIPE_FORMAT_B8G8R8A8_UNORM:
+ return SVGA3D_B8G8R8A8_UNORM;
+ case PIPE_FORMAT_B8G8R8X8_UNORM:
+ return SVGA3D_B8G8R8X8_UNORM;
+ case PIPE_FORMAT_B5G6R5_UNORM:
+ return SVGA3D_R5G6B5;
+ case PIPE_FORMAT_B5G5R5A1_UNORM:
+ return SVGA3D_A1R5G5B5;
+ default:
+ debug_printf("Invalid format %s specified for screen target\n",
+ svga_format_name(format));
+ return SVGA3D_FORMAT_INVALID;
+ }
+}
+
/*
* Translate from gallium format to SVGA3D format.
*/
@@ -388,6 +411,9 @@ svga_translate_format(const struct svga_screen *ss,
if (bind & (PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER)) {
return format_conversion_table[format].vertex_format;
}
+ else if (bind & PIPE_BIND_SCANOUT) {
+ return svga_translate_screen_target_format_vgpu10(format);
+ }
else {
return format_conversion_table[format].pixel_format;
}