Skip to content

Commit c15f5fd

Browse files
drm: initial implementation DRM_IOCTL_MODE_MAP_DUMB
Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
1 parent bf12266 commit c15f5fd

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/aero_kernel/src/drivers/drm/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,16 @@ impl INodeInterface for Drm {
594594
Ok(0)
595595
}
596596

597+
DRM_IOCTL_MODE_MAP_DUMB => {
598+
let struc = VirtAddr::new(arg as u64)
599+
.read_mut::<DrmModeMapDumb>()
600+
.unwrap();
601+
602+
let handle = self.find_handle(struc.handle).unwrap();
603+
struc.offset = handle.mapping as _;
604+
Ok(0)
605+
}
606+
597607
_ => {
598608
// command[8..16] is the ASCII character supposedly unique to each driver.
599609
if command.get_bits(8..16) == DRM_IOCTL_BASE {

src/uapi/src/drm.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,15 @@ pub struct DrmModeCreateDumb {
222222
pub size: u64,
223223
}
224224

225+
#[repr(C)]
226+
pub struct DrmModeMapDumb {
227+
pub handle: u32, // handle for the object being mapped
228+
pub pad: u32,
229+
// Fake offset to use for subsequent mmap call. This is a fixed-size
230+
// type for 32/64 compatibility.
231+
pub offset: u64,
232+
}
233+
225234
// DRM IOCTL constants:
226235
pub const DRM_IOCTL_VERSION: usize = drm_iowr::<DrmVersion>(0x00);
227236
pub const DRM_IOCTL_GET_CAP: usize = drm_iowr::<DrmGetCap>(0x0c);
@@ -232,3 +241,4 @@ pub const DRM_IOCTL_GET_CONNECTOR: usize = drm_iowr::<DrmModeGetConnector>(0xa7)
232241
pub const DRM_IOCTL_MODE_ADDFB: usize = drm_iowr::<DrmModeFbCmd>(0xae);
233242

234243
pub const DRM_IOCTL_MODE_CREATE_DUMB: usize = drm_iowr::<DrmModeCreateDumb>(0xb2);
244+
pub const DRM_IOCTL_MODE_MAP_DUMB: usize = drm_iowr::<DrmModeMapDumb>(0xb3);

0 commit comments

Comments
 (0)