logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

pvr_drm.h (40166B)


  1. /* SPDX-License-Identifier: (GPL-2.0-only WITH Linux-syscall-note) OR MIT */
  2. /* Copyright (c) 2023 Imagination Technologies Ltd. */
  3. #ifndef PVR_DRM_UAPI_H
  4. #define PVR_DRM_UAPI_H
  5. #include "drm.h"
  6. #include <linux/const.h>
  7. #include <linux/types.h>
  8. #if defined(__cplusplus)
  9. extern "C" {
  10. #endif
  11. /**
  12. * DOC: PowerVR UAPI
  13. *
  14. * The PowerVR IOCTL argument structs have a few limitations in place, in
  15. * addition to the standard kernel restrictions:
  16. *
  17. * - All members must be type-aligned.
  18. * - The overall struct must be padded to 64-bit alignment.
  19. * - Explicit padding is almost always required. This takes the form of
  20. * ``_padding_[x]`` members of sufficient size to pad to the next power-of-two
  21. * alignment, where [x] is the offset into the struct in hexadecimal. Arrays
  22. * are never used for alignment. Padding fields must be zeroed; this is
  23. * always checked.
  24. * - Unions may only appear as the last member of a struct.
  25. * - Individual union members may grow in the future. The space between the
  26. * end of a union member and the end of its containing union is considered
  27. * "implicit padding" and must be zeroed. This is always checked.
  28. *
  29. * In addition to the IOCTL argument structs, the PowerVR UAPI makes use of
  30. * DEV_QUERY argument structs. These are used to fetch information about the
  31. * device and runtime. These structs are subject to the same rules set out
  32. * above.
  33. */
  34. /**
  35. * struct drm_pvr_obj_array - Container used to pass arrays of objects
  36. *
  37. * It is not unusual to have to extend objects to pass new parameters, and the DRM
  38. * ioctl infrastructure is supporting that by padding ioctl arguments with zeros
  39. * when the data passed by userspace is smaller than the struct defined in the
  40. * drm_ioctl_desc, thus keeping things backward compatible. This type is just
  41. * applying the same concepts to indirect objects passed through arrays referenced
  42. * from the main ioctl arguments structure: the stride basically defines the size
  43. * of the object passed by userspace, which allows the kernel driver to pad with
  44. * zeros when it's smaller than the size of the object it expects.
  45. *
  46. * Use ``DRM_PVR_OBJ_ARRAY()`` to fill object array fields, unless you
  47. * have a very good reason not to.
  48. */
  49. struct drm_pvr_obj_array {
  50. /** @stride: Stride of object struct. Used for versioning. */
  51. __u32 stride;
  52. /** @count: Number of objects in the array. */
  53. __u32 count;
  54. /** @array: User pointer to an array of objects. */
  55. __u64 array;
  56. };
  57. /**
  58. * DRM_PVR_OBJ_ARRAY() - Helper macro for filling &struct drm_pvr_obj_array.
  59. * @cnt: Number of elements pointed to py @ptr.
  60. * @ptr: Pointer to start of a C array.
  61. *
  62. * Return: Literal of type &struct drm_pvr_obj_array.
  63. */
  64. #define DRM_PVR_OBJ_ARRAY(cnt, ptr) \
  65. { .stride = sizeof((ptr)[0]), .count = (cnt), .array = (__u64)(uintptr_t)(ptr) }
  66. /**
  67. * DOC: PowerVR IOCTL interface
  68. */
  69. /**
  70. * PVR_IOCTL() - Build a PowerVR IOCTL number
  71. * @_ioctl: An incrementing id for this IOCTL. Added to %DRM_COMMAND_BASE.
  72. * @_mode: Must be one of %DRM_IOR, %DRM_IOW or %DRM_IOWR.
  73. * @_data: The type of the args struct passed by this IOCTL.
  74. *
  75. * The struct referred to by @_data must have a ``drm_pvr_ioctl_`` prefix and an
  76. * ``_args suffix``. They are therefore omitted from @_data.
  77. *
  78. * This should only be used to build the constants described below; it should
  79. * never be used to call an IOCTL directly.
  80. *
  81. * Return: An IOCTL number to be passed to ioctl() from userspace.
  82. */
  83. #define PVR_IOCTL(_ioctl, _mode, _data) \
  84. _mode(DRM_COMMAND_BASE + (_ioctl), struct drm_pvr_ioctl_##_data##_args)
  85. #define DRM_IOCTL_PVR_DEV_QUERY PVR_IOCTL(0x00, DRM_IOWR, dev_query)
  86. #define DRM_IOCTL_PVR_CREATE_BO PVR_IOCTL(0x01, DRM_IOWR, create_bo)
  87. #define DRM_IOCTL_PVR_GET_BO_MMAP_OFFSET PVR_IOCTL(0x02, DRM_IOWR, get_bo_mmap_offset)
  88. #define DRM_IOCTL_PVR_CREATE_VM_CONTEXT PVR_IOCTL(0x03, DRM_IOWR, create_vm_context)
  89. #define DRM_IOCTL_PVR_DESTROY_VM_CONTEXT PVR_IOCTL(0x04, DRM_IOW, destroy_vm_context)
  90. #define DRM_IOCTL_PVR_VM_MAP PVR_IOCTL(0x05, DRM_IOW, vm_map)
  91. #define DRM_IOCTL_PVR_VM_UNMAP PVR_IOCTL(0x06, DRM_IOW, vm_unmap)
  92. #define DRM_IOCTL_PVR_CREATE_CONTEXT PVR_IOCTL(0x07, DRM_IOWR, create_context)
  93. #define DRM_IOCTL_PVR_DESTROY_CONTEXT PVR_IOCTL(0x08, DRM_IOW, destroy_context)
  94. #define DRM_IOCTL_PVR_CREATE_FREE_LIST PVR_IOCTL(0x09, DRM_IOWR, create_free_list)
  95. #define DRM_IOCTL_PVR_DESTROY_FREE_LIST PVR_IOCTL(0x0a, DRM_IOW, destroy_free_list)
  96. #define DRM_IOCTL_PVR_CREATE_HWRT_DATASET PVR_IOCTL(0x0b, DRM_IOWR, create_hwrt_dataset)
  97. #define DRM_IOCTL_PVR_DESTROY_HWRT_DATASET PVR_IOCTL(0x0c, DRM_IOW, destroy_hwrt_dataset)
  98. #define DRM_IOCTL_PVR_SUBMIT_JOBS PVR_IOCTL(0x0d, DRM_IOW, submit_jobs)
  99. /**
  100. * DOC: PowerVR IOCTL DEV_QUERY interface
  101. */
  102. /**
  103. * struct drm_pvr_dev_query_gpu_info - Container used to fetch information about
  104. * the graphics processor.
  105. *
  106. * When fetching this type &struct drm_pvr_ioctl_dev_query_args.type must be set
  107. * to %DRM_PVR_DEV_QUERY_GPU_INFO_GET.
  108. */
  109. struct drm_pvr_dev_query_gpu_info {
  110. /**
  111. * @gpu_id: GPU identifier.
  112. *
  113. * For all currently supported GPUs this is the BVNC encoded as a 64-bit
  114. * value as follows:
  115. *
  116. * +--------+--------+--------+-------+
  117. * | 63..48 | 47..32 | 31..16 | 15..0 |
  118. * +========+========+========+=======+
  119. * | B | V | N | C |
  120. * +--------+--------+--------+-------+
  121. */
  122. __u64 gpu_id;
  123. /**
  124. * @num_phantoms: Number of Phantoms present.
  125. */
  126. __u32 num_phantoms;
  127. /** @_padding_c: Reserved. This field must be zeroed. */
  128. __u32 _padding_c;
  129. };
  130. /**
  131. * struct drm_pvr_dev_query_runtime_info - Container used to fetch information
  132. * about the graphics runtime.
  133. *
  134. * When fetching this type &struct drm_pvr_ioctl_dev_query_args.type must be set
  135. * to %DRM_PVR_DEV_QUERY_RUNTIME_INFO_GET.
  136. */
  137. struct drm_pvr_dev_query_runtime_info {
  138. /**
  139. * @free_list_min_pages: Minimum allowed free list size,
  140. * in PM physical pages.
  141. */
  142. __u64 free_list_min_pages;
  143. /**
  144. * @free_list_max_pages: Maximum allowed free list size,
  145. * in PM physical pages.
  146. */
  147. __u64 free_list_max_pages;
  148. /**
  149. * @common_store_alloc_region_size: Size of the Allocation
  150. * Region within the Common Store used for coefficient and shared
  151. * registers, in dwords.
  152. */
  153. __u32 common_store_alloc_region_size;
  154. /**
  155. * @common_store_partition_space_size: Size of the
  156. * Partition Space within the Common Store for output buffers, in
  157. * dwords.
  158. */
  159. __u32 common_store_partition_space_size;
  160. /**
  161. * @max_coeffs: Maximum coefficients, in dwords.
  162. */
  163. __u32 max_coeffs;
  164. /**
  165. * @cdm_max_local_mem_size_regs: Maximum amount of local
  166. * memory available to a compute kernel, in dwords.
  167. */
  168. __u32 cdm_max_local_mem_size_regs;
  169. };
  170. /**
  171. * struct drm_pvr_dev_query_quirks - Container used to fetch information about
  172. * hardware fixes for which the device may require support in the user mode
  173. * driver.
  174. *
  175. * When fetching this type &struct drm_pvr_ioctl_dev_query_args.type must be set
  176. * to %DRM_PVR_DEV_QUERY_QUIRKS_GET.
  177. */
  178. struct drm_pvr_dev_query_quirks {
  179. /**
  180. * @quirks: A userspace address for the hardware quirks __u32 array.
  181. *
  182. * The first @musthave_count items in the list are quirks that the
  183. * client must support for this device. If userspace does not support
  184. * all these quirks then functionality is not guaranteed and client
  185. * initialisation must fail.
  186. * The remaining quirks in the list affect userspace and the kernel or
  187. * firmware. They are disabled by default and require userspace to
  188. * opt-in. The opt-in mechanism depends on the quirk.
  189. */
  190. __u64 quirks;
  191. /** @count: Length of @quirks (number of __u32). */
  192. __u16 count;
  193. /**
  194. * @musthave_count: The number of entries in @quirks that are
  195. * mandatory, starting at index 0.
  196. */
  197. __u16 musthave_count;
  198. /** @_padding_c: Reserved. This field must be zeroed. */
  199. __u32 _padding_c;
  200. };
  201. /**
  202. * struct drm_pvr_dev_query_enhancements - Container used to fetch information
  203. * about optional enhancements supported by the device that require support in
  204. * the user mode driver.
  205. *
  206. * When fetching this type &struct drm_pvr_ioctl_dev_query_args.type must be set
  207. * to %DRM_PVR_DEV_ENHANCEMENTS_GET.
  208. */
  209. struct drm_pvr_dev_query_enhancements {
  210. /**
  211. * @enhancements: A userspace address for the hardware enhancements
  212. * __u32 array.
  213. *
  214. * These enhancements affect userspace and the kernel or firmware. They
  215. * are disabled by default and require userspace to opt-in. The opt-in
  216. * mechanism depends on the enhancement.
  217. */
  218. __u64 enhancements;
  219. /** @count: Length of @enhancements (number of __u32). */
  220. __u16 count;
  221. /** @_padding_a: Reserved. This field must be zeroed. */
  222. __u16 _padding_a;
  223. /** @_padding_c: Reserved. This field must be zeroed. */
  224. __u32 _padding_c;
  225. };
  226. /**
  227. * enum drm_pvr_heap_id - Array index for heap info data returned by
  228. * %DRM_PVR_DEV_QUERY_HEAP_INFO_GET.
  229. *
  230. * For compatibility reasons all indices will be present in the returned array,
  231. * however some heaps may not be present. These are indicated where
  232. * &struct drm_pvr_heap.size is set to zero.
  233. */
  234. enum drm_pvr_heap_id {
  235. /** @DRM_PVR_HEAP_GENERAL: General purpose heap. */
  236. DRM_PVR_HEAP_GENERAL = 0,
  237. /** @DRM_PVR_HEAP_PDS_CODE_DATA: PDS code and data heap. */
  238. DRM_PVR_HEAP_PDS_CODE_DATA,
  239. /** @DRM_PVR_HEAP_USC_CODE: USC code heap. */
  240. DRM_PVR_HEAP_USC_CODE,
  241. /** @DRM_PVR_HEAP_RGNHDR: Region header heap. Only used if GPU has BRN63142. */
  242. DRM_PVR_HEAP_RGNHDR,
  243. /** @DRM_PVR_HEAP_VIS_TEST: Visibility test heap. */
  244. DRM_PVR_HEAP_VIS_TEST,
  245. /** @DRM_PVR_HEAP_TRANSFER_FRAG: Transfer fragment heap. */
  246. DRM_PVR_HEAP_TRANSFER_FRAG,
  247. /**
  248. * @DRM_PVR_HEAP_COUNT: The number of heaps returned by
  249. * %DRM_PVR_DEV_QUERY_HEAP_INFO_GET.
  250. *
  251. * More heaps may be added, so this also serves as the copy limit when
  252. * sent by the caller.
  253. */
  254. DRM_PVR_HEAP_COUNT
  255. /* Please only add additional heaps above DRM_PVR_HEAP_COUNT! */
  256. };
  257. /**
  258. * struct drm_pvr_heap - Container holding information about a single heap.
  259. *
  260. * This will always be fetched as an array.
  261. */
  262. struct drm_pvr_heap {
  263. /** @base: Base address of heap. */
  264. __u64 base;
  265. /** @size: Size of heap, in bytes. Will be 0 if the heap is not present. */
  266. __u64 size;
  267. /** @flags: Flags for this heap. Currently always 0. */
  268. __u32 flags;
  269. /** @page_size_log2: Log2 of page size. */
  270. __u32 page_size_log2;
  271. };
  272. /**
  273. * struct drm_pvr_dev_query_heap_info - Container used to fetch information
  274. * about heaps supported by the device driver.
  275. *
  276. * Please note all driver-supported heaps will be returned up to &heaps.count.
  277. * Some heaps will not be present in all devices, which will be indicated by
  278. * &struct drm_pvr_heap.size being set to zero.
  279. *
  280. * When fetching this type &struct drm_pvr_ioctl_dev_query_args.type must be set
  281. * to %DRM_PVR_DEV_QUERY_HEAP_INFO_GET.
  282. */
  283. struct drm_pvr_dev_query_heap_info {
  284. /**
  285. * @heaps: Array of &struct drm_pvr_heap. If pointer is NULL, the count
  286. * and stride will be updated with those known to the driver version, to
  287. * facilitate allocation by the caller.
  288. */
  289. struct drm_pvr_obj_array heaps;
  290. };
  291. /**
  292. * enum drm_pvr_static_data_area_usage - Array index for static data area info
  293. * returned by %DRM_PVR_DEV_QUERY_STATIC_DATA_AREAS_GET.
  294. *
  295. * For compatibility reasons all indices will be present in the returned array,
  296. * however some areas may not be present. These are indicated where
  297. * &struct drm_pvr_static_data_area.size is set to zero.
  298. */
  299. enum drm_pvr_static_data_area_usage {
  300. /**
  301. * @DRM_PVR_STATIC_DATA_AREA_EOT: End of Tile PDS program code segment.
  302. *
  303. * The End of Tile PDS task runs at completion of a tile during a fragment job, and is
  304. * responsible for emitting the tile to the Pixel Back End.
  305. */
  306. DRM_PVR_STATIC_DATA_AREA_EOT = 0,
  307. /**
  308. * @DRM_PVR_STATIC_DATA_AREA_FENCE: MCU fence area, used during cache flush and
  309. * invalidation.
  310. *
  311. * This must point to valid physical memory but the contents otherwise are not used.
  312. */
  313. DRM_PVR_STATIC_DATA_AREA_FENCE,
  314. /**
  315. * @DRM_PVR_STATIC_DATA_AREA_VDM_SYNC: VDM sync program.
  316. *
  317. * The VDM sync program is used to synchronise multiple areas of the GPU hardware.
  318. */
  319. DRM_PVR_STATIC_DATA_AREA_VDM_SYNC,
  320. /**
  321. * @DRM_PVR_STATIC_DATA_AREA_YUV_CSC: YUV coefficients.
  322. *
  323. * Area contains up to 16 slots with stride of 64 bytes. Each is a 3x4 matrix of u16 fixed
  324. * point numbers, with 1 sign bit, 2 integer bits and 13 fractional bits.
  325. *
  326. * The slots are :
  327. * 0 = VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY_KHR
  328. * 1 = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY_KHR (full range)
  329. * 2 = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY_KHR (conformant range)
  330. * 3 = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709_KHR (full range)
  331. * 4 = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709_KHR (conformant range)
  332. * 5 = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601_KHR (full range)
  333. * 6 = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601_KHR (conformant range)
  334. * 7 = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020_KHR (full range)
  335. * 8 = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020_KHR (conformant range)
  336. * 9 = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601_KHR (conformant range, 10 bit)
  337. * 10 = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709_KHR (conformant range, 10 bit)
  338. * 11 = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020_KHR (conformant range, 10 bit)
  339. * 14 = Identity (biased)
  340. * 15 = Identity
  341. */
  342. DRM_PVR_STATIC_DATA_AREA_YUV_CSC,
  343. };
  344. /**
  345. * struct drm_pvr_static_data_area - Container holding information about a
  346. * single static data area.
  347. *
  348. * This will always be fetched as an array.
  349. */
  350. struct drm_pvr_static_data_area {
  351. /**
  352. * @area_usage: Usage of static data area.
  353. * See &enum drm_pvr_static_data_area_usage.
  354. */
  355. __u16 area_usage;
  356. /**
  357. * @location_heap_id: Array index of heap where this of static data
  358. * area is located. This array is fetched using
  359. * %DRM_PVR_DEV_QUERY_HEAP_INFO_GET.
  360. */
  361. __u16 location_heap_id;
  362. /** @size: Size of static data area. Not present if set to zero. */
  363. __u32 size;
  364. /** @offset: Offset of static data area from start of heap. */
  365. __u64 offset;
  366. };
  367. /**
  368. * struct drm_pvr_dev_query_static_data_areas - Container used to fetch
  369. * information about the static data areas in heaps supported by the device
  370. * driver.
  371. *
  372. * Please note all driver-supported static data areas will be returned up to
  373. * &static_data_areas.count. Some will not be present for all devices which,
  374. * will be indicated by &struct drm_pvr_static_data_area.size being set to zero.
  375. *
  376. * Further, some heaps will not be present either. See &struct
  377. * drm_pvr_dev_query_heap_info.
  378. *
  379. * When fetching this type &struct drm_pvr_ioctl_dev_query_args.type must be set
  380. * to %DRM_PVR_DEV_QUERY_STATIC_DATA_AREAS_GET.
  381. */
  382. struct drm_pvr_dev_query_static_data_areas {
  383. /**
  384. * @static_data_areas: Array of &struct drm_pvr_static_data_area. If
  385. * pointer is NULL, the count and stride will be updated with those
  386. * known to the driver version, to facilitate allocation by the caller.
  387. */
  388. struct drm_pvr_obj_array static_data_areas;
  389. };
  390. /**
  391. * enum drm_pvr_dev_query - For use with &drm_pvr_ioctl_dev_query_args.type to
  392. * indicate the type of the receiving container.
  393. *
  394. * Append only. Do not reorder.
  395. */
  396. enum drm_pvr_dev_query {
  397. /**
  398. * @DRM_PVR_DEV_QUERY_GPU_INFO_GET: The dev query args contain a pointer
  399. * to &struct drm_pvr_dev_query_gpu_info.
  400. */
  401. DRM_PVR_DEV_QUERY_GPU_INFO_GET = 0,
  402. /**
  403. * @DRM_PVR_DEV_QUERY_RUNTIME_INFO_GET: The dev query args contain a
  404. * pointer to &struct drm_pvr_dev_query_runtime_info.
  405. */
  406. DRM_PVR_DEV_QUERY_RUNTIME_INFO_GET,
  407. /**
  408. * @DRM_PVR_DEV_QUERY_QUIRKS_GET: The dev query args contain a pointer
  409. * to &struct drm_pvr_dev_query_quirks.
  410. */
  411. DRM_PVR_DEV_QUERY_QUIRKS_GET,
  412. /**
  413. * @DRM_PVR_DEV_QUERY_ENHANCEMENTS_GET: The dev query args contain a
  414. * pointer to &struct drm_pvr_dev_query_enhancements.
  415. */
  416. DRM_PVR_DEV_QUERY_ENHANCEMENTS_GET,
  417. /**
  418. * @DRM_PVR_DEV_QUERY_HEAP_INFO_GET: The dev query args contain a
  419. * pointer to &struct drm_pvr_dev_query_heap_info.
  420. */
  421. DRM_PVR_DEV_QUERY_HEAP_INFO_GET,
  422. /**
  423. * @DRM_PVR_DEV_QUERY_STATIC_DATA_AREAS_GET: The dev query args contain
  424. * a pointer to &struct drm_pvr_dev_query_static_data_areas.
  425. */
  426. DRM_PVR_DEV_QUERY_STATIC_DATA_AREAS_GET,
  427. };
  428. /**
  429. * struct drm_pvr_ioctl_dev_query_args - Arguments for %DRM_IOCTL_PVR_DEV_QUERY.
  430. */
  431. struct drm_pvr_ioctl_dev_query_args {
  432. /**
  433. * @type: Type of query and output struct. See &enum drm_pvr_dev_query.
  434. */
  435. __u32 type;
  436. /**
  437. * @size: Size of the receiving struct, see @type.
  438. *
  439. * After a successful call this will be updated to the written byte
  440. * length.
  441. * Can also be used to get the minimum byte length (see @pointer).
  442. * This allows additional fields to be appended to the structs in
  443. * future.
  444. */
  445. __u32 size;
  446. /**
  447. * @pointer: Pointer to struct @type.
  448. *
  449. * Must be large enough to contain @size bytes.
  450. * If pointer is NULL, the expected size will be returned in the @size
  451. * field, but no other data will be written.
  452. */
  453. __u64 pointer;
  454. };
  455. /**
  456. * DOC: PowerVR IOCTL CREATE_BO interface
  457. */
  458. /**
  459. * DOC: Flags for CREATE_BO
  460. *
  461. * We use "device" to refer to the GPU here because of the ambiguity between CPU and GPU in some
  462. * fonts.
  463. *
  464. * Device mapping options
  465. * :DRM_PVR_BO_BYPASS_DEVICE_CACHE: Specify that device accesses to this memory will bypass the
  466. * cache. This is used for buffers that will either be regularly updated by the CPU (eg free
  467. * lists) or will be accessed only once and therefore isn't worth caching (eg partial render
  468. * buffers).
  469. * By default, the device flushes its memory caches after every job, so this is not normally
  470. * required for coherency.
  471. * :DRM_PVR_BO_PM_FW_PROTECT: Specify that only the Parameter Manager (PM) and/or firmware
  472. * processor should be allowed to access this memory when mapped to the device. It is not
  473. * valid to specify this flag with DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS.
  474. *
  475. * CPU mapping options
  476. * :DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS: Allow userspace to map and access the contents of this
  477. * memory. It is not valid to specify this flag with DRM_PVR_BO_PM_FW_PROTECT.
  478. */
  479. #define DRM_PVR_BO_BYPASS_DEVICE_CACHE _BITULL(0)
  480. #define DRM_PVR_BO_PM_FW_PROTECT _BITULL(1)
  481. #define DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS _BITULL(2)
  482. /* Bits 3..63 are reserved. */
  483. #define DRM_PVR_BO_FLAGS_MASK (DRM_PVR_BO_BYPASS_DEVICE_CACHE | DRM_PVR_BO_PM_FW_PROTECT | \
  484. DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS)
  485. /**
  486. * struct drm_pvr_ioctl_create_bo_args - Arguments for %DRM_IOCTL_PVR_CREATE_BO
  487. */
  488. struct drm_pvr_ioctl_create_bo_args {
  489. /**
  490. * @size: [IN] Size of buffer object to create. This must be page size
  491. * aligned.
  492. */
  493. __u64 size;
  494. /**
  495. * @handle: [OUT] GEM handle of the new buffer object for use in
  496. * userspace.
  497. */
  498. __u32 handle;
  499. /** @_padding_c: Reserved. This field must be zeroed. */
  500. __u32 _padding_c;
  501. /**
  502. * @flags: [IN] Options which will affect the behaviour of this
  503. * creation operation and future mapping operations on the created
  504. * object. This field must be a valid combination of ``DRM_PVR_BO_*``
  505. * values, with all bits marked as reserved set to zero.
  506. */
  507. __u64 flags;
  508. };
  509. /**
  510. * DOC: PowerVR IOCTL GET_BO_MMAP_OFFSET interface
  511. */
  512. /**
  513. * struct drm_pvr_ioctl_get_bo_mmap_offset_args - Arguments for
  514. * %DRM_IOCTL_PVR_GET_BO_MMAP_OFFSET
  515. *
  516. * Like other DRM drivers, the "mmap" IOCTL doesn't actually map any memory.
  517. * Instead, it allocates a fake offset which refers to the specified buffer
  518. * object. This offset can be used with a real mmap call on the DRM device
  519. * itself.
  520. */
  521. struct drm_pvr_ioctl_get_bo_mmap_offset_args {
  522. /** @handle: [IN] GEM handle of the buffer object to be mapped. */
  523. __u32 handle;
  524. /** @_padding_4: Reserved. This field must be zeroed. */
  525. __u32 _padding_4;
  526. /** @offset: [OUT] Fake offset to use in the real mmap call. */
  527. __u64 offset;
  528. };
  529. /**
  530. * DOC: PowerVR IOCTL CREATE_VM_CONTEXT and DESTROY_VM_CONTEXT interfaces
  531. */
  532. /**
  533. * struct drm_pvr_ioctl_create_vm_context_args - Arguments for
  534. * %DRM_IOCTL_PVR_CREATE_VM_CONTEXT
  535. */
  536. struct drm_pvr_ioctl_create_vm_context_args {
  537. /** @handle: [OUT] Handle for new VM context. */
  538. __u32 handle;
  539. /** @_padding_4: Reserved. This field must be zeroed. */
  540. __u32 _padding_4;
  541. };
  542. /**
  543. * struct drm_pvr_ioctl_destroy_vm_context_args - Arguments for
  544. * %DRM_IOCTL_PVR_DESTROY_VM_CONTEXT
  545. */
  546. struct drm_pvr_ioctl_destroy_vm_context_args {
  547. /**
  548. * @handle: [IN] Handle for VM context to be destroyed.
  549. */
  550. __u32 handle;
  551. /** @_padding_4: Reserved. This field must be zeroed. */
  552. __u32 _padding_4;
  553. };
  554. /**
  555. * DOC: PowerVR IOCTL VM_MAP and VM_UNMAP interfaces
  556. *
  557. * The VM UAPI allows userspace to create buffer object mappings in GPU virtual address space.
  558. *
  559. * The client is responsible for managing GPU address space. It should allocate mappings within
  560. * the heaps returned by %DRM_PVR_DEV_QUERY_HEAP_INFO_GET.
  561. *
  562. * %DRM_IOCTL_PVR_VM_MAP creates a new mapping. The client provides the target virtual address for
  563. * the mapping. Size and offset within the mapped buffer object can be specified, so the client can
  564. * partially map a buffer.
  565. *
  566. * %DRM_IOCTL_PVR_VM_UNMAP removes a mapping. The entire mapping will be removed from GPU address
  567. * space only if the size of the mapping matches that known to the driver.
  568. */
  569. /**
  570. * struct drm_pvr_ioctl_vm_map_args - Arguments for %DRM_IOCTL_PVR_VM_MAP.
  571. */
  572. struct drm_pvr_ioctl_vm_map_args {
  573. /**
  574. * @vm_context_handle: [IN] Handle for VM context for this mapping to
  575. * exist in.
  576. */
  577. __u32 vm_context_handle;
  578. /** @flags: [IN] Flags which affect this mapping. Currently always 0. */
  579. __u32 flags;
  580. /**
  581. * @device_addr: [IN] Requested device-virtual address for the mapping.
  582. * This must be non-zero and aligned to the device page size for the
  583. * heap containing the requested address. It is an error to specify an
  584. * address which is not contained within one of the heaps returned by
  585. * %DRM_PVR_DEV_QUERY_HEAP_INFO_GET.
  586. */
  587. __u64 device_addr;
  588. /**
  589. * @handle: [IN] Handle of the target buffer object. This must be a
  590. * valid handle returned by %DRM_IOCTL_PVR_CREATE_BO.
  591. */
  592. __u32 handle;
  593. /** @_padding_14: Reserved. This field must be zeroed. */
  594. __u32 _padding_14;
  595. /**
  596. * @offset: [IN] Offset into the target bo from which to begin the
  597. * mapping.
  598. */
  599. __u64 offset;
  600. /**
  601. * @size: [IN] Size of the requested mapping. Must be aligned to
  602. * the device page size for the heap containing the requested address,
  603. * as well as the host page size. When added to @device_addr, the
  604. * result must not overflow the heap which contains @device_addr (i.e.
  605. * the range specified by @device_addr and @size must be completely
  606. * contained within a single heap specified by
  607. * %DRM_PVR_DEV_QUERY_HEAP_INFO_GET).
  608. */
  609. __u64 size;
  610. };
  611. /**
  612. * struct drm_pvr_ioctl_vm_unmap_args - Arguments for %DRM_IOCTL_PVR_VM_UNMAP.
  613. */
  614. struct drm_pvr_ioctl_vm_unmap_args {
  615. /**
  616. * @vm_context_handle: [IN] Handle for VM context that this mapping
  617. * exists in.
  618. */
  619. __u32 vm_context_handle;
  620. /** @_padding_4: Reserved. This field must be zeroed. */
  621. __u32 _padding_4;
  622. /**
  623. * @device_addr: [IN] Device-virtual address at the start of the target
  624. * mapping. This must be non-zero.
  625. */
  626. __u64 device_addr;
  627. /**
  628. * @size: Size in bytes of the target mapping. This must be non-zero.
  629. */
  630. __u64 size;
  631. };
  632. /**
  633. * DOC: PowerVR IOCTL CREATE_CONTEXT and DESTROY_CONTEXT interfaces
  634. */
  635. /**
  636. * enum drm_pvr_ctx_priority - Arguments for
  637. * &drm_pvr_ioctl_create_context_args.priority
  638. */
  639. enum drm_pvr_ctx_priority {
  640. /** @DRM_PVR_CTX_PRIORITY_LOW: Priority below normal. */
  641. DRM_PVR_CTX_PRIORITY_LOW = -512,
  642. /** @DRM_PVR_CTX_PRIORITY_NORMAL: Normal priority. */
  643. DRM_PVR_CTX_PRIORITY_NORMAL = 0,
  644. /**
  645. * @DRM_PVR_CTX_PRIORITY_HIGH: Priority above normal.
  646. * Note this requires ``CAP_SYS_NICE`` or ``DRM_MASTER``.
  647. */
  648. DRM_PVR_CTX_PRIORITY_HIGH = 512,
  649. };
  650. /**
  651. * enum drm_pvr_ctx_type - Arguments for
  652. * &struct drm_pvr_ioctl_create_context_args.type
  653. */
  654. enum drm_pvr_ctx_type {
  655. /**
  656. * @DRM_PVR_CTX_TYPE_RENDER: Render context.
  657. */
  658. DRM_PVR_CTX_TYPE_RENDER = 0,
  659. /**
  660. * @DRM_PVR_CTX_TYPE_COMPUTE: Compute context.
  661. */
  662. DRM_PVR_CTX_TYPE_COMPUTE,
  663. /**
  664. * @DRM_PVR_CTX_TYPE_TRANSFER_FRAG: Transfer context for fragment data
  665. * master.
  666. */
  667. DRM_PVR_CTX_TYPE_TRANSFER_FRAG,
  668. };
  669. /**
  670. * struct drm_pvr_ioctl_create_context_args - Arguments for
  671. * %DRM_IOCTL_PVR_CREATE_CONTEXT
  672. */
  673. struct drm_pvr_ioctl_create_context_args {
  674. /**
  675. * @type: [IN] Type of context to create.
  676. *
  677. * This must be one of the values defined by &enum drm_pvr_ctx_type.
  678. */
  679. __u32 type;
  680. /** @flags: [IN] Flags for context. */
  681. __u32 flags;
  682. /**
  683. * @priority: [IN] Priority of new context.
  684. *
  685. * This must be one of the values defined by &enum drm_pvr_ctx_priority.
  686. */
  687. __s32 priority;
  688. /** @handle: [OUT] Handle for new context. */
  689. __u32 handle;
  690. /**
  691. * @static_context_state: [IN] Pointer to static context state stream.
  692. */
  693. __u64 static_context_state;
  694. /**
  695. * @static_context_state_len: [IN] Length of static context state, in bytes.
  696. */
  697. __u32 static_context_state_len;
  698. /**
  699. * @vm_context_handle: [IN] Handle for VM context that this context is
  700. * associated with.
  701. */
  702. __u32 vm_context_handle;
  703. /**
  704. * @callstack_addr: [IN] Address for initial call stack pointer. Only valid
  705. * if @type is %DRM_PVR_CTX_TYPE_RENDER, otherwise must be 0.
  706. */
  707. __u64 callstack_addr;
  708. };
  709. /**
  710. * struct drm_pvr_ioctl_destroy_context_args - Arguments for
  711. * %DRM_IOCTL_PVR_DESTROY_CONTEXT
  712. */
  713. struct drm_pvr_ioctl_destroy_context_args {
  714. /**
  715. * @handle: [IN] Handle for context to be destroyed.
  716. */
  717. __u32 handle;
  718. /** @_padding_4: Reserved. This field must be zeroed. */
  719. __u32 _padding_4;
  720. };
  721. /**
  722. * DOC: PowerVR IOCTL CREATE_FREE_LIST and DESTROY_FREE_LIST interfaces
  723. */
  724. /**
  725. * struct drm_pvr_ioctl_create_free_list_args - Arguments for
  726. * %DRM_IOCTL_PVR_CREATE_FREE_LIST
  727. *
  728. * Free list arguments have the following constraints :
  729. *
  730. * - @max_num_pages must be greater than zero.
  731. * - @grow_threshold must be between 0 and 100.
  732. * - @grow_num_pages must be less than or equal to &max_num_pages.
  733. * - @initial_num_pages, @max_num_pages and @grow_num_pages must be multiples
  734. * of 4.
  735. * - When &grow_num_pages is 0, @initial_num_pages must be equal to
  736. * @max_num_pages.
  737. * - When &grow_num_pages is non-zero, @initial_num_pages must be less than
  738. * @max_num_pages.
  739. */
  740. struct drm_pvr_ioctl_create_free_list_args {
  741. /**
  742. * @free_list_gpu_addr: [IN] Address of GPU mapping of buffer object
  743. * containing memory to be used by free list.
  744. *
  745. * The mapped region of the buffer object must be at least
  746. * @max_num_pages * ``sizeof(__u32)``.
  747. *
  748. * The buffer object must have been created with
  749. * %DRM_PVR_BO_DEVICE_PM_FW_PROTECT set and
  750. * %DRM_PVR_BO_CPU_ALLOW_USERSPACE_ACCESS not set.
  751. */
  752. __u64 free_list_gpu_addr;
  753. /** @initial_num_pages: [IN] Pages initially allocated to free list. */
  754. __u32 initial_num_pages;
  755. /** @max_num_pages: [IN] Maximum number of pages in free list. */
  756. __u32 max_num_pages;
  757. /** @grow_num_pages: [IN] Pages to grow free list by per request. */
  758. __u32 grow_num_pages;
  759. /**
  760. * @grow_threshold: [IN] Percentage of FL memory used that should
  761. * trigger a new grow request.
  762. */
  763. __u32 grow_threshold;
  764. /**
  765. * @vm_context_handle: [IN] Handle for VM context that the free list buffer
  766. * object is mapped in.
  767. */
  768. __u32 vm_context_handle;
  769. /**
  770. * @handle: [OUT] Handle for created free list.
  771. */
  772. __u32 handle;
  773. };
  774. /**
  775. * struct drm_pvr_ioctl_destroy_free_list_args - Arguments for
  776. * %DRM_IOCTL_PVR_DESTROY_FREE_LIST
  777. */
  778. struct drm_pvr_ioctl_destroy_free_list_args {
  779. /**
  780. * @handle: [IN] Handle for free list to be destroyed.
  781. */
  782. __u32 handle;
  783. /** @_padding_4: Reserved. This field must be zeroed. */
  784. __u32 _padding_4;
  785. };
  786. /**
  787. * DOC: PowerVR IOCTL CREATE_HWRT_DATASET and DESTROY_HWRT_DATASET interfaces
  788. */
  789. /**
  790. * struct drm_pvr_create_hwrt_geom_data_args - Geometry data arguments used for
  791. * &struct drm_pvr_ioctl_create_hwrt_dataset_args.geom_data_args.
  792. */
  793. struct drm_pvr_create_hwrt_geom_data_args {
  794. /** @tpc_dev_addr: [IN] Tail pointer cache GPU virtual address. */
  795. __u64 tpc_dev_addr;
  796. /** @tpc_size: [IN] Size of TPC, in bytes. */
  797. __u32 tpc_size;
  798. /** @tpc_stride: [IN] Stride between layers in TPC, in pages */
  799. __u32 tpc_stride;
  800. /** @vheap_table_dev_addr: [IN] VHEAP table GPU virtual address. */
  801. __u64 vheap_table_dev_addr;
  802. /** @rtc_dev_addr: [IN] Render Target Cache virtual address. */
  803. __u64 rtc_dev_addr;
  804. };
  805. /**
  806. * struct drm_pvr_create_hwrt_rt_data_args - Render target arguments used for
  807. * &struct drm_pvr_ioctl_create_hwrt_dataset_args.rt_data_args.
  808. */
  809. struct drm_pvr_create_hwrt_rt_data_args {
  810. /** @pm_mlist_dev_addr: [IN] PM MLIST GPU virtual address. */
  811. __u64 pm_mlist_dev_addr;
  812. /** @macrotile_array_dev_addr: [IN] Macrotile array GPU virtual address. */
  813. __u64 macrotile_array_dev_addr;
  814. /** @region_header_dev_addr: [IN] Region header array GPU virtual address. */
  815. __u64 region_header_dev_addr;
  816. };
  817. #define PVR_DRM_HWRT_FREE_LIST_LOCAL 0
  818. #define PVR_DRM_HWRT_FREE_LIST_GLOBAL 1U
  819. /**
  820. * struct drm_pvr_ioctl_create_hwrt_dataset_args - Arguments for
  821. * %DRM_IOCTL_PVR_CREATE_HWRT_DATASET
  822. */
  823. struct drm_pvr_ioctl_create_hwrt_dataset_args {
  824. /** @geom_data_args: [IN] Geometry data arguments. */
  825. struct drm_pvr_create_hwrt_geom_data_args geom_data_args;
  826. /**
  827. * @rt_data_args: [IN] Array of render target arguments.
  828. *
  829. * Each entry in this array represents a render target in a double buffered
  830. * setup.
  831. */
  832. struct drm_pvr_create_hwrt_rt_data_args rt_data_args[2];
  833. /**
  834. * @free_list_handles: [IN] Array of free list handles.
  835. *
  836. * free_list_handles[PVR_DRM_HWRT_FREE_LIST_LOCAL] must have initial
  837. * size of at least that reported by
  838. * &drm_pvr_dev_query_runtime_info.free_list_min_pages.
  839. */
  840. __u32 free_list_handles[2];
  841. /** @width: [IN] Width in pixels. */
  842. __u32 width;
  843. /** @height: [IN] Height in pixels. */
  844. __u32 height;
  845. /** @samples: [IN] Number of samples. */
  846. __u32 samples;
  847. /** @layers: [IN] Number of layers. */
  848. __u32 layers;
  849. /** @isp_merge_lower_x: [IN] Lower X coefficient for triangle merging. */
  850. __u32 isp_merge_lower_x;
  851. /** @isp_merge_lower_y: [IN] Lower Y coefficient for triangle merging. */
  852. __u32 isp_merge_lower_y;
  853. /** @isp_merge_scale_x: [IN] Scale X coefficient for triangle merging. */
  854. __u32 isp_merge_scale_x;
  855. /** @isp_merge_scale_y: [IN] Scale Y coefficient for triangle merging. */
  856. __u32 isp_merge_scale_y;
  857. /** @isp_merge_upper_x: [IN] Upper X coefficient for triangle merging. */
  858. __u32 isp_merge_upper_x;
  859. /** @isp_merge_upper_y: [IN] Upper Y coefficient for triangle merging. */
  860. __u32 isp_merge_upper_y;
  861. /**
  862. * @region_header_size: [IN] Size of region header array. This common field is used by
  863. * both render targets in this data set.
  864. *
  865. * The units for this field differ depending on what version of the simple internal
  866. * parameter format the device uses. If format 2 is in use then this is interpreted as the
  867. * number of region headers. For other formats it is interpreted as the size in dwords.
  868. */
  869. __u32 region_header_size;
  870. /**
  871. * @handle: [OUT] Handle for created HWRT dataset.
  872. */
  873. __u32 handle;
  874. };
  875. /**
  876. * struct drm_pvr_ioctl_destroy_hwrt_dataset_args - Arguments for
  877. * %DRM_IOCTL_PVR_DESTROY_HWRT_DATASET
  878. */
  879. struct drm_pvr_ioctl_destroy_hwrt_dataset_args {
  880. /**
  881. * @handle: [IN] Handle for HWRT dataset to be destroyed.
  882. */
  883. __u32 handle;
  884. /** @_padding_4: Reserved. This field must be zeroed. */
  885. __u32 _padding_4;
  886. };
  887. /**
  888. * DOC: PowerVR IOCTL SUBMIT_JOBS interface
  889. */
  890. /**
  891. * DOC: Flags for the drm_pvr_sync_op object.
  892. *
  893. * .. c:macro:: DRM_PVR_SYNC_OP_HANDLE_TYPE_MASK
  894. *
  895. * Handle type mask for the drm_pvr_sync_op::flags field.
  896. *
  897. * .. c:macro:: DRM_PVR_SYNC_OP_FLAG_HANDLE_TYPE_SYNCOBJ
  898. *
  899. * Indicates the handle passed in drm_pvr_sync_op::handle is a syncobj handle.
  900. * This is the default type.
  901. *
  902. * .. c:macro:: DRM_PVR_SYNC_OP_FLAG_HANDLE_TYPE_TIMELINE_SYNCOBJ
  903. *
  904. * Indicates the handle passed in drm_pvr_sync_op::handle is a timeline syncobj handle.
  905. *
  906. * .. c:macro:: DRM_PVR_SYNC_OP_FLAG_SIGNAL
  907. *
  908. * Signal operation requested. The out-fence bound to the job will be attached to
  909. * the syncobj whose handle is passed in drm_pvr_sync_op::handle.
  910. *
  911. * .. c:macro:: DRM_PVR_SYNC_OP_FLAG_WAIT
  912. *
  913. * Wait operation requested. The job will wait for this particular syncobj or syncobj
  914. * point to be signaled before being started.
  915. * This is the default operation.
  916. */
  917. #define DRM_PVR_SYNC_OP_FLAG_HANDLE_TYPE_MASK 0xf
  918. #define DRM_PVR_SYNC_OP_FLAG_HANDLE_TYPE_SYNCOBJ 0
  919. #define DRM_PVR_SYNC_OP_FLAG_HANDLE_TYPE_TIMELINE_SYNCOBJ 1
  920. #define DRM_PVR_SYNC_OP_FLAG_SIGNAL _BITULL(31)
  921. #define DRM_PVR_SYNC_OP_FLAG_WAIT 0
  922. #define DRM_PVR_SYNC_OP_FLAGS_MASK (DRM_PVR_SYNC_OP_FLAG_HANDLE_TYPE_MASK | \
  923. DRM_PVR_SYNC_OP_FLAG_SIGNAL)
  924. /**
  925. * struct drm_pvr_sync_op - Object describing a sync operation
  926. */
  927. struct drm_pvr_sync_op {
  928. /** @handle: Handle of sync object. */
  929. __u32 handle;
  930. /** @flags: Combination of ``DRM_PVR_SYNC_OP_FLAG_`` flags. */
  931. __u32 flags;
  932. /** @value: Timeline value for this drm_syncobj. MBZ for a binary syncobj. */
  933. __u64 value;
  934. };
  935. /**
  936. * DOC: Flags for SUBMIT_JOB ioctl geometry command.
  937. *
  938. * .. c:macro:: DRM_PVR_SUBMIT_JOB_GEOM_CMD_FIRST
  939. *
  940. * Indicates if this the first command to be issued for a render.
  941. *
  942. * .. c:macro:: DRM_PVR_SUBMIT_JOB_GEOM_CMD_LAST
  943. *
  944. * Indicates if this the last command to be issued for a render.
  945. *
  946. * .. c:macro:: DRM_PVR_SUBMIT_JOB_GEOM_CMD_SINGLE_CORE
  947. *
  948. * Forces to use single core in a multi core device.
  949. *
  950. * .. c:macro:: DRM_PVR_SUBMIT_JOB_GEOM_CMD_FLAGS_MASK
  951. *
  952. * Logical OR of all the geometry cmd flags.
  953. */
  954. #define DRM_PVR_SUBMIT_JOB_GEOM_CMD_FIRST _BITULL(0)
  955. #define DRM_PVR_SUBMIT_JOB_GEOM_CMD_LAST _BITULL(1)
  956. #define DRM_PVR_SUBMIT_JOB_GEOM_CMD_SINGLE_CORE _BITULL(2)
  957. #define DRM_PVR_SUBMIT_JOB_GEOM_CMD_FLAGS_MASK \
  958. (DRM_PVR_SUBMIT_JOB_GEOM_CMD_FIRST | \
  959. DRM_PVR_SUBMIT_JOB_GEOM_CMD_LAST | \
  960. DRM_PVR_SUBMIT_JOB_GEOM_CMD_SINGLE_CORE)
  961. /**
  962. * DOC: Flags for SUBMIT_JOB ioctl fragment command.
  963. *
  964. * .. c:macro:: DRM_PVR_SUBMIT_JOB_FRAG_CMD_SINGLE_CORE
  965. *
  966. * Use single core in a multi core setup.
  967. *
  968. * .. c:macro:: DRM_PVR_SUBMIT_JOB_FRAG_CMD_DEPTHBUFFER
  969. *
  970. * Indicates whether a depth buffer is present.
  971. *
  972. * .. c:macro:: DRM_PVR_SUBMIT_JOB_FRAG_CMD_STENCILBUFFER
  973. *
  974. * Indicates whether a stencil buffer is present.
  975. *
  976. * .. c:macro:: DRM_PVR_SUBMIT_JOB_FRAG_CMD_PREVENT_CDM_OVERLAP
  977. *
  978. * Disallow compute overlapped with this render.
  979. *
  980. * .. c:macro:: DRM_PVR_SUBMIT_JOB_FRAG_CMD_GET_VIS_RESULTS
  981. *
  982. * Indicates whether this render produces visibility results.
  983. *
  984. * .. c:macro:: DRM_PVR_SUBMIT_JOB_FRAG_CMD_SCRATCHBUFFER
  985. *
  986. * Indicates whether partial renders write to a scratch buffer instead of
  987. * the final surface. It also forces the full screen copy expected to be
  988. * present on the last render after all partial renders have completed.
  989. *
  990. * .. c:macro:: DRM_PVR_SUBMIT_JOB_FRAG_CMD_DISABLE_PIXELMERGE
  991. *
  992. * Disable pixel merging for this render.
  993. *
  994. * .. c:macro:: DRM_PVR_SUBMIT_JOB_FRAG_CMD_FLAGS_MASK
  995. *
  996. * Logical OR of all the fragment cmd flags.
  997. */
  998. #define DRM_PVR_SUBMIT_JOB_FRAG_CMD_SINGLE_CORE _BITULL(0)
  999. #define DRM_PVR_SUBMIT_JOB_FRAG_CMD_DEPTHBUFFER _BITULL(1)
  1000. #define DRM_PVR_SUBMIT_JOB_FRAG_CMD_STENCILBUFFER _BITULL(2)
  1001. #define DRM_PVR_SUBMIT_JOB_FRAG_CMD_PREVENT_CDM_OVERLAP _BITULL(3)
  1002. #define DRM_PVR_SUBMIT_JOB_FRAG_CMD_SCRATCHBUFFER _BITULL(4)
  1003. #define DRM_PVR_SUBMIT_JOB_FRAG_CMD_GET_VIS_RESULTS _BITULL(5)
  1004. #define DRM_PVR_SUBMIT_JOB_FRAG_CMD_PARTIAL_RENDER _BITULL(6)
  1005. #define DRM_PVR_SUBMIT_JOB_FRAG_CMD_DISABLE_PIXELMERGE _BITULL(7)
  1006. #define DRM_PVR_SUBMIT_JOB_FRAG_CMD_FLAGS_MASK \
  1007. (DRM_PVR_SUBMIT_JOB_FRAG_CMD_SINGLE_CORE | \
  1008. DRM_PVR_SUBMIT_JOB_FRAG_CMD_DEPTHBUFFER | \
  1009. DRM_PVR_SUBMIT_JOB_FRAG_CMD_STENCILBUFFER | \
  1010. DRM_PVR_SUBMIT_JOB_FRAG_CMD_PREVENT_CDM_OVERLAP | \
  1011. DRM_PVR_SUBMIT_JOB_FRAG_CMD_SCRATCHBUFFER | \
  1012. DRM_PVR_SUBMIT_JOB_FRAG_CMD_GET_VIS_RESULTS | \
  1013. DRM_PVR_SUBMIT_JOB_FRAG_CMD_PARTIAL_RENDER | \
  1014. DRM_PVR_SUBMIT_JOB_FRAG_CMD_DISABLE_PIXELMERGE)
  1015. /**
  1016. * DOC: Flags for SUBMIT_JOB ioctl compute command.
  1017. *
  1018. * .. c:macro:: DRM_PVR_SUBMIT_JOB_COMPUTE_CMD_PREVENT_ALL_OVERLAP
  1019. *
  1020. * Disallow other jobs overlapped with this compute.
  1021. *
  1022. * .. c:macro:: DRM_PVR_SUBMIT_JOB_COMPUTE_CMD_SINGLE_CORE
  1023. *
  1024. * Forces to use single core in a multi core device.
  1025. *
  1026. * .. c:macro:: DRM_PVR_SUBMIT_JOB_COMPUTE_CMD_FLAGS_MASK
  1027. *
  1028. * Logical OR of all the compute cmd flags.
  1029. */
  1030. #define DRM_PVR_SUBMIT_JOB_COMPUTE_CMD_PREVENT_ALL_OVERLAP _BITULL(0)
  1031. #define DRM_PVR_SUBMIT_JOB_COMPUTE_CMD_SINGLE_CORE _BITULL(1)
  1032. #define DRM_PVR_SUBMIT_JOB_COMPUTE_CMD_FLAGS_MASK \
  1033. (DRM_PVR_SUBMIT_JOB_COMPUTE_CMD_PREVENT_ALL_OVERLAP | \
  1034. DRM_PVR_SUBMIT_JOB_COMPUTE_CMD_SINGLE_CORE)
  1035. /**
  1036. * DOC: Flags for SUBMIT_JOB ioctl transfer command.
  1037. *
  1038. * .. c:macro:: DRM_PVR_SUBMIT_JOB_TRANSFER_CMD_SINGLE_CORE
  1039. *
  1040. * Forces job to use a single core in a multi core device.
  1041. *
  1042. * .. c:macro:: DRM_PVR_SUBMIT_JOB_TRANSFER_CMD_FLAGS_MASK
  1043. *
  1044. * Logical OR of all the transfer cmd flags.
  1045. */
  1046. #define DRM_PVR_SUBMIT_JOB_TRANSFER_CMD_SINGLE_CORE _BITULL(0)
  1047. #define DRM_PVR_SUBMIT_JOB_TRANSFER_CMD_FLAGS_MASK \
  1048. DRM_PVR_SUBMIT_JOB_TRANSFER_CMD_SINGLE_CORE
  1049. /**
  1050. * enum drm_pvr_job_type - Arguments for &struct drm_pvr_job.job_type
  1051. */
  1052. enum drm_pvr_job_type {
  1053. /** @DRM_PVR_JOB_TYPE_GEOMETRY: Job type is geometry. */
  1054. DRM_PVR_JOB_TYPE_GEOMETRY = 0,
  1055. /** @DRM_PVR_JOB_TYPE_FRAGMENT: Job type is fragment. */
  1056. DRM_PVR_JOB_TYPE_FRAGMENT,
  1057. /** @DRM_PVR_JOB_TYPE_COMPUTE: Job type is compute. */
  1058. DRM_PVR_JOB_TYPE_COMPUTE,
  1059. /** @DRM_PVR_JOB_TYPE_TRANSFER_FRAG: Job type is a fragment transfer. */
  1060. DRM_PVR_JOB_TYPE_TRANSFER_FRAG,
  1061. };
  1062. /**
  1063. * struct drm_pvr_hwrt_data_ref - Reference HWRT data
  1064. */
  1065. struct drm_pvr_hwrt_data_ref {
  1066. /** @set_handle: HWRT data set handle. */
  1067. __u32 set_handle;
  1068. /** @data_index: Index of the HWRT data inside the data set. */
  1069. __u32 data_index;
  1070. };
  1071. /**
  1072. * struct drm_pvr_job - Job arguments passed to the %DRM_IOCTL_PVR_SUBMIT_JOBS ioctl
  1073. */
  1074. struct drm_pvr_job {
  1075. /**
  1076. * @type: [IN] Type of job being submitted
  1077. *
  1078. * This must be one of the values defined by &enum drm_pvr_job_type.
  1079. */
  1080. __u32 type;
  1081. /**
  1082. * @context_handle: [IN] Context handle.
  1083. *
  1084. * When @job_type is %DRM_PVR_JOB_TYPE_RENDER, %DRM_PVR_JOB_TYPE_COMPUTE or
  1085. * %DRM_PVR_JOB_TYPE_TRANSFER_FRAG, this must be a valid handle returned by
  1086. * %DRM_IOCTL_PVR_CREATE_CONTEXT. The type of context must be compatible
  1087. * with the type of job being submitted.
  1088. *
  1089. * When @job_type is %DRM_PVR_JOB_TYPE_NULL, this must be zero.
  1090. */
  1091. __u32 context_handle;
  1092. /**
  1093. * @flags: [IN] Flags for command.
  1094. *
  1095. * Those are job-dependent. See all ``DRM_PVR_SUBMIT_JOB_*``.
  1096. */
  1097. __u32 flags;
  1098. /**
  1099. * @cmd_stream_len: [IN] Length of command stream, in bytes.
  1100. */
  1101. __u32 cmd_stream_len;
  1102. /**
  1103. * @cmd_stream: [IN] Pointer to command stream for command.
  1104. *
  1105. * The command stream must be u64-aligned.
  1106. */
  1107. __u64 cmd_stream;
  1108. /** @sync_ops: [IN] Fragment sync operations. */
  1109. struct drm_pvr_obj_array sync_ops;
  1110. /**
  1111. * @hwrt: [IN] HWRT data used by render jobs (geometry or fragment).
  1112. *
  1113. * Must be zero for non-render jobs.
  1114. */
  1115. struct drm_pvr_hwrt_data_ref hwrt;
  1116. };
  1117. /**
  1118. * struct drm_pvr_ioctl_submit_jobs_args - Arguments for %DRM_IOCTL_PVR_SUBMIT_JOB
  1119. *
  1120. * If the syscall returns an error it is important to check the value of
  1121. * @jobs.count. This indicates the index into @jobs.array where the
  1122. * error occurred.
  1123. */
  1124. struct drm_pvr_ioctl_submit_jobs_args {
  1125. /** @jobs: [IN] Array of jobs to submit. */
  1126. struct drm_pvr_obj_array jobs;
  1127. };
  1128. #if defined(__cplusplus)
  1129. }
  1130. #endif
  1131. #endif /* PVR_DRM_UAPI_H */