A CPU job is a type of job that performs operations that requires CPU intervention. An indirect CSD job is a job that, when executed in the queue, will map the indirect buffer, read the dispatch parameters, and submit a regular dispatch. Therefore, it is a job that needs CPU intervention. So, create a user extension for the CPU job that enables the creation of an indirect CSD. This user extension will allow the creation of a CSD job linked to a CPU job. The CPU job will wait for the indirect CSD job dependencies and, once they are signaled, it will update the CSD job parameters.
Showing the changes to include/uapi (1 of 4 files). Show all
Unified · Split
| @@ -71,7 +71,8 @@ extern "C" { · 70 unmodified lines | ||
| 71 | 71 | struct drm_v3d_extension { |
| 72 | 72 | __u64 next; |
| 73 | 73 | __u32 id; |
| 74 | −#define DRM_V3D_EXT_ID_MULTI_SYNC 0x01 | |
| 74 | +#define DRM_V3D_EXT_ID_MULTI_SYNC 0x01 | |
| 75 | +#define DRM_V3D_EXT_ID_CPU_INDIRECT_CSD 0x02 | |
| 75 | 76 | __u32 flags; /* mbz */ |
| 76 | 77 | }; |
| 77 | 78 | |
| @@ -365,8 +366,46 @@ struct drm_v3d_submit_csd { · 287 unmodified lines | ||
| 365 | 366 | __u32 pad; |
| 366 | 367 | }; |
| 367 | 368 | |
| 369 | +/** | |
| 370 | + * struct drm_v3d_indirect_csd - ioctl extension for the CPU job to create an | |
| 371 | + * indirect CSD | |
| 372 | + * | |
| 373 | + * When an extension of DRM_V3D_EXT_ID_CPU_INDIRECT_CSD id is defined, it | |
| 374 | + * points to this extension to define a indirect CSD submission. It creates a | |
| 375 | + * CPU job linked to a CSD job. The CPU job waits for the indirect CSD | |
| 376 | + * dependencies and, once they are signaled, it updates the CSD job config | |
| 377 | + * before allowing the CSD job execution. | |
| 378 | + */ | |
| 379 | +struct drm_v3d_indirect_csd { | |
| 380 | + struct drm_v3d_extension base; | |
| 381 | + | |
| 382 | + /* Indirect CSD */ | |
| 383 | + struct drm_v3d_submit_csd submit; | |
| 384 | + | |
| 385 | + /* Handle of the indirect BO, that should be also attached to the | |
| 386 | + * indirect CSD. | |
| 387 | + */ | |
| 388 | + __u32 indirect; | |
| 389 | + | |
| 390 | + /* Offset within the BO where the workgroup counts are stored */ | |
| 391 | + __u32 offset; | |
| 392 | + | |
| 393 | + /* Workgroups size */ | |
| 394 | + __u32 wg_size; | |
| 395 | + | |
| 396 | + /* Indices of the uniforms with the workgroup dispatch counts | |
| 397 | + * in the uniform stream. If the uniform rewrite is not needed, | |
| 398 | + * the offset must be 0xffffffff. | |
| 399 | + */ | |
| 400 | + __u32 wg_uniform_offsets[3]; | |
| 401 | +}; | |
| 402 | + | |
| 368 | 403 | struct drm_v3d_submit_cpu { |
| 369 | − /* Pointer to a u32 array of the BOs that are referenced by the job. */ | |
| 404 | + /* Pointer to a u32 array of the BOs that are referenced by the job. | |
| 405 | + * | |
| 406 | + * For DRM_V3D_EXT_ID_CPU_INDIRECT_CSD, it must contain only one BO, | |
| 407 | + * that contains the workgroup counts. | |
| 408 | + */ | |
| 370 | 409 | __u64 bo_handles; |
| 371 | 410 | |
| 372 | 411 | /* Number of BO handles passed in (size is that times 4). */ |