@@ -33,6 +33,9 @@ use crate::mem::paging::VirtAddr;
33
33
use uapi:: drm:: * ;
34
34
35
35
trait DrmDevice : Send + Sync {
36
+ /// Returns weather the DRM device supports creating dumb buffers.
37
+ fn dumb_create ( & self ) -> bool ;
38
+
36
39
/// Returns a tuple containg the driver major, minor and patch level respectively.
37
40
fn driver_version ( & self ) -> ( usize , usize , usize ) ;
38
41
/// Returns a tuple contaning the driver name, desc and date respectively.
@@ -106,6 +109,26 @@ impl INodeInterface for Drm {
106
109
Ok ( 0 )
107
110
}
108
111
112
+ DRM_IOCTL_GET_CAP => {
113
+ let struc = VirtAddr :: new ( arg as u64 ) . read_mut :: < DrmGetCap > ( ) . unwrap ( ) ;
114
+
115
+ // NOTE: The user is responsible for zeroing out the structure.
116
+ match struc. capability {
117
+ DRM_CAP_DUMB_BUFFER => {
118
+ if self . device . dumb_create ( ) {
119
+ struc. value = 1 ;
120
+ }
121
+ }
122
+
123
+ cap => {
124
+ log:: warn!( "drm: unknown capability (`{cap}`)" ) ;
125
+ return Err ( FileSystemError :: NotSupported ) ;
126
+ }
127
+ }
128
+
129
+ Ok ( 0 )
130
+ }
131
+
109
132
_ => {
110
133
// command[8..16] is the ASCII character supposedly unique to each driver.
111
134
if command. get_bits ( 8 ..16 ) == DRM_IOCTL_BASE {
@@ -114,7 +137,7 @@ impl INodeInterface for Drm {
114
137
unimplemented ! ( "drm: function (`{function}`) not supported" )
115
138
}
116
139
117
- log:: warn!( "drm: unknown ioctl (`{command}`) called " ) ;
140
+ log:: warn!( "drm: unknown ioctl command (`{command}`)" ) ;
118
141
Err ( FileSystemError :: NotSupported )
119
142
}
120
143
}
@@ -145,6 +168,10 @@ impl DrmDevice for RawFramebuffer {
145
168
fn driver_info ( & self ) -> ( & ' static str , & ' static str , & ' static str ) {
146
169
( "rawfb_gpu" , "rawfb gpu" , "0" )
147
170
}
171
+
172
+ fn dumb_create ( & self ) -> bool {
173
+ true
174
+ }
148
175
}
149
176
150
177
fn init ( ) {
0 commit comments