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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36249>
(cherry picked from commit f6b844e239)
This commit is contained in:
Karol Herbst 2025-07-21 18:10:49 +02:00 committed by Eric Engestrom
parent dec55fc830
commit f4e852d3ad
2 changed files with 19 additions and 13 deletions

View file

@ -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

View file

@ -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(),