etnaviv: fix tile status interaction with write mappings
authorLucas Stach <l.stach@pengutronix.de>
Fri, 18 Nov 2022 11:24:58 +0000 (12:24 +0100)
committerMarge Bot <emma+marge@anholt.net>
Tue, 22 Nov 2022 10:01:56 +0000 (10:01 +0000)
commit0fb813526e3b3be6cf8a866b084db044ccd0e103
tree304788684a3add9ecd286d595aefbdb7f2bacffd
parentf7d6c6e1ed9919d37ceb05cbe5ed75b377253a3a
etnaviv: fix tile status interaction with write mappings

This fixes a longstanding bug in the interaction between TS and a write
mapping. The write does not update TS regardless of the way the update
is done. Update via etna_copy_resource would just set the target ts_valid
to false without actually writing back any dirty TS to the resource.
Writes via the CPU would update the resource, but keep ts_valid at true
even if the tile status may now not match the actually written tiles of
the resource anymore.

Fix this by writing back a dirty TS to the target resource if needed
before updating the level with the write data. Always invalidate TS,
even when the update is done by the CPU.

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/19846>
src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
src/gallium/drivers/etnaviv/etnaviv_transfer.c