From f4e852d3ad0e3874d63a4b234a4078494fb062e0 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Mon, 21 Jul 2025 18:10:49 +0200 Subject: [PATCH] rusticl/gl: only flush objects on import if we get a valid fd If no context is current we might not get anything to wait on. Cc: mesa-stable Part-of: (cherry picked from commit f6b844e239c780aac439c0e877af3e14a5493484) --- .pick_status.json | 2 +- src/gallium/frontends/rusticl/core/gl.rs | 30 ++++++++++++++---------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index fb328e5226f..33d35f94261 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -6234,7 +6234,7 @@ "description": "rusticl/gl: only flush objects on import if we get a valid fd", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/frontends/rusticl/core/gl.rs b/src/gallium/frontends/rusticl/core/gl.rs index 5c632a34430..f06e8394366 100644 --- a/src/gallium/frontends/rusticl/core/gl.rs +++ b/src/gallium/frontends/rusticl/core/gl.rs @@ -255,16 +255,19 @@ impl GLCtxManager { &mut export_in, &mut flush_out, ); - // TODO: use fence_server_sync in ctx inside the queue thread - let fence_fd = FenceFd { fd }; - cl_ctx.devs.iter().for_each(|dev| { - let fence = dev.helper_ctx().import_fence(&fence_fd); - fence.wait(); - }); if err_flush != 0 { err_flush } else { + if fd != -1 { + // TODO: use fence_server_sync in ctx inside the queue thread + let fence_fd = FenceFd { fd }; + cl_ctx.devs.iter().for_each(|dev| { + let fence = dev.helper_ctx().import_fence(&fence_fd); + fence.wait(); + }); + } + egl_export_object_func( disp.cast(), ctx.cast(), @@ -289,16 +292,19 @@ impl GLCtxManager { &mut export_in, &mut flush_out, ); - // TODO: use fence_server_sync in ctx inside the queue thread - let fence_fd = FenceFd { fd }; - cl_ctx.devs.iter().for_each(|dev| { - let fence = dev.helper_ctx().import_fence(&fence_fd); - fence.wait(); - }); if err_flush != 0 { err_flush } else { + if fd != -1 { + // TODO: use fence_server_sync in ctx inside the queue thread + let fence_fd = FenceFd { fd }; + cl_ctx.devs.iter().for_each(|dev| { + let fence = dev.helper_ctx().import_fence(&fence_fd); + fence.wait(); + }); + } + glx_export_object_func( disp.cast(), ctx.cast(),