mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-27 01:10:25 +01:00
rusticl: specify FD type when importing fences
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36780>
This commit is contained in:
parent
f543b36178
commit
da8e990a0a
4 changed files with 13 additions and 8 deletions
|
|
@ -12,6 +12,7 @@ use crate::core::gl::*;
|
|||
use crate::core::memory::*;
|
||||
use crate::core::queue::*;
|
||||
|
||||
use mesa_rust_gen::pipe_fd_type;
|
||||
use mesa_rust_util::properties::Properties;
|
||||
use mesa_rust_util::ptr::*;
|
||||
use mesa_rust_util::static_assert;
|
||||
|
|
@ -3326,7 +3327,7 @@ fn enqueue_acquire_gl_objects(
|
|||
false,
|
||||
Box::new(move |_, ctx| {
|
||||
if let Some(fence_fd) = fence_fd {
|
||||
ctx.import_fence(&fence_fd)
|
||||
ctx.import_fence(&fence_fd, pipe_fd_type::PIPE_FD_TYPE_NATIVE_SYNC)
|
||||
.ok_or(CL_OUT_OF_RESOURCES)?
|
||||
.gpu_wait(ctx)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ pub trait HelperContextWrapper {
|
|||
) -> Option<PipeTransfer>;
|
||||
|
||||
fn is_create_fence_fd_supported(&self) -> bool;
|
||||
fn import_fence(&self, fence_fd: &FenceFd) -> CLResult<PipeFence>;
|
||||
fn import_fence(&self, fence_fd: &FenceFd, fence_type: pipe_fd_type) -> CLResult<PipeFence>;
|
||||
}
|
||||
|
||||
pub struct HelperContext<'a> {
|
||||
|
|
@ -246,8 +246,10 @@ impl HelperContextWrapper for HelperContext<'_> {
|
|||
self.lock.is_create_fence_fd_supported()
|
||||
}
|
||||
|
||||
fn import_fence(&self, fd: &FenceFd) -> CLResult<PipeFence> {
|
||||
self.lock.import_fence(fd).ok_or(CL_OUT_OF_HOST_MEMORY)
|
||||
fn import_fence(&self, fd: &FenceFd, fence_type: pipe_fd_type) -> CLResult<PipeFence> {
|
||||
self.lock
|
||||
.import_fence(fd, fence_type)
|
||||
.ok_or(CL_OUT_OF_HOST_MEMORY)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use crate::core::util::*;
|
|||
|
||||
use libc_rust_gen::{close, dlsym};
|
||||
use mesa_rust::pipe::context::RWFlags;
|
||||
use mesa_rust_gen::pipe_fd_type;
|
||||
use rusticl_opencl_gen::*;
|
||||
|
||||
use mesa_rust::pipe::fence::*;
|
||||
|
|
@ -285,7 +286,9 @@ impl GLCtxManager {
|
|||
|
||||
if let Some(fence_fd) = self.do_flush(&mut [export_in])? {
|
||||
for dev in &cl_ctx.devs {
|
||||
let fence = dev.helper_ctx().import_fence(&fence_fd)?;
|
||||
let fence = dev
|
||||
.helper_ctx()
|
||||
.import_fence(&fence_fd, pipe_fd_type::PIPE_FD_TYPE_NATIVE_SYNC)?;
|
||||
fence.wait();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ use crate::pipe::resource::*;
|
|||
use crate::pipe::screen::*;
|
||||
use crate::pipe::transfer::*;
|
||||
|
||||
use mesa_rust_gen::pipe_fd_type::*;
|
||||
use mesa_rust_gen::*;
|
||||
use mesa_rust_util::has_required_feature;
|
||||
|
||||
|
|
@ -637,14 +636,14 @@ impl PipeContext {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn import_fence(&self, fence_fd: &FenceFd) -> Option<PipeFence> {
|
||||
pub fn import_fence(&self, fence_fd: &FenceFd, fence_type: pipe_fd_type) -> Option<PipeFence> {
|
||||
unsafe {
|
||||
let mut fence = ptr::null_mut();
|
||||
self.pipe.as_ref().create_fence_fd.unwrap()(
|
||||
self.pipe.as_ptr(),
|
||||
&mut fence,
|
||||
fence_fd.fd,
|
||||
PIPE_FD_TYPE_NATIVE_SYNC,
|
||||
fence_type,
|
||||
);
|
||||
PipeFence::new(fence, &self.screen)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue