Skip to content

Commit dcdae6e

Browse files
committed
drm/v3d: Fix Indirect Dispatch configuration for V3D 7.1.6 and later
This commit is a resubmission of commit 1fe1c66 ("drm/v3d: Fix Indirect Dispatch configuration for V3D 7.1.6 and later"), which was accidentally reverted by commit 91dae75 ("Merge tag 'drm-misc-next-2024-08-01' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-next"), likely due to an unfortunate conflict resolution. From the original commit message: ``` `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: 91dae75 ("Merge tag 'drm-misc-next-2024-08-01' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-next") Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Link: https://lore.kernel.org/r/20250409205051.9639-1-mcanal@igalia.com
1 parent 1d34597 commit dcdae6e

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
@@ -428,7 +428,8 @@ v3d_rewrite_csd_job_wg_counts_from_indirect(struct v3d_cpu_job *job)
428428
struct v3d_bo *bo = to_v3d_bo(job->base.bo[0]);
429429
struct v3d_bo *indirect = to_v3d_bo(indirect_csd->indirect);
430430
struct drm_v3d_submit_csd *args = &indirect_csd->job->args;
431-
u32 *wg_counts;
431+
struct v3d_dev *v3d = job->base.v3d;
432+
u32 num_batches, *wg_counts;
432433

433434
v3d_get_bo_vaddr(bo);
434435
v3d_get_bo_vaddr(indirect);
@@ -441,8 +442,17 @@ v3d_rewrite_csd_job_wg_counts_from_indirect(struct v3d_cpu_job *job)
441442
args->cfg[0] = wg_counts[0] << V3D_CSD_CFG012_WG_COUNT_SHIFT;
442443
args->cfg[1] = wg_counts[1] << V3D_CSD_CFG012_WG_COUNT_SHIFT;
443444
args->cfg[2] = wg_counts[2] << V3D_CSD_CFG012_WG_COUNT_SHIFT;
444-
args->cfg[4] = DIV_ROUND_UP(indirect_csd->wg_size, 16) *
445-
(wg_counts[0] * wg_counts[1] * wg_counts[2]) - 1;
445+
446+
num_batches = DIV_ROUND_UP(indirect_csd->wg_size, 16) *
447+
(wg_counts[0] * wg_counts[1] * wg_counts[2]);
448+
449+
/* V3D 7.1.6 and later don't subtract 1 from the number of batches */
450+
if (v3d->ver < 71 || (v3d->ver == 71 && v3d->rev < 6))
451+
args->cfg[4] = num_batches - 1;
452+
else
453+
args->cfg[4] = num_batches;
454+
455+
WARN_ON(args->cfg[4] == ~0);
446456

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

0 commit comments

Comments
 (0)