aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2019-11-25 11:23:03 -0800
committerEric Anholt <[email protected]>2019-12-11 04:24:18 +0000
commitea7631a9a6a57e81600e8dc38fc2322f65e6ae98 (patch)
treebc6f24662e0b162809fdfa26875b8a3d8e43635d /src/gallium/drivers/freedreno
parentbbe84c6c315db706406a40ac9dd7c198619e9794 (diff)
freedreno: Move UBWC layout into a slices array like the non-UBWC slices.
This is a little refactor in preparation for UBWC mipmapping support. Reviewed-by: Kristian H. Kristensen <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno')
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_gmem.c2
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_image.c6
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_resource.c4
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_texture.c2
-rw-r--r--src/gallium/drivers/freedreno/freedreno_resource.c6
5 files changed, 11 insertions, 9 deletions
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c
index 35199aea99a..fbc53b748ed 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c
@@ -61,7 +61,7 @@ fd6_emit_flag_reference(struct fd_ringbuffer *ring, struct fd_resource *rsc,
if (fd_resource_ubwc_enabled(rsc, level)) {
OUT_RELOCW(ring, rsc->bo, fd_resource_ubwc_offset(rsc, level, layer), 0, 0);
OUT_RING(ring,
- A6XX_RB_MRT_FLAG_BUFFER_PITCH_PITCH(rsc->layout.ubwc_pitch) |
+ A6XX_RB_MRT_FLAG_BUFFER_PITCH_PITCH(rsc->layout.ubwc_slices[level].pitch) |
A6XX_RB_MRT_FLAG_BUFFER_PITCH_ARRAY_PITCH(rsc->layout.ubwc_size));
} else {
OUT_RING(ring, 0x00000000); /* RB_MRT_FLAG_BUFFER[i].ADDR_LO */
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_image.c b/src/gallium/drivers/freedreno/a6xx/fd6_image.c
index 62ce378653d..8cc95b7cb5b 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_image.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_image.c
@@ -196,9 +196,10 @@ static void emit_image_tex(struct fd_ringbuffer *ring, struct fd6_image *img)
OUT_RING(ring, 0x00000000); /* texconst6 */
if (ubwc_enabled) {
+ struct fdl_slice *ubwc_slice = &rsc->layout.ubwc_slices[img->level];
OUT_RELOC(ring, rsc->bo, img->ubwc_offset, 0, 0);
OUT_RING(ring, A6XX_TEX_CONST_9_FLAG_BUFFER_ARRAY_PITCH(rsc->layout.ubwc_size));
- OUT_RING(ring, A6XX_TEX_CONST_10_FLAG_BUFFER_PITCH(rsc->layout.ubwc_pitch));
+ OUT_RING(ring, A6XX_TEX_CONST_10_FLAG_BUFFER_PITCH(ubwc_slice->pitch));
} else {
OUT_RING(ring, 0x00000000); /* texconst7 */
OUT_RING(ring, 0x00000000); /* texconst8 */
@@ -254,9 +255,10 @@ static void emit_image_ssbo(struct fd_ringbuffer *ring, struct fd6_image *img)
OUT_RING(ring, 0x00000000);
if (ubwc_enabled) {
+ struct fdl_slice *ubwc_slice = &rsc->layout.ubwc_slices[img->level];
OUT_RELOCW(ring, rsc->bo, img->ubwc_offset, 0, 0);
OUT_RING(ring, A6XX_IBO_9_FLAG_BUFFER_ARRAY_PITCH(rsc->layout.ubwc_size));
- OUT_RING(ring, A6XX_IBO_10_FLAG_BUFFER_PITCH(rsc->layout.ubwc_pitch));
+ OUT_RING(ring, A6XX_IBO_10_FLAG_BUFFER_PITCH(ubwc_slice->pitch));
} else {
OUT_RING(ring, 0x00000000);
OUT_RING(ring, 0x00000000);
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_resource.c b/src/gallium/drivers/freedreno/a6xx/fd6_resource.c
index 8b5e79c4ae8..4a35dd6db2f 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_resource.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_resource.c
@@ -267,8 +267,8 @@ fd6_fill_ubwc_buffer_sizes(struct fd_resource *rsc)
slice->offset += meta_size;
}
- rsc->layout.ubwc_offset = 0;
- rsc->layout.ubwc_pitch = meta_stride;
+ rsc->layout.ubwc_slices[0].offset = 0;
+ rsc->layout.ubwc_slices[0].pitch = meta_stride;
rsc->layout.ubwc_size = meta_size >> 2; /* in dwords??? */
rsc->layout.tile_mode = TILE6_3;
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_texture.c b/src/gallium/drivers/freedreno/a6xx/fd6_texture.c
index 585d3eb81e8..a5185cd6708 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_texture.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_texture.c
@@ -279,7 +279,7 @@ fd6_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc,
if (so->ubwc_enabled) {
so->texconst9 |= A6XX_TEX_CONST_9_FLAG_BUFFER_ARRAY_PITCH(rsc->layout.ubwc_size);
- so->texconst10 |= A6XX_TEX_CONST_10_FLAG_BUFFER_PITCH(rsc->layout.ubwc_pitch);
+ so->texconst10 |= A6XX_TEX_CONST_10_FLAG_BUFFER_PITCH(rsc->layout.ubwc_slices[lvl].pitch);
}
so->texconst2 |= A6XX_TEX_CONST_2_TYPE(fd6_tex_type(cso->target));
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c
index 3e74e0c5a00..5826e16c154 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -223,10 +223,10 @@ fd_try_shadow_resource(struct fd_context *ctx, struct fd_resource *rsc,
/* TODO valid_buffer_range?? */
swap(rsc->bo, shadow->bo);
swap(rsc->write_batch, shadow->write_batch);
- for (int level = 0; level <= prsc->last_level; level++)
+ for (int level = 0; level <= prsc->last_level; level++) {
swap(rsc->layout.slices[level], shadow->layout.slices[level]);
- swap(rsc->layout.ubwc_offset, shadow->layout.ubwc_offset);
- swap(rsc->layout.ubwc_pitch, shadow->layout.ubwc_pitch);
+ swap(rsc->layout.ubwc_slices[level], shadow->layout.ubwc_slices[level]);
+ }
swap(rsc->layout.ubwc_size, shadow->layout.ubwc_size);
rsc->seqno = p_atomic_inc_return(&ctx->screen->rsc_seqno);