From 908d5ee9eb5d00a114a9ee9e6dc595a894cb7b88 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Thu, 21 Feb 2019 08:26:18 -0500 Subject: [PATCH] freedreno/a6xx: enable tiled images Turns out we can write to tiled images as well as read. This avoids having to linearize or do the tiling in the shader. Signed-off-by: Rob Clark --- src/freedreno/registers/a6xx.xml.h | 6 ++++++ src/gallium/drivers/freedreno/a6xx/fd6_image.c | 7 ++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/freedreno/registers/a6xx.xml.h b/src/freedreno/registers/a6xx.xml.h index 1d8ca525602..78869bf0469 100644 --- a/src/freedreno/registers/a6xx.xml.h +++ b/src/freedreno/registers/a6xx.xml.h @@ -5406,6 +5406,12 @@ static inline uint32_t A6XX_TEX_CONST_10_FLAG_BUFFER_ARRAY_PITCH(uint32_t val) #define REG_A6XX_TEX_CONST_15 0x0000000f #define REG_A6XX_IBO_0 0x00000000 +#define A6XX_IBO_0_TILE_MODE__MASK 0x00000003 +#define A6XX_IBO_0_TILE_MODE__SHIFT 0 +static inline uint32_t A6XX_IBO_0_TILE_MODE(enum a6xx_tile_mode val) +{ + return ((val) << A6XX_IBO_0_TILE_MODE__SHIFT) & A6XX_IBO_0_TILE_MODE__MASK; +} #define A6XX_IBO_0_FMT__MASK 0x3fc00000 #define A6XX_IBO_0_FMT__SHIFT 22 static inline uint32_t A6XX_IBO_0_FMT(enum a6xx_tex_fmt val) diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_image.c b/src/gallium/drivers/freedreno/a6xx/fd6_image.c index e7874139bec..d41a8887a53 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_image.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_image.c @@ -157,8 +157,6 @@ static void translate_buf(struct fd6_image *img, const struct pipe_shader_buffer static void emit_image_tex(struct fd_ringbuffer *ring, struct fd6_image *img) { - debug_assert(fd_resource(img->prsc)->tile_mode == 0); - OUT_RING(ring, A6XX_TEX_CONST_0_FMT(img->fmt) | A6XX_TEX_CONST_0_TILE_MODE(fd_resource(img->prsc)->tile_mode) | fd6_tex_swiz(img->prsc, img->pfmt, PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y, @@ -208,9 +206,8 @@ fd6_emit_ssbo_tex(struct fd_ringbuffer *ring, const struct pipe_shader_buffer *p static void emit_image_ssbo(struct fd_ringbuffer *ring, struct fd6_image *img) { - debug_assert(fd_resource(img->prsc)->tile_mode == 0); - - OUT_RING(ring, A6XX_IBO_0_FMT(img->fmt)); + OUT_RING(ring, A6XX_IBO_0_FMT(img->fmt) | + A6XX_IBO_0_TILE_MODE(fd_resource(img->prsc)->tile_mode)); OUT_RING(ring, A6XX_IBO_1_WIDTH(img->width) | A6XX_IBO_1_HEIGHT(img->height)); OUT_RING(ring, A6XX_IBO_2_PITCH(img->pitch) | -- 2.30.2