Merge branch 'drm7' into 'master'
Support dumb buffer drm ioctls See merge request redox-os/relibc!816
This commit is contained in:
+33
-4
@@ -6,10 +6,10 @@ use core::{
|
||||
};
|
||||
|
||||
pub use drm_sys::{
|
||||
__kernel_size_t, drm_get_cap, drm_mode_card_res, drm_mode_crtc, drm_mode_fb_cmd,
|
||||
drm_mode_fb_cmd2, drm_mode_get_connector, drm_mode_get_encoder, drm_mode_get_plane,
|
||||
drm_mode_get_plane_res, drm_mode_modeinfo, drm_mode_obj_get_properties, drm_set_client_cap,
|
||||
drm_version,
|
||||
__kernel_size_t, drm_get_cap, drm_mode_card_res, drm_mode_create_dumb, drm_mode_crtc,
|
||||
drm_mode_destroy_dumb, drm_mode_fb_cmd, drm_mode_fb_cmd2, drm_mode_get_connector,
|
||||
drm_mode_get_encoder, drm_mode_get_plane, drm_mode_get_plane_res, drm_mode_map_dumb,
|
||||
drm_mode_modeinfo, drm_mode_obj_get_properties, drm_set_client_cap, drm_version,
|
||||
};
|
||||
|
||||
pub const VERSION: u64 = 0;
|
||||
@@ -124,6 +124,35 @@ define_ioctl_data! {
|
||||
}
|
||||
}
|
||||
|
||||
pub const MODE_CREATE_DUMB: u64 = 0xB2;
|
||||
define_ioctl_data! {
|
||||
struct drm_mode_create_dumb, DrmModeCreateDumb {
|
||||
height: u32,
|
||||
width: u32,
|
||||
bpp: u32,
|
||||
flags: u32,
|
||||
handle: u32,
|
||||
pitch: u32,
|
||||
size: u64,
|
||||
}
|
||||
}
|
||||
|
||||
pub const MODE_MAP_DUMB: u64 = 0xB3;
|
||||
define_ioctl_data! {
|
||||
struct drm_mode_map_dumb, DrmModeMapDumb {
|
||||
handle: u32,
|
||||
pad: u32,
|
||||
offset: u64,
|
||||
}
|
||||
}
|
||||
|
||||
pub const MODE_DESTROY_DUMB: u64 = 0xB4;
|
||||
define_ioctl_data! {
|
||||
struct drm_mode_destroy_dumb, DrmModeDestroyDumb {
|
||||
handle: u32,
|
||||
}
|
||||
}
|
||||
|
||||
pub const MODE_GET_PLANE_RES: u64 = 0xB5;
|
||||
define_ioctl_data! {
|
||||
struct drm_mode_get_plane_res, DrmModeGetPlaneRes {
|
||||
|
||||
@@ -56,16 +56,6 @@ impl Dev {
|
||||
Ok(Self { fd })
|
||||
}
|
||||
|
||||
unsafe fn call<T>(&self, payload: &mut T, func: u64) -> syscall::Result<usize> {
|
||||
let bytes = slice::from_raw_parts_mut(payload as *mut T as *mut u8, size_of::<T>());
|
||||
redox_rt::sys::sys_call(
|
||||
self.fd as usize,
|
||||
bytes,
|
||||
syscall::CallFlags::empty(),
|
||||
&[func],
|
||||
)
|
||||
}
|
||||
|
||||
unsafe fn read_write_ioctl<T: IoctlData>(
|
||||
&self,
|
||||
mut buf: IoctlBuffer,
|
||||
@@ -108,6 +98,9 @@ pub(super) unsafe fn ioctl(fd: c_int, func: u8, buf: IoctlBuffer) -> Result<c_in
|
||||
0xA6 => dev.read_write_ioctl::<drm_mode_get_encoder>(buf, MODE_GET_ENCODER),
|
||||
0xA7 => dev.read_write_ioctl::<drm_mode_get_connector>(buf, MODE_GET_CONNECTOR),
|
||||
0xAD => dev.read_write_ioctl::<drm_mode_fb_cmd>(buf, MODE_GET_FB),
|
||||
0xB2 => dev.read_write_ioctl::<drm_mode_create_dumb>(buf, MODE_CREATE_DUMB),
|
||||
0xB3 => dev.read_write_ioctl::<drm_mode_map_dumb>(buf, MODE_MAP_DUMB),
|
||||
0xB4 => dev.read_write_ioctl::<drm_mode_destroy_dumb>(buf, MODE_DESTROY_DUMB),
|
||||
0xB5 => dev.read_write_ioctl::<drm_mode_get_plane_res>(buf, MODE_GET_PLANE_RES),
|
||||
0xB6 => dev.read_write_ioctl::<drm_mode_get_plane>(buf, MODE_GET_PLANE),
|
||||
0xB9 => dev.read_write_ioctl::<drm_mode_obj_get_properties>(buf, MODE_OBJ_GET_PROPERTIES),
|
||||
|
||||
Reference in New Issue
Block a user