metal: add support for render-only devices
This commit is contained in:
parent
17e434ba34
commit
3d60cfc5dc
3 changed files with 78 additions and 57 deletions
|
|
@ -17,7 +17,11 @@ use {
|
|||
ffi::CString,
|
||||
io::{BufRead, BufReader},
|
||||
},
|
||||
uapi::{OwnedFd, Pod, Ustring, c, pod_zeroed},
|
||||
uapi::{
|
||||
OwnedFd, Pod, Ustring,
|
||||
c::{self, c_int},
|
||||
pod_zeroed,
|
||||
},
|
||||
};
|
||||
|
||||
pub unsafe fn ioctl<T>(fd: c::c_int, request: c::c_ulong, t: &mut T) -> Result<c::c_int, OsError> {
|
||||
|
|
@ -546,10 +550,10 @@ pub fn mode_get_resources(fd: c::c_int) -> Result<DrmCardResources, DrmError> {
|
|||
}
|
||||
|
||||
Ok(DrmCardResources {
|
||||
min_width: res.min_width,
|
||||
max_width: res.max_width,
|
||||
min_height: res.min_height,
|
||||
max_height: res.max_height,
|
||||
_min_width: res.min_width,
|
||||
_max_width: res.max_width,
|
||||
_min_height: res.min_height,
|
||||
_max_height: res.max_height,
|
||||
_fbs: fbs,
|
||||
crtcs,
|
||||
connectors,
|
||||
|
|
@ -557,6 +561,16 @@ pub fn mode_get_resources(fd: c::c_int) -> Result<DrmCardResources, DrmError> {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn mode_supports_get_resources(fd: c_int) -> Result<bool, DrmError> {
|
||||
let mut res = drm_mode_card_res::default();
|
||||
let res = unsafe { ioctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &mut res) };
|
||||
match res {
|
||||
Ok(_) => Ok(true),
|
||||
Err(e) if e.0 == c::EOPNOTSUPP => Ok(false),
|
||||
Err(e) => Err(DrmError::GetResources(e)),
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
struct drm_mode_get_plane_res {
|
||||
plane_id_ptr: u64,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue