zink: add a ref for flush resource

the lifetime of this needs to always be preserved

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11665>
This commit is contained in:
Mike Blumenkrantz 2021-05-28 15:06:53 -04:00 committed by Marge Bot
parent 005262863f
commit e58eb3f269
3 changed files with 5 additions and 5 deletions

View File

@ -87,7 +87,7 @@ zink_reset_batch_state(struct zink_context *ctx, struct zink_batch_state *bs)
_mesa_set_remove(bs->fbs, entry);
}
bs->flush_res = NULL;
pipe_resource_reference(&bs->flush_res, NULL);
ctx->resource_size -= bs->resource_size;
bs->resource_size = 0;
@ -370,7 +370,7 @@ submit_queue(void *data, void *gdata, int thread_index)
};
if (bs->flush_res && screen->needs_mesa_flush_wsi) {
struct zink_resource *flush_res = bs->flush_res;
struct zink_resource *flush_res = zink_resource(bs->flush_res);
mem_signal.memory = flush_res->scanout_obj ? flush_res->scanout_obj->mem : flush_res->obj->mem;
si.pNext = &mem_signal;
}
@ -543,7 +543,7 @@ void
zink_end_batch(struct zink_context *ctx, struct zink_batch *batch)
{
if (batch->state->flush_res)
copy_scanout(batch->state, batch->state->flush_res);
copy_scanout(batch->state, zink_resource(batch->state->flush_res));
if (!ctx->queries_disabled)
zink_suspend_queries(ctx, batch);

View File

@ -73,7 +73,7 @@ struct zink_batch_state {
struct util_queue_fence flush_completed;
unsigned compute_count;
struct zink_resource *flush_res;
struct pipe_resource *flush_res;
struct set *fbs;
struct set *programs;

View File

@ -2771,7 +2771,7 @@ zink_flush_resource(struct pipe_context *pctx,
* WSI support is added
*/
if (pres->bind & (PIPE_BIND_SHARED | PIPE_BIND_SCANOUT))
ctx->batch.state->flush_res = zink_resource(pres);
pipe_resource_reference(&ctx->batch.state->flush_res, pres);
}
void