etnaviv: fix wrong surface TS clear size

Clearing ts_size - ts_offset bytes in a level means we are clearing the
TS region of all layers in the level starting from the surface layer, so
clearing one surface might corrupt all other layers of a resource level.
Use the correct size to clear only the requested TS region.

Cc: mesa-stable
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19814>
This commit is contained in:
Lucas Stach 2022-11-17 15:56:40 +01:00 committed by Marge Bot
parent d9e2a7d6ad
commit b6fa3cdb0e

View file

@ -158,7 +158,6 @@ etna_create_surface(struct pipe_context *pctx, struct pipe_resource *prsc,
assert(layer_offset < surf->surf.ts_size);
surf->surf.ts_offset += layer_offset;
surf->surf.ts_size -= layer_offset;
surf->surf.ts_valid = false;
surf->ts_reloc.bo = rsc->ts_bo;
@ -179,7 +178,7 @@ etna_create_surface(struct pipe_context *pctx, struct pipe_resource *prsc,
.dest_tiling = ETNA_LAYOUT_TILED,
.dither = {0xffffffff, 0xffffffff},
.width = 16,
.height = align(surf->surf.ts_size / 0x40, 4),
.height = align(lev->ts_layer_stride / 0x40, 4),
.clear_value = {screen->specs.ts_clear_value},
.clear_mode = VIVS_RS_CLEAR_CONTROL_MODE_ENABLED1,
.clear_bits = 0xffff