| 1 |
|
| 2 |
|
| 3 | #ifndef _PANTHOR_DRM_H_
|
| 4 | #define _PANTHOR_DRM_H_
|
| 5 |
|
| 6 | #include "drm.h"
|
| 7 |
|
| 8 | #if defined(__cplusplus)
|
| 9 | extern "C" {
|
| 10 | #endif
|
| 11 |
|
| 12 | |
| 13 | * DOC: Introduction
|
| 14 | *
|
| 15 | * This documentation describes the Panthor IOCTLs.
|
| 16 | *
|
| 17 | * Just a few generic rules about the data passed to the Panthor IOCTLs:
|
| 18 | *
|
| 19 | * - Structures must be aligned on 64-bit/8-byte. If the object is not
|
| 20 | * naturally aligned, a padding field must be added.
|
| 21 | * - Fields must be explicitly aligned to their natural type alignment with
|
| 22 | * pad[0..N] fields.
|
| 23 | * - All padding fields will be checked by the driver to make sure they are
|
| 24 | * zeroed.
|
| 25 | * - Flags can be added, but not removed/replaced.
|
| 26 | * - New fields can be added to the main structures (the structures
|
| 27 | * directly passed to the ioctl). Those fields can be added at the end of
|
| 28 | * the structure, or replace existing padding fields. Any new field being
|
| 29 | * added must preserve the behavior that existed before those fields were
|
| 30 | * added when a value of zero is passed.
|
| 31 | * - New fields can be added to indirect objects (objects pointed by the
|
| 32 | * main structure), iff those objects are passed a size to reflect the
|
| 33 | * size known by the userspace driver (see drm_panthor_obj_array::stride
|
| 34 | * or drm_panthor_dev_query::size).
|
| 35 | * - If the kernel driver is too old to know some fields, those will be
|
| 36 | * ignored if zero, and otherwise rejected (and so will be zero on output).
|
| 37 | * - If userspace is too old to know some fields, those will be zeroed
|
| 38 | * (input) before the structure is parsed by the kernel driver.
|
| 39 | * - Each new flag/field addition must come with a driver version update so
|
| 40 | * the userspace driver doesn't have to trial and error to know which
|
| 41 | * flags are supported.
|
| 42 | * - Structures should not contain unions, as this would defeat the
|
| 43 | * extensibility of such structures.
|
| 44 | * - IOCTLs can't be removed or replaced. New IOCTL IDs should be placed
|
| 45 | * at the end of the drm_panthor_ioctl_id enum.
|
| 46 |
|
| 47 |
|
| 48 | |
| 49 | * DOC: MMIO regions exposed to userspace.
|
| 50 | *
|
| 51 | * .. c:macro:: DRM_PANTHOR_USER_MMIO_OFFSET
|
| 52 | *
|
| 53 | * File offset for all MMIO regions being exposed to userspace. Don't use
|
| 54 | * this value directly, use DRM_PANTHOR_USER_<name>_OFFSET values instead.
|
| 55 | * pgoffset passed to mmap2() is an unsigned long, which forces us to use a
|
| 56 | * different offset on 32-bit and 64-bit systems.
|
| 57 | *
|
| 58 | * .. c:macro:: DRM_PANTHOR_USER_FLUSH_ID_MMIO_OFFSET
|
| 59 | *
|
| 60 | * File offset for the LATEST_FLUSH_ID register. The Userspace driver controls
|
| 61 | * GPU cache flushing through CS instructions, but the flush reduction
|
| 62 | * mechanism requires a flush_id. This flush_id could be queried with an
|
| 63 | * ioctl, but Arm provides a well-isolated register page containing only this
|
| 64 | * read-only register, so let's expose this page through a static mmap offset
|
| 65 | * and allow direct mapping of this MMIO region so we can avoid the
|
| 66 | * user <-> kernel round-trip.
|
| 67 |
|
| 68 | #define DRM_PANTHOR_USER_MMIO_OFFSET_32BIT (1ull << 43)
|
| 69 | #define DRM_PANTHOR_USER_MMIO_OFFSET_64BIT (1ull << 56)
|
| 70 | #define DRM_PANTHOR_USER_MMIO_OFFSET (sizeof(unsigned long) < 8 ? \
|
| 71 | DRM_PANTHOR_USER_MMIO_OFFSET_32BIT : \
|
| 72 | DRM_PANTHOR_USER_MMIO_OFFSET_64BIT)
|
| 73 | #define DRM_PANTHOR_USER_FLUSH_ID_MMIO_OFFSET (DRM_PANTHOR_USER_MMIO_OFFSET | 0)
|
| 74 |
|
| 75 | |
| 76 | * DOC: IOCTL IDs
|
| 77 | *
|
| 78 | * enum drm_panthor_ioctl_id - IOCTL IDs
|
| 79 | *
|
| 80 | * Place new ioctls at the end, don't re-order, don't replace or remove entries.
|
| 81 | *
|
| 82 | * These IDs are not meant to be used directly. Use the DRM_IOCTL_PANTHOR_xxx
|
| 83 | * definitions instead.
|
| 84 |
|
| 85 | enum drm_panthor_ioctl_id {
|
| 86 |
|
| 87 | DRM_PANTHOR_DEV_QUERY = 0,
|
| 88 |
|
| 89 |
|
| 90 | DRM_PANTHOR_VM_CREATE,
|
| 91 |
|
| 92 |
|
| 93 | DRM_PANTHOR_VM_DESTROY,
|
| 94 |
|
| 95 |
|
| 96 | DRM_PANTHOR_VM_BIND,
|
| 97 |
|
| 98 |
|
| 99 | DRM_PANTHOR_VM_GET_STATE,
|
| 100 |
|
| 101 |
|
| 102 | DRM_PANTHOR_BO_CREATE,
|
| 103 |
|
| 104 | |
| 105 | * @DRM_PANTHOR_BO_MMAP_OFFSET: Get the file offset to pass to
|
| 106 | * mmap to map a GEM object.
|
| 107 |
|
| 108 | DRM_PANTHOR_BO_MMAP_OFFSET,
|
| 109 |
|
| 110 |
|
| 111 | DRM_PANTHOR_GROUP_CREATE,
|
| 112 |
|
| 113 |
|
| 114 | DRM_PANTHOR_GROUP_DESTROY,
|
| 115 |
|
| 116 | |
| 117 | * @DRM_PANTHOR_GROUP_SUBMIT: Submit jobs to queues belonging
|
| 118 | * to a specific scheduling group.
|
| 119 |
|
| 120 | DRM_PANTHOR_GROUP_SUBMIT,
|
| 121 |
|
| 122 |
|
| 123 | DRM_PANTHOR_GROUP_GET_STATE,
|
| 124 |
|
| 125 |
|
| 126 | DRM_PANTHOR_TILER_HEAP_CREATE,
|
| 127 |
|
| 128 |
|
| 129 | DRM_PANTHOR_TILER_HEAP_DESTROY,
|
| 130 |
|
| 131 |
|
| 132 | DRM_PANTHOR_BO_SET_LABEL,
|
| 133 |
|
| 134 | |
| 135 | * @DRM_PANTHOR_SET_USER_MMIO_OFFSET: Set the offset to use as the user MMIO offset.
|
| 136 | *
|
| 137 | * The default behavior is to pick the MMIO offset based on the size of the pgoff_t
|
| 138 | * type seen by the process that manipulates the FD, such that a 32-bit process can
|
| 139 | * always map the user MMIO ranges. But this approach doesn't work well for emulators
|
| 140 | * like FEX, where the emulator is an 64-bit binary which might be executing 32-bit
|
| 141 | * code. In that case, the kernel thinks it's the 64-bit process and assumes
|
| 142 | * DRM_PANTHOR_USER_MMIO_OFFSET_64BIT is in use, but the UMD library expects
|
| 143 | * DRM_PANTHOR_USER_MMIO_OFFSET_32BIT, because it can't mmap() anything above the
|
| 144 | * pgoff_t size.
|
| 145 |
|
| 146 | DRM_PANTHOR_SET_USER_MMIO_OFFSET,
|
| 147 |
|
| 148 |
|
| 149 | DRM_PANTHOR_BO_SYNC,
|
| 150 |
|
| 151 | |
| 152 | * @DRM_PANTHOR_BO_QUERY_INFO: Query information about a BO.
|
| 153 | *
|
| 154 | * This is useful for imported BOs.
|
| 155 |
|
| 156 | DRM_PANTHOR_BO_QUERY_INFO,
|
| 157 | };
|
| 158 |
|
| 159 | |
| 160 | * DOC: IOCTL arguments
|
| 161 |
|
| 162 |
|
| 163 | |
| 164 | * struct drm_panthor_obj_array - Object array.
|
| 165 | *
|
| 166 | * This object is used to pass an array of objects whose size is subject to changes in
|
| 167 | * future versions of the driver. In order to support this mutability, we pass a stride
|
| 168 | * describing the size of the object as known by userspace.
|
| 169 | *
|
| 170 | * You shouldn't fill drm_panthor_obj_array fields directly. You should instead use
|
| 171 | * the DRM_PANTHOR_OBJ_ARRAY() macro that takes care of initializing the stride to
|
| 172 | * the object size.
|
| 173 |
|
| 174 | struct drm_panthor_obj_array {
|
| 175 |
|
| 176 | __u32 stride;
|
| 177 |
|
| 178 |
|
| 179 | __u32 count;
|
| 180 |
|
| 181 |
|
| 182 | __u64 array;
|
| 183 | };
|
| 184 |
|
| 185 | |
| 186 | * DRM_PANTHOR_OBJ_ARRAY() - Initialize a drm_panthor_obj_array field.
|
| 187 | * @cnt: Number of elements in the array.
|
| 188 | * @ptr: Pointer to the array to pass to the kernel.
|
| 189 | *
|
| 190 | * Macro initializing a drm_panthor_obj_array based on the object size as known
|
| 191 | * by userspace.
|
| 192 |
|
| 193 | #define DRM_PANTHOR_OBJ_ARRAY(cnt, ptr) \
|
| 194 | { .stride = sizeof((ptr)[0]), .count = (cnt), .array = (__u64)(uintptr_t)(ptr) }
|
| 195 |
|
| 196 | |
| 197 | * enum drm_panthor_sync_op_flags - Synchronization operation flags.
|
| 198 |
|
| 199 | enum drm_panthor_sync_op_flags {
|
| 200 |
|
| 201 | DRM_PANTHOR_SYNC_OP_HANDLE_TYPE_MASK = 0xff,
|
| 202 |
|
| 203 |
|
| 204 | DRM_PANTHOR_SYNC_OP_HANDLE_TYPE_SYNCOBJ = 0,
|
| 205 |
|
| 206 | |
| 207 | * @DRM_PANTHOR_SYNC_OP_HANDLE_TYPE_TIMELINE_SYNCOBJ: Timeline synchronization
|
| 208 | * object type.
|
| 209 |
|
| 210 | DRM_PANTHOR_SYNC_OP_HANDLE_TYPE_TIMELINE_SYNCOBJ = 1,
|
| 211 |
|
| 212 |
|
| 213 | DRM_PANTHOR_SYNC_OP_WAIT = 0 << 31,
|
| 214 |
|
| 215 |
|
| 216 | DRM_PANTHOR_SYNC_OP_SIGNAL = (int)(1u << 31),
|
| 217 | };
|
| 218 |
|
| 219 | |
| 220 | * struct drm_panthor_sync_op - Synchronization operation.
|
| 221 |
|
| 222 | struct drm_panthor_sync_op {
|
| 223 |
|
| 224 | __u32 flags;
|
| 225 |
|
| 226 |
|
| 227 | __u32 handle;
|
| 228 |
|
| 229 | |
| 230 | * @timeline_value: MBZ if
|
| 231 | * (flags & DRM_PANTHOR_SYNC_OP_HANDLE_TYPE_MASK) !=
|
| 232 | * DRM_PANTHOR_SYNC_OP_HANDLE_TYPE_TIMELINE_SYNCOBJ.
|
| 233 |
|
| 234 | __u64 timeline_value;
|
| 235 | };
|
| 236 |
|
| 237 | |
| 238 | * enum drm_panthor_dev_query_type - Query type
|
| 239 | *
|
| 240 | * Place new types at the end, don't re-order, don't remove or replace.
|
| 241 |
|
| 242 | enum drm_panthor_dev_query_type {
|
| 243 |
|
| 244 | DRM_PANTHOR_DEV_QUERY_GPU_INFO = 0,
|
| 245 |
|
| 246 |
|
| 247 | DRM_PANTHOR_DEV_QUERY_CSIF_INFO,
|
| 248 |
|
| 249 |
|
| 250 | DRM_PANTHOR_DEV_QUERY_TIMESTAMP_INFO,
|
| 251 |
|
| 252 | |
| 253 | * @DRM_PANTHOR_DEV_QUERY_GROUP_PRIORITIES_INFO: Query allowed group priorities information.
|
| 254 |
|
| 255 | DRM_PANTHOR_DEV_QUERY_GROUP_PRIORITIES_INFO,
|
| 256 |
|
| 257 |
|
| 258 | DRM_PANTHOR_DEV_QUERY_MMU_INFO,
|
| 259 | };
|
| 260 |
|
| 261 | |
| 262 | * enum drm_panthor_gpu_coherency: Type of GPU coherency
|
| 263 |
|
| 264 | enum drm_panthor_gpu_coherency {
|
| 265 | |
| 266 | * @DRM_PANTHOR_GPU_COHERENCY_ACE_LITE: ACE Lite coherency.
|
| 267 |
|
| 268 | DRM_PANTHOR_GPU_COHERENCY_ACE_LITE = 0,
|
| 269 |
|
| 270 | |
| 271 | * @DRM_PANTHOR_GPU_COHERENCY_ACE: ACE coherency.
|
| 272 |
|
| 273 | DRM_PANTHOR_GPU_COHERENCY_ACE = 1,
|
| 274 |
|
| 275 | |
| 276 | * @DRM_PANTHOR_GPU_COHERENCY_NONE: No coherency.
|
| 277 |
|
| 278 | DRM_PANTHOR_GPU_COHERENCY_NONE = 31,
|
| 279 | };
|
| 280 |
|
| 281 | |
| 282 | * struct drm_panthor_gpu_info - GPU information
|
| 283 | *
|
| 284 | * Structure grouping all queryable information relating to the GPU.
|
| 285 |
|
| 286 | struct drm_panthor_gpu_info {
|
| 287 |
|
| 288 | __u32 gpu_id;
|
| 289 | #define DRM_PANTHOR_ARCH_MAJOR(x) ((x) >> 28)
|
| 290 | #define DRM_PANTHOR_ARCH_MINOR(x) (((x) >> 24) & 0xf)
|
| 291 | #define DRM_PANTHOR_ARCH_REV(x) (((x) >> 20) & 0xf)
|
| 292 | #define DRM_PANTHOR_PRODUCT_MAJOR(x) (((x) >> 16) & 0xf)
|
| 293 | #define DRM_PANTHOR_VERSION_MAJOR(x) (((x) >> 12) & 0xf)
|
| 294 | #define DRM_PANTHOR_VERSION_MINOR(x) (((x) >> 4) & 0xff)
|
| 295 | #define DRM_PANTHOR_VERSION_STATUS(x) ((x) & 0xf)
|
| 296 |
|
| 297 |
|
| 298 | __u32 gpu_rev;
|
| 299 |
|
| 300 |
|
| 301 | __u32 csf_id;
|
| 302 | #define DRM_PANTHOR_CSHW_MAJOR(x) (((x) >> 26) & 0x3f)
|
| 303 | #define DRM_PANTHOR_CSHW_MINOR(x) (((x) >> 20) & 0x3f)
|
| 304 | #define DRM_PANTHOR_CSHW_REV(x) (((x) >> 16) & 0xf)
|
| 305 | #define DRM_PANTHOR_MCU_MAJOR(x) (((x) >> 10) & 0x3f)
|
| 306 | #define DRM_PANTHOR_MCU_MINOR(x) (((x) >> 4) & 0x3f)
|
| 307 | #define DRM_PANTHOR_MCU_REV(x) ((x) & 0xf)
|
| 308 |
|
| 309 |
|
| 310 | __u32 l2_features;
|
| 311 |
|
| 312 |
|
| 313 | __u32 tiler_features;
|
| 314 |
|
| 315 |
|
| 316 | __u32 mem_features;
|
| 317 |
|
| 318 |
|
| 319 | __u32 mmu_features;
|
| 320 | #define DRM_PANTHOR_MMU_VA_BITS(x) ((x) & 0xff)
|
| 321 |
|
| 322 |
|
| 323 | __u32 thread_features;
|
| 324 |
|
| 325 |
|
| 326 | __u32 max_threads;
|
| 327 |
|
| 328 |
|
| 329 | __u32 thread_max_workgroup_size;
|
| 330 |
|
| 331 | |
| 332 | * @thread_max_barrier_size: Maximum number of threads that can wait
|
| 333 | * simultaneously on a barrier.
|
| 334 |
|
| 335 | __u32 thread_max_barrier_size;
|
| 336 |
|
| 337 | |
| 338 | * @coherency_features: Coherency features.
|
| 339 | *
|
| 340 | * Combination of drm_panthor_gpu_coherency flags.
|
| 341 | *
|
| 342 | * Note that this is just what the coherency protocols supported by the
|
| 343 | * GPU, but the actual coherency in place depends on the SoC
|
| 344 | * integration and is reflected by
|
| 345 | * drm_panthor_gpu_info::selected_coherency.
|
| 346 |
|
| 347 | __u32 coherency_features;
|
| 348 |
|
| 349 |
|
| 350 | __u32 texture_features[4];
|
| 351 |
|
| 352 |
|
| 353 | __u32 as_present;
|
| 354 |
|
| 355 | |
| 356 | * @selected_coherency: Coherency selected for this device.
|
| 357 | *
|
| 358 | * One of drm_panthor_gpu_coherency.
|
| 359 |
|
| 360 | __u32 selected_coherency;
|
| 361 |
|
| 362 |
|
| 363 | __u64 shader_present;
|
| 364 |
|
| 365 |
|
| 366 | __u64 l2_present;
|
| 367 |
|
| 368 |
|
| 369 | __u64 tiler_present;
|
| 370 |
|
| 371 |
|
| 372 | __u32 core_features;
|
| 373 |
|
| 374 |
|
| 375 | __u32 pad;
|
| 376 |
|
| 377 |
|
| 378 | __u64 gpu_features;
|
| 379 | };
|
| 380 |
|
| 381 | |
| 382 | * struct drm_panthor_csif_info - Command stream interface information
|
| 383 | *
|
| 384 | * Structure grouping all queryable information relating to the command stream interface.
|
| 385 |
|
| 386 | struct drm_panthor_csif_info {
|
| 387 |
|
| 388 | __u32 csg_slot_count;
|
| 389 |
|
| 390 |
|
| 391 | __u32 cs_slot_count;
|
| 392 |
|
| 393 |
|
| 394 | __u32 cs_reg_count;
|
| 395 |
|
| 396 |
|
| 397 | __u32 scoreboard_slot_count;
|
| 398 |
|
| 399 | |
| 400 | * @unpreserved_cs_reg_count: Number of command stream registers reserved by
|
| 401 | * the kernel driver to call a userspace command stream.
|
| 402 | *
|
| 403 | * All registers can be used by a userspace command stream, but the
|
| 404 | * [cs_slot_count - unpreserved_cs_reg_count .. cs_slot_count] registers are
|
| 405 | * used by the kernel when DRM_PANTHOR_IOCTL_GROUP_SUBMIT is called.
|
| 406 |
|
| 407 | __u32 unpreserved_cs_reg_count;
|
| 408 |
|
| 409 | |
| 410 | * @pad: Padding field, set to zero.
|
| 411 |
|
| 412 | __u32 pad;
|
| 413 | };
|
| 414 |
|
| 415 | |
| 416 | * enum drm_panthor_timestamp_info_flags - drm_panthor_timestamp_info.flags
|
| 417 |
|
| 418 | enum drm_panthor_timestamp_info_flags {
|
| 419 |
|
| 420 | DRM_PANTHOR_TIMESTAMP_GPU = 1 << 0,
|
| 421 |
|
| 422 |
|
| 423 | DRM_PANTHOR_TIMESTAMP_CPU_NONE = 0 << 1,
|
| 424 |
|
| 425 |
|
| 426 | DRM_PANTHOR_TIMESTAMP_CPU_MONOTONIC = 1 << 1,
|
| 427 |
|
| 428 |
|
| 429 | DRM_PANTHOR_TIMESTAMP_CPU_MONOTONIC_RAW = 2 << 1,
|
| 430 |
|
| 431 |
|
| 432 | DRM_PANTHOR_TIMESTAMP_CPU_TYPE_MASK = 7 << 1,
|
| 433 |
|
| 434 |
|
| 435 | DRM_PANTHOR_TIMESTAMP_GPU_OFFSET = 1 << 4,
|
| 436 |
|
| 437 |
|
| 438 | DRM_PANTHOR_TIMESTAMP_GPU_CYCLE_COUNT = 1 << 5,
|
| 439 |
|
| 440 |
|
| 441 | DRM_PANTHOR_TIMESTAMP_FREQ = 1 << 6,
|
| 442 |
|
| 443 |
|
| 444 | DRM_PANTHOR_TIMESTAMP_DURATION = 1 << 7,
|
| 445 | };
|
| 446 |
|
| 447 | |
| 448 | * struct drm_panthor_timestamp_info - Timestamp information
|
| 449 | *
|
| 450 | * Structure grouping all queryable information relating to the GPU timestamp.
|
| 451 |
|
| 452 | struct drm_panthor_timestamp_info {
|
| 453 | |
| 454 | * @timestamp_frequency: The frequency of the timestamp timer or 0 if
|
| 455 | * unknown.
|
| 456 |
|
| 457 | __u64 timestamp_frequency;
|
| 458 |
|
| 459 |
|
| 460 | __u64 current_timestamp;
|
| 461 |
|
| 462 |
|
| 463 | __u64 timestamp_offset;
|
| 464 |
|
| 465 | |
| 466 | * @flags: Bitmask of drm_panthor_timestamp_info_flags.
|
| 467 | *
|
| 468 | * If set to 0, then it is interpreted as:
|
| 469 | * DRM_PANTHOR_TIMESTAMP_GPU |
|
| 470 | * DRM_PANTHOR_TIMESTAMP_GPU_OFFSET |
|
| 471 | * DRM_PANTHOR_TIMESTAMP_FREQ
|
| 472 | *
|
| 473 | * Note: these flags are exclusive to each other (only one can be used):
|
| 474 | * - DRM_PANTHOR_TIMESTAMP_CPU_NONE
|
| 475 | * - DRM_PANTHOR_TIMESTAMP_CPU_MONOTONIC
|
| 476 | * - DRM_PANTHOR_TIMESTAMP_CPU_MONOTONIC_RAW
|
| 477 |
|
| 478 | __u32 flags;
|
| 479 |
|
| 480 |
|
| 481 | __u32 duration_nsec;
|
| 482 |
|
| 483 |
|
| 484 | __u64 cycle_count;
|
| 485 |
|
| 486 |
|
| 487 | __u64 cpu_timestamp_sec;
|
| 488 |
|
| 489 |
|
| 490 | __u64 cpu_timestamp_nsec;
|
| 491 | };
|
| 492 |
|
| 493 | |
| 494 | * struct drm_panthor_mmu_info - MMU information
|
| 495 | *
|
| 496 | * Structure grouping all queryable information relating to the MMU.
|
| 497 |
|
| 498 | struct drm_panthor_mmu_info {
|
| 499 |
|
| 500 | __u64 page_size_bitmap;
|
| 501 | };
|
| 502 |
|
| 503 | |
| 504 | * struct drm_panthor_group_priorities_info - Group priorities information
|
| 505 | *
|
| 506 | * Structure grouping all queryable information relating to the allowed group priorities.
|
| 507 |
|
| 508 | struct drm_panthor_group_priorities_info {
|
| 509 | |
| 510 | * @allowed_mask: Bitmask of the allowed group priorities.
|
| 511 | *
|
| 512 | * Each bit represents a variant of the enum drm_panthor_group_priority.
|
| 513 |
|
| 514 | __u8 allowed_mask;
|
| 515 |
|
| 516 |
|
| 517 | __u8 pad[3];
|
| 518 | };
|
| 519 |
|
| 520 | |
| 521 | * struct drm_panthor_dev_query - Arguments passed to DRM_PANTHOR_IOCTL_DEV_QUERY
|
| 522 |
|
| 523 | struct drm_panthor_dev_query {
|
| 524 |
|
| 525 | __u32 type;
|
| 526 |
|
| 527 | |
| 528 | * @size: size of the type being queried.
|
| 529 | *
|
| 530 | * If pointer is NULL, size is updated by the driver to provide the
|
| 531 | * output structure size. If pointer is not NULL, the driver will
|
| 532 | * only copy min(size, actual_structure_size) bytes to the pointer,
|
| 533 | * and update the size accordingly. This allows us to extend query
|
| 534 | * types without breaking userspace.
|
| 535 |
|
| 536 | __u32 size;
|
| 537 |
|
| 538 | |
| 539 | * @pointer: user pointer to a query type struct.
|
| 540 | *
|
| 541 | * Pointer can be NULL, in which case, nothing is copied, but the
|
| 542 | * actual structure size is returned. If not NULL, it must point to
|
| 543 | * a location that's large enough to hold size bytes.
|
| 544 |
|
| 545 | __u64 pointer;
|
| 546 | };
|
| 547 |
|
| 548 | |
| 549 | * struct drm_panthor_vm_create - Arguments passed to DRM_PANTHOR_IOCTL_VM_CREATE
|
| 550 |
|
| 551 | struct drm_panthor_vm_create {
|
| 552 |
|
| 553 | __u32 flags;
|
| 554 |
|
| 555 |
|
| 556 | __u32 id;
|
| 557 |
|
| 558 | |
| 559 | * @user_va_range: Size of the VA space reserved for user objects.
|
| 560 | *
|
| 561 | * The kernel will pick the remaining space to map kernel-only objects to the
|
| 562 | * VM (heap chunks, heap context, ring buffers, kernel synchronization objects,
|
| 563 | * ...). If the space left for kernel objects is too small, kernel object
|
| 564 | * allocation will fail further down the road. One can use
|
| 565 | * drm_panthor_gpu_info::mmu_features to extract the total virtual address
|
| 566 | * range, and chose a user_va_range that leaves some space to the kernel.
|
| 567 | *
|
| 568 | * If user_va_range is zero, the kernel will pick a sensible value based on
|
| 569 | * TASK_SIZE and the virtual range supported by the GPU MMU (the kernel/user
|
| 570 | * split should leave enough VA space for userspace processes to support SVM,
|
| 571 | * while still allowing the kernel to map some amount of kernel objects in
|
| 572 | * the kernel VA range). The value chosen by the driver will be returned in
|
| 573 | * @user_va_range.
|
| 574 | *
|
| 575 | * User VA space always starts at 0x0, kernel VA space is always placed after
|
| 576 | * the user VA range.
|
| 577 |
|
| 578 | __u64 user_va_range;
|
| 579 | };
|
| 580 |
|
| 581 | |
| 582 | * struct drm_panthor_vm_destroy - Arguments passed to DRM_PANTHOR_IOCTL_VM_DESTROY
|
| 583 |
|
| 584 | struct drm_panthor_vm_destroy {
|
| 585 |
|
| 586 | __u32 id;
|
| 587 |
|
| 588 |
|
| 589 | __u32 pad;
|
| 590 | };
|
| 591 |
|
| 592 | |
| 593 | * enum drm_panthor_vm_bind_op_flags - VM bind operation flags
|
| 594 |
|
| 595 | enum drm_panthor_vm_bind_op_flags {
|
| 596 | |
| 597 | * @DRM_PANTHOR_VM_BIND_OP_MAP_READONLY: Map the memory read-only.
|
| 598 | *
|
| 599 | * Only valid with DRM_PANTHOR_VM_BIND_OP_TYPE_MAP.
|
| 600 |
|
| 601 | DRM_PANTHOR_VM_BIND_OP_MAP_READONLY = 1 << 0,
|
| 602 |
|
| 603 | |
| 604 | * @DRM_PANTHOR_VM_BIND_OP_MAP_NOEXEC: Map the memory not-executable.
|
| 605 | *
|
| 606 | * Only valid with DRM_PANTHOR_VM_BIND_OP_TYPE_MAP.
|
| 607 |
|
| 608 | DRM_PANTHOR_VM_BIND_OP_MAP_NOEXEC = 1 << 1,
|
| 609 |
|
| 610 | |
| 611 | * @DRM_PANTHOR_VM_BIND_OP_MAP_UNCACHED: Map the memory uncached.
|
| 612 | *
|
| 613 | * Only valid with DRM_PANTHOR_VM_BIND_OP_TYPE_MAP.
|
| 614 |
|
| 615 | DRM_PANTHOR_VM_BIND_OP_MAP_UNCACHED = 1 << 2,
|
| 616 |
|
| 617 | |
| 618 | * @DRM_PANTHOR_VM_BIND_OP_MAP_SPARSE: Sparsely map a virtual memory range
|
| 619 | *
|
| 620 | * Only valid with DRM_PANTHOR_VM_BIND_OP_TYPE_MAP.
|
| 621 | *
|
| 622 | * When this flag is set, the whole vm_bind range is mapped over a dummy object in a cyclic
|
| 623 | * fashion, and all GPU reads from addresses in the range return undefined values. This flag
|
| 624 | * being set means drm_panthor_vm_bind_op::bo_offset and drm_panthor_vm_bind_op::bo_handle
|
| 625 | * must both be set to 0. DRM_PANTHOR_VM_BIND_OP_MAP_NOEXEC must also be set.
|
| 626 |
|
| 627 | DRM_PANTHOR_VM_BIND_OP_MAP_SPARSE = 1 << 3,
|
| 628 |
|
| 629 | |
| 630 | * @DRM_PANTHOR_VM_BIND_OP_TYPE_MASK: Mask used to determine the type of operation.
|
| 631 |
|
| 632 | DRM_PANTHOR_VM_BIND_OP_TYPE_MASK = (int)(0xfu << 28),
|
| 633 |
|
| 634 |
|
| 635 | DRM_PANTHOR_VM_BIND_OP_TYPE_MAP = 0 << 28,
|
| 636 |
|
| 637 |
|
| 638 | DRM_PANTHOR_VM_BIND_OP_TYPE_UNMAP = 1 << 28,
|
| 639 |
|
| 640 | |
| 641 | * @DRM_PANTHOR_VM_BIND_OP_TYPE_SYNC_ONLY: No VM operation.
|
| 642 | *
|
| 643 | * Just serves as a synchronization point on a VM queue.
|
| 644 | *
|
| 645 | * Only valid if %DRM_PANTHOR_VM_BIND_ASYNC is set in drm_panthor_vm_bind::flags,
|
| 646 | * and drm_panthor_vm_bind_op::syncs contains at least one element.
|
| 647 |
|
| 648 | DRM_PANTHOR_VM_BIND_OP_TYPE_SYNC_ONLY = 2 << 28,
|
| 649 | };
|
| 650 |
|
| 651 | |
| 652 | * struct drm_panthor_vm_bind_op - VM bind operation
|
| 653 |
|
| 654 | struct drm_panthor_vm_bind_op {
|
| 655 |
|
| 656 | __u32 flags;
|
| 657 |
|
| 658 | |
| 659 | * @bo_handle: Handle of the buffer object to map.
|
| 660 | * MBZ for unmap or sync-only operations.
|
| 661 |
|
| 662 | __u32 bo_handle;
|
| 663 |
|
| 664 | |
| 665 | * @bo_offset: Buffer object offset.
|
| 666 | * MBZ for unmap or sync-only operations.
|
| 667 |
|
| 668 | __u64 bo_offset;
|
| 669 |
|
| 670 | |
| 671 | * @va: Virtual address to map/unmap.
|
| 672 | * MBZ for sync-only operations.
|
| 673 |
|
| 674 | __u64 va;
|
| 675 |
|
| 676 | |
| 677 | * @size: Size to map/unmap.
|
| 678 | * MBZ for sync-only operations.
|
| 679 |
|
| 680 | __u64 size;
|
| 681 |
|
| 682 | |
| 683 | * @syncs: Array of struct drm_panthor_sync_op synchronization
|
| 684 | * operations.
|
| 685 | *
|
| 686 | * This array must be empty if %DRM_PANTHOR_VM_BIND_ASYNC is not set on
|
| 687 | * the drm_panthor_vm_bind object containing this VM bind operation.
|
| 688 | *
|
| 689 | * This array shall not be empty for sync-only operations.
|
| 690 |
|
| 691 | struct drm_panthor_obj_array syncs;
|
| 692 | };
|
| 693 |
|
| 694 | |
| 695 | * enum drm_panthor_vm_bind_flags - VM bind flags
|
| 696 |
|
| 697 | enum drm_panthor_vm_bind_flags {
|
| 698 | |
| 699 | * @DRM_PANTHOR_VM_BIND_ASYNC: VM bind operations are queued to the VM
|
| 700 | * queue instead of being executed synchronously.
|
| 701 |
|
| 702 | DRM_PANTHOR_VM_BIND_ASYNC = 1 << 0,
|
| 703 | };
|
| 704 |
|
| 705 | |
| 706 | * struct drm_panthor_vm_bind - Arguments passed to DRM_IOCTL_PANTHOR_VM_BIND
|
| 707 |
|
| 708 | struct drm_panthor_vm_bind {
|
| 709 |
|
| 710 | __u32 vm_id;
|
| 711 |
|
| 712 |
|
| 713 | __u32 flags;
|
| 714 |
|
| 715 |
|
| 716 | struct drm_panthor_obj_array ops;
|
| 717 | };
|
| 718 |
|
| 719 | |
| 720 | * enum drm_panthor_vm_state - VM states.
|
| 721 |
|
| 722 | enum drm_panthor_vm_state {
|
| 723 | |
| 724 | * @DRM_PANTHOR_VM_STATE_USABLE: VM is usable.
|
| 725 | *
|
| 726 | * New VM operations will be accepted on this VM.
|
| 727 |
|
| 728 | DRM_PANTHOR_VM_STATE_USABLE,
|
| 729 |
|
| 730 | |
| 731 | * @DRM_PANTHOR_VM_STATE_UNUSABLE: VM is unusable.
|
| 732 | *
|
| 733 | * Something put the VM in an unusable state (like an asynchronous
|
| 734 | * VM_BIND request failing for any reason).
|
| 735 | *
|
| 736 | * Once the VM is in this state, all new MAP operations will be
|
| 737 | * rejected, and any GPU job targeting this VM will fail.
|
| 738 | * UNMAP operations are still accepted.
|
| 739 | *
|
| 740 | * The only way to recover from an unusable VM is to create a new
|
| 741 | * VM, and destroy the old one.
|
| 742 |
|
| 743 | DRM_PANTHOR_VM_STATE_UNUSABLE,
|
| 744 | };
|
| 745 |
|
| 746 | |
| 747 | * struct drm_panthor_vm_get_state - Get VM state.
|
| 748 |
|
| 749 | struct drm_panthor_vm_get_state {
|
| 750 |
|
| 751 | __u32 vm_id;
|
| 752 |
|
| 753 | |
| 754 | * @state: state returned by the driver.
|
| 755 | *
|
| 756 | * Must be one of the enum drm_panthor_vm_state values.
|
| 757 |
|
| 758 | __u32 state;
|
| 759 | };
|
| 760 |
|
| 761 | |
| 762 | * enum drm_panthor_bo_flags - Buffer object flags, passed at creation time.
|
| 763 |
|
| 764 | enum drm_panthor_bo_flags {
|
| 765 |
|
| 766 | DRM_PANTHOR_BO_NO_MMAP = (1 << 0),
|
| 767 |
|
| 768 | |
| 769 | * @DRM_PANTHOR_BO_WB_MMAP: Force "Write-Back Cacheable" CPU mapping.
|
| 770 | *
|
| 771 | * CPU map the buffer object in userspace by forcing the "Write-Back
|
| 772 | * Cacheable" cacheability attribute. The mapping otherwise uses the
|
| 773 | * "Non-Cacheable" attribute if the GPU is not IO coherent.
|
| 774 |
|
| 775 | DRM_PANTHOR_BO_WB_MMAP = (1 << 1),
|
| 776 | };
|
| 777 |
|
| 778 | |
| 779 | * struct drm_panthor_bo_create - Arguments passed to DRM_IOCTL_PANTHOR_BO_CREATE.
|
| 780 |
|
| 781 | struct drm_panthor_bo_create {
|
| 782 | |
| 783 | * @size: Requested size for the object
|
| 784 | *
|
| 785 | * The (page-aligned) allocated size for the object will be returned.
|
| 786 |
|
| 787 | __u64 size;
|
| 788 |
|
| 789 | |
| 790 | * @flags: Flags. Must be a combination of drm_panthor_bo_flags flags.
|
| 791 |
|
| 792 | __u32 flags;
|
| 793 |
|
| 794 | |
| 795 | * @exclusive_vm_id: Exclusive VM this buffer object will be mapped to.
|
| 796 | *
|
| 797 | * If not zero, the field must refer to a valid VM ID, and implies that:
|
| 798 | * - the buffer object will only ever be bound to that VM
|
| 799 | * - cannot be exported as a PRIME fd
|
| 800 |
|
| 801 | __u32 exclusive_vm_id;
|
| 802 |
|
| 803 | |
| 804 | * @handle: Returned handle for the object.
|
| 805 | *
|
| 806 | * Object handles are nonzero.
|
| 807 |
|
| 808 | __u32 handle;
|
| 809 |
|
| 810 |
|
| 811 | __u32 pad;
|
| 812 | };
|
| 813 |
|
| 814 | |
| 815 | * struct drm_panthor_bo_mmap_offset - Arguments passed to DRM_IOCTL_PANTHOR_BO_MMAP_OFFSET.
|
| 816 |
|
| 817 | struct drm_panthor_bo_mmap_offset {
|
| 818 |
|
| 819 | __u32 handle;
|
| 820 |
|
| 821 |
|
| 822 | __u32 pad;
|
| 823 |
|
| 824 |
|
| 825 | __u64 offset;
|
| 826 | };
|
| 827 |
|
| 828 | |
| 829 | * struct drm_panthor_queue_create - Queue creation arguments.
|
| 830 |
|
| 831 | struct drm_panthor_queue_create {
|
| 832 | |
| 833 | * @priority: Defines the priority of queues inside a group. Goes from 0 to 15,
|
| 834 | * 15 being the highest priority.
|
| 835 |
|
| 836 | __u8 priority;
|
| 837 |
|
| 838 |
|
| 839 | __u8 pad[3];
|
| 840 |
|
| 841 |
|
| 842 | __u32 ringbuf_size;
|
| 843 | };
|
| 844 |
|
| 845 | |
| 846 | * enum drm_panthor_group_priority - Scheduling group priority
|
| 847 |
|
| 848 | enum drm_panthor_group_priority {
|
| 849 |
|
| 850 | PANTHOR_GROUP_PRIORITY_LOW = 0,
|
| 851 |
|
| 852 |
|
| 853 | PANTHOR_GROUP_PRIORITY_MEDIUM,
|
| 854 |
|
| 855 | |
| 856 | * @PANTHOR_GROUP_PRIORITY_HIGH: High priority group.
|
| 857 | *
|
| 858 | * Requires CAP_SYS_NICE or DRM_MASTER.
|
| 859 |
|
| 860 | PANTHOR_GROUP_PRIORITY_HIGH,
|
| 861 |
|
| 862 | |
| 863 | * @PANTHOR_GROUP_PRIORITY_REALTIME: Realtime priority group.
|
| 864 | *
|
| 865 | * Requires CAP_SYS_NICE or DRM_MASTER.
|
| 866 |
|
| 867 | PANTHOR_GROUP_PRIORITY_REALTIME,
|
| 868 | };
|
| 869 |
|
| 870 | |
| 871 | * struct drm_panthor_group_create - Arguments passed to DRM_IOCTL_PANTHOR_GROUP_CREATE
|
| 872 |
|
| 873 | struct drm_panthor_group_create {
|
| 874 |
|
| 875 | struct drm_panthor_obj_array queues;
|
| 876 |
|
| 877 | |
| 878 | * @max_compute_cores: Maximum number of cores that can be used by compute
|
| 879 | * jobs across CS queues bound to this group.
|
| 880 | *
|
| 881 | * Must be less or equal to the number of bits set in @compute_core_mask.
|
| 882 |
|
| 883 | __u8 max_compute_cores;
|
| 884 |
|
| 885 | |
| 886 | * @max_fragment_cores: Maximum number of cores that can be used by fragment
|
| 887 | * jobs across CS queues bound to this group.
|
| 888 | *
|
| 889 | * Must be less or equal to the number of bits set in @fragment_core_mask.
|
| 890 |
|
| 891 | __u8 max_fragment_cores;
|
| 892 |
|
| 893 | |
| 894 | * @max_tiler_cores: Maximum number of tilers that can be used by tiler jobs
|
| 895 | * across CS queues bound to this group.
|
| 896 | *
|
| 897 | * Must be less or equal to the number of bits set in @tiler_core_mask.
|
| 898 |
|
| 899 | __u8 max_tiler_cores;
|
| 900 |
|
| 901 |
|
| 902 | __u8 priority;
|
| 903 |
|
| 904 |
|
| 905 | __u32 pad;
|
| 906 |
|
| 907 | |
| 908 | * @compute_core_mask: Mask encoding cores that can be used for compute jobs.
|
| 909 | *
|
| 910 | * This field must have at least @max_compute_cores bits set.
|
| 911 | *
|
| 912 | * The bits set here should also be set in drm_panthor_gpu_info::shader_present.
|
| 913 |
|
| 914 | __u64 compute_core_mask;
|
| 915 |
|
| 916 | |
| 917 | * @fragment_core_mask: Mask encoding cores that can be used for fragment jobs.
|
| 918 | *
|
| 919 | * This field must have at least @max_fragment_cores bits set.
|
| 920 | *
|
| 921 | * The bits set here should also be set in drm_panthor_gpu_info::shader_present.
|
| 922 |
|
| 923 | __u64 fragment_core_mask;
|
| 924 |
|
| 925 | |
| 926 | * @tiler_core_mask: Mask encoding cores that can be used for tiler jobs.
|
| 927 | *
|
| 928 | * This field must have at least @max_tiler_cores bits set.
|
| 929 | *
|
| 930 | * The bits set here should also be set in drm_panthor_gpu_info::tiler_present.
|
| 931 |
|
| 932 | __u64 tiler_core_mask;
|
| 933 |
|
| 934 | |
| 935 | * @vm_id: VM ID to bind this group to.
|
| 936 | *
|
| 937 | * All submission to queues bound to this group will use this VM.
|
| 938 |
|
| 939 | __u32 vm_id;
|
| 940 |
|
| 941 | |
| 942 | * @group_handle: Returned group handle. Passed back when submitting jobs or
|
| 943 | * destroying a group.
|
| 944 |
|
| 945 | __u32 group_handle;
|
| 946 | };
|
| 947 |
|
| 948 | |
| 949 | * struct drm_panthor_group_destroy - Arguments passed to DRM_IOCTL_PANTHOR_GROUP_DESTROY
|
| 950 |
|
| 951 | struct drm_panthor_group_destroy {
|
| 952 |
|
| 953 | __u32 group_handle;
|
| 954 |
|
| 955 |
|
| 956 | __u32 pad;
|
| 957 | };
|
| 958 |
|
| 959 | |
| 960 | * struct drm_panthor_queue_submit - Job submission arguments.
|
| 961 | *
|
| 962 | * This is describing the userspace command stream to call from the kernel
|
| 963 | * command stream ring-buffer. Queue submission is always part of a group
|
| 964 | * submission, taking one or more jobs to submit to the underlying queues.
|
| 965 |
|
| 966 | struct drm_panthor_queue_submit {
|
| 967 |
|
| 968 | __u32 queue_index;
|
| 969 |
|
| 970 | |
| 971 | * @stream_size: Size of the command stream to execute.
|
| 972 | *
|
| 973 | * Must be 64-bit/8-byte aligned (the size of a CS instruction)
|
| 974 | *
|
| 975 | * Can be zero if stream_addr is zero too.
|
| 976 | *
|
| 977 | * When the stream size is zero, the queue submit serves as a
|
| 978 | * synchronization point.
|
| 979 |
|
| 980 | __u32 stream_size;
|
| 981 |
|
| 982 | |
| 983 | * @stream_addr: GPU address of the command stream to execute.
|
| 984 | *
|
| 985 | * Must be aligned on 64-byte.
|
| 986 | *
|
| 987 | * Can be zero is stream_size is zero too.
|
| 988 |
|
| 989 | __u64 stream_addr;
|
| 990 |
|
| 991 | |
| 992 | * @latest_flush: FLUSH_ID read at the time the stream was built.
|
| 993 | *
|
| 994 | * This allows cache flush elimination for the automatic
|
| 995 | * flush+invalidate(all) done at submission time, which is needed to
|
| 996 | * ensure the GPU doesn't get garbage when reading the indirect command
|
| 997 | * stream buffers. If you want the cache flush to happen
|
| 998 | * unconditionally, pass a zero here.
|
| 999 | *
|
| 1000 | * Ignored when stream_size is zero.
|
| 1001 |
|
| 1002 | __u32 latest_flush;
|
| 1003 |
|
| 1004 |
|
| 1005 | __u32 pad;
|
| 1006 |
|
| 1007 |
|
| 1008 | struct drm_panthor_obj_array syncs;
|
| 1009 | };
|
| 1010 |
|
| 1011 | |
| 1012 | * struct drm_panthor_group_submit - Arguments passed to DRM_IOCTL_PANTHOR_GROUP_SUBMIT
|
| 1013 |
|
| 1014 | struct drm_panthor_group_submit {
|
| 1015 |
|
| 1016 | __u32 group_handle;
|
| 1017 |
|
| 1018 |
|
| 1019 | __u32 pad;
|
| 1020 |
|
| 1021 |
|
| 1022 | struct drm_panthor_obj_array queue_submits;
|
| 1023 | };
|
| 1024 |
|
| 1025 | |
| 1026 | * enum drm_panthor_group_state_flags - Group state flags
|
| 1027 |
|
| 1028 | enum drm_panthor_group_state_flags {
|
| 1029 | |
| 1030 | * @DRM_PANTHOR_GROUP_STATE_TIMEDOUT: Group had unfinished jobs.
|
| 1031 | *
|
| 1032 | * When a group ends up with this flag set, no jobs can be submitted to its queues.
|
| 1033 |
|
| 1034 | DRM_PANTHOR_GROUP_STATE_TIMEDOUT = 1 << 0,
|
| 1035 |
|
| 1036 | |
| 1037 | * @DRM_PANTHOR_GROUP_STATE_FATAL_FAULT: Group had fatal faults.
|
| 1038 | *
|
| 1039 | * When a group ends up with this flag set, no jobs can be submitted to its queues.
|
| 1040 |
|
| 1041 | DRM_PANTHOR_GROUP_STATE_FATAL_FAULT = 1 << 1,
|
| 1042 |
|
| 1043 | |
| 1044 | * @DRM_PANTHOR_GROUP_STATE_INNOCENT: Group was killed during a reset caused by other
|
| 1045 | * groups.
|
| 1046 | *
|
| 1047 | * This flag can only be set if DRM_PANTHOR_GROUP_STATE_TIMEDOUT is set and
|
| 1048 | * DRM_PANTHOR_GROUP_STATE_FATAL_FAULT is not.
|
| 1049 |
|
| 1050 | DRM_PANTHOR_GROUP_STATE_INNOCENT = 1 << 2,
|
| 1051 | };
|
| 1052 |
|
| 1053 | |
| 1054 | * struct drm_panthor_group_get_state - Arguments passed to DRM_IOCTL_PANTHOR_GROUP_GET_STATE
|
| 1055 | *
|
| 1056 | * Used to query the state of a group and decide whether a new group should be created to
|
| 1057 | * replace it.
|
| 1058 |
|
| 1059 | struct drm_panthor_group_get_state {
|
| 1060 |
|
| 1061 | __u32 group_handle;
|
| 1062 |
|
| 1063 | |
| 1064 | * @state: Combination of DRM_PANTHOR_GROUP_STATE_* flags encoding the
|
| 1065 | * group state.
|
| 1066 |
|
| 1067 | __u32 state;
|
| 1068 |
|
| 1069 |
|
| 1070 | __u32 fatal_queues;
|
| 1071 |
|
| 1072 |
|
| 1073 | __u32 pad;
|
| 1074 | };
|
| 1075 |
|
| 1076 | |
| 1077 | * struct drm_panthor_tiler_heap_create - Arguments passed to DRM_IOCTL_PANTHOR_TILER_HEAP_CREATE
|
| 1078 |
|
| 1079 | struct drm_panthor_tiler_heap_create {
|
| 1080 |
|
| 1081 | __u32 vm_id;
|
| 1082 |
|
| 1083 |
|
| 1084 | __u32 initial_chunk_count;
|
| 1085 |
|
| 1086 | |
| 1087 | * @chunk_size: Chunk size.
|
| 1088 | *
|
| 1089 | * Must be page-aligned and lie in the [128k:8M] range.
|
| 1090 |
|
| 1091 | __u32 chunk_size;
|
| 1092 |
|
| 1093 | |
| 1094 | * @max_chunks: Maximum number of chunks that can be allocated.
|
| 1095 | *
|
| 1096 | * Must be at least @initial_chunk_count.
|
| 1097 |
|
| 1098 | __u32 max_chunks;
|
| 1099 |
|
| 1100 | |
| 1101 | * @target_in_flight: Maximum number of in-flight render passes.
|
| 1102 | *
|
| 1103 | * If the heap has more than tiler jobs in-flight, the FW will wait for render
|
| 1104 | * passes to finish before queuing new tiler jobs.
|
| 1105 |
|
| 1106 | __u32 target_in_flight;
|
| 1107 |
|
| 1108 |
|
| 1109 | __u32 handle;
|
| 1110 |
|
| 1111 |
|
| 1112 | __u64 tiler_heap_ctx_gpu_va;
|
| 1113 |
|
| 1114 | |
| 1115 | * @first_heap_chunk_gpu_va: First heap chunk.
|
| 1116 | *
|
| 1117 | * The tiler heap is formed of heap chunks forming a single-link list. This
|
| 1118 | * is the first element in the list.
|
| 1119 |
|
| 1120 | __u64 first_heap_chunk_gpu_va;
|
| 1121 | };
|
| 1122 |
|
| 1123 | |
| 1124 | * struct drm_panthor_tiler_heap_destroy - Arguments passed to DRM_IOCTL_PANTHOR_TILER_HEAP_DESTROY
|
| 1125 |
|
| 1126 | struct drm_panthor_tiler_heap_destroy {
|
| 1127 | |
| 1128 | * @handle: Handle of the tiler heap to destroy.
|
| 1129 | *
|
| 1130 | * Must be a valid heap handle returned by DRM_IOCTL_PANTHOR_TILER_HEAP_CREATE.
|
| 1131 |
|
| 1132 | __u32 handle;
|
| 1133 |
|
| 1134 |
|
| 1135 | __u32 pad;
|
| 1136 | };
|
| 1137 |
|
| 1138 | |
| 1139 | * struct drm_panthor_bo_set_label - Arguments passed to DRM_IOCTL_PANTHOR_BO_SET_LABEL
|
| 1140 |
|
| 1141 | struct drm_panthor_bo_set_label {
|
| 1142 |
|
| 1143 | __u32 handle;
|
| 1144 |
|
| 1145 |
|
| 1146 | __u32 pad;
|
| 1147 |
|
| 1148 | |
| 1149 | * @label: User pointer to a NUL-terminated string
|
| 1150 | *
|
| 1151 | * Length cannot be greater than 4096
|
| 1152 |
|
| 1153 | __u64 label;
|
| 1154 | };
|
| 1155 |
|
| 1156 | |
| 1157 | * struct drm_panthor_set_user_mmio_offset - Arguments passed to
|
| 1158 | * DRM_IOCTL_PANTHOR_SET_USER_MMIO_OFFSET
|
| 1159 | *
|
| 1160 | * This ioctl is only really useful if you want to support userspace
|
| 1161 | * CPU emulation environments where the size of an unsigned long differs
|
| 1162 | * between the host and the guest architectures.
|
| 1163 |
|
| 1164 | struct drm_panthor_set_user_mmio_offset {
|
| 1165 | |
| 1166 | * @offset: User MMIO offset to use.
|
| 1167 | *
|
| 1168 | * Must be either DRM_PANTHOR_USER_MMIO_OFFSET_32BIT or
|
| 1169 | * DRM_PANTHOR_USER_MMIO_OFFSET_64BIT.
|
| 1170 | *
|
| 1171 | * Use DRM_PANTHOR_USER_MMIO_OFFSET (which selects OFFSET_32BIT or
|
| 1172 | * OFFSET_64BIT based on the size of an unsigned long) unless you
|
| 1173 | * have a very good reason to overrule this decision.
|
| 1174 |
|
| 1175 | __u64 offset;
|
| 1176 | };
|
| 1177 |
|
| 1178 | |
| 1179 | * enum drm_panthor_bo_sync_op_type - BO sync type
|
| 1180 |
|
| 1181 | enum drm_panthor_bo_sync_op_type {
|
| 1182 |
|
| 1183 | DRM_PANTHOR_BO_SYNC_CPU_CACHE_FLUSH = 0,
|
| 1184 |
|
| 1185 |
|
| 1186 | DRM_PANTHOR_BO_SYNC_CPU_CACHE_FLUSH_AND_INVALIDATE = 1,
|
| 1187 | };
|
| 1188 |
|
| 1189 | |
| 1190 | * struct drm_panthor_bo_sync_op - BO map sync op
|
| 1191 |
|
| 1192 | struct drm_panthor_bo_sync_op {
|
| 1193 |
|
| 1194 | __u32 handle;
|
| 1195 |
|
| 1196 |
|
| 1197 | __u32 type;
|
| 1198 |
|
| 1199 | |
| 1200 | * @offset: Offset into the BO at which the sync range starts.
|
| 1201 | *
|
| 1202 | * This will be rounded down to the nearest cache line as needed.
|
| 1203 |
|
| 1204 | __u64 offset;
|
| 1205 |
|
| 1206 | |
| 1207 | * @size: Size of the range to sync
|
| 1208 | *
|
| 1209 | * @size + @offset will be rounded up to the nearest cache line as
|
| 1210 | * needed.
|
| 1211 |
|
| 1212 | __u64 size;
|
| 1213 | };
|
| 1214 |
|
| 1215 | |
| 1216 | * struct drm_panthor_bo_sync - BO map sync request
|
| 1217 |
|
| 1218 | struct drm_panthor_bo_sync {
|
| 1219 | |
| 1220 | * @ops: Array of struct drm_panthor_bo_sync_op sync operations.
|
| 1221 |
|
| 1222 | struct drm_panthor_obj_array ops;
|
| 1223 | };
|
| 1224 |
|
| 1225 | |
| 1226 | * enum drm_panthor_bo_extra_flags - Set of flags returned on a BO_QUERY_INFO request
|
| 1227 | *
|
| 1228 | * Those are flags reflecting BO properties that are not directly coming from the flags
|
| 1229 | * passed are creation time, or information on BOs that were imported from other drivers.
|
| 1230 |
|
| 1231 | enum drm_panthor_bo_extra_flags {
|
| 1232 | |
| 1233 | * @DRM_PANTHOR_BO_IS_IMPORTED: BO has been imported from an external driver.
|
| 1234 | *
|
| 1235 | * Note that imported dma-buf handles are not flagged as imported if they
|
| 1236 | * where exported by panthor. Only buffers that are coming from other drivers
|
| 1237 | * (dma heaps, other GPUs, display controllers, V4L, ...).
|
| 1238 | *
|
| 1239 | * It's also important to note that all imported BOs are mapped cached and can't
|
| 1240 | * be considered IO-coherent even if the GPU is. This means they require explicit
|
| 1241 | * syncs that must go through the DRM_PANTHOR_BO_SYNC ioctl (userland cache
|
| 1242 | * maintenance is not allowed in that case, because extra operations might be
|
| 1243 | * needed to make changes visible to the CPU/device, like buffer migration when the
|
| 1244 | * exporter is a GPU with its own VRAM).
|
| 1245 |
|
| 1246 | DRM_PANTHOR_BO_IS_IMPORTED = (1 << 0),
|
| 1247 | };
|
| 1248 |
|
| 1249 | |
| 1250 | * struct drm_panthor_bo_query_info - Query BO info
|
| 1251 |
|
| 1252 | struct drm_panthor_bo_query_info {
|
| 1253 |
|
| 1254 | __u32 handle;
|
| 1255 |
|
| 1256 | |
| 1257 | * @extra_flags: Combination of enum drm_panthor_bo_extra_flags flags.
|
| 1258 |
|
| 1259 | __u32 extra_flags;
|
| 1260 |
|
| 1261 | |
| 1262 | * @create_flags: Flags passed at creation time.
|
| 1263 | *
|
| 1264 | * Combination of enum drm_panthor_bo_flags flags.
|
| 1265 | * Will be zero if the buffer comes from a different driver.
|
| 1266 |
|
| 1267 | __u32 create_flags;
|
| 1268 |
|
| 1269 |
|
| 1270 | __u32 pad;
|
| 1271 | };
|
| 1272 |
|
| 1273 | |
| 1274 | * DRM_IOCTL_PANTHOR() - Build a Panthor IOCTL number
|
| 1275 | * @__access: Access type. Must be R, W or RW.
|
| 1276 | * @__id: One of the DRM_PANTHOR_xxx id.
|
| 1277 | * @__type: Suffix of the type being passed to the IOCTL.
|
| 1278 | *
|
| 1279 | * Don't use this macro directly, use the DRM_IOCTL_PANTHOR_xxx
|
| 1280 | * values instead.
|
| 1281 | *
|
| 1282 | * Return: An IOCTL number to be passed to ioctl() from userspace.
|
| 1283 |
|
| 1284 | #define DRM_IOCTL_PANTHOR(__access, __id, __type) \
|
| 1285 | DRM_IO ## __access(DRM_COMMAND_BASE + DRM_PANTHOR_ ## __id, \
|
| 1286 | struct drm_panthor_ ## __type)
|
| 1287 |
|
| 1288 | enum {
|
| 1289 | DRM_IOCTL_PANTHOR_DEV_QUERY =
|
| 1290 | DRM_IOCTL_PANTHOR(WR, DEV_QUERY, dev_query),
|
| 1291 | DRM_IOCTL_PANTHOR_VM_CREATE =
|
| 1292 | DRM_IOCTL_PANTHOR(WR, VM_CREATE, vm_create),
|
| 1293 | DRM_IOCTL_PANTHOR_VM_DESTROY =
|
| 1294 | DRM_IOCTL_PANTHOR(WR, VM_DESTROY, vm_destroy),
|
| 1295 | DRM_IOCTL_PANTHOR_VM_BIND =
|
| 1296 | DRM_IOCTL_PANTHOR(WR, VM_BIND, vm_bind),
|
| 1297 | DRM_IOCTL_PANTHOR_VM_GET_STATE =
|
| 1298 | DRM_IOCTL_PANTHOR(WR, VM_GET_STATE, vm_get_state),
|
| 1299 | DRM_IOCTL_PANTHOR_BO_CREATE =
|
| 1300 | DRM_IOCTL_PANTHOR(WR, BO_CREATE, bo_create),
|
| 1301 | DRM_IOCTL_PANTHOR_BO_MMAP_OFFSET =
|
| 1302 | DRM_IOCTL_PANTHOR(WR, BO_MMAP_OFFSET, bo_mmap_offset),
|
| 1303 | DRM_IOCTL_PANTHOR_GROUP_CREATE =
|
| 1304 | DRM_IOCTL_PANTHOR(WR, GROUP_CREATE, group_create),
|
| 1305 | DRM_IOCTL_PANTHOR_GROUP_DESTROY =
|
| 1306 | DRM_IOCTL_PANTHOR(WR, GROUP_DESTROY, group_destroy),
|
| 1307 | DRM_IOCTL_PANTHOR_GROUP_SUBMIT =
|
| 1308 | DRM_IOCTL_PANTHOR(WR, GROUP_SUBMIT, group_submit),
|
| 1309 | DRM_IOCTL_PANTHOR_GROUP_GET_STATE =
|
| 1310 | DRM_IOCTL_PANTHOR(WR, GROUP_GET_STATE, group_get_state),
|
| 1311 | DRM_IOCTL_PANTHOR_TILER_HEAP_CREATE =
|
| 1312 | DRM_IOCTL_PANTHOR(WR, TILER_HEAP_CREATE, tiler_heap_create),
|
| 1313 | DRM_IOCTL_PANTHOR_TILER_HEAP_DESTROY =
|
| 1314 | DRM_IOCTL_PANTHOR(WR, TILER_HEAP_DESTROY, tiler_heap_destroy),
|
| 1315 | DRM_IOCTL_PANTHOR_BO_SET_LABEL =
|
| 1316 | DRM_IOCTL_PANTHOR(WR, BO_SET_LABEL, bo_set_label),
|
| 1317 | DRM_IOCTL_PANTHOR_SET_USER_MMIO_OFFSET =
|
| 1318 | DRM_IOCTL_PANTHOR(WR, SET_USER_MMIO_OFFSET, set_user_mmio_offset),
|
| 1319 | DRM_IOCTL_PANTHOR_BO_SYNC =
|
| 1320 | DRM_IOCTL_PANTHOR(WR, BO_SYNC, bo_sync),
|
| 1321 | DRM_IOCTL_PANTHOR_BO_QUERY_INFO =
|
| 1322 | DRM_IOCTL_PANTHOR(WR, BO_QUERY_INFO, bo_query_info),
|
| 1323 | };
|
| 1324 |
|
| 1325 | #if defined(__cplusplus)
|
| 1326 | }
|
| 1327 | #endif
|
| 1328 |
|
| 1329 | #endif
|