mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 18:18:06 +02:00
rusticl/screen: implement uuid wrapper funcs
Reviewed-by: Karol Herbst <kherbst@redhat.com> Tested-by: Andrey Alekseenko <al42and@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23147>
This commit is contained in:
parent
c06a18ad9a
commit
536283555e
1 changed files with 37 additions and 0 deletions
|
|
@ -11,6 +11,8 @@ use mesa_rust_util::string::*;
|
|||
use std::convert::TryInto;
|
||||
use std::ffi::CStr;
|
||||
use std::mem::size_of;
|
||||
use std::os::raw::c_char;
|
||||
use std::os::raw::c_uchar;
|
||||
use std::os::raw::c_void;
|
||||
use std::ptr;
|
||||
use std::sync::Arc;
|
||||
|
|
@ -21,6 +23,9 @@ pub struct PipeScreen {
|
|||
screen: *mut pipe_screen,
|
||||
}
|
||||
|
||||
const UUID_SIZE: usize = PIPE_UUID_SIZE as usize;
|
||||
const LUID_SIZE: usize = PIPE_LUID_SIZE as usize;
|
||||
|
||||
// until we have a better solution
|
||||
pub trait ComputeParam<T> {
|
||||
fn compute_param(&self, cap: pipe_compute_cap) -> T;
|
||||
|
|
@ -229,6 +234,28 @@ impl PipeScreen {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn device_node_mask(&self) -> Option<u32> {
|
||||
unsafe { Some((*self.screen).get_device_node_mask?(self.screen)) }
|
||||
}
|
||||
|
||||
pub fn device_uuid(&self) -> Option<[c_uchar; UUID_SIZE]> {
|
||||
let mut uuid = [0; UUID_SIZE];
|
||||
let ptr = uuid.as_mut_ptr();
|
||||
unsafe {
|
||||
(*self.screen).get_device_uuid?(self.screen, ptr.cast());
|
||||
}
|
||||
|
||||
Some(uuid)
|
||||
}
|
||||
|
||||
pub fn device_luid(&self) -> Option<[c_uchar; LUID_SIZE]> {
|
||||
let mut luid = [0; LUID_SIZE];
|
||||
let ptr = luid.as_mut_ptr();
|
||||
unsafe { (*self.screen).get_device_luid?(self.screen, ptr.cast()) }
|
||||
|
||||
Some(luid)
|
||||
}
|
||||
|
||||
pub fn device_vendor(&self) -> String {
|
||||
unsafe {
|
||||
let s = *self.screen;
|
||||
|
|
@ -240,6 +267,16 @@ impl PipeScreen {
|
|||
unsafe { *self.ldev.ldev }.type_
|
||||
}
|
||||
|
||||
pub fn driver_uuid(&self) -> Option<[c_char; UUID_SIZE]> {
|
||||
let mut uuid = [0; UUID_SIZE];
|
||||
let ptr = uuid.as_mut_ptr();
|
||||
unsafe {
|
||||
(*self.screen).get_driver_uuid?(self.screen, ptr.cast());
|
||||
}
|
||||
|
||||
Some(uuid)
|
||||
}
|
||||
|
||||
pub fn cl_cts_version(&self) -> &CStr {
|
||||
unsafe {
|
||||
let s = *self.screen;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue