Module: Mesa Branch: main Commit: 425d7acd4aabc4558140ec7ec89347de6e62be88 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=425d7acd4aabc4558140ec7ec89347de6e62be88
Author: Antonio Gomes <antoniospg...@gmail.com> Date: Sun Oct 29 00:22:17 2023 -0300 rusticl/device: Enable gl_sharing only if create_fence_fd is implemented Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21305> --- src/gallium/frontends/rusticl/core/device.rs | 7 +++++++ src/gallium/frontends/rusticl/mesa/pipe/context.rs | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/gallium/frontends/rusticl/core/device.rs b/src/gallium/frontends/rusticl/core/device.rs index f0b95766ff1..59ce525886c 100644 --- a/src/gallium/frontends/rusticl/core/device.rs +++ b/src/gallium/frontends/rusticl/core/device.rs @@ -90,6 +90,8 @@ pub trait HelperContextWrapper { fn compute_state_subgroup_size(&self, state: *mut c_void, block: &[u32; 3]) -> u32; fn unmap(&self, tx: PipeTransfer); + + fn is_create_fence_fd_supported(&self) -> bool; } pub struct HelperContext<'a> { @@ -188,6 +190,10 @@ impl<'a> HelperContextWrapper for HelperContext<'a> { fn unmap(&self, tx: PipeTransfer) { tx.with_ctx(&self.lock); } + + fn is_create_fence_fd_supported(&self) -> bool { + self.lock.is_create_fence_fd_supported() + } } impl_cl_type_trait!(cl_device_id, Device, CL_INVALID_DEVICE); @@ -705,6 +711,7 @@ impl Device { && !self.is_device_software() && self.screen.is_res_handle_supported() && self.screen.device_uuid().is_some() + && self.helper_ctx().is_create_fence_fd_supported() } pub fn is_device_software(&self) -> bool { diff --git a/src/gallium/frontends/rusticl/mesa/pipe/context.rs b/src/gallium/frontends/rusticl/mesa/pipe/context.rs index 11472aa4891..75dff224cb7 100644 --- a/src/gallium/frontends/rusticl/mesa/pipe/context.rs +++ b/src/gallium/frontends/rusticl/mesa/pipe/context.rs @@ -342,6 +342,10 @@ impl PipeContext { } } + pub fn is_create_fence_fd_supported(&self) -> bool { + unsafe { self.pipe.as_ref().create_fence_fd.is_some() } + } + pub fn create_sampler_state(&self, state: &pipe_sampler_state) -> *mut c_void { unsafe { self.pipe.as_ref().create_sampler_state.unwrap()(self.pipe.as_ptr(), state) } }