etnaviv: properly reference flush_resources
The flush_resources recorded in the context need to stay alive until the context is flushed, at which point additional resolve operations are done to those resources. While the backing BO is alive due to being referenced in the cmdstream, the resource might already be destroyed at this point. Keep a reference to the resource to make sure it is still available at context flush time. Fixes:7b9d8d1936
("etnaviv: flush used render buffers on context flush when neccessary") Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19280> (cherry picked from commit16e0702ec7
)
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
"description": "etnaviv: properly reference flush_resources",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "7b9d8d1936d72af6fd1bfd30afed354bb76b4c0c"
|
||||
},
|
||||
|
@@ -517,6 +517,7 @@ etna_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence,
|
||||
struct pipe_resource *prsc = (struct pipe_resource *)entry->key;
|
||||
|
||||
pctx->flush_resource(pctx, prsc);
|
||||
pipe_resource_reference(&prsc, NULL);
|
||||
}
|
||||
_mesa_set_clear(ctx->flush_resources, NULL);
|
||||
|
||||
|
@@ -793,8 +793,14 @@ etna_record_flush_resources(struct etna_context *ctx)
|
||||
if (fb->nr_cbufs > 0) {
|
||||
struct etna_surface *surf = etna_surface(fb->cbufs[0]);
|
||||
|
||||
if (!etna_resource(surf->prsc)->explicit_flush)
|
||||
_mesa_set_add(ctx->flush_resources, surf->prsc);
|
||||
if (!etna_resource(surf->prsc)->explicit_flush) {
|
||||
bool found;
|
||||
|
||||
_mesa_set_search_or_add(ctx->flush_resources, surf->prsc, &found);
|
||||
|
||||
if (!found)
|
||||
pipe_reference(NULL, &surf->prsc->reference);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user