panthor_drm.h 35 KB

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