mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-07 08:18:24 +02:00
zink: skip all post-process when importing and resource_create fails
When the pipe_resource pointer returned by resource_create is NULL, the process importing the handle into the underlying Vulkan driver is known to have failed, and the handle importing process shouldn't continue. Just return NULL in this case to prevent further check of pres being non-NULL. This also fixes the issue that renderonly code lacks check for non-NULL pres, and the conversion of pipe_resource to zink_resource in renderonly codepath is now gone because of a converted zink_resource is available above. Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40490>
This commit is contained in:
parent
79ac5fd4c2
commit
af8923bb01
1 changed files with 10 additions and 11 deletions
|
|
@ -2129,20 +2129,19 @@ zink_resource_from_handle(struct pipe_screen *pscreen,
|
|||
}
|
||||
templ2.bind |= ZINK_BIND_DMABUF;
|
||||
struct pipe_resource *pres = resource_create(pscreen, &templ2, whandle, usage, &modifier, modifier_count, NULL, NULL);
|
||||
if (pres) {
|
||||
struct zink_resource *res = zink_resource(pres);
|
||||
if (pres->target != PIPE_BUFFER)
|
||||
res->valid = true;
|
||||
else
|
||||
tc_buffer_disable_cpu_storage(pres);
|
||||
res->obj->immutable_handle = true;
|
||||
res->internal_format = whandle->format;
|
||||
}
|
||||
if (!pres)
|
||||
return NULL;
|
||||
|
||||
struct zink_resource *res = zink_resource(pres);
|
||||
if (pres->target != PIPE_BUFFER)
|
||||
res->valid = true;
|
||||
else
|
||||
tc_buffer_disable_cpu_storage(pres);
|
||||
res->obj->immutable_handle = true;
|
||||
res->internal_format = whandle->format;
|
||||
|
||||
#ifdef HAVE_LIBDRM
|
||||
if (screen->ro) {
|
||||
struct zink_resource *res = zink_resource(pres);
|
||||
|
||||
/* Make sure that renderonly has a handle to our buffer in the display's
|
||||
* fd, so that a later renderonly_get_handle() returns correct handles
|
||||
* or GEM names.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue