rusticl/mesa: wire up fence_server

We need this to wait on imported fences.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36249>
(cherry picked from commit 8617cf46d6)
This commit is contained in:
Karol Herbst 2025-07-07 16:39:31 +02:00 committed by Eric Engestrom
parent 1bcc0e5bed
commit d0121cdfd2
3 changed files with 21 additions and 2 deletions

View file

@ -3024,7 +3024,7 @@
"description": "rusticl/mesa: wire up fence_server",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -629,6 +629,11 @@ impl PipeContext {
}
}
}
pub fn has_fence_server(&self) -> bool {
let pipe = unsafe { self.pipe().as_ref() };
pipe.fence_server_signal.is_some() && pipe.fence_server_sync.is_some()
}
}
impl Drop for PipeContext {

View file

@ -1,4 +1,4 @@
use crate::pipe::screen::*;
use crate::pipe::{context::PipeContext, screen::*};
use libc_rust_gen::close;
use mesa_rust_gen::*;
@ -30,6 +30,20 @@ impl PipeFence {
}
}
pub fn gpu_signal(&self, ctx: &PipeContext) {
debug_assert!(ctx.has_fence_server());
unsafe {
ctx.pipe().as_ref().fence_server_signal.unwrap()(ctx.pipe().as_ptr(), self.fence);
}
}
pub fn gpu_wait(&self, ctx: &PipeContext) {
debug_assert!(ctx.has_fence_server());
unsafe {
ctx.pipe().as_ref().fence_server_sync.unwrap()(ctx.pipe().as_ptr(), self.fence);
}
}
pub fn wait(&self) {
self.screen.fence_finish(self.fence);
}