zink: only add necessary binds during dmabuf export

SHARED might only be present, so add it conditionally

Fixes: 4eeabb59f5 ("zink: rebind resources for export as needed")

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17010>
This commit is contained in:
Mike Blumenkrantz 2022-06-09 16:20:44 -04:00 committed by Marge Bot
parent 44cf6f7564
commit 4c908e3d7b

View file

@ -1350,7 +1350,10 @@ zink_resource_get_handle(struct pipe_screen *pscreen,
if (!res->obj->exportable) {
assert(!res->all_binds); //TODO handle if problematic
assert(!zink_resource_usage_is_unflushed(res));
if (!add_resource_bind(screen->copy_context, res, ZINK_BIND_DMABUF | PIPE_BIND_SHARED))
unsigned bind = ZINK_BIND_DMABUF;
if (!(res->base.b.bind & PIPE_BIND_SHARED))
bind |= PIPE_BIND_SHARED;
if (!add_resource_bind(screen->copy_context, res, bind))
return false;
p_atomic_inc(&screen->image_rebind_counter);
screen->copy_context->base.flush(&screen->copy_context->base, NULL, 0);