From 719ea1f03984f959700326aaec04b5bcdf3ca982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ADra=20Canal?= Date: Thu, 4 Jun 2026 17:32:20 -0300 Subject: [PATCH] drm/v3d: Make v3d_get_cpu_indirect_csd_params() a pure parser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit v3d_get_cpu_indirect_csd_params() currently does double duty: it parses the indirect CSD extension and, while still inside the extension parser, also creates the CSD/clean jobs and locks their BOs through a separate DRM exec context. This nested submission deviates from the standard flow and makes it hard to fold the indirect CSD path into the unified submit chain. Stash the parsed drm_v3d_submit_csd args in struct v3d_indirect_csd_info and have the parser only fill in the parameters. Then, move job creation (v3d_setup_csd_jobs_and_bos()) into v3d_submit_cpu_ioctl(), where is the proper place to create jobs. No functional change, but prepares to move the CPU ioctl into the unified submission chain. Reviewed-by: Tvrtko Ursulin Link: https://patch.msgid.link/20260604-v3d-sched-misc-fixes-v4-7-c068f5bf5ccf@igalia.com Signed-off-by: MaĆ­ra Canal --- drivers/gpu/drm/v3d/v3d_drv.h | 5 +++++ drivers/gpu/drm/v3d/v3d_submit.c | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/v3d/v3d_drv.h b/drivers/gpu/drm/v3d/v3d_drv.h index 8ee3f2964ecd..1f1d4364b031 100644 --- a/drivers/gpu/drm/v3d/v3d_drv.h +++ b/drivers/gpu/drm/v3d/v3d_drv.h @@ -429,6 +429,11 @@ struct v3d_indirect_csd_info { /* Clean cache job associated to the Indirect CSD job */ struct v3d_job *clean_job; + /* Indirect CSD args, stashed by the extension parser and later used + * to create the CSD job from them. + */ + struct drm_v3d_submit_csd args; + /* Offset within the BO where the workgroup counts are stored */ u32 offset; diff --git a/drivers/gpu/drm/v3d/v3d_submit.c b/drivers/gpu/drm/v3d/v3d_submit.c index 0beab1d14450..3f6dae8cb126 100644 --- a/drivers/gpu/drm/v3d/v3d_submit.c +++ b/drivers/gpu/drm/v3d/v3d_submit.c @@ -632,6 +632,7 @@ v3d_get_cpu_indirect_csd_params(struct drm_file *file_priv, } job->job_type = V3D_CPU_JOB_TYPE_INDIRECT_CSD; + info->args = indirect_csd.submit; info->offset = indirect_csd.offset; info->wg_size = indirect_csd.wg_size; memcpy(&info->wg_uniform_offsets, &indirect_csd.wg_uniform_offsets, @@ -639,9 +640,7 @@ v3d_get_cpu_indirect_csd_params(struct drm_file *file_priv, info->indirect = drm_gem_object_lookup(file_priv, indirect_csd.indirect); - return v3d_setup_csd_jobs_and_bos(file_priv, v3d, &indirect_csd.submit, - &info->job, &info->clean_job, - NULL, &info->exec); + return 0; } /* Get data for the query timestamp job submission. */ @@ -1404,6 +1403,17 @@ v3d_submit_cpu_ioctl(struct drm_device *dev, void *data, goto fail; } + if (cpu_job->job_type == V3D_CPU_JOB_TYPE_INDIRECT_CSD) { + ret = v3d_setup_csd_jobs_and_bos(file_priv, v3d, + &cpu_job->indirect_csd.args, + &cpu_job->indirect_csd.job, + &cpu_job->indirect_csd.clean_job, + NULL, + &cpu_job->indirect_csd.exec); + if (ret) + goto fail; + } + clean_job = cpu_job->indirect_csd.clean_job; csd_job = cpu_job->indirect_csd.job;