zink: make get_resource_usage() public
also cover compute batch id (still not yet used) Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8781>
This commit is contained in:
parent
079fae8822
commit
e196c471a4
|
@ -508,11 +508,11 @@ zink_transfer_copy_bufimage(struct zink_context *ctx,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t
|
uint32_t
|
||||||
get_resource_usage(struct zink_resource *res)
|
zink_get_resource_usage(struct zink_resource *res)
|
||||||
{
|
{
|
||||||
uint32_t batch_uses = 0;
|
uint32_t batch_uses = 0;
|
||||||
for (unsigned i = 0; i < 4; i++)
|
for (unsigned i = 0; i < ARRAY_SIZE(res->batch_uses); i++)
|
||||||
batch_uses |= p_atomic_read(&res->batch_uses[i]) << i;
|
batch_uses |= p_atomic_read(&res->batch_uses[i]) << i;
|
||||||
return batch_uses;
|
return batch_uses;
|
||||||
}
|
}
|
||||||
|
@ -528,7 +528,7 @@ zink_transfer_map(struct pipe_context *pctx,
|
||||||
struct zink_context *ctx = zink_context(pctx);
|
struct zink_context *ctx = zink_context(pctx);
|
||||||
struct zink_screen *screen = zink_screen(pctx->screen);
|
struct zink_screen *screen = zink_screen(pctx->screen);
|
||||||
struct zink_resource *res = zink_resource(pres);
|
struct zink_resource *res = zink_resource(pres);
|
||||||
uint32_t batch_uses = get_resource_usage(res);
|
uint32_t batch_uses = zink_get_resource_usage(res);
|
||||||
|
|
||||||
struct zink_transfer *trans = slab_alloc(&ctx->transfer_pool);
|
struct zink_transfer *trans = slab_alloc(&ctx->transfer_pool);
|
||||||
if (!trans)
|
if (!trans)
|
||||||
|
@ -672,7 +672,7 @@ zink_transfer_unmap(struct pipe_context *pctx,
|
||||||
|
|
||||||
if (trans->base.usage & PIPE_MAP_WRITE) {
|
if (trans->base.usage & PIPE_MAP_WRITE) {
|
||||||
struct zink_context *ctx = zink_context(pctx);
|
struct zink_context *ctx = zink_context(pctx);
|
||||||
uint32_t batch_uses = get_resource_usage(res);
|
uint32_t batch_uses = zink_get_resource_usage(res);
|
||||||
if (batch_uses >= ZINK_RESOURCE_ACCESS_WRITE)
|
if (batch_uses >= ZINK_RESOURCE_ACCESS_WRITE)
|
||||||
zink_fence_wait(pctx);
|
zink_fence_wait(pctx);
|
||||||
zink_transfer_copy_bufimage(ctx, res, staging_res, trans, true);
|
zink_transfer_copy_bufimage(ctx, res, staging_res, trans, true);
|
||||||
|
|
|
@ -89,4 +89,7 @@ zink_get_depth_stencil_resources(struct pipe_resource *res,
|
||||||
|
|
||||||
void
|
void
|
||||||
zink_resource_setup_transfer_layouts(struct zink_batch *batch, struct zink_resource *src, struct zink_resource *dst);
|
zink_resource_setup_transfer_layouts(struct zink_batch *batch, struct zink_resource *src, struct zink_resource *dst);
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
zink_get_resource_usage(struct zink_resource *res);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue