aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno
diff options
context:
space:
mode:
authorKristian H. Kristensen <[email protected]>2019-11-27 16:06:59 -0800
committerKristian H. Kristensen <[email protected]>2019-12-19 09:56:05 -0800
commit1d7267fc91ae59635faabc99022054bc4b839904 (patch)
treea27c3e8098c3a4686c4f01b6c06d0c755e5b13f9 /src/gallium/drivers/freedreno
parente0ebaa819df33de74f73f42e17536f4f2dc5446a (diff)
freedreno/a6xx: Add fd_resource_swap() helper
Reviewed-by: Eric Anholt <[email protected]> Signed-off-by: Kristian H. Kristensen <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2848>
Diffstat (limited to 'src/gallium/drivers/freedreno')
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_blitter.c4
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_format.c2
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_format.h7
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_gmem.c4
4 files changed, 12 insertions, 5 deletions
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
index 58b564f8f4b..8357e71fc76 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
@@ -390,8 +390,8 @@ emit_blit_or_clear_texture(struct fd_context *ctx, struct fd_ringbuffer *ring,
/* Linear levels of a tiled resource are always WZYX, so look at
* rsc->tile_mode to determine the swap.
*/
- sswap = src->layout.tile_mode ? WZYX : fd6_pipe2swap(info->src.format);
- dswap = dst->layout.tile_mode ? WZYX : fd6_pipe2swap(info->dst.format);
+ sswap = fd6_resource_swap(src, info->src.format);
+ dswap = fd6_resource_swap(dst, info->dst.format);
if (util_format_is_compressed(info->src.format)) {
debug_assert(info->src.format == info->dst.format);
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_format.c b/src/gallium/drivers/freedreno/a6xx/fd6_format.c
index e703de8e12b..d09bdc776b2 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_format.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_format.c
@@ -487,7 +487,7 @@ fd6_tex_const_0(struct pipe_resource *prsc,
return
A6XX_TEX_CONST_0_FMT(fd6_pipe2tex(format)) |
A6XX_TEX_CONST_0_SAMPLES(fd_msaa_samples(prsc->nr_samples)) |
- A6XX_TEX_CONST_0_SWAP(rsc->layout.tile_mode ? WZYX : fd6_pipe2swap(format)) |
+ A6XX_TEX_CONST_0_SWAP(fd6_resource_swap(rsc, format)) |
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])) |
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_format.h b/src/gallium/drivers/freedreno/a6xx/fd6_format.h
index 8da5f08be50..90b06197ef5 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_format.h
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_format.h
@@ -118,4 +118,11 @@ fd6_ifmt(enum a6xx_color_fmt fmt)
return 0;
}
}
+
+static inline uint32_t
+fd6_resource_swap(struct fd_resource *rsc, enum pipe_format format)
+{
+ return rsc->layout.tile_mode ? WZYX : fd6_pipe2swap(format);
+}
+
#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 a97f4742828..dfff3ecc512 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c
@@ -113,7 +113,7 @@ emit_mrt(struct fd_ringbuffer *ring, struct pipe_framebuffer_state *pfb,
psurf->u.tex.first_layer);
stride = slice->pitch * rsc->layout.cpp * pfb->samples;
- swap = rsc->layout.tile_mode ? WZYX : fd6_pipe2swap(pformat);
+ swap = fd6_resource_swap(rsc, pformat);
tile_mode = fd_resource_tile_mode(psurf->texture, psurf->u.tex.level);
@@ -961,7 +961,7 @@ emit_blit(struct fd_batch *batch,
enum a6xx_color_fmt format = fd6_pipe2color(pfmt);
uint32_t stride = slice->pitch * rsc->layout.cpp;
uint32_t size = slice->size0;
- enum a3xx_color_swap swap = rsc->layout.tile_mode ? WZYX : fd6_pipe2swap(pfmt);
+ enum a3xx_color_swap swap = fd6_resource_swap(rsc, pfmt);
enum a3xx_msaa_samples samples =
fd_msaa_samples(rsc->base.nr_samples);
uint32_t tile_mode = fd_resource_tile_mode(&rsc->base, psurf->u.tex.level);