rusticl/device: Enable gl_sharing only if create_fence_fd is implemented

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21305>
This commit is contained in:
Antonio Gomes 2023-10-29 00:22:17 -03:00 committed by Marge Bot
parent 7bb131964b
commit 425d7acd4a
2 changed files with 11 additions and 0 deletions

View file

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

View file

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