1
0
Fork 0
forked from wry/wry

all: implement hardware cursors

This commit is contained in:
Julian Orth 2022-06-01 21:46:31 +02:00
parent 6cc97ee56e
commit 3b8935cf55
23 changed files with 614 additions and 91 deletions

View file

@ -32,7 +32,11 @@ use {
use crate::{
backend,
utils::{errorfmt::ErrorFmt, stack::Stack, syncqueue::SyncQueue, vec_ext::VecExt},
video::{dmabuf::DmaBuf, INVALID_MODIFIER},
video::{
dmabuf::DmaBuf,
drm::sys::{DRM_CAP_CURSOR_HEIGHT, DRM_CAP_CURSOR_WIDTH},
INVALID_MODIFIER,
},
};
pub use sys::{
drm_mode_modeinfo, DRM_CLIENT_CAP_ATOMIC, DRM_MODE_ATOMIC_ALLOW_MODESET,
@ -235,6 +239,12 @@ impl DrmMaster {
mode_getencoder(self.raw(), encoder.0)
}
pub fn get_cursor_size(&self) -> Result<(u64, u64), OsError> {
let width = self.get_cap(DRM_CAP_CURSOR_WIDTH)?;
let height = self.get_cap(DRM_CAP_CURSOR_HEIGHT)?;
Ok((width, height))
}
pub fn get_connector_info(
&self,
connector: DrmConnector,

View file

@ -217,6 +217,9 @@ const DRM_MODE_PROP_SIGNED_RANGE: u32 = drm_mode_prop_type(2);
const DRM_MODE_PROP_ATOMIC: u32 = 0x80000000;
pub const DRM_CAP_CURSOR_WIDTH: u64 = 0x8;
pub const DRM_CAP_CURSOR_HEIGHT: u64 = 0x9;
#[repr(C)]
struct drm_mode_property_enum {
value: u64,