Mesa (main): i915g: Add missing support for sRGB S3TC.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Aug 16 02:41:34 UTC 2021


Module: Mesa
Branch: main
Commit: 22ec89b66b6e93ffceecad9af6199a3c08fe480e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=22ec89b66b6e93ffceecad9af6199a3c08fe480e

Author: Emma Anholt <emma at anholt.net>
Date:   Fri Aug 13 17:03:55 2021 -0700

i915g: Add missing support for sRGB S3TC.

Apparently despite not advertising the format, GL wanted it and we would
assertion fail in format choosing.  Easy enough to add.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12367>

---

 src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt | 14 +++++---------
 src/gallium/drivers/i915/i915_screen.c                |  5 +++--
 src/gallium/drivers/i915/i915_state_sampler.c         |  7 +++++--
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt b/src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt
index d0994dded64..ad1bc689d6c 100644
--- a/src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt
+++ b/src/gallium/drivers/i915/ci/piglit-i915-g33-fails.txt
@@ -41,7 +41,7 @@ spec@!opengl 1.1 at clipflat@glDrawElements(GL_QUADS)- glFrontFace(GL_CW)- glPolygo
 spec@!opengl 1.1 at clipflat@glDrawElements(GL_QUAD_STRIP)- glFrontFace(GL_CCW)- glPolygonMode(GL_FILL)- quadrant: center middle PV: FIRST,Fail
 spec@!opengl 1.1 at clipflat@glDrawElements(GL_QUAD_STRIP)- glFrontFace(GL_CW)- glPolygonMode(GL_FILL)- quadrant: center middle PV: FIRST,Fail
 spec@!opengl 1.1 at depthstencil-default_fb-clear,Fail
-spec@!opengl 1.1 at getteximage-formats,Crash
+spec@!opengl 1.1 at getteximage-formats,Fail
 spec@!opengl 1.1 at gl-1.1-drawarrays-vertex-count 100000 varray gl_quad_strip,Crash
 spec@!opengl 1.1 at gl-1.1-drawarrays-vertex-count 100000 vbo gl_quad_strip,Crash
 spec@!opengl 1.1 at gl-1.2-texture-base-level,Fail
@@ -395,8 +395,6 @@ spec at ext_framebuffer_object@fbo-stencil-gl_stencil_index1-blit,Fail
 spec at ext_framebuffer_object@fbo-stencil-gl_stencil_index16-blit,Fail
 spec at ext_framebuffer_object@fbo-stencil-gl_stencil_index4-blit,Fail
 spec at ext_framebuffer_object@fbo-stencil-gl_stencil_index8-blit,Fail
-spec at ext_framebuffer_object@getteximage-formats init-by-clear-and-render,Crash
-spec at ext_framebuffer_object@getteximage-formats init-by-rendering,Crash
 spec at ext_image_dma_buf_import@ext_image_dma_buf_import-export,Fail
 spec at ext_image_dma_buf_import@ext_image_dma_buf_import-export-tex,Fail
 spec at ext_image_dma_buf_import@ext_image_dma_buf_import-intel_external_sampler_only,Fail
@@ -428,9 +426,6 @@ spec at ext_packed_depth_stencil@fbo-depthstencil-gl_depth24_stencil8-clear,Fail
 spec at ext_packed_depth_stencil@fbo-stencil-gl_depth24_stencil8-blit,Fail
 spec at ext_packed_depth_stencil@texwrap formats bordercolor,Fail
 spec at ext_packed_depth_stencil@texwrap formats bordercolor at GL_DEPTH24_STENCIL8- border color only,Fail
-spec at ext_texture_compression_s3tc@compressedteximage gl_compressed_srgb_alpha_s3tc_dxt3_ext,Fail
-spec at ext_texture_compression_s3tc@compressedteximage gl_compressed_srgb_alpha_s3tc_dxt5_ext,Crash
-spec at ext_texture_compression_s3tc@compressedteximage gl_compressed_srgb_s3tc_dxt1_ext,Fail
 spec at ext_texture_compression_s3tc@s3tc-targeted,Fail
 spec at ext_texture_compression_s3tc@texwrap formats bordercolor,Fail
 spec at ext_texture_compression_s3tc@texwrap formats bordercolor at GL_COMPRESSED_RGBA_S3TC_DXT1_EXT- border color only,Fail
@@ -438,19 +433,20 @@ spec at ext_texture_compression_s3tc@texwrap formats bordercolor at GL_COMPRESSED_RGBA
 spec at ext_texture_compression_s3tc@texwrap formats bordercolor at GL_COMPRESSED_RGBA_S3TC_DXT5_EXT- border color only,Fail
 spec at ext_texture_compression_s3tc@texwrap formats bordercolor at GL_COMPRESSED_RGB_S3TC_DXT1_EXT- border color only,Fail
 spec at ext_texture_format_bgra8888@api-errors,Fail
