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>
(cherry picked from commit b6fa3cdb0e)
This commit is contained in:
Lucas Stach 2022-11-17 15:56:40 +01:00 committed by Dylan Baker
parent 5f0859c9b8
commit 2cfea392a7
2 changed files with 2 additions and 3 deletions

View file

@ -463,7 +463,7 @@
"description": "etnaviv: fix wrong surface TS clear size",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -154,7 +154,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;
@ -175,7 +174,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