mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
zink: refactor resource_sync_writes_from_batch_usage() to manage batch id internally
this is always used the same way, so we can simplify the code a bit for future use Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9626>
This commit is contained in:
parent
304ee56cab
commit
c5390b2ef7
1 changed files with 6 additions and 3 deletions
|
|
@ -55,8 +55,11 @@ debug_describe_zink_resource_object(char *buf, const struct zink_resource_object
|
|||
|
||||
|
||||
static void
|
||||
resource_sync_writes_from_batch_usage(struct zink_context *ctx, uint32_t batch_uses)
|
||||
resource_sync_writes_from_batch_usage(struct zink_context *ctx, struct zink_resource *res)
|
||||
{
|
||||
uint32_t batch_uses = zink_get_resource_usage(res);
|
||||
batch_uses &= ~(ZINK_RESOURCE_ACCESS_READ << ZINK_COMPUTE_BATCH_ID);
|
||||
|
||||
uint32_t write_mask = 0;
|
||||
for (int i = 0; i < ZINK_NUM_GFX_BATCHES + ZINK_COMPUTE_BATCH_COUNT; i++)
|
||||
write_mask |= ZINK_RESOURCE_ACCESS_WRITE << i;
|
||||
|
|
@ -680,7 +683,7 @@ zink_transfer_map(struct pipe_context *pctx,
|
|||
zink_wait_on_batch(ctx, ZINK_COMPUTE_BATCH_ID);
|
||||
batch_uses &= ~(ZINK_RESOURCE_ACCESS_READ << ZINK_COMPUTE_BATCH_ID);
|
||||
if (usage & PIPE_MAP_READ && batch_uses >= ZINK_RESOURCE_ACCESS_WRITE)
|
||||
resource_sync_writes_from_batch_usage(ctx, batch_uses);
|
||||
resource_sync_writes_from_batch_usage(ctx, res);
|
||||
else if (usage & PIPE_MAP_WRITE && batch_uses) {
|
||||
/* need to wait for all rendering to finish
|
||||
* TODO: optimize/fix this to be much less obtrusive
|
||||
|
|
@ -782,7 +785,7 @@ zink_transfer_map(struct pipe_context *pctx,
|
|||
batch_uses &= ~(ZINK_RESOURCE_ACCESS_READ << ZINK_COMPUTE_BATCH_ID);
|
||||
if (batch_uses >= ZINK_RESOURCE_ACCESS_WRITE) {
|
||||
if (usage & PIPE_MAP_READ)
|
||||
resource_sync_writes_from_batch_usage(ctx, batch_uses);
|
||||
resource_sync_writes_from_batch_usage(ctx, res);
|
||||
else
|
||||
zink_fence_wait(pctx);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue