From 4e799fa5dac7827acdf9b9a0929b9d83ff4cbb40 Mon Sep 17 00:00:00 2001 From: lfdevs Date: Tue, 21 Jul 2026 01:13:40 +0800 Subject: [PATCH] freedreno/kgsl: try dma-buf export before shadowing Imported KGSL BOs can already carry a valid dma-buf fd even when the pipe resource was not created with PIPE_BIND_SHARED. Shadowing such resources before attempting export unnecessarily replaces their backing storage and can leave cached texture state referring to the old resource sequence number. Keep the LINEAR modifier requirement, but try the normal export path first. Native KGSL BOs that cannot be exported still fall back to a shared linear shadow resource. This avoids Xwayland aborts when presenting imported Vulkan DRI3 buffers. --- .../drivers/freedreno/freedreno_resource.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c index eefbad2282e..627e18f4c35 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.c +++ b/src/gallium/drivers/freedreno/freedreno_resource.c @@ -1115,23 +1115,9 @@ fd_resource_get_handle(struct pipe_screen *pscreen, struct pipe_context *pctx, handle->modifier = fd_resource_modifier(rsc); - if (fd_screen(pscreen)->kgsl_dmabuf) { + if (fd_screen(pscreen)->kgsl_dmabuf) handle->modifier = DRM_FORMAT_MOD_LINEAR; - if (!(prsc->bind & PIPE_BIND_SHARED)) { - struct fd_context *ctx = fd_screen_aux_context_get(pscreen); - - prsc->bind |= PIPE_BIND_SHARED; - - bool ret = fd_try_shadow_resource(ctx, rsc, 0, NULL, handle->modifier); - - fd_screen_aux_context_put(pscreen); - - if (!ret) - return false; - } - } - if (prsc->target != PIPE_BUFFER) { struct fdl_metadata metadata = { .modifier = handle->modifier,