Mesa (main): zink: add a ref for flush resource
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jul 1 23:10:56 UTC 2021
Module: Mesa
Branch: main
Commit: e58eb3f269210e1a55a36c813e9575337343c8c6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e58eb3f269210e1a55a36c813e9575337343c8c6
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Fri May 28 15:06:53 2021 -0400
zink: add a ref for flush resource
the lifetime of this needs to always be preserved
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11665>
---
src/gallium/drivers/zink/zink_batch.c | 6 +++---
src/gallium/drivers/zink/zink_batch.h | 2 +-
src/gallium/drivers/zink/zink_context.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_batch.c b/src/gallium/drivers/zink/zink_batch.c
index a469c565bba..bcef5b9a00f 100644
--- a/src/gallium/drivers/zink/zink_batch.c
+++ b/src/gallium/drivers/zink/zink_batch.c
@@ -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);
diff --git a/src/gallium/drivers/zink/zink_batch.h b/src/gallium/drivers/zink/zink_batch.h
index 0baed1c5da7..90ab7d3746c 100644
--- a/src/gallium/drivers/zink/zink_batch.h
+++ b/src/gallium/drivers/zink/zink_batch.h
@@ -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;
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 9a3fa4a2836..3b444b2c219 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -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
More information about the mesa-commit
mailing list