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

v3d_drm.h (23678B)


  1. /*
  2. * Copyright © 2014-2018 Broadcom
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice (including the next
  12. * paragraph) shall be included in all copies or substantial portions of the
  13. * Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  18. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  21. * IN THE SOFTWARE.
  22. */
  23. #ifndef _V3D_DRM_H_
  24. #define _V3D_DRM_H_
  25. #include "drm.h"
  26. #if defined(__cplusplus)
  27. extern "C" {
  28. #endif
  29. #define DRM_V3D_SUBMIT_CL 0x00
  30. #define DRM_V3D_WAIT_BO 0x01
  31. #define DRM_V3D_CREATE_BO 0x02
  32. #define DRM_V3D_MMAP_BO 0x03
  33. #define DRM_V3D_GET_PARAM 0x04
  34. #define DRM_V3D_GET_BO_OFFSET 0x05
  35. #define DRM_V3D_SUBMIT_TFU 0x06
  36. #define DRM_V3D_SUBMIT_CSD 0x07
  37. #define DRM_V3D_PERFMON_CREATE 0x08
  38. #define DRM_V3D_PERFMON_DESTROY 0x09
  39. #define DRM_V3D_PERFMON_GET_VALUES 0x0a
  40. #define DRM_V3D_SUBMIT_CPU 0x0b
  41. #define DRM_V3D_PERFMON_GET_COUNTER 0x0c
  42. #define DRM_IOCTL_V3D_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CL, struct drm_v3d_submit_cl)
  43. #define DRM_IOCTL_V3D_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_WAIT_BO, struct drm_v3d_wait_bo)
  44. #define DRM_IOCTL_V3D_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_CREATE_BO, struct drm_v3d_create_bo)
  45. #define DRM_IOCTL_V3D_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_MMAP_BO, struct drm_v3d_mmap_bo)
  46. #define DRM_IOCTL_V3D_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_PARAM, struct drm_v3d_get_param)
  47. #define DRM_IOCTL_V3D_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_BO_OFFSET, struct drm_v3d_get_bo_offset)
  48. #define DRM_IOCTL_V3D_SUBMIT_TFU DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_TFU, struct drm_v3d_submit_tfu)
  49. #define DRM_IOCTL_V3D_SUBMIT_CSD DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CSD, struct drm_v3d_submit_csd)
  50. #define DRM_IOCTL_V3D_PERFMON_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_PERFMON_CREATE, \
  51. struct drm_v3d_perfmon_create)
  52. #define DRM_IOCTL_V3D_PERFMON_DESTROY DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_PERFMON_DESTROY, \
  53. struct drm_v3d_perfmon_destroy)
  54. #define DRM_IOCTL_V3D_PERFMON_GET_VALUES DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_PERFMON_GET_VALUES, \
  55. struct drm_v3d_perfmon_get_values)
  56. #define DRM_IOCTL_V3D_SUBMIT_CPU DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CPU, struct drm_v3d_submit_cpu)
  57. #define DRM_IOCTL_V3D_PERFMON_GET_COUNTER DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_PERFMON_GET_COUNTER, \
  58. struct drm_v3d_perfmon_get_counter)
  59. #define DRM_V3D_SUBMIT_CL_FLUSH_CACHE 0x01
  60. #define DRM_V3D_SUBMIT_EXTENSION 0x02
  61. /* struct drm_v3d_extension - ioctl extensions
  62. *
  63. * Linked-list of generic extensions where the id identify which struct is
  64. * pointed by ext_data. Therefore, DRM_V3D_EXT_ID_* is used on id to identify
  65. * the extension type.
  66. */
  67. struct drm_v3d_extension {
  68. __u64 next;
  69. __u32 id;
  70. #define DRM_V3D_EXT_ID_MULTI_SYNC 0x01
  71. #define DRM_V3D_EXT_ID_CPU_INDIRECT_CSD 0x02
  72. #define DRM_V3D_EXT_ID_CPU_TIMESTAMP_QUERY 0x03
  73. #define DRM_V3D_EXT_ID_CPU_RESET_TIMESTAMP_QUERY 0x04
  74. #define DRM_V3D_EXT_ID_CPU_COPY_TIMESTAMP_QUERY 0x05
  75. #define DRM_V3D_EXT_ID_CPU_RESET_PERFORMANCE_QUERY 0x06
  76. #define DRM_V3D_EXT_ID_CPU_COPY_PERFORMANCE_QUERY 0x07
  77. __u32 flags; /* mbz */
  78. };
  79. /* struct drm_v3d_sem - wait/signal semaphore
  80. *
  81. * If binary semaphore, it only takes syncobj handle and ignores flags and
  82. * point fields. Point is defined for timeline syncobj feature.
  83. */
  84. struct drm_v3d_sem {
  85. __u32 handle; /* syncobj */
  86. /* rsv below, for future uses */
  87. __u32 flags;
  88. __u64 point; /* for timeline sem support */
  89. __u64 mbz[2]; /* must be zero, rsv */
  90. };
  91. /* Enum for each of the V3D queues. */
  92. enum v3d_queue {
  93. V3D_BIN,
  94. V3D_RENDER,
  95. V3D_TFU,
  96. V3D_CSD,
  97. V3D_CACHE_CLEAN,
  98. V3D_CPU,
  99. };
  100. /**
  101. * struct drm_v3d_multi_sync - ioctl extension to add support multiples
  102. * syncobjs for commands submission.
  103. *
  104. * When an extension of DRM_V3D_EXT_ID_MULTI_SYNC id is defined, it points to
  105. * this extension to define wait and signal dependencies, instead of single
  106. * in/out sync entries on submitting commands. The field flags is used to
  107. * determine the stage to set wait dependencies.
  108. */
  109. struct drm_v3d_multi_sync {
  110. struct drm_v3d_extension base;
  111. /* Array of wait and signal semaphores */
  112. __u64 in_syncs;
  113. __u64 out_syncs;
  114. /* Number of entries */
  115. __u32 in_sync_count;
  116. __u32 out_sync_count;
  117. /* set the stage (v3d_queue) to sync */
  118. __u32 wait_stage;
  119. __u32 pad; /* mbz */
  120. };
  121. /**
  122. * struct drm_v3d_submit_cl - ioctl argument for submitting commands to the 3D
  123. * engine.
  124. *
  125. * This asks the kernel to have the GPU execute an optional binner
  126. * command list, and a render command list.
  127. *
  128. * The L1T, slice, L2C, L2T, and GCA caches will be flushed before
  129. * each CL executes. The VCD cache should be flushed (if necessary)
  130. * by the submitted CLs. The TLB writes are guaranteed to have been
  131. * flushed by the time the render done IRQ happens, which is the
  132. * trigger for out_sync. Any dirtying of cachelines by the job (only
  133. * possible using TMU writes) must be flushed by the caller using the
  134. * DRM_V3D_SUBMIT_CL_FLUSH_CACHE_FLAG flag.
  135. */
  136. struct drm_v3d_submit_cl {
  137. /* Pointer to the binner command list.
  138. *
  139. * This is the first set of commands executed, which runs the
  140. * coordinate shader to determine where primitives land on the screen,
  141. * then writes out the state updates and draw calls necessary per tile
  142. * to the tile allocation BO.
  143. *
  144. * This BCL will block on any previous BCL submitted on the
  145. * same FD, but not on any RCL or BCLs submitted by other
  146. * clients -- that is left up to the submitter to control
  147. * using in_sync_bcl if necessary.
  148. */
  149. __u32 bcl_start;
  150. /** End address of the BCL (first byte after the BCL) */
  151. __u32 bcl_end;
  152. /* Offset of the render command list.
  153. *
  154. * This is the second set of commands executed, which will either
  155. * execute the tiles that have been set up by the BCL, or a fixed set
  156. * of tiles (in the case of RCL-only blits).
  157. *
  158. * This RCL will block on this submit's BCL, and any previous
  159. * RCL submitted on the same FD, but not on any RCL or BCLs
  160. * submitted by other clients -- that is left up to the
  161. * submitter to control using in_sync_rcl if necessary.
  162. */
  163. __u32 rcl_start;
  164. /** End address of the RCL (first byte after the RCL) */
  165. __u32 rcl_end;
  166. /** An optional sync object to wait on before starting the BCL. */
  167. __u32 in_sync_bcl;
  168. /** An optional sync object to wait on before starting the RCL. */
  169. __u32 in_sync_rcl;
  170. /** An optional sync object to place the completion fence in. */
  171. __u32 out_sync;
  172. /* Offset of the tile alloc memory
  173. *
  174. * This is optional on V3D 3.3 (where the CL can set the value) but
  175. * required on V3D 4.1.
  176. */
  177. __u32 qma;
  178. /** Size of the tile alloc memory. */
  179. __u32 qms;
  180. /** Offset of the tile state data array. */
  181. __u32 qts;
  182. /* Pointer to a u32 array of the BOs that are referenced by the job.
  183. */
  184. __u64 bo_handles;
  185. /* Number of BO handles passed in (size is that times 4). */
  186. __u32 bo_handle_count;
  187. /* DRM_V3D_SUBMIT_* properties */
  188. __u32 flags;
  189. /* ID of the perfmon to attach to this job. 0 means no perfmon. */
  190. __u32 perfmon_id;
  191. __u32 pad;
  192. /* Pointer to an array of ioctl extensions*/
  193. __u64 extensions;
  194. };
  195. /**
  196. * struct drm_v3d_wait_bo - ioctl argument for waiting for
  197. * completion of the last DRM_V3D_SUBMIT_CL on a BO.
  198. *
  199. * This is useful for cases where multiple processes might be
  200. * rendering to a BO and you want to wait for all rendering to be
  201. * completed.
  202. */
  203. struct drm_v3d_wait_bo {
  204. __u32 handle;
  205. __u32 pad;
  206. __u64 timeout_ns;
  207. };
  208. /**
  209. * struct drm_v3d_create_bo - ioctl argument for creating V3D BOs.
  210. *
  211. * There are currently no values for the flags argument, but it may be
  212. * used in a future extension.
  213. */
  214. struct drm_v3d_create_bo {
  215. __u32 size;
  216. __u32 flags;
  217. /** Returned GEM handle for the BO. */
  218. __u32 handle;
  219. /**
  220. * Returned offset for the BO in the V3D address space. This offset
  221. * is private to the DRM fd and is valid for the lifetime of the GEM
  222. * handle.
  223. *
  224. * This offset value will always be nonzero, since various HW
  225. * units treat 0 specially.
  226. */
  227. __u32 offset;
  228. };
  229. /**
  230. * struct drm_v3d_mmap_bo - ioctl argument for mapping V3D BOs.
  231. *
  232. * This doesn't actually perform an mmap. Instead, it returns the
  233. * offset you need to use in an mmap on the DRM device node. This
  234. * means that tools like valgrind end up knowing about the mapped
  235. * memory.
  236. *
  237. * There are currently no values for the flags argument, but it may be
  238. * used in a future extension.
  239. */
  240. struct drm_v3d_mmap_bo {
  241. /** Handle for the object being mapped. */
  242. __u32 handle;
  243. __u32 flags;
  244. /** offset into the drm node to use for subsequent mmap call. */
  245. __u64 offset;
  246. };
  247. enum drm_v3d_param {
  248. DRM_V3D_PARAM_V3D_UIFCFG,
  249. DRM_V3D_PARAM_V3D_HUB_IDENT1,
  250. DRM_V3D_PARAM_V3D_HUB_IDENT2,
  251. DRM_V3D_PARAM_V3D_HUB_IDENT3,
  252. DRM_V3D_PARAM_V3D_CORE0_IDENT0,
  253. DRM_V3D_PARAM_V3D_CORE0_IDENT1,
  254. DRM_V3D_PARAM_V3D_CORE0_IDENT2,
  255. DRM_V3D_PARAM_SUPPORTS_TFU,
  256. DRM_V3D_PARAM_SUPPORTS_CSD,
  257. DRM_V3D_PARAM_SUPPORTS_CACHE_FLUSH,
  258. DRM_V3D_PARAM_SUPPORTS_PERFMON,
  259. DRM_V3D_PARAM_SUPPORTS_MULTISYNC_EXT,
  260. DRM_V3D_PARAM_SUPPORTS_CPU_QUEUE,
  261. DRM_V3D_PARAM_MAX_PERF_COUNTERS,
  262. };
  263. struct drm_v3d_get_param {
  264. __u32 param;
  265. __u32 pad;
  266. __u64 value;
  267. };
  268. /**
  269. * Returns the offset for the BO in the V3D address space for this DRM fd.
  270. * This is the same value returned by drm_v3d_create_bo, if that was called
  271. * from this DRM fd.
  272. */
  273. struct drm_v3d_get_bo_offset {
  274. __u32 handle;
  275. __u32 offset;
  276. };
  277. struct drm_v3d_submit_tfu {
  278. __u32 icfg;
  279. __u32 iia;
  280. __u32 iis;
  281. __u32 ica;
  282. __u32 iua;
  283. __u32 ioa;
  284. __u32 ios;
  285. __u32 coef[4];
  286. /* First handle is the output BO, following are other inputs.
  287. * 0 for unused.
  288. */
  289. __u32 bo_handles[4];
  290. /* sync object to block on before running the TFU job. Each TFU
  291. * job will execute in the order submitted to its FD. Synchronization
  292. * against rendering jobs requires using sync objects.
  293. */
  294. __u32 in_sync;
  295. /* Sync object to signal when the TFU job is done. */
  296. __u32 out_sync;
  297. __u32 flags;
  298. /* Pointer to an array of ioctl extensions*/
  299. __u64 extensions;
  300. struct {
  301. __u32 ioc;
  302. __u32 pad;
  303. } v71;
  304. };
  305. /* Submits a compute shader for dispatch. This job will block on any
  306. * previous compute shaders submitted on this fd, and any other
  307. * synchronization must be performed with in_sync/out_sync.
  308. */
  309. struct drm_v3d_submit_csd {
  310. __u32 cfg[7];
  311. __u32 coef[4];
  312. /* Pointer to a u32 array of the BOs that are referenced by the job.
  313. */
  314. __u64 bo_handles;
  315. /* Number of BO handles passed in (size is that times 4). */
  316. __u32 bo_handle_count;
  317. /* sync object to block on before running the CSD job. Each
  318. * CSD job will execute in the order submitted to its FD.
  319. * Synchronization against rendering/TFU jobs or CSD from
  320. * other fds requires using sync objects.
  321. */
  322. __u32 in_sync;
  323. /* Sync object to signal when the CSD job is done. */
  324. __u32 out_sync;
  325. /* ID of the perfmon to attach to this job. 0 means no perfmon. */
  326. __u32 perfmon_id;
  327. /* Pointer to an array of ioctl extensions*/
  328. __u64 extensions;
  329. __u32 flags;
  330. __u32 pad;
  331. };
  332. /**
  333. * struct drm_v3d_indirect_csd - ioctl extension for the CPU job to create an
  334. * indirect CSD
  335. *
  336. * When an extension of DRM_V3D_EXT_ID_CPU_INDIRECT_CSD id is defined, it
  337. * points to this extension to define a indirect CSD submission. It creates a
  338. * CPU job linked to a CSD job. The CPU job waits for the indirect CSD
  339. * dependencies and, once they are signaled, it updates the CSD job config
  340. * before allowing the CSD job execution.
  341. */
  342. struct drm_v3d_indirect_csd {
  343. struct drm_v3d_extension base;
  344. /* Indirect CSD */
  345. struct drm_v3d_submit_csd submit;
  346. /* Handle of the indirect BO, that should be also attached to the
  347. * indirect CSD.
  348. */
  349. __u32 indirect;
  350. /* Offset within the BO where the workgroup counts are stored */
  351. __u32 offset;
  352. /* Workgroups size */
  353. __u32 wg_size;
  354. /* Indices of the uniforms with the workgroup dispatch counts
  355. * in the uniform stream. If the uniform rewrite is not needed,
  356. * the offset must be 0xffffffff.
  357. */
  358. __u32 wg_uniform_offsets[3];
  359. };
  360. /**
  361. * struct drm_v3d_timestamp_query - ioctl extension for the CPU job to calculate
  362. * a timestamp query
  363. *
  364. * When an extension DRM_V3D_EXT_ID_TIMESTAMP_QUERY is defined, it points to
  365. * this extension to define a timestamp query submission. This CPU job will
  366. * calculate the timestamp query and update the query value within the
  367. * timestamp BO. Moreover, it will signal the timestamp syncobj to indicate
  368. * query availability.
  369. */
  370. struct drm_v3d_timestamp_query {
  371. struct drm_v3d_extension base;
  372. /* Array of queries' offsets within the timestamp BO for their value */
  373. __u64 offsets;
  374. /* Array of timestamp's syncobjs to indicate its availability */
  375. __u64 syncs;
  376. /* Number of queries */
  377. __u32 count;
  378. /* mbz */
  379. __u32 pad;
  380. };
  381. /**
  382. * struct drm_v3d_reset_timestamp_query - ioctl extension for the CPU job to
  383. * reset timestamp queries
  384. *
  385. * When an extension DRM_V3D_EXT_ID_CPU_RESET_TIMESTAMP_QUERY is defined, it
  386. * points to this extension to define a reset timestamp submission. This CPU
  387. * job will reset the timestamp queries based on value offset of the first
  388. * query. Moreover, it will reset the timestamp syncobj to reset query
  389. * availability.
  390. */
  391. struct drm_v3d_reset_timestamp_query {
  392. struct drm_v3d_extension base;
  393. /* Array of timestamp's syncobjs to indicate its availability */
  394. __u64 syncs;
  395. /* Offset of the first query within the timestamp BO for its value */
  396. __u32 offset;
  397. /* Number of queries */
  398. __u32 count;
  399. };
  400. /**
  401. * struct drm_v3d_copy_timestamp_query - ioctl extension for the CPU job to copy
  402. * query results to a buffer
  403. *
  404. * When an extension DRM_V3D_EXT_ID_CPU_COPY_TIMESTAMP_QUERY is defined, it
  405. * points to this extension to define a copy timestamp query submission. This
  406. * CPU job will copy the timestamp queries results to a BO with the offset
  407. * and stride defined in the extension.
  408. */
  409. struct drm_v3d_copy_timestamp_query {
  410. struct drm_v3d_extension base;
  411. /* Define if should write to buffer using 64 or 32 bits */
  412. __u8 do_64bit;
  413. /* Define if it can write to buffer even if the query is not available */
  414. __u8 do_partial;
  415. /* Define if it should write availability bit to buffer */
  416. __u8 availability_bit;
  417. /* mbz */
  418. __u8 pad;
  419. /* Offset of the buffer in the BO */
  420. __u32 offset;
  421. /* Stride of the buffer in the BO */
  422. __u32 stride;
  423. /* Number of queries */
  424. __u32 count;
  425. /* Array of queries' offsets within the timestamp BO for their value */
  426. __u64 offsets;
  427. /* Array of timestamp's syncobjs to indicate its availability */
  428. __u64 syncs;
  429. };
  430. /**
  431. * struct drm_v3d_reset_performance_query - ioctl extension for the CPU job to
  432. * reset performance queries
  433. *
  434. * When an extension DRM_V3D_EXT_ID_CPU_RESET_PERFORMANCE_QUERY is defined, it
  435. * points to this extension to define a reset performance submission. This CPU
  436. * job will reset the performance queries by resetting the values of the
  437. * performance monitors. Moreover, it will reset the syncobj to reset query
  438. * availability.
  439. */
  440. struct drm_v3d_reset_performance_query {
  441. struct drm_v3d_extension base;
  442. /* Array of performance queries's syncobjs to indicate its availability */
  443. __u64 syncs;
  444. /* Number of queries */
  445. __u32 count;
  446. /* Number of performance monitors */
  447. __u32 nperfmons;
  448. /* Array of u64 user-pointers that point to an array of kperfmon_ids */
  449. __u64 kperfmon_ids;
  450. };
  451. /**
  452. * struct drm_v3d_copy_performance_query - ioctl extension for the CPU job to copy
  453. * performance query results to a buffer
  454. *
  455. * When an extension DRM_V3D_EXT_ID_CPU_COPY_PERFORMANCE_QUERY is defined, it
  456. * points to this extension to define a copy performance query submission. This
  457. * CPU job will copy the performance queries results to a BO with the offset
  458. * and stride defined in the extension.
  459. */
  460. struct drm_v3d_copy_performance_query {
  461. struct drm_v3d_extension base;
  462. /* Define if should write to buffer using 64 or 32 bits */
  463. __u8 do_64bit;
  464. /* Define if it can write to buffer even if the query is not available */
  465. __u8 do_partial;
  466. /* Define if it should write availability bit to buffer */
  467. __u8 availability_bit;
  468. /* mbz */
  469. __u8 pad;
  470. /* Offset of the buffer in the BO */
  471. __u32 offset;
  472. /* Stride of the buffer in the BO */
  473. __u32 stride;
  474. /* Number of performance monitors */
  475. __u32 nperfmons;
  476. /* Number of performance counters related to this query pool */
  477. __u32 ncounters;
  478. /* Number of queries */
  479. __u32 count;
  480. /* Array of performance queries's syncobjs to indicate its availability */
  481. __u64 syncs;
  482. /* Array of u64 user-pointers that point to an array of kperfmon_ids */
  483. __u64 kperfmon_ids;
  484. };
  485. struct drm_v3d_submit_cpu {
  486. /* Pointer to a u32 array of the BOs that are referenced by the job.
  487. *
  488. * For DRM_V3D_EXT_ID_CPU_INDIRECT_CSD, it must contain only one BO,
  489. * that contains the workgroup counts.
  490. *
  491. * For DRM_V3D_EXT_ID_TIMESTAMP_QUERY, it must contain only one BO,
  492. * that will contain the timestamp.
  493. *
  494. * For DRM_V3D_EXT_ID_CPU_RESET_TIMESTAMP_QUERY, it must contain only
  495. * one BO, that contains the timestamp.
  496. *
  497. * For DRM_V3D_EXT_ID_CPU_COPY_TIMESTAMP_QUERY, it must contain two
  498. * BOs. The first is the BO where the timestamp queries will be written
  499. * to. The second is the BO that contains the timestamp.
  500. *
  501. * For DRM_V3D_EXT_ID_CPU_RESET_PERFORMANCE_QUERY, it must contain no
  502. * BOs.
  503. *
  504. * For DRM_V3D_EXT_ID_CPU_COPY_PERFORMANCE_QUERY, it must contain one
  505. * BO, where the performance queries will be written.
  506. */
  507. __u64 bo_handles;
  508. /* Number of BO handles passed in (size is that times 4). */
  509. __u32 bo_handle_count;
  510. __u32 flags;
  511. /* Pointer to an array of ioctl extensions*/
  512. __u64 extensions;
  513. };
  514. /* The performance counters index represented by this enum are deprecated and
  515. * must no longer be used. These counters are only valid for V3D 4.2.
  516. *
  517. * In order to check for performance counter information,
  518. * use DRM_IOCTL_V3D_PERFMON_GET_COUNTER.
  519. *
  520. * Don't use V3D_PERFCNT_NUM to retrieve the maximum number of performance
  521. * counters. You should use DRM_IOCTL_V3D_GET_PARAM with the following
  522. * parameter: DRM_V3D_PARAM_MAX_PERF_COUNTERS.
  523. */
  524. enum {
  525. V3D_PERFCNT_FEP_VALID_PRIMTS_NO_PIXELS,
  526. V3D_PERFCNT_FEP_VALID_PRIMS,
  527. V3D_PERFCNT_FEP_EZ_NFCLIP_QUADS,
  528. V3D_PERFCNT_FEP_VALID_QUADS,
  529. V3D_PERFCNT_TLB_QUADS_STENCIL_FAIL,
  530. V3D_PERFCNT_TLB_QUADS_STENCILZ_FAIL,
  531. V3D_PERFCNT_TLB_QUADS_STENCILZ_PASS,
  532. V3D_PERFCNT_TLB_QUADS_ZERO_COV,
  533. V3D_PERFCNT_TLB_QUADS_NONZERO_COV,
  534. V3D_PERFCNT_TLB_QUADS_WRITTEN,
  535. V3D_PERFCNT_PTB_PRIM_VIEWPOINT_DISCARD,
  536. V3D_PERFCNT_PTB_PRIM_CLIP,
  537. V3D_PERFCNT_PTB_PRIM_REV,
  538. V3D_PERFCNT_QPU_IDLE_CYCLES,
  539. V3D_PERFCNT_QPU_ACTIVE_CYCLES_VERTEX_COORD_USER,
  540. V3D_PERFCNT_QPU_ACTIVE_CYCLES_FRAG,
  541. V3D_PERFCNT_QPU_CYCLES_VALID_INSTR,
  542. V3D_PERFCNT_QPU_CYCLES_TMU_STALL,
  543. V3D_PERFCNT_QPU_CYCLES_SCOREBOARD_STALL,
  544. V3D_PERFCNT_QPU_CYCLES_VARYINGS_STALL,
  545. V3D_PERFCNT_QPU_IC_HIT,
  546. V3D_PERFCNT_QPU_IC_MISS,
  547. V3D_PERFCNT_QPU_UC_HIT,
  548. V3D_PERFCNT_QPU_UC_MISS,
  549. V3D_PERFCNT_TMU_TCACHE_ACCESS,
  550. V3D_PERFCNT_TMU_TCACHE_MISS,
  551. V3D_PERFCNT_VPM_VDW_STALL,
  552. V3D_PERFCNT_VPM_VCD_STALL,
  553. V3D_PERFCNT_BIN_ACTIVE,
  554. V3D_PERFCNT_RDR_ACTIVE,
  555. V3D_PERFCNT_L2T_HITS,
  556. V3D_PERFCNT_L2T_MISSES,
  557. V3D_PERFCNT_CYCLE_COUNT,
  558. V3D_PERFCNT_QPU_CYCLES_STALLED_VERTEX_COORD_USER,
  559. V3D_PERFCNT_QPU_CYCLES_STALLED_FRAGMENT,
  560. V3D_PERFCNT_PTB_PRIMS_BINNED,
  561. V3D_PERFCNT_AXI_WRITES_WATCH_0,
  562. V3D_PERFCNT_AXI_READS_WATCH_0,
  563. V3D_PERFCNT_AXI_WRITE_STALLS_WATCH_0,
  564. V3D_PERFCNT_AXI_READ_STALLS_WATCH_0,
  565. V3D_PERFCNT_AXI_WRITE_BYTES_WATCH_0,
  566. V3D_PERFCNT_AXI_READ_BYTES_WATCH_0,
  567. V3D_PERFCNT_AXI_WRITES_WATCH_1,
  568. V3D_PERFCNT_AXI_READS_WATCH_1,
  569. V3D_PERFCNT_AXI_WRITE_STALLS_WATCH_1,
  570. V3D_PERFCNT_AXI_READ_STALLS_WATCH_1,
  571. V3D_PERFCNT_AXI_WRITE_BYTES_WATCH_1,
  572. V3D_PERFCNT_AXI_READ_BYTES_WATCH_1,
  573. V3D_PERFCNT_TLB_PARTIAL_QUADS,
  574. V3D_PERFCNT_TMU_CONFIG_ACCESSES,
  575. V3D_PERFCNT_L2T_NO_ID_STALL,
  576. V3D_PERFCNT_L2T_COM_QUE_STALL,
  577. V3D_PERFCNT_L2T_TMU_WRITES,
  578. V3D_PERFCNT_TMU_ACTIVE_CYCLES,
  579. V3D_PERFCNT_TMU_STALLED_CYCLES,
  580. V3D_PERFCNT_CLE_ACTIVE,
  581. V3D_PERFCNT_L2T_TMU_READS,
  582. V3D_PERFCNT_L2T_CLE_READS,
  583. V3D_PERFCNT_L2T_VCD_READS,
  584. V3D_PERFCNT_L2T_TMUCFG_READS,
  585. V3D_PERFCNT_L2T_SLC0_READS,
  586. V3D_PERFCNT_L2T_SLC1_READS,
  587. V3D_PERFCNT_L2T_SLC2_READS,
  588. V3D_PERFCNT_L2T_TMU_W_MISSES,
  589. V3D_PERFCNT_L2T_TMU_R_MISSES,
  590. V3D_PERFCNT_L2T_CLE_MISSES,
  591. V3D_PERFCNT_L2T_VCD_MISSES,
  592. V3D_PERFCNT_L2T_TMUCFG_MISSES,
  593. V3D_PERFCNT_L2T_SLC0_MISSES,
  594. V3D_PERFCNT_L2T_SLC1_MISSES,
  595. V3D_PERFCNT_L2T_SLC2_MISSES,
  596. V3D_PERFCNT_CORE_MEM_WRITES,
  597. V3D_PERFCNT_L2T_MEM_WRITES,
  598. V3D_PERFCNT_PTB_MEM_WRITES,
  599. V3D_PERFCNT_TLB_MEM_WRITES,
  600. V3D_PERFCNT_CORE_MEM_READS,
  601. V3D_PERFCNT_L2T_MEM_READS,
  602. V3D_PERFCNT_PTB_MEM_READS,
  603. V3D_PERFCNT_PSE_MEM_READS,
  604. V3D_PERFCNT_TLB_MEM_READS,
  605. V3D_PERFCNT_GMP_MEM_READS,
  606. V3D_PERFCNT_PTB_W_MEM_WORDS,
  607. V3D_PERFCNT_TLB_W_MEM_WORDS,
  608. V3D_PERFCNT_PSE_R_MEM_WORDS,
  609. V3D_PERFCNT_TLB_R_MEM_WORDS,
  610. V3D_PERFCNT_TMU_MRU_HITS,
  611. V3D_PERFCNT_COMPUTE_ACTIVE,
  612. V3D_PERFCNT_NUM,
  613. };
  614. #define DRM_V3D_MAX_PERF_COUNTERS 32
  615. struct drm_v3d_perfmon_create {
  616. __u32 id;
  617. __u32 ncounters;
  618. __u8 counters[DRM_V3D_MAX_PERF_COUNTERS];
  619. };
  620. struct drm_v3d_perfmon_destroy {
  621. __u32 id;
  622. };
  623. /*
  624. * Returns the values of the performance counters tracked by this
  625. * perfmon (as an array of ncounters u64 values).
  626. *
  627. * No implicit synchronization is performed, so the user has to
  628. * guarantee that any jobs using this perfmon have already been
  629. * completed (probably by blocking on the seqno returned by the
  630. * last exec that used the perfmon).
  631. */
  632. struct drm_v3d_perfmon_get_values {
  633. __u32 id;
  634. __u32 pad;
  635. __u64 values_ptr;
  636. };
  637. #define DRM_V3D_PERFCNT_MAX_NAME 64
  638. #define DRM_V3D_PERFCNT_MAX_CATEGORY 32
  639. #define DRM_V3D_PERFCNT_MAX_DESCRIPTION 256
  640. /**
  641. * struct drm_v3d_perfmon_get_counter - ioctl to get the description of a
  642. * performance counter
  643. *
  644. * As userspace needs to retrieve information about the performance counters
  645. * available, this IOCTL allows users to get information about a performance
  646. * counter (name, category and description).
  647. */
  648. struct drm_v3d_perfmon_get_counter {
  649. /*
  650. * Counter ID
  651. *
  652. * Must be smaller than the maximum number of performance counters, which
  653. * can be retrieve through DRM_V3D_PARAM_MAX_PERF_COUNTERS.
  654. */
  655. __u8 counter;
  656. /* Name of the counter */
  657. __u8 name[DRM_V3D_PERFCNT_MAX_NAME];
  658. /* Category of the counter */
  659. __u8 category[DRM_V3D_PERFCNT_MAX_CATEGORY];
  660. /* Description of the counter */
  661. __u8 description[DRM_V3D_PERFCNT_MAX_DESCRIPTION];
  662. /* mbz */
  663. __u8 reserved[7];
  664. };
  665. #if defined(__cplusplus)
  666. }
  667. #endif
  668. #endif /* _V3D_DRM_H_ */