freedreno/a6xx: enable tiled images
authorRob Clark <robdclark@gmail.com>
Thu, 21 Feb 2019 13:26:18 +0000 (08:26 -0500)
committerRob Clark <robdclark@gmail.com>
Thu, 21 Feb 2019 14:06:06 +0000 (09:06 -0500)
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 <robdclark@gmail.com>
src/freedreno/registers/a6xx.xml.h
src/gallium/drivers/freedreno/a6xx/fd6_image.c

index 1d8ca525602e577c3e415bd4de908b52118276bb..78869bf0469fc858b27236ac64f5478519fc7449 100644 (file)
@@ -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)
index e7874139bec225721d77bc4ccd7bc7881118e96d..d41a8887a538986f9da9294b46137a2f640a7c79 100644 (file)
@@ -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) |