Skip to content

panfrost: fix an incorrect stencil clear optimization

Eric Smith requested to merge ericsmith/mesa:panfrost-stencil-sync into main
panfrost: fix an incorrect stencil clear optimization

We track stencil clears and writes to optimize them. Unfortunately, the
code for doing this tracks the whole resource, not individual layers or
levels within the resource, which can result in incorrect output when
different levels or layers are accessed. Modified to optimize only the first
layer/level; this will handle the common case of a single stencil texture
while allowing arrays or mipmaps to still work (albeit slightly slower).

The original optimization was introduced in a2463ec271ff ("panfrost:
Constant stencil buffer tracking") but the code has been reformatted
since then, so this change won't apply as-is that far back. It's fairly
obvious how to apply it by hand.

Fixes: a2463ec271f ("panfrost: Constant stencil value tracking")
Signed-off-by: Eric R. Smith <eric.smith@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Edited by Eric Smith

Merge request reports