drm: Support MODE_SET_CRTC, MODE_CURSOR and MODE_CURSOR2
This commit is contained in:
+34
-5
@@ -7,11 +7,11 @@ use core::{
|
||||
|
||||
pub use drm_sys::{
|
||||
__kernel_size_t, DRM_PROP_NAME_LEN, drm_get_cap, drm_mode_card_res,
|
||||
drm_mode_connector_set_property, drm_mode_create_dumb, drm_mode_crtc, drm_mode_destroy_dumb,
|
||||
drm_mode_fb_cmd, drm_mode_fb_cmd2, drm_mode_get_blob, drm_mode_get_connector,
|
||||
drm_mode_get_encoder, drm_mode_get_plane, drm_mode_get_plane_res, drm_mode_get_property,
|
||||
drm_mode_map_dumb, drm_mode_modeinfo, drm_mode_obj_get_properties, drm_mode_property_enum,
|
||||
drm_set_client_cap, drm_version,
|
||||
drm_mode_connector_set_property, drm_mode_create_dumb, drm_mode_crtc, drm_mode_cursor,
|
||||
drm_mode_cursor2, drm_mode_destroy_dumb, drm_mode_fb_cmd, drm_mode_fb_cmd2, drm_mode_get_blob,
|
||||
drm_mode_get_connector, drm_mode_get_encoder, drm_mode_get_plane, drm_mode_get_plane_res,
|
||||
drm_mode_get_property, drm_mode_map_dumb, drm_mode_modeinfo, drm_mode_obj_get_properties,
|
||||
drm_mode_property_enum, drm_set_client_cap, drm_version,
|
||||
};
|
||||
|
||||
pub const VERSION: u64 = 0;
|
||||
@@ -66,6 +66,7 @@ define_ioctl_data! {
|
||||
}
|
||||
|
||||
pub const MODE_GET_CRTC: u64 = 0xA1;
|
||||
pub const MODE_SET_CRTC: u64 = 0xA2;
|
||||
define_ioctl_data! {
|
||||
struct drm_mode_crtc, DrmModeCrtc {
|
||||
set_connectors_ptr: u64 [array<u32, count_connectors>],
|
||||
@@ -80,6 +81,19 @@ define_ioctl_data! {
|
||||
}
|
||||
}
|
||||
|
||||
pub const MODE_CURSOR: u64 = 0xA3;
|
||||
define_ioctl_data! {
|
||||
struct drm_mode_cursor, DrmModeCursor {
|
||||
flags: u32,
|
||||
crtc_id: u32,
|
||||
x: i32,
|
||||
y:i32,
|
||||
width:u32,
|
||||
height:u32,
|
||||
handle:u32,
|
||||
}
|
||||
}
|
||||
|
||||
pub const MODE_GET_ENCODER: u64 = 0xA6;
|
||||
define_ioctl_data! {
|
||||
struct drm_mode_get_encoder, DrmModeGetEncoder {
|
||||
@@ -232,6 +246,21 @@ define_ioctl_data! {
|
||||
}
|
||||
}
|
||||
|
||||
pub const MODE_CURSOR2: u64 = 0xBB;
|
||||
define_ioctl_data! {
|
||||
struct drm_mode_cursor2, DrmModeCursor2 {
|
||||
flags: u32,
|
||||
crtc_id: u32,
|
||||
x: i32,
|
||||
y: i32,
|
||||
width: u32,
|
||||
height: u32,
|
||||
handle: u32,
|
||||
hot_x: i32,
|
||||
hot_y: i32,
|
||||
}
|
||||
}
|
||||
|
||||
pub const MODE_GET_FB2: u64 = 0xCE;
|
||||
define_ioctl_data! {
|
||||
struct drm_mode_fb_cmd2, DrmModeFbCmd2 {
|
||||
|
||||
@@ -95,6 +95,8 @@ pub(super) unsafe fn ioctl(fd: c_int, func: u8, buf: IoctlBuffer) -> Result<c_in
|
||||
0x0D => unsafe { dev.write_ioctl::<drm_set_client_cap>(buf, SET_CLIENT_CAP) },
|
||||
0xA0 => unsafe { dev.read_write_ioctl::<drm_mode_card_res>(buf, MODE_CARD_RES) },
|
||||
0xA1 => unsafe { dev.read_write_ioctl::<drm_mode_crtc>(buf, MODE_GET_CRTC) },
|
||||
0xA2 => unsafe { dev.read_write_ioctl::<drm_mode_crtc>(buf, MODE_SET_CRTC) },
|
||||
0xA3 => unsafe { dev.write_ioctl::<drm_mode_cursor>(buf, MODE_CURSOR) },
|
||||
0xA6 => unsafe { dev.read_write_ioctl::<drm_mode_get_encoder>(buf, MODE_GET_ENCODER) },
|
||||
0xA7 => unsafe { dev.read_write_ioctl::<drm_mode_get_connector>(buf, MODE_GET_CONNECTOR) },
|
||||
0xAA => unsafe { dev.read_write_ioctl::<drm_mode_get_property>(buf, MODE_GET_PROPERTY) },
|
||||
@@ -113,6 +115,7 @@ pub(super) unsafe fn ioctl(fd: c_int, func: u8, buf: IoctlBuffer) -> Result<c_in
|
||||
0xB9 => unsafe {
|
||||
dev.read_write_ioctl::<drm_mode_obj_get_properties>(buf, MODE_OBJ_GET_PROPERTIES)
|
||||
},
|
||||
0xBB => unsafe { dev.write_ioctl::<drm_mode_cursor2>(buf, MODE_CURSOR2) },
|
||||
0xCE => unsafe { dev.read_write_ioctl::<drm_mode_fb_cmd2>(buf, MODE_GET_FB2) },
|
||||
_ => {
|
||||
todo_skip!(
|
||||
|
||||
Reference in New Issue
Block a user