A CPU job is a type of job that performs operations that requires CPU intervention. A copy performance query job is a job that copy the complete or partial result of a query to a buffer. In order to copy the result of a performance query to a buffer, we need to get the values from the performance monitors. So, create a user extension for the CPU job that enables the creation of a copy performance query job. This user extension will allow the creation of a CPU job that copy the results of a performance query to a BO with the possibility to indicate the availability with a availability bit.
Showing the changes to include/uapi/drm (1 of 4 files). Show all
Unified · Split
| @@ -77,6 +77,7 @@ struct drm_v3d_extension { · 76 unmodified lines | |||
| 77 | #define DRM_V3D_EXT_ID_CPU_RESET_TIMESTAMP_QUERY 0x04 | 77 | #define DRM_V3D_EXT_ID_CPU_RESET_TIMESTAMP_QUERY 0x04 |
| 78 | #define DRM_V3D_EXT_ID_CPU_COPY_TIMESTAMP_QUERY 0x05 | 78 | #define DRM_V3D_EXT_ID_CPU_COPY_TIMESTAMP_QUERY 0x05 |
| 79 | #define DRM_V3D_EXT_ID_CPU_RESET_PERFORMANCE_QUERY 0x06 | 79 | #define DRM_V3D_EXT_ID_CPU_RESET_PERFORMANCE_QUERY 0x06 |
| 80 | #define DRM_V3D_EXT_ID_CPU_COPY_PERFORMANCE_QUERY 0x07 | ||
| 80 | __u32 flags; /* mbz */ | 81 | __u32 flags; /* mbz */ |
| 81 | }; | 82 | }; |
| 82 | 83 | ||
| @@ -519,6 +520,52 @@ struct drm_v3d_reset_performance_query { · 436 unmodified lines | |||
| 519 | __u64 kperfmon_ids; | 520 | __u64 kperfmon_ids; |
| 520 | }; | 521 | }; |
| 521 | 522 | ||
| 523 | /** | ||
| 524 | * struct drm_v3d_copy_performance_query - ioctl extension for the CPU job to copy | ||
| 525 | * performance query results to a buffer | ||
| 526 | * | ||
| 527 | * When an extension DRM_V3D_EXT_ID_CPU_COPY_PERFORMANCE_QUERY is defined, it | ||
| 528 | * points to this extension to define a copy performance query submission. This | ||
| 529 | * CPU job will copy the performance queries results to a BO with the offset | ||
| 530 | * and stride defined in the extension. | ||
| 531 | */ | ||
| 532 | struct drm_v3d_copy_performance_query { | ||
| 533 | struct drm_v3d_extension base; | ||
| 534 | |||
| 535 | /* Define if should write to buffer using 64 or 32 bits */ | ||
| 536 | __u8 do_64bit; | ||
| 537 | |||
| 538 | /* Define if it can write to buffer even if the query is not available */ | ||
| 539 | __u8 do_partial; | ||
| 540 | |||
| 541 | /* Define if it should write availability bit to buffer */ | ||
| 542 | __u8 availability_bit; | ||
| 543 | |||
| 544 | /* mbz */ | ||
| 545 | __u8 pad; | ||
| 546 | |||
| 547 | /* Offset of the buffer in the BO */ | ||
| 548 | __u32 offset; | ||
| 549 | |||
| 550 | /* Stride of the buffer in the BO */ | ||
| 551 | __u32 stride; | ||
| 552 | |||
| 553 | /* Number of performance monitors */ | ||
| 554 | __u32 nperfmons; | ||
| 555 | |||
| 556 | /* Number of performance counters related to this query pool */ | ||
| 557 | __u32 ncounters; | ||
| 558 | |||
| 559 | /* Number of queries */ | ||
| 560 | __u32 count; | ||
| 561 | |||
| 562 | /* Array of performance queries's syncobjs to indicate its availability */ | ||
| 563 | __u64 syncs; | ||
| 564 | |||
| 565 | /* Array of u64 user-pointers that point to an array of kperfmon_ids */ | ||
| 566 | __u64 kperfmon_ids; | ||
| 567 | }; | ||
| 568 | |||
| 522 | struct drm_v3d_submit_cpu { | 569 | struct drm_v3d_submit_cpu { |
| 523 | /* Pointer to a u32 array of the BOs that are referenced by the job. | 570 | /* Pointer to a u32 array of the BOs that are referenced by the job. |
| 524 | * | 571 | * |
| @@ -537,6 +584,9 @@ struct drm_v3d_submit_cpu { · 12 unmodified lines | |||
| 537 | * | 584 | * |
| 538 | * For DRM_V3D_EXT_ID_CPU_RESET_PERFORMANCE_QUERY, it must contain no | 585 | * For DRM_V3D_EXT_ID_CPU_RESET_PERFORMANCE_QUERY, it must contain no |
| 539 | * BOs. | 586 | * BOs. |
| 587 | * | ||
| 588 | * For DRM_V3D_EXT_ID_CPU_COPY_PERFORMANCE_QUERY, it must contain one | ||
| 589 | * BO, where the performance queries will be written. | ||
| 540 | */ | 590 | */ |
| 541 | __u64 bo_handles; | 591 | __u64 bo_handles; |
| 542 | 592 | ||