Module: Mesa Branch: main Commit: 17ac8e76047f2f521ff217d99ca119fc13488348 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=17ac8e76047f2f521ff217d99ca119fc13488348
Author: Mike Blumenkrantz <[email protected]> Date: Fri Apr 29 07:42:05 2022 -0400 Revert "zink: export fd info for all 2d images" This reverts commit fda7371b4cfc5a15f2207f5165f3a8e14442a522. this breaks suballocation Reviewed-by: Dave Airlie <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16252> --- src/gallium/drivers/zink/zink_resource.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index ba67d59e109..2cc2023daf5 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -497,7 +497,7 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t VK_IMAGE_ASPECT_PLANE_2_BIT, }; VkExternalMemoryHandleTypeFlags external = 0; - bool needs_export = templ->target == PIPE_TEXTURE_2D; + bool needs_export = (templ->bind & ZINK_BIND_VIDEO) != 0; if (whandle) { if (whandle->type == WINSYS_HANDLE_TYPE_FD || whandle->type == ZINK_EXTERNAL_MEMORY_HANDLE) needs_export |= true; @@ -505,7 +505,7 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t unreachable("unknown handle type"); } if (needs_export) { - if (!whandle || whandle->type == ZINK_EXTERNAL_MEMORY_HANDLE) { + if (whandle && whandle->type == ZINK_EXTERNAL_MEMORY_HANDLE) { external = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; } else { external = VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT; @@ -777,7 +777,7 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t } VkExportMemoryAllocateInfo emai; - if (needs_export) { + if ((templ->bind & ZINK_BIND_VIDEO) || ((templ->bind & PIPE_BIND_SHARED) && shared)) { emai.sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO; emai.handleTypes = export_types;