-spec at ext_texture_srgb@fbo-generatemipmap-formats-s3tc,Crash
 spec at ext_texture_srgb@tex-srgb,Fail
 spec at ext_texture_srgb@texwrap formats bordercolor,Fail
 spec at ext_texture_srgb@texwrap formats bordercolor at GL_SLUMINANCE8- border color only,Fail
 spec at ext_texture_srgb@texwrap formats bordercolor at GL_SLUMINANCE8_ALPHA8- border color only,Fail
 spec at ext_texture_srgb@texwrap formats bordercolor at GL_SRGB8- border color only,Fail
 spec at ext_texture_srgb@texwrap formats bordercolor at GL_SRGB8_ALPHA8- border color only,Fail
-spec at ext_texture_srgb@texwrap formats-s3tc,Crash
-spec at ext_texture_srgb@texwrap formats-s3tc bordercolor,Crash
+spec at ext_texture_srgb@texwrap formats-s3tc bordercolor,Fail
 spec at ext_texture_srgb@texwrap formats-s3tc bordercolor at GL_COMPRESSED_SLUMINANCE- border color only,Fail
 spec at ext_texture_srgb@texwrap formats-s3tc bordercolor at GL_COMPRESSED_SLUMINANCE_ALPHA- border color only,Fail
 spec at ext_texture_srgb@texwrap formats-s3tc bordercolor at GL_COMPRESSED_SRGB- border color only,Fail
 spec at ext_texture_srgb@texwrap formats-s3tc bordercolor at GL_COMPRESSED_SRGB_ALPHA- border color only,Fail
+spec at ext_texture_srgb@texwrap formats-s3tc bordercolor at GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT- border color only,Fail
+spec at ext_texture_srgb@texwrap formats-s3tc bordercolor at GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT- border color only,Fail
+spec at ext_texture_srgb@texwrap formats-s3tc bordercolor at GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT- border color only,Fail
 spec at ext_texture_srgb@texwrap formats-s3tc bordercolor at GL_COMPRESSED_SRGB_S3TC_DXT1_EXT- border color only,Fail
 spec at glsl-1.10@execution at built-in-functions@fs-atan-vec3-vec3,Fail
 spec at glsl-1.10@execution at built-in-functions@fs-atan-vec4-vec4,Fail
diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
index b9e00f8a3b6..690c67b2559 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -447,8 +447,9 @@ i915_is_format_supported(struct pipe_screen *screen, enum pipe_format format,
       PIPE_FORMAT_YUYV,
       /* XXX why not?
       PIPE_FORMAT_Z16_UNORM, */
-      PIPE_FORMAT_DXT1_RGB, PIPE_FORMAT_DXT1_RGBA, PIPE_FORMAT_DXT3_RGBA,
-      PIPE_FORMAT_DXT5_RGBA, PIPE_FORMAT_Z24X8_UNORM,
+      PIPE_FORMAT_DXT1_RGB, PIPE_FORMAT_DXT1_SRGB, PIPE_FORMAT_DXT1_RGBA,
+      PIPE_FORMAT_DXT1_SRGBA, PIPE_FORMAT_DXT3_RGBA, PIPE_FORMAT_DXT3_SRGBA,
+      PIPE_FORMAT_DXT5_RGBA, PIPE_FORMAT_DXT5_SRGBA, PIPE_FORMAT_Z24X8_UNORM,
       PIPE_FORMAT_Z24_UNORM_S8_UINT, PIPE_FORMAT_NONE /* list terminator */
    };
    static const enum pipe_format render_supported[] = {
diff --git a/src/gallium/drivers/i915/i915_state_sampler.c b/src/gallium/drivers/i915/i915_state_sampler.c
index f8d478ea00b..bcfffcee143 100644
--- a/src/gallium/drivers/i915/i915_state_sampler.c
+++ b/src/gallium/drivers/i915/i915_state_sampler.c
@@ -84,8 +84,7 @@ update_sampler(struct i915_context *i915, uint32_t unit,
    if (pt->format == PIPE_FORMAT_UYVY || pt->format == PIPE_FORMAT_YUYV)
       state[0] |= SS2_COLORSPACE_CONVERSION;
 
-   if (pt->format == PIPE_FORMAT_B8G8R8A8_SRGB ||
-       pt->format == PIPE_FORMAT_L8_SRGB) {
+   if (util_format_is_srgb(pt->format)) {
       state[0] |= SS2_REVERSE_GAMMA_ENABLE;
    }
 
@@ -221,11 +220,15 @@ translate_texture_format(enum pipe_format pipeFormat,
    case PIPE_FORMAT_Z16_UNORM:
       return (MAPSURF_16BIT | MT_16BIT_L16);
    case PIPE_FORMAT_DXT1_RGBA:
+   case PIPE_FORMAT_DXT1_SRGBA:
    case PIPE_FORMAT_DXT1_RGB:
+   case PIPE_FORMAT_DXT1_SRGB:
       return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT1);
    case PIPE_FORMAT_DXT3_RGBA:
+   case PIPE_FORMAT_DXT3_SRGBA:
       return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3);
    case PIPE_FORMAT_DXT5_RGBA:
+   case PIPE_FORMAT_DXT5_SRGBA:
       return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5);
    case PIPE_FORMAT_Z24_UNORM_S8_UINT:
    case PIPE_FORMAT_Z24X8_UNORM: {



More information about the mesa-commit mailing list