mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 02:10:11 +01:00
zink: make map_count useful for dedicated image allocations
Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12410>
This commit is contained in:
parent
89e2591e8d
commit
daff597940
2 changed files with 8 additions and 2 deletions
|
|
@ -1058,11 +1058,14 @@ map_resource(struct zink_screen *screen, struct zink_resource *res)
|
|||
static void
|
||||
unmap_resource(struct zink_screen *screen, struct zink_resource *res)
|
||||
{
|
||||
res->obj->map = NULL;
|
||||
if (!res->obj->dedicated)
|
||||
zink_bo_unmap(screen, res->obj->bo);
|
||||
else
|
||||
else {
|
||||
if (!p_atomic_dec_zero(&res->obj->map_count))
|
||||
return;
|
||||
vkUnmapMemory(screen->dev, res->obj->mem);
|
||||
}
|
||||
res->obj->map = NULL;
|
||||
}
|
||||
|
||||
static void *
|
||||
|
|
@ -1323,6 +1326,8 @@ zink_transfer_map(struct pipe_context *pctx,
|
|||
}
|
||||
if (sizeof(void*) == 4)
|
||||
trans->base.b.usage |= ZINK_MAP_TEMPORARY;
|
||||
if (res->obj->dedicated)
|
||||
p_atomic_inc(&res->obj->map_count);
|
||||
}
|
||||
if ((usage & PIPE_MAP_PERSISTENT) && !(usage & PIPE_MAP_COHERENT))
|
||||
res->obj->persistent_maps++;
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ struct zink_resource_object {
|
|||
struct zink_batch_usage *reads;
|
||||
struct zink_batch_usage *writes;
|
||||
void *map;
|
||||
unsigned map_count;
|
||||
|
||||
struct util_dynarray tmp;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue