Skip to content

Commit 1fe1c66

Browse files
committed
drm/v3d: Fix Indirect Dispatch configuration for V3D 7.1.6 and later
`args->cfg[4]` is configured in Indirect Dispatch using the number of batches. Currently, for all V3D tech versions, `args->cfg[4]` equals the number of batches subtracted by 1. But, for V3D 7.1.6 and later, we must not subtract 1 from the number of batches. Implement the fix by checking the V3D tech version and revision. Fixes several `dEQP-VK.synchronization*` CTS tests related to Indirect Dispatch. Fixes: 18b8413 ("drm/v3d: Create a CPU job extension for a indirect CSD job") Signed-off-by: Maíra Canal <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 7c78fdb commit 1fe1c66

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

drivers/gpu/drm/v3d/v3d_sched.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,8 @@ v3d_rewrite_csd_job_wg_counts_from_indirect(struct v3d_cpu_job *job)
331331
struct v3d_bo *bo = to_v3d_bo(job->base.bo[0]);
332332
struct v3d_bo *indirect = to_v3d_bo(indirect_csd->indirect);
333333
struct drm_v3d_submit_csd *args = &indirect_csd->job->args;
334-
u32 *wg_counts;
334+
struct v3d_dev *v3d = job->base.v3d;
335+
u32 num_batches, *wg_counts;
335336

336337
v3d_get_bo_vaddr(bo);
337338
v3d_get_bo_vaddr(indirect);
@@ -344,8 +345,17 @@ v3d_rewrite_csd_job_wg_counts_from_indirect(struct v3d_cpu_job *job)
344345
args->cfg[0] = wg_counts[0] << V3D_CSD_CFG012_WG_COUNT_SHIFT;
345346
args->cfg[1] = wg_counts[1] << V3D_CSD_CFG012_WG_COUNT_SHIFT;
346347
args->cfg[2] = wg_counts[2] << V3D_CSD_CFG012_WG_COUNT_SHIFT;
347-
args->cfg[4] = DIV_ROUND_UP(indirect_csd->wg_size, 16) *
348-
(wg_counts[0] * wg_counts[1] * wg_counts[2]) - 1;
348+
349+
num_batches = DIV_ROUND_UP(indirect_csd->wg_size, 16) *
350+
(wg_counts[0] * wg_counts[1] * wg_counts[2]);
351+
352+
/* V3D 7.1.6 and later don't subtract 1 from the number of batches */
353+
if (v3d->ver < 71 || (v3d->ver == 71 && v3d->rev < 6))
354+
args->cfg[4] = num_batches - 1;
355+
else
356+
args->cfg[4] = num_batches;
357+
358+
WARN_ON(args->cfg[4] == ~0);
349359

350360
for (int i = 0; i < 3; i++) {
351361
/* 0xffffffff indicates that the uniform rewrite is not needed */

0 commit comments

Comments
 (0)