drm/v3d: Fix Indirect Dispatch configuration for V3D 7.1.6 and later
Subsystems (3)
Maíra Canal
maintainerPATCH 1/1 drm/v3d: Fix Indirect Dispatch configuration for V3D 7.1.6 and later
This commit is a resubmission of commit 1fe1c66274fb ("drm/v3d: Fix Indirect Dispatch configuration for V3D 7.1.6 and later"), which was accidentally reverted by commit 91dae758bdb8 ("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. ```
--- drivers/gpu/drm/v3d/v3d_sched.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/v3d/v3d_sched.c +13 -3
@@ -428,7 +428,8 @@ v3d_rewrite_csd_job_wg_counts_from_indirect(struct v3d_cpu_job *job)struct v3d_bo *bo =to_v3d_bo (job->base.bo[0 ]);struct v3d_bo *indirect =to_v3d_bo (indirect_csd->indirect);struct drm_v3d_submit_csd *args = &indirect_csd->job->args; -u32 *wg_counts; +struct v3d_dev *v3d = job->base.v3d; +u32 num_batches, *wg_counts;v3d_get_bo_vaddr (bo);v3d_get_bo_vaddr (indirect);
@@ -441,8 +442,17 @@ v3d_rewrite_csd_job_wg_counts_from_indirect(struct v3d_cpu_job *job) args->cfg[0 ] = wg_counts[0 ] <<V3D_CSD_CFG012_WG_COUNT_SHIFT ; args->cfg[1 ] = wg_counts[1 ] <<V3D_CSD_CFG012_WG_COUNT_SHIFT ; args->cfg[2 ] = wg_counts[2 ] <<V3D_CSD_CFG012_WG_COUNT_SHIFT ; - args->cfg[4 ] =DIV_ROUND_UP (indirect_csd->wg_size,16 ) * - (wg_counts[0 ] * wg_counts[1 ] * wg_counts[2 ]) -1 ; + + num_batches =DIV_ROUND_UP (indirect_csd->wg_size,16 ) * + (wg_counts[0 ] * wg_counts[1 ] * wg_counts[2 ]); + +/* V3D 7.1.6 and later don't subtract 1 from the number of batches */ +if (v3d->ver <71 || (v3d->ver ==71 && v3d->rev <6 )) + args->cfg[4 ] = num_batches -1 ; +else + args->cfg[4 ] = num_batches; + +WARN_ON (args->cfg[4 ] == ~0 );for (int i =0 ; i <3 ; i++) {/* 0xffffffff indicates that the uniform rewrite is not needed */
Signature · 1 line
2.49.0
Quoted 73 lines · Maíra Canal
This commit is a resubmission of commit
1fe1c66274fb("drm/v3d: Fix Indirect Dispatch configuration for V3D 7.1.6 and later"), which was accidentally reverted by commit91dae758bdb8("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 91dae758bdb8 ("Merge tag 'drm-misc-next-2024-08-01' ofhttps://gitlab.freedesktop.org/drm/misc/kernel into drm-next")
Signed-off-by Maíra Canal <[email protected]>---
drivers/gpu/drm/v3d/v3d_sched.c | 16 +++++++++++++---1 file changed, 13 insertions(+), 3 deletions(-)drivers/gpu/drm/v3d/v3d_sched.c +2
-1@@ -428,7 +428,8 @@ v3d_rewrite_csd_job_wg_counts_from_indirect(struct v3d_cpu_job *job) struct v3d_bo *bo = to_v3d_bo(job->base.bo[0]); struct v3d_bo *indirect = to_v3d_bo(indirect_csd->indirect); struct drm_v3d_submit_csd *args = &indirect_csd->job->args; -u32 *wg_counts; +struct v3d_dev *v3d = job->base.v3d; +u32 num_batches, *wg_counts;
v3d_get_bo_vaddr(bo);
v3d_get_bo_vaddr(indirect);drivers/gpu/drm/v3d/v3d_sched.c +0
-0@@ -441,8 +442,17 @@ v3d_rewrite_csd_job_wg_counts_from_indirect(struct v3d_cpu_job *job)args->cfg[0] = wg_counts[0] <<
V3D_CSD_CFG012_WG_COUNT_SHIFT;
args->cfg[1] = wg_counts[1] <<V3D_CSD_CFG012_WG_COUNT_SHIFT;
args->cfg[2] = wg_counts[2] <<V3D_CSD_CFG012_WG_COUNT_SHIFT;drivers/gpu/drm/v3d/v3d_sched.c +5
-3- args->cfg[4 ] =DIV_ROUND_UP (indirect_csd->wg_size,16 ) * - (wg_counts[0] * wg_counts[1] * wg_counts[2]) -1 ; + + num_batches =DIV_ROUND_UP (indirect_csd->wg_size,16 ) * + (wg_counts[0] * wg_counts[1] * wg_counts[2]); + +/* V3D 7.1.6 and later don't subtract 1 from the number of batches */
drivers/gpu/drm/v3d/v3d_sched.c +6
-0+if (v3d->ver <71 || (v3d->ver ==71 && v3d->rev <6 )) + args->cfg[4 ] = num_batches -1 ; +else + args->cfg[4 ] = num_batches; + +WARN_ON (args->cfg[4 ] == ~0 );
for (int i = 0; i < 3; i++) {
/*0xffffffffindicates that the uniform rewrite is not needed */
Hi Iago,
Quoted 1 line · Iago Toral
Reviewed-by Iago Toral Quiroga <[email protected]>
Applied to misc/kernel.git (drm-misc-fixes).
Best Regards,
- Maíra
Quoted 76 lines · Maíra Canal
Quoted 73 lines
This commit is a resubmission of commit
1fe1c66274fb("drm/v3d: Fix Indirect Dispatch configuration for V3D 7.1.6 and later"), which was accidentally reverted by commit91dae758bdb8("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 91dae758bdb8 ("Merge tag 'drm-misc-next-2024-08-01' ofhttps://gitlab.freedesktop.org/drm/misc/kernel into drm-next")
Signed-off-by Maíra Canal <[email protected]>--- drivers/gpu/drm/v3d/v3d_sched.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)drivers/gpu/drm/v3d/v3d_sched.c +2
-1@@ -428,7 +428,8 @@ v3d_rewrite_csd_job_wg_counts_from_indirect(struct v3d_cpu_job *job) struct v3d_bo *bo = to_v3d_bo(job->base.bo[0]); struct v3d_bo *indirect = to_v3d_bo(indirect_csd->indirect); struct drm_v3d_submit_csd *args = &indirect_csd->job->args; -u32 *wg_counts; +struct v3d_dev *v3d = job->base.v3d; +u32 num_batches, *wg_counts; v3d_get_bo_vaddr(bo);
v3d_get_bo_vaddr(indirect);drivers/gpu/drm/v3d/v3d_sched.c +5
-3@@ -441,8 +442,17 @@ v3d_rewrite_csd_job_wg_counts_from_indirect(struct v3d_cpu_job *job) args->cfg[0] = wg_counts[0] <<V3D_CSD_CFG012_WG_COUNT_SHIFT ; args->cfg[1] = wg_counts[1] <<V3D_CSD_CFG012_WG_COUNT_SHIFT ; args->cfg[2] = wg_counts[2] <<V3D_CSD_CFG012_WG_COUNT_SHIFT ; - args->cfg[4 ] =DIV_ROUND_UP (indirect_csd->wg_size,16 ) * - (wg_counts[0] * wg_counts[1] * wg_counts[2]) -1 ; + + num_batches =DIV_ROUND_UP (indirect_csd->wg_size,16 ) * + (wg_counts[0] * wg_counts[1] * wg_counts[2]); + +/* V3D 7.1.6 and later don't subtract 1 from the number of batches */
drivers/gpu/drm/v3d/v3d_sched.c +6
-0+if (v3d->ver <71 || (v3d->ver ==71 && v3d->rev <6 )) + args->cfg[4 ] = num_batches -1 ; +else + args->cfg[4 ] = num_batches; + +WARN_ON (args->cfg[4 ] == ~0 ); for (int i = 0; i < 3; i++) { /* 0xffffffff indicates that the uniform rewrite isnot needed */