Mesa (main): freedreno/a6xx: Inline remaining fd6_tex_const_0() call.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Nov 11 00:48:00 UTC 2021


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

Author: Emma Anholt <emma at anholt.net>
Date:   Tue Nov  9 14:32:49 2021 -0800

freedreno/a6xx: Inline remaining fd6_tex_const_0() call.

Less indirection and fixups for figuring out what's going on.

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

---

 src/gallium/drivers/freedreno/a6xx/fd6_format.c | 22 ----------------------
 src/gallium/drivers/freedreno/a6xx/fd6_format.h |  5 -----
 src/gallium/drivers/freedreno/a6xx/fd6_gmem.c   | 25 +++++++++++++++++--------
 3 files changed, 17 insertions(+), 35 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_format.c b/src/gallium/drivers/freedreno/a6xx/fd6_format.c
index b901e4dac18..2b4acc6010a 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_format.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_format.c
@@ -81,25 +81,3 @@ fd6_tex_swiz(enum pipe_format format, unsigned char *swiz, unsigned swizzle_r,
       util_format_compose_swizzles(desc->swizzle, uswiz, swiz);
    }
 }
-
-/* Compute the TEX_CONST_0 value for texture state, including SWIZ/SWAP/etc: */
-uint32_t
-fd6_tex_const_0(struct pipe_resource *prsc, unsigned level,
-                enum pipe_format format, unsigned swizzle_r, unsigned swizzle_g,
-                unsigned swizzle_b, unsigned swizzle_a)
-{
-   struct fd_resource *rsc = fd_resource(prsc);
-   unsigned char swiz[4];
-
-   fd6_tex_swiz(format, swiz, swizzle_r, swizzle_g, swizzle_b, swizzle_a);
-
-   return A6XX_TEX_CONST_0_FMT(fd6_texture_format(format, rsc->layout.tile_mode)) |
-          A6XX_TEX_CONST_0_SAMPLES(fd_msaa_samples(prsc->nr_samples)) |
-          A6XX_TEX_CONST_0_SWAP(fd6_texture_swap(format, rsc->layout.tile_mode)) |
-          A6XX_TEX_CONST_0_TILE_MODE(fd_resource_tile_mode(prsc, level)) |
-          COND(util_format_is_srgb(format), A6XX_TEX_CONST_0_SRGB) |
-          A6XX_TEX_CONST_0_SWIZ_X(fd6_pipe2swiz(swiz[0])) |
-          A6XX_TEX_CONST_0_SWIZ_Y(fd6_pipe2swiz(swiz[1])) |
-          A6XX_TEX_CONST_0_SWIZ_Z(fd6_pipe2swiz(swiz[2])) |
-          A6XX_TEX_CONST_0_SWIZ_W(fd6_pipe2swiz(swiz[3]));
-}
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_format.h b/src/gallium/drivers/freedreno/a6xx/fd6_format.h
index ee5e877f27e..d525dfcaa1c 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_format.h
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_format.h
@@ -40,9 +40,4 @@ void fd6_tex_swiz(enum pipe_format format, unsigned char *swiz,
                   unsigned swizzle_r, unsigned swizzle_g, unsigned swizzle_b,
                   unsigned swizzle_a);
 
-uint32_t fd6_tex_const_0(struct pipe_resource *prsc, unsigned level,
-                         enum pipe_format format, unsigned swizzle_r,
-                         unsigned swizzle_g, unsigned swizzle_b,
-                         unsigned swizzle_a);
-
 #endif /* FD6_UTIL_H_ */
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c
index 87c9ba8c717..2f626114e7e 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c
@@ -265,14 +265,23 @@ patch_fb_read_gmem(struct fd_batch *batch)
    const struct fd_gmem_stateobj *gmem = batch->gmem_state;
    struct pipe_framebuffer_state *pfb = &batch->framebuffer;
    struct pipe_surface *psurf = pfb->cbufs[0];
-   uint32_t texconst0 = fd6_tex_const_0(
-      psurf->texture, psurf->u.tex.level, psurf->format, PIPE_SWIZZLE_X,
-      PIPE_SWIZZLE_Y, PIPE_SWIZZLE_Z, PIPE_SWIZZLE_W);
-
-   /* always TILE6_2 mode in GMEM.. which also means no swap: */
-   texconst0 &=
-      ~(A6XX_TEX_CONST_0_SWAP__MASK | A6XX_TEX_CONST_0_TILE_MODE__MASK);
-   texconst0 |= A6XX_TEX_CONST_0_TILE_MODE(TILE6_2);
+   struct pipe_resource *prsc = psurf->texture;
+   struct fd_resource *rsc = fd_resource(prsc);
+   enum pipe_format format = psurf->format;
+
+   uint8_t swiz[4];
+   fd6_tex_swiz(psurf->format, swiz, PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y, PIPE_SWIZZLE_Z, PIPE_SWIZZLE_W);
+
+   /* always TILE6_2 mode in GMEM, which also means no swap: */
+   uint32_t texconst0 = A6XX_TEX_CONST_0_FMT(fd6_texture_format(format, rsc->layout.tile_mode)) |
+          A6XX_TEX_CONST_0_SAMPLES(fd_msaa_samples(prsc->nr_samples)) |
+          A6XX_TEX_CONST_0_SWAP(WZYX) |
+          A6XX_TEX_CONST_0_TILE_MODE(TILE6_2) |
+          COND(util_format_is_srgb(format), A6XX_TEX_CONST_0_SRGB) |
+          A6XX_TEX_CONST_0_SWIZ_X(fd6_pipe2swiz(swiz[0])) |
+          A6XX_TEX_CONST_0_SWIZ_Y(fd6_pipe2swiz(swiz[1])) |
+          A6XX_TEX_CONST_0_SWIZ_Z(fd6_pipe2swiz(swiz[2])) |
+          A6XX_TEX_CONST_0_SWIZ_W(fd6_pipe2swiz(swiz[3]));
 
    for (unsigned i = 0; i < num_patches; i++) {
       struct fd_cs_patch *patch = fd_patch_element(&batch->fb_read_patches, i);



More information about the mesa-commit mailing list