etnaviv: use most recent shadow of resources as blit source/target

The frontend does not know that etnaviv may keep multiple shadows around
for a resource, so it will always pass in the base resource as blit source
and destination. For those blits to work as expected by the API we need to
work out which shadow is the most recent one and use those as blit source
and destination resources.

CC: mesa-stable
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35526>
This commit is contained in:
Lucas Stach 2025-06-13 23:05:28 +02:00 committed by Marge Bot
parent d4780f03fc
commit ede41372f4

View file

@ -104,10 +104,32 @@ etna_blit(struct pipe_context *pctx, const struct pipe_blit_info *blit_info)
{
struct etna_context *ctx = etna_context(pctx);
struct pipe_blit_info info = *blit_info;
struct etna_resource *src = etna_resource(info.src.resource);
struct etna_resource *dst = etna_resource(info.dst.resource);
if (info.render_condition_enable && !etna_render_condition_check(pctx))
return;
/* blit from most recent shadow of the source */
if (src->render &&
etna_resource_level_newer(&etna_resource(src->render)->levels[info.src.level],
&etna_resource(info.src.resource)->levels[info.src.level]))
info.src.resource = src->render;
if (src->texture &&
etna_resource_level_newer(&etna_resource(src->texture)->levels[info.src.level],
&etna_resource(info.src.resource)->levels[info.src.level]))
info.src.resource = src->texture;
/* blit to the most recent shadow of the destination */
if (dst->render &&
etna_resource_level_newer(&etna_resource(dst->render)->levels[info.dst.level],
&etna_resource(info.dst.resource)->levels[info.dst.level]))
info.dst.resource = dst->render;
if (dst->texture &&
etna_resource_level_newer(&etna_resource(dst->texture)->levels[info.dst.level],
&etna_resource(info.dst.resource)->levels[info.dst.level]))
info.dst.resource = dst->texture;
if (ctx->blit(pctx, &info))
goto success;