mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-20 20:50:44 +02:00
zink: track invalidation for image resources
an image only has valid data if: * it's imported * it's written to * it's mapped for write Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16877>
This commit is contained in:
parent
8575080990
commit
3e2c65281d
3 changed files with 17 additions and 3 deletions
|
|
@ -502,6 +502,8 @@ zink_batch_resource_usage_set(struct zink_batch *batch, struct zink_resource *re
|
|||
res->obj->dt_has_data = true;
|
||||
}
|
||||
}
|
||||
if (write && !res->obj->is_buffer)
|
||||
res->valid = true;
|
||||
zink_resource_usage_set(res, batch->state, write);
|
||||
/* multiple array entries are fine */
|
||||
if (!res->obj->coherent && res->obj->persistent_maps)
|
||||
|
|
|
|||
|
|
@ -1429,8 +1429,12 @@ zink_resource_from_handle(struct pipe_screen *pscreen,
|
|||
modifier_count = 1;
|
||||
}
|
||||
struct pipe_resource *pres = resource_create(pscreen, &templ2, whandle, usage, &modifier, modifier_count, NULL);
|
||||
if (pres)
|
||||
zink_resource(pres)->drm_format = whandle->format;
|
||||
if (pres) {
|
||||
struct zink_resource *res = zink_resource(pres);
|
||||
res->drm_format = whandle->format;
|
||||
if (pres->target != PIPE_BUFFER)
|
||||
res->valid = true;
|
||||
}
|
||||
return pres;
|
||||
#else
|
||||
return NULL;
|
||||
|
|
@ -1492,7 +1496,10 @@ zink_resource_from_memobj(struct pipe_screen *pscreen,
|
|||
{
|
||||
struct zink_memory_object *memobj = (struct zink_memory_object *)pmemobj;
|
||||
|
||||
return resource_create(pscreen, templ, &memobj->whandle, 0, NULL, 0, NULL);
|
||||
struct pipe_resource *pres = resource_create(pscreen, templ, &memobj->whandle, 0, NULL, 0, NULL);
|
||||
if (pres && pres->target != PIPE_BUFFER)
|
||||
zink_resource(pres)->valid = true;
|
||||
return pres;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
@ -1537,6 +1544,8 @@ zink_resource_invalidate(struct pipe_context *pctx, struct pipe_resource *pres)
|
|||
{
|
||||
if (pres->target == PIPE_BUFFER)
|
||||
invalidate_buffer(zink_context(pctx), zink_resource(pres));
|
||||
else
|
||||
zink_resource(pres)->valid = false;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1925,6 +1934,8 @@ zink_image_map(struct pipe_context *pctx,
|
|||
}
|
||||
if (!ptr)
|
||||
goto fail;
|
||||
if (usage & PIPE_MAP_WRITE)
|
||||
res->valid = true;
|
||||
|
||||
if (sizeof(void*) == 4)
|
||||
trans->base.b.usage |= ZINK_MAP_TEMPORARY;
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ struct zink_resource {
|
|||
VkImageAspectFlags aspect;
|
||||
bool optimal_tiling;
|
||||
bool need_2D;
|
||||
bool valid;
|
||||
uint8_t fb_binds; //not counted in all_binds
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue