github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/dev_dri.txt (about) 1 # Copyright 2015 syzkaller project authors. All rights reserved. 2 # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 3 4 include <uapi/asm/ioctl.h> 5 include <uapi/linux/fcntl.h> 6 include <uapi/drm/drm.h> 7 include <uapi/drm/drm_mode.h> 8 include <uapi/drm/drm_fourcc.h> 9 include <linux/agp_backend.h> 10 11 resource fd_dri[fd] 12 resource drmctx[int32] 13 resource drm_agp_handle[intptr] 14 resource drm_gem_handle[int32] 15 resource drm_gem_name[int32] 16 resource drm_obj_id[int32] 17 resource drm_crtc_id[drm_obj_id] 18 resource drm_connector_id[drm_obj_id] 19 resource drm_fb_id[drm_obj_id] 20 21 syz_open_dev$dri(dev ptr[in, string["/dev/dri/card#"]], id intptr, flags flags[open_flags]) fd_dri 22 syz_open_dev$dricontrol(dev ptr[in, string["/dev/dri/controlD#"]], id intptr, flags flags[open_flags]) fd_dri 23 syz_open_dev$drirender(dev ptr[in, string["/dev/dri/renderD#"]], id intptr, flags flags[open_flags]) fd_dri 24 openat$drirender128(fd const[AT_FDCWD], file ptr[in, string["/dev/dri/renderD128"]], flags flags[open_flags], mode const[0]) fd_dri 25 26 ioctl$DRM_IOCTL_VERSION(fd fd_dri, cmd const[DRM_IOCTL_VERSION], arg ptr[inout, drm_version]) 27 ioctl$DRM_IOCTL_GET_UNIQUE(fd fd_dri, cmd const[DRM_IOCTL_GET_UNIQUE], arg ptr[in, drm_unique$out]) 28 ioctl$DRM_IOCTL_GET_MAGIC(fd fd_dri, cmd const[DRM_IOCTL_GET_MAGIC], arg ptr[in, int32]) 29 ioctl$DRM_IOCTL_IRQ_BUSID(fd fd_dri, cmd const[DRM_IOCTL_IRQ_BUSID], arg ptr[inout, drm_irq_busid]) 30 ioctl$DRM_IOCTL_GET_MAP(fd fd_dri, cmd const[DRM_IOCTL_GET_MAP], arg ptr[inout, drm_map$DRM_IOCTL_GET_MAP]) 31 ioctl$DRM_IOCTL_GET_CLIENT(fd fd_dri, cmd const[DRM_IOCTL_GET_CLIENT], arg ptr[inout, drm_client]) 32 ioctl$DRM_IOCTL_GET_STATS(fd fd_dri, cmd const[DRM_IOCTL_GET_STATS], arg buffer[out]) 33 ioctl$DRM_IOCTL_GET_CAP(fd fd_dri, cmd const[DRM_IOCTL_GET_CAP], arg ptr[in, drm_get_cap]) 34 ioctl$DRM_IOCTL_SET_CLIENT_CAP(fd fd_dri, cmd const[DRM_IOCTL_SET_CLIENT_CAP], arg ptr[in, drm_get_cap]) 35 ioctl$DRM_IOCTL_SET_VERSION(fd fd_dri, cmd const[DRM_IOCTL_SET_VERSION], arg ptr[in, drm_set_version]) 36 ioctl$DRM_IOCTL_SET_UNIQUE(fd fd_dri, cmd const[DRM_IOCTL_SET_UNIQUE], arg ptr[in, drm_unique$in]) 37 ioctl$DRM_IOCTL_AUTH_MAGIC(fd fd_dri, cmd const[DRM_IOCTL_AUTH_MAGIC], arg ptr[in, int32]) 38 ioctl$DRM_IOCTL_ADD_MAP(fd fd_dri, cmd const[DRM_IOCTL_ADD_MAP], arg ptr[inout, drm_map$DRM_IOCTL_ADD_MAP]) 39 ioctl$DRM_IOCTL_RM_MAP(fd fd_dri, cmd const[DRM_IOCTL_RM_MAP], arg ptr[in, drm_map$DRM_IOCTL_RM_MAP]) 40 ioctl$DRM_IOCTL_SET_SAREA_CTX(fd fd_dri, cmd const[DRM_IOCTL_SET_SAREA_CTX], arg ptr[in, drm_ctx_priv_map]) 41 ioctl$DRM_IOCTL_GET_SAREA_CTX(fd fd_dri, cmd const[DRM_IOCTL_GET_SAREA_CTX], arg ptr[in, drm_ctx_priv_map]) 42 ioctl$DRM_IOCTL_SET_MASTER(fd fd_dri, cmd const[DRM_IOCTL_SET_MASTER]) 43 ioctl$DRM_IOCTL_DROP_MASTER(fd fd_dri, cmd const[DRM_IOCTL_DROP_MASTER]) 44 ioctl$DRM_IOCTL_ADD_CTX(fd fd_dri, cmd const[DRM_IOCTL_ADD_CTX], arg ptr[out, drm_ctx]) 45 ioctl$DRM_IOCTL_RM_CTX(fd fd_dri, cmd const[DRM_IOCTL_RM_CTX], arg ptr[in, drm_ctx]) 46 ioctl$DRM_IOCTL_GET_CTX(fd fd_dri, cmd const[DRM_IOCTL_GET_CTX], arg ptr[in, drm_ctx]) 47 ioctl$DRM_IOCTL_SWITCH_CTX(fd fd_dri, cmd const[DRM_IOCTL_SWITCH_CTX], arg ptr[in, drm_ctx]) 48 ioctl$DRM_IOCTL_NEW_CTX(fd fd_dri, cmd const[DRM_IOCTL_NEW_CTX], arg ptr[in, drm_ctx]) 49 ioctl$DRM_IOCTL_RES_CTX(fd fd_dri, cmd const[DRM_IOCTL_RES_CTX], arg ptr[in, drm_ctx_res]) 50 ioctl$DRM_IOCTL_LOCK(fd fd_dri, cmd const[DRM_IOCTL_LOCK], arg ptr[in, drm_lock]) 51 ioctl$DRM_IOCTL_UNLOCK(fd fd_dri, cmd const[DRM_IOCTL_UNLOCK], arg ptr[in, drm_lock]) 52 ioctl$DRM_IOCTL_ADD_BUFS(fd fd_dri, cmd const[DRM_IOCTL_ADD_BUFS], arg ptr[in, drm_buf_desc]) 53 ioctl$DRM_IOCTL_MARK_BUFS(fd fd_dri, cmd const[DRM_IOCTL_MARK_BUFS], arg ptr[in, drm_buf_desc]) 54 ioctl$DRM_IOCTL_INFO_BUFS(fd fd_dri, cmd const[DRM_IOCTL_INFO_BUFS], arg ptr[in, drm_buf_desc]) 55 ioctl$DRM_IOCTL_MAP_BUFS(fd fd_dri, cmd const[DRM_IOCTL_MAP_BUFS], arg ptr[in, drm_buf_map]) 56 ioctl$DRM_IOCTL_FREE_BUFS(fd fd_dri, cmd const[DRM_IOCTL_FREE_BUFS], arg ptr[in, drm_buf_free]) 57 ioctl$DRM_IOCTL_DMA(fd fd_dri, cmd const[DRM_IOCTL_DMA], arg ptr[in, drm_dma]) 58 ioctl$DRM_IOCTL_CONTROL(fd fd_dri, cmd const[DRM_IOCTL_CONTROL], arg ptr[in, drm_control]) 59 ioctl$DRM_IOCTL_AGP_ACQUIRE(fd fd_dri, cmd const[DRM_IOCTL_AGP_ACQUIRE]) 60 ioctl$DRM_IOCTL_AGP_RELEASE(fd fd_dri, cmd const[DRM_IOCTL_AGP_RELEASE]) 61 ioctl$DRM_IOCTL_AGP_ENABLE(fd fd_dri, cmd const[DRM_IOCTL_AGP_ENABLE], arg ptr[in, int32]) 62 ioctl$DRM_IOCTL_AGP_INFO(fd fd_dri, cmd const[DRM_IOCTL_AGP_INFO], arg buffer[out]) 63 ioctl$DRM_IOCTL_AGP_ALLOC(fd fd_dri, cmd const[DRM_IOCTL_AGP_ALLOC], arg ptr[inout, drm_agp_buffer$DRM_IOCTL_AGP_ALLOC]) 64 ioctl$DRM_IOCTL_AGP_FREE(fd fd_dri, cmd const[DRM_IOCTL_AGP_FREE], arg ptr[in, drm_agp_buffer$DRM_IOCTL_AGP_FREE]) 65 ioctl$DRM_IOCTL_AGP_BIND(fd fd_dri, cmd const[DRM_IOCTL_AGP_BIND], arg ptr[in, drm_agp_binding]) 66 ioctl$DRM_IOCTL_AGP_UNBIND(fd fd_dri, cmd const[DRM_IOCTL_AGP_UNBIND], arg ptr[in, drm_agp_binding]) 67 ioctl$DRM_IOCTL_SG_ALLOC(fd fd_dri, cmd const[DRM_IOCTL_SG_ALLOC], arg ptr[in, drm_scatter_gather]) 68 ioctl$DRM_IOCTL_SG_FREE(fd fd_dri, cmd const[DRM_IOCTL_SG_FREE], arg ptr[in, drm_scatter_gather]) 69 ioctl$DRM_IOCTL_WAIT_VBLANK(fd fd_dri, cmd const[DRM_IOCTL_WAIT_VBLANK], arg ptr[in, drm_wait_vblank_request]) 70 ioctl$DRM_IOCTL_MODESET_CTL(fd fd_dri, cmd const[DRM_IOCTL_MODESET_CTL], arg ptr[in, drm_modeset_ctl]) 71 ioctl$DRM_IOCTL_GEM_OPEN(fd fd_dri, cmd const[DRM_IOCTL_GEM_OPEN], arg ptr[inout, drm_gem_open]) 72 ioctl$DRM_IOCTL_GEM_CLOSE(fd fd_dri, cmd const[DRM_IOCTL_GEM_CLOSE], arg ptr[in, drm_gem_close]) 73 ioctl$DRM_IOCTL_GEM_FLINK(fd fd_dri, cmd const[DRM_IOCTL_GEM_FLINK], arg ptr[inout, drm_gem_flink]) 74 ioctl$DRM_IOCTL_MODE_GETRESOURCES(fd fd_dri, cmd const[DRM_IOCTL_MODE_GETRESOURCES], arg ptr[inout, drm_mode_card_res]) 75 ioctl$DRM_IOCTL_PRIME_HANDLE_TO_FD(fd fd_dri, cmd const[DRM_IOCTL_PRIME_HANDLE_TO_FD], arg ptr[inout, drm_prime_handle$DRM_IOCTL_PRIME_HANDLE_TO_FD]) 76 ioctl$DRM_IOCTL_PRIME_FD_TO_HANDLE(fd fd_dri, cmd const[DRM_IOCTL_PRIME_FD_TO_HANDLE], arg ptr[inout, drm_prime_handle$DRM_IOCTL_PRIME_FD_TO_HANDLE]) 77 ioctl$DRM_IOCTL_MODE_GETPLANERESOURCES(fd fd_dri, cmd const[DRM_IOCTL_MODE_GETPLANERESOURCES], arg ptr[inout, drm_mode_get_plane_res]) 78 ioctl$DRM_IOCTL_MODE_GETCRTC(fd fd_dri, cmd const[DRM_IOCTL_MODE_GETCRTC], arg ptr[inout, drm_mode_crtc$DRM_IOCTL_MODE_GETCRTC]) 79 ioctl$DRM_IOCTL_MODE_SETCRTC(fd fd_dri, cmd const[DRM_IOCTL_MODE_SETCRTC], arg ptr[in, drm_mode_crtc$DRM_IOCTL_MODE_SETCRTC]) 80 81 ioctl$DRM_IOCTL_MODE_GETPLANE(fd fd_dri, cmd const[DRM_IOCTL_MODE_GETPLANE], arg ptr[inout, drm_mode_get_plane]) 82 ioctl$DRM_IOCTL_MODE_SETPLANE(fd fd_dri, cmd const[DRM_IOCTL_MODE_SETPLANE], arg ptr[in, drm_mode_set_plane]) 83 84 resource drm_plane_id[drm_obj_id] 85 86 drm_mode_get_plane_res { 87 ids ptr64[out, array[drm_plane_id]] 88 cnt len[ids, int32] 89 } 90 91 drm_mode_get_plane { 92 plane_id drm_plane_id (in) 93 # These are outputs: 94 crtc_id drm_crtc_id 95 fb_id drm_fb_id 96 possible_crtcs const[0, int32] 97 gamma_size const[0, int32] 98 count_format_types len[format_type_ptr, int32] 99 format_type_ptr ptr64[out, array[int32]] 100 } 101 102 drm_mode_set_plane { 103 plane_id drm_plane_id 104 crtc_id drm_crtc_id 105 fb_id drm_fb_id 106 flags int32 107 crtc_x int32 108 crtc_y int32 109 crtc_w int32 110 crtc_h int32 111 src_x int32 112 src_y int32 113 src_h int32 114 src_w int32 115 } 116 117 ioctl$DRM_IOCTL_MODE_CURSOR(fd fd_dri, cmd const[DRM_IOCTL_MODE_CURSOR], arg ptr[in, drm_mode_cursor]) 118 ioctl$DRM_IOCTL_MODE_CURSOR2(fd fd_dri, cmd const[DRM_IOCTL_MODE_CURSOR2], arg ptr[in, drm_mode_cursor2]) 119 120 drm_mode_cursor { 121 flags flags[drm_mode_cursor_flags, int32] 122 crtc_id drm_crtc_id 123 x int32 124 y int32 125 width int32 126 height int32 127 handle int32 128 } 129 130 drm_mode_cursor2 { 131 flags flags[drm_mode_cursor_flags, int32] 132 crtc_id drm_crtc_id 133 x int32 134 y int32 135 width int32 136 height int32 137 handle int32 138 hot_x int32 139 hot_y int32 140 } 141 142 drm_mode_cursor_flags = DRM_MODE_CURSOR_BO, DRM_MODE_CURSOR_MOVE 143 144 ioctl$DRM_IOCTL_MODE_GETGAMMA(fd fd_dri, cmd const[DRM_IOCTL_MODE_GETGAMMA], arg ptr[in, drm_mode_crtc_lut]) 145 ioctl$DRM_IOCTL_MODE_SETGAMMA(fd fd_dri, cmd const[DRM_IOCTL_MODE_SETGAMMA], arg ptr[in, drm_mode_crtc_lut]) 146 147 drm_mode_crtc_lut { 148 crtc_id drm_crtc_id 149 # gamma_size needs to be equal to gamma_size passed to DRM_IOCTL_MODE_SETCRTC. 150 gamma_size len[red, int32] 151 red ptr64[in, array[int16]] 152 # NEED: these should be of the same size as red. 153 green ptr64[in, array[int16]] 154 blue ptr64[in, array[int16]] 155 } 156 157 ioctl$DRM_IOCTL_MODE_GETENCODER(fd fd_dri, cmd const[DRM_IOCTL_MODE_GETENCODER], arg ptr[inout, drm_mode_get_encoder]) 158 159 resource drm_encoder_id[drm_obj_id] 160 161 drm_mode_get_encoder { 162 encoder_id drm_encoder_id (in) 163 # Outputs: 164 encoder_type const[0, int32] 165 crtc_id drm_crtc_id (out) 166 possible_crtcs const[0, int32] 167 possible_clones const[0, int32] 168 } 169 170 ioctl$DRM_IOCTL_MODE_GETCONNECTOR(fd fd_dri, cmd const[DRM_IOCTL_MODE_GETCONNECTOR], arg ptr[inout, drm_mode_get_connector]) 171 172 resource drm_prop_id[drm_obj_id] 173 174 drm_mode_get_connector { 175 # Everything except for connector_id are outputs. 176 encoders_ptr ptr64[out, array[drm_encoder_id]] 177 modes_ptr ptr64[out, array[drm_mode_modeinfo]] 178 props_ptr ptr64[out, array[drm_prop_id]] 179 prop_values_ptr ptr64[out, array[int64]] 180 count_modes len[modes_ptr, int32] 181 count_props len[props_ptr, int32] 182 count_encoders len[encoders_ptr, int32] 183 encoder_id drm_encoder_id (out) 184 connector_id drm_connector_id (in) 185 connector_type const[0, int32] 186 connector_type_id const[0, int32] 187 connection const[0, int32] 188 mm_width const[0, int32] 189 mm_height const[0, int32] 190 subpixel const[0, int32] 191 pad const[0, int32] 192 } 193 194 ioctl$DRM_IOCTL_MODE_GETPROPERTY(fd fd_dri, cmd const[DRM_IOCTL_MODE_GETPROPERTY], arg ptr[inout, drm_mode_get_property]) 195 ioctl$DRM_IOCTL_MODE_SETPROPERTY(fd fd_dri, cmd const[DRM_IOCTL_MODE_SETPROPERTY], arg ptr[in, drm_mode_connector_set_property]) 196 ioctl$DRM_IOCTL_MODE_GETPROPBLOB(fd fd_dri, cmd const[DRM_IOCTL_MODE_GETPROPBLOB], arg ptr[in, drm_mode_get_blob]) 197 ioctl$DRM_IOCTL_MODE_OBJ_GETPROPERTIES(fd fd_dri, cmd const[DRM_IOCTL_MODE_OBJ_GETPROPERTIES], arg ptr[inout, drm_mode_obj_get_properties]) 198 ioctl$DRM_IOCTL_MODE_OBJ_SETPROPERTY(fd fd_dri, cmd const[DRM_IOCTL_MODE_OBJ_SETPROPERTY], arg ptr[in, drm_mode_obj_set_property]) 199 ioctl$DRM_IOCTL_MODE_CREATEPROPBLOB(fd fd_dri, cmd const[DRM_IOCTL_MODE_CREATEPROPBLOB], arg ptr[inout, drm_mode_create_blob]) 200 ioctl$DRM_IOCTL_MODE_DESTROYPROPBLOB(fd fd_dri, cmd const[DRM_IOCTL_MODE_DESTROYPROPBLOB], arg ptr[in, drm_mode_destroy_blob]) 201 202 drm_mode_get_property { 203 values_ptr ptr64[out, array[int64]] 204 enum_blob_ptr ptr64[out, array[drm_mode_property_enum]] 205 prop_id drm_prop_id (in) 206 flags const[0, int32] 207 name array[const[0, int8], DRM_PROP_NAME_LEN] 208 count_values len[values_ptr, int32] 209 count_enum_blobs len[enum_blob_ptr, int32] 210 } 211 212 drm_mode_property_enum { 213 value int64 214 name array[const[0, int8], DRM_PROP_NAME_LEN] 215 } 216 217 drm_mode_connector_set_property { 218 value int64 219 prop_id drm_prop_id 220 connector_id drm_connector_id 221 } 222 223 drm_mode_obj_set_property { 224 value int64 225 prop_id drm_prop_id 226 obj_id drm_obj_id 227 obj_type flags[drm_obj_type, int32] 228 } 229 230 drm_obj_type = DRM_MODE_OBJECT_CRTC, DRM_MODE_OBJECT_CONNECTOR, DRM_MODE_OBJECT_ENCODER, DRM_MODE_OBJECT_MODE, DRM_MODE_OBJECT_PROPERTY, DRM_MODE_OBJECT_FB, DRM_MODE_OBJECT_BLOB, DRM_MODE_OBJECT_PLANE, DRM_MODE_OBJECT_ANY 231 232 drm_mode_obj_get_properties { 233 props_ptr ptr64[out, array[drm_prop_id]] 234 # NEED: this should be the same size as props_ptr. 235 prop_values_ptr ptr64[out, array[int64]] 236 count_props len[props_ptr, int32] 237 obj_id drm_obj_id (in) 238 obj_type flags[drm_obj_type, int32] 239 } 240 241 resource drm_blob_id[drm_obj_id] 242 243 drm_mode_get_blob { 244 blob_id drm_blob_id 245 length len[data, int32] 246 data ptr64[out, array[int8]] 247 } 248 249 drm_mode_create_blob { 250 data ptr64[in, array[int8]] 251 length len[data, int32] 252 blob_id drm_blob_id (out) 253 } 254 255 drm_mode_destroy_blob { 256 blob_id drm_blob_id 257 } 258 259 ioctl$DRM_IOCTL_MODE_GETFB(fd fd_dri, cmd const[DRM_IOCTL_MODE_GETFB], arg ptr[inout, drm_mode_fb_cmd$DRM_IOCTL_MODE_GETFB]) 260 ioctl$DRM_IOCTL_MODE_ADDFB(fd fd_dri, cmd const[DRM_IOCTL_MODE_ADDFB], arg ptr[in, drm_mode_fb_cmd$DRM_IOCTL_MODE_ADDFB]) 261 ioctl$DRM_IOCTL_MODE_GETFB2(fd fd_dri, cmd const[DRM_IOCTL_MODE_GETFB2], arg ptr[inout, drm_mode_fb_cmd2$DRM_IOCTL_MODE_GETFB2]) 262 ioctl$DRM_IOCTL_MODE_ADDFB2(fd fd_dri, cmd const[DRM_IOCTL_MODE_ADDFB2], arg ptr[in, drm_mode_fb_cmd2$DRM_IOCTL_MODE_ADDFB2]) 263 264 drm_mode_fb_cmd$DRM_IOCTL_MODE_GETFB { 265 fb_id drm_fb_id (in) 266 width int32 (out) 267 height int32 (out) 268 pitch int32 (out) 269 bpp int32 (out) 270 depth int32 (out) 271 handle int32 (out) 272 } 273 274 drm_mode_fb_cmd$DRM_IOCTL_MODE_ADDFB { 275 fb_id drm_fb_id 276 width int32 277 height int32 278 pitch int32 279 bpp int32 280 depth int32 281 handle int32 282 } 283 284 drm_mode_fb_cmd2$DRM_IOCTL_MODE_GETFB2 { 285 fb_id drm_fb_id (in) 286 width int32 287 height int32 288 pixel_format int32 289 flags flags[drm_mode_fb_flags, int32] 290 handles array[drm_gem_handle, 4] (out) 291 pitches array[int32, 4] 292 offsets array[int32, 4] 293 modifier array[int64, 4] 294 } 295 296 drm_mode_fb_cmd2$DRM_IOCTL_MODE_ADDFB2 { 297 fb_id drm_fb_id 298 width int32 299 height int32 300 pixel_format int32 301 flags flags[drm_mode_fb_flags, int32] 302 handles array[drm_gem_handle, 4] 303 pitches array[int32, 4] 304 offsets array[int32, 4] 305 modifier array[int64, 4] 306 } 307 308 drm_mode_fb_flags = DRM_MODE_FB_INTERLACED, DRM_MODE_FB_MODIFIERS 309 310 ioctl$DRM_IOCTL_MODE_RMFB(fd fd_dri, cmd const[DRM_IOCTL_MODE_RMFB], arg ptr[in, drm_fb_id]) 311 ioctl$DRM_IOCTL_MODE_PAGE_FLIP(fd fd_dri, cmd const[DRM_IOCTL_MODE_PAGE_FLIP], arg ptr[in, drm_mode_crtc_page_flip_target]) 312 313 drm_mode_crtc_page_flip_target { 314 crtc_id drm_crtc_id 315 fb_id drm_fb_id 316 flags flags[drm_page_flip_flags, int32] 317 sequence int32 318 user_data int64 319 } 320 321 drm_page_flip_flags = DRM_MODE_PAGE_FLIP_EVENT, DRM_MODE_PAGE_FLIP_ASYNC, DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE, DRM_MODE_PAGE_FLIP_TARGET_RELATIVE 322 323 ioctl$DRM_IOCTL_MODE_DIRTYFB(fd fd_dri, cmd const[DRM_IOCTL_MODE_DIRTYFB], arg ptr[in, drm_mode_fb_dirty_cmd]) 324 325 drm_mode_fb_dirty_cmd { 326 fb_id drm_fb_id 327 flags flags[drm_mode_fb_dirty_flags, int32] 328 color int32 329 num_clips len[clips_ptr, int32] 330 clips_ptr ptr64[in, array[drm_clip_rect]] 331 } 332 333 drm_clip_rect { 334 x1 int16 335 y1 int16 336 x2 int16 337 y2 int16 338 } 339 340 drm_mode_fb_dirty_flags = DRM_MODE_FB_DIRTY_ANNOTATE_COPY, DRM_MODE_FB_DIRTY_ANNOTATE_FILL 341 342 ioctl$DRM_IOCTL_MODE_CREATE_DUMB(fd fd_dri, cmd const[DRM_IOCTL_MODE_CREATE_DUMB], arg ptr[inout, drm_mode_create_dumb]) 343 ioctl$DRM_IOCTL_MODE_MAP_DUMB(fd fd_dri, cmd const[DRM_IOCTL_MODE_MAP_DUMB], arg ptr[inout, drm_mode_map_dumb]) 344 ioctl$DRM_IOCTL_MODE_DESTROY_DUMB(fd fd_dri, cmd const[DRM_IOCTL_MODE_DESTROY_DUMB], arg ptr[in, drm_mode_destroy_dumb]) 345 346 resource drm_dumb_handle[int32] 347 348 drm_mode_create_dumb { 349 height int32 (in) 350 width int32 (in) 351 bpp int32 (in) 352 # flags does not seem to be used by any driver. 353 flags const[0, int32] 354 handle drm_dumb_handle (out) 355 pitch int32 (out) 356 size int64 (out) 357 } 358 359 drm_mode_map_dumb { 360 handle drm_dumb_handle (in) 361 pad const[0, int32] 362 offset int64 (out) 363 } 364 365 drm_mode_destroy_dumb { 366 handle drm_dumb_handle 367 } 368 369 ioctl$DRM_IOCTL_MODE_ATOMIC(fd fd_dri, cmd const[DRM_IOCTL_MODE_ATOMIC], arg ptr[in, drm_mode_atomic]) 370 371 drm_mode_atomic { 372 flags flags[drm_mode_atomic_flags, int32] 373 count_objs len[objs_ptr, int32] 374 objs_ptr ptr64[in, array[drm_obj_id]] 375 # NEED: this array is probably parallel to objs_ptr. 376 count_props_ptr ptr64[in, array[int32]] 377 props_ptr ptr64[in, array[drm_prop_id]] 378 prop_values_ptr ptr64[in, array[int64]] 379 reserved const[0, int64] 380 user_data int64 381 } 382 383 drm_mode_atomic_flags = DRM_MODE_PAGE_FLIP_EVENT, DRM_MODE_ATOMIC_TEST_ONLY, DRM_MODE_ATOMIC_NONBLOCK, DRM_MODE_ATOMIC_ALLOW_MODESET 384 385 resource fd_drm_syncobj[fd] 386 resource drm_syncobj[int32] 387 388 # TODO: drm_syncpoint should be a resource and it used to be. 389 # But it was produced only by drm_syncobj_wait/drm_syncobj_timeline_wait.first_signaled 390 # which actually returns some int32 index rather than int64 syncpoint. 391 # Once it was fixed nothing produces drm_syncpoint anymore, so it was downgraded to plain int. 392 # resource drm_syncpoint[int64] 393 type drm_syncpoint int64 394 395 # See https://www.kernel.org/doc/html/latest/gpu/drm-mm.html#drm-sync-objects 396 # for more details 397 ioctl$DRM_IOCTL_SYNCOBJ_CREATE(fd fd_dri, cmd const[DRM_IOCTL_SYNCOBJ_CREATE], arg ptr[inout, drm_syncobj_create]) 398 ioctl$DRM_IOCTL_SYNCOBJ_DESTROY(fd fd_dri, cmd const[DRM_IOCTL_SYNCOBJ_DESTROY], arg ptr[in, drm_syncobj_destroy]) 399 ioctl$DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD_SYNC_FILE(fd fd_dri, cmd const[DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD], arg ptr[inout, drm_syncobj_handle$to_sync_file]) 400 ioctl$DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD_FD(fd fd_dri, cmd const[DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD], arg ptr[inout, drm_syncobj_handle$to_fd]) 401 ioctl$DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE_SYNC_FILE(fd fd_dri, cmd const[DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE], arg ptr[inout, drm_syncobj_handle$from_sync_file]) 402 ioctl$DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE_FD(fd fd_dri, cmd const[DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE], arg ptr[inout, drm_syncobj_handle$from_fd]) 403 ioctl$DRM_IOCTL_SYNCOBJ_TRANSFER(fd fd_dri, cmd const[DRM_IOCTL_SYNCOBJ_TRANSFER], arg ptr[inout, drm_syncobj_transfer]) 404 ioctl$DRM_IOCTL_SYNCOBJ_WAIT(fd fd_dri, cmd const[DRM_IOCTL_SYNCOBJ_WAIT], arg ptr[inout, drm_syncobj_wait]) 405 ioctl$DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT(fd fd_dri, cmd const[DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT], arg ptr[inout, drm_syncobj_timeline_wait]) 406 ioctl$DRM_IOCTL_SYNCOBJ_RESET(fd fd_dri, cmd const[DRM_IOCTL_SYNCOBJ_RESET], arg ptr[in, drm_syncobj_array]) 407 ioctl$DRM_IOCTL_SYNCOBJ_SIGNAL(fd fd_dri, cmd const[DRM_IOCTL_SYNCOBJ_SIGNAL], arg ptr[in, drm_syncobj_array]) 408 ioctl$DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL(fd fd_dri, cmd const[DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL], arg ptr[in, drm_syncobj_timeline_array]) 409 ioctl$DRM_IOCTL_SYNCOBJ_QUERY(fd fd_dri, cmd const[DRM_IOCTL_SYNCOBJ_QUERY], arg ptr[inout, drm_syncobj_timeline_array]) 410 411 drm_syncobj_create { 412 handle drm_syncobj (out) 413 flags flags[drm_syncobj_create_flags, int32] (in) 414 } 415 416 drm_syncobj_destroy { 417 handle drm_syncobj 418 pad const[0, int32] 419 } 420 421 drm_syncobj_handle$to_sync_file { 422 handle drm_syncobj (in) 423 flags const[DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE, int32] 424 fd fd_sync_file (out) 425 pad const[0, int32] 426 } 427 428 drm_syncobj_handle$to_fd { 429 handle drm_syncobj (in) 430 flags const[0, int32] 431 fd fd_drm_syncobj (out) 432 pad const[0, int32] 433 } 434 435 drm_syncobj_handle$from_sync_file { 436 handle drm_syncobj (out) 437 flags const[DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE, int32] 438 fd fd_sync_file (in) 439 pad const[0, int32] 440 } 441 442 drm_syncobj_handle$from_fd { 443 handle drm_syncobj (out) 444 flags const[0, int32] 445 fd fd_drm_syncobj (in) 446 pad const[0, int32] 447 } 448 449 drm_syncobj_transfer { 450 src_handle drm_syncobj (in) 451 dst_handle drm_syncobj (in) 452 src_point drm_syncpoint (in) 453 dst_point drm_syncpoint (in) 454 flags flags[drm_syncobj_wait_flags, int32] (in) 455 pad const[0, int32] 456 } 457 458 drm_syncobj_wait { 459 handles ptr64[in, array[drm_syncobj]] 460 timeout_nsec int64 (in) 461 count_handles len[handles, int32] 462 flags flags[drm_syncobj_wait_flags, int32] (in) 463 first_signaled int32 (out) 464 pad const[0, int32] 465 } 466 467 drm_syncobj_timeline_wait { 468 handles ptr64[in, array[drm_syncobj]] 469 points ptr64[in, array[drm_syncpoint]] 470 timeout_nsec int64 471 count_handles len[handles, int32] 472 flags flags[drm_syncobj_wait_flags, int32] (in) 473 first_signaled int32 (out) 474 pad const[0, int32] 475 } 476 477 drm_syncobj_array { 478 handles ptr64[in, array[drm_syncobj]] 479 count_handles len[handles, int32] 480 pad const[0, int32] 481 } 482 483 drm_syncobj_timeline_array { 484 handles ptr64[in, array[drm_syncobj]] 485 points ptr64[inout, array[drm_syncpoint]] 486 count_handles len[handles, int32] 487 flags flags[drm_syncobj_query_flags, int32] (in) 488 } 489 490 # TODO: describe SEQUENCE ioctls (but we don't have DRIVER_MODESET hardware). 491 #ioctl$DRM_IOCTL_CRTC_GET_SEQUENCE(fd fd_dri, cmd const[DRM_IOCTL_CRTC_GET_SEQUENCE], arg ptr[in, XXXXX]) 492 #ioctl$DRM_IOCTL_CRTC_QUEUE_SEQUENCE(fd fd_dri, cmd const[DRM_IOCTL_CRTC_QUEUE_SEQUENCE], arg ptr[in, XXXXX]) 493 494 ioctl$DRM_IOCTL_MODE_CREATE_LEASE(fd fd_dri, cmd const[DRM_IOCTL_MODE_CREATE_LEASE], arg ptr[inout, drm_mode_create_lease]) 495 ioctl$DRM_IOCTL_MODE_LIST_LESSEES(fd fd_dri, cmd const[DRM_IOCTL_MODE_LIST_LESSEES], arg ptr[in, drm_mode_list_lessees]) 496 ioctl$DRM_IOCTL_MODE_GET_LEASE(fd fd_dri, cmd const[DRM_IOCTL_MODE_GET_LEASE], arg ptr[inout, drm_mode_get_lease]) 497 ioctl$DRM_IOCTL_MODE_REVOKE_LEASE(fd fd_dri, cmd const[DRM_IOCTL_MODE_REVOKE_LEASE], arg ptr[in, drm_mode_revoke_lease]) 498 499 resource drm_lessee_id[int32] 500 501 drm_mode_create_lease { 502 object_ids ptr64[in, array[drm_obj_id]] (in) 503 object_count len[object_ids, int32] (in) 504 flags flags[drm_mode_create_lease_flag, int32] (in) 505 lessee_id drm_lessee_id (out) 506 fd fd (out) 507 } 508 509 drm_mode_create_lease_flag = O_CLOEXEC, O_NONBLOCK 510 511 drm_mode_list_lessees { 512 count_lessees len[lessees_ptr, int32] 513 pad const[0, int32] 514 lessees_ptr ptr64[out, array[drm_lessee_id]] 515 } 516 517 drm_mode_get_lease { 518 count_objects len[objects_ptr, int32] 519 pad const[0, int32] 520 objects_ptr ptr64[out, array[drm_obj_id]] 521 } 522 523 drm_mode_revoke_lease { 524 lessee_id drm_lessee_id 525 } 526 527 drm_version { 528 maj int32 529 min int32 530 patch int32 531 namelen len[name, intptr] 532 name buffer[out] 533 datelen len[date, intptr] 534 date buffer[out] 535 desclen len[desc, intptr] 536 desc buffer[out] 537 } 538 539 drm_unique$in { 540 len len[uni, intptr] 541 uni buffer[in] 542 } 543 544 drm_unique$out { 545 len len[uni, intptr] 546 uni buffer[out] 547 } 548 549 drm_irq_busid { 550 irq int32 (out) 551 bus int32 (in) 552 dev int32 (in) 553 func int32 (in) 554 } 555 556 drm_map$DRM_IOCTL_GET_MAP { 557 off vma (inout) 558 size intptr (out) 559 type int32 (out) 560 flags int32 (out) 561 handle vma (out) 562 mtrr int32 (out) 563 } 564 565 drm_map$DRM_IOCTL_ADD_MAP { 566 off vma (in) 567 size intptr (in) 568 type flags[drm_map_type, int32] (in) 569 flags flags[drm_map_flags, int32] (in) 570 handle vma (out) 571 mtrr int32 (out) 572 } 573 574 drm_map$DRM_IOCTL_RM_MAP { 575 # Only handle is used. 576 off const[0, intptr] 577 size const[0, intptr] 578 type const[0, int32] 579 flags const[0, int32] 580 handle vma 581 mtrr const[0, int32] 582 } 583 584 drm_client { 585 idx int32 586 auth int32 587 pid alignptr[pid] 588 uid alignptr[uid] 589 magic intptr 590 iocs intptr 591 } 592 593 drm_get_cap { 594 cap flags[drm_cap, int64] 595 val const[0, int64] 596 } 597 598 drm_cap = DRM_CAP_DUMB_BUFFER, DRM_CAP_VBLANK_HIGH_CRTC, DRM_CAP_DUMB_PREFERRED_DEPTH, DRM_CAP_DUMB_PREFER_SHADOW, DRM_CAP_PRIME, DRM_PRIME_CAP_IMPORT, DRM_PRIME_CAP_EXPORT, DRM_CAP_TIMESTAMP_MONOTONIC, DRM_CAP_ASYNC_PAGE_FLIP, DRM_CAP_CURSOR_WIDTH, DRM_CAP_CURSOR_HEIGHT, DRM_CAP_ADDFB2_MODIFIERS, DRM_CAP_PAGE_FLIP_TARGET, DRM_CAP_CRTC_IN_VBLANK_EVENT, DRM_CAP_SYNCOBJ, DRM_CAP_SYNCOBJ_TIMELINE 599 600 drm_set_version { 601 di_maj int32 602 di_min int32 603 dd_maj int32 604 dd_min int32 605 } 606 607 drm_ctx_priv_map { 608 ctxid drmctx 609 handle buffer[out] 610 } 611 612 drm_ctx { 613 handle drmctx 614 flags flags[drm_ctx_flags, int32] 615 } 616 617 drm_ctx_res { 618 count len[context, int32] 619 context ptr[out, array[drm_ctx]] 620 } 621 622 drm_lock { 623 context drmctx 624 flags flags[drm_lock_flags, int32] 625 } 626 627 drm_buf_desc { 628 count int32 629 size int32 630 lomark int32 631 himark int32 632 flags flags[drm_buf_flags, int32] 633 # TODO: what is agp addresses? should it be a special type? 634 agpaddr intptr 635 } 636 637 drm_buf_map { 638 count len[list, int32] 639 virtual buffer[out] 640 list ptr[in, array[drm_buf_pub]] 641 } 642 643 drm_buf_pub { 644 idx int32 645 total len[addr, int32] 646 used int32 647 addr buffer[out] 648 } 649 650 drm_buf_free { 651 count len[list, int32] 652 list ptr[in, array[int32]] 653 } 654 655 drm_dma { 656 context drmctx 657 sendcnt len[sendind, int32] 658 sendind ptr[in, array[int32]] 659 sendsiz ptr[in, array[int32]] 660 flags flags[drm_dma_flags, int32] 661 reqcnd len[reqind, int32] 662 reqsiz0 int32 663 reqind ptr[in, array[int32]] 664 reqsiz ptr[in, array[int32]] 665 granted const[0, int32] 666 } 667 668 drm_control { 669 func flags[drm_control_type, int32] 670 irq int32 671 } 672 673 drm_agp_buffer$DRM_IOCTL_AGP_ALLOC { 674 size intptr (in) 675 handle drm_agp_handle (out) 676 type flags[drm_agp_mem_type, intptr] (in) 677 physic intptr (out) 678 } 679 680 drm_agp_buffer$DRM_IOCTL_AGP_FREE { 681 # Only handle is used. 682 size const[0, intptr] 683 handle drm_agp_handle 684 type const[0, intptr] 685 physic const[0, intptr] 686 } 687 688 drm_agp_binding { 689 handle drm_agp_handle 690 offset intptr 691 } 692 693 drm_scatter_gather { 694 size intptr 695 handle drm_agp_handle 696 } 697 698 drm_wait_vblank_request { 699 type flags[drm_vblank_seq_type, int32] 700 seq int32 701 signal intptr 702 } 703 704 drm_modeset_ctl { 705 crtc int32 706 cmd int32 707 } 708 709 drm_gem_open { 710 name drm_gem_name (in) 711 handle drm_gem_handle (out) 712 size int64 (out) 713 } 714 715 drm_gem_close { 716 handle drm_gem_handle 717 pad const[0, int32] 718 } 719 720 drm_gem_flink { 721 handle drm_gem_handle (in) 722 name drm_gem_name (out) 723 } 724 725 drm_mode_card_res { 726 fbid ptr64[out, array[drm_fb_id]] 727 crtcid ptr64[out, array[drm_crtc_id]] 728 connid ptr64[out, array[drm_connector_id]] 729 encid ptr64[out, array[drm_encoder_id]] 730 nfbid len[fbid, int32] 731 ncrtcid len[crtcid, int32] 732 nconnid len[connid, int32] 733 nencid len[encid, int32] 734 maxw const[0, int32] 735 maxh const[0, int32] 736 minw const[0, int32] 737 minh const[0, int32] 738 } 739 740 drm_prime_handle$DRM_IOCTL_PRIME_HANDLE_TO_FD { 741 handle drm_gem_handle (in) 742 flags flags[dup_flags, int32] (in) 743 fd fd_dri (out) 744 } 745 746 drm_prime_handle$DRM_IOCTL_PRIME_FD_TO_HANDLE { 747 handle drm_gem_handle (out) 748 flags const[0, int32] 749 fd fd_dri (in) 750 } 751 752 drm_mode_crtc$DRM_IOCTL_MODE_GETCRTC { 753 set_connectors_ptr ptr64[in, array[const[0, int32]]] 754 count_connectors len[set_connectors_ptr, int32] 755 crtc_id drm_crtc_id (in) 756 fb_id drm_fb_id (out) 757 x int32 (out) 758 y int32 (out) 759 gamma_size int32 (out) 760 mode_valid int32 (out) 761 mode drm_mode_modeinfo (out) 762 } 763 764 drm_mode_crtc$DRM_IOCTL_MODE_SETCRTC { 765 set_connectors_ptr ptr64[in, array[drm_connector_id]] 766 count_connectors len[set_connectors_ptr, int32] 767 crtc_id drm_crtc_id 768 fb_id drm_fb_id 769 x int32 770 y int32 771 gamma_size int32 772 mode_valid int32 773 mode drm_mode_modeinfo 774 } 775 776 drm_mode_modeinfo { 777 clock int32 778 hdisplay int16 779 hsync_start int16 780 hsync_end int16 781 htotal int16 782 hskew int16 783 vdisplay int16 784 vsync_start int16 785 vsync_end int16 786 vtotal int16 787 vscan int16 788 vrefresh int32 789 flags int32 790 type int32 791 name array[int8, DRM_DISPLAY_MODE_LEN] 792 } 793 794 drm_agp_mem_type = 0, 1, 2, AGP_USER_MEMORY, AGP_USER_CACHED_MEMORY 795 drm_map_type = _DRM_FRAME_BUFFER, _DRM_REGISTERS, _DRM_SHM, _DRM_AGP, _DRM_SCATTER_GATHER, _DRM_CONSISTENT 796 drm_map_flags = _DRM_RESTRICTED, _DRM_READ_ONLY, _DRM_LOCKED, _DRM_KERNEL, _DRM_WRITE_COMBINING, _DRM_CONTAINS_LOCK, _DRM_REMOVABLE, _DRM_DRIVER 797 drm_ctx_flags = _DRM_CONTEXT_PRESERVED, _DRM_CONTEXT_2DONLY 798 drm_lock_flags = _DRM_LOCK_READY, _DRM_LOCK_QUIESCENT, _DRM_LOCK_FLUSH, _DRM_LOCK_FLUSH_ALL, _DRM_HALT_ALL_QUEUES, _DRM_HALT_CUR_QUEUES 799 drm_buf_flags = _DRM_PAGE_ALIGN, _DRM_AGP_BUFFER, _DRM_SG_BUFFER, _DRM_FB_BUFFER, _DRM_PCI_BUFFER_RO 800 drm_dma_flags = _DRM_DMA_BLOCK, _DRM_DMA_WHILE_LOCKED, _DRM_DMA_PRIORITY, _DRM_DMA_WAIT, _DRM_DMA_SMALLER_OK, _DRM_DMA_LARGER_OK 801 drm_control_type = DRM_ADD_COMMAND, DRM_RM_COMMAND, DRM_INST_HANDLER, DRM_UNINST_HANDLER 802 drm_vblank_seq_type = _DRM_VBLANK_ABSOLUTE, _DRM_VBLANK_RELATIVE, _DRM_VBLANK_HIGH_CRTC_MASK, _DRM_VBLANK_EVENT, _DRM_VBLANK_FLIP, _DRM_VBLANK_NEXTONMISS, _DRM_VBLANK_SECONDARY, _DRM_VBLANK_SIGNAL 803 drm_syncobj_create_flags = DRM_SYNCOBJ_CREATE_SIGNALED 804 drm_syncobj_wait_flags = DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL, DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT, DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE 805 drm_syncobj_query_flags = DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED