Mesa (main): i915g: Add support for FXT1.

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


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

Author: Emma Anholt <emma at anholt.net>
Date:   Fri Aug 13 21:10:21 2021 -0700

i915g: Add support for FXT1.

This was the only GL extension supported by i915c and not i915g.

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

---

 src/gallium/drivers/i915/i915_resource_texture.c | 10 +++++-----
 src/gallium/drivers/i915/i915_screen.c           |  1 +
 src/gallium/drivers/i915/i915_state_sampler.c    |  6 ++----
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c
index da02159bfa8..ec04dac0f24 100644
--- a/src/gallium/drivers/i915/i915_resource_texture.c
+++ b/src/gallium/drivers/i915/i915_resource_texture.c
@@ -169,7 +169,7 @@ i915_texture_tiling(struct i915_screen *is, struct i915_texture *tex)
    if (tex->b.target == PIPE_TEXTURE_1D)
       return I915_TILE_NONE;
 
-   if (util_format_is_s3tc(tex->b.format))
+   if (util_format_is_compressed(tex->b.format))
       return I915_TILE_X;
 
    if (is->debug.use_blitter)
@@ -366,7 +366,7 @@ i915_texture_layout_2d(struct i915_texture *tex)
    unsigned nblocksy = util_format_get_nblocksy(pt->format, width);
    unsigned align_y = 2;
 
-   if (util_format_is_s3tc(pt->format))
+   if (util_format_is_compressed(pt->format))
       align_y = 1;
 
    tex->stride = align(util_format_get_stride(pt->format, width), 4);
@@ -470,7 +470,7 @@ i945_texture_layout_2d(struct i915_texture *tex)
    unsigned nblocksx = util_format_get_nblocksx(pt->format, width);
    unsigned nblocksy = util_format_get_nblocksy(pt->format, height);
 
-   if (util_format_is_s3tc(pt->format)) {
+   if (util_format_is_compressed(pt->format)) {
       align_x = 1;
       align_y = 1;
    }
@@ -648,7 +648,7 @@ i945_texture_layout_cube(struct i915_texture *tex)
    unsigned face;
 
    assert(pt->width0 == pt->height0);       /* cubemap images are square */
-   assert(util_format_is_s3tc(pt->format)); /* compressed only */
+   assert(util_format_is_compressed(pt->format)); /* compressed only */
 
    /*
     * Depending on the size of the largest images, pitch can be
@@ -747,7 +747,7 @@ i945_texture_layout(struct i915_texture *tex)
       i945_texture_layout_3d(tex);
       break;
    case PIPE_TEXTURE_CUBE:
-      if (!util_format_is_s3tc(tex->b.format))
+      if (!util_format_is_compressed(tex->b.format))
          i9x5_texture_layout_cube(tex);
       else
          i945_texture_layout_cube(tex);
diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
index 690c67b2559..417f96bb4b7 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -450,6 +450,7 @@ i915_is_format_supported(struct pipe_screen *screen, enum pipe_format format,
       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_FXT1_RGB, PIPE_FORMAT_FXT1_RGBA,
       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 72070d7059a..c95eab91768 100644
--- a/src/gallium/drivers/i915/i915_state_sampler.c
+++ b/src/gallium/drivers/i915/i915_state_sampler.c
@@ -212,11 +212,9 @@ translate_texture_format(enum pipe_format pipeFormat,
       return (MAPSURF_422 | MT_422_YCRCB_NORMAL);
    case PIPE_FORMAT_UYVY:
       return (MAPSURF_422 | MT_422_YCRCB_SWAPY);
-#if 0
-   case PIPE_FORMAT_RGB_FXT1:
-   case PIPE_FORMAT_RGBA_FXT1:
+   case PIPE_FORMAT_FXT1_RGB:
+   case PIPE_FORMAT_FXT1_RGBA:
       return (MAPSURF_COMPRESSED | MT_COMPRESS_FXT1);
-#endif
    case PIPE_FORMAT_Z16_UNORM:
       return (MAPSURF_16BIT | MT_16BIT_L16);
    case PIPE_FORMAT_DXT1_RGB:



More information about the mesa-commit mailing list