difos/target/linux/bcm27xx/patches-6.12/950-0755-drm-v3d-CPU-job-submissions-shouldn-t-affect-V3D-GPU.patch
Álvaro Fernández Rojas 8f9e91ad03 bcm27xx: add 6.12 patches from RPi repo
These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.12.y
With the following command:
git format-patch -N v6.12.27..HEAD
(HEAD -> 8d3206ee456a5ecdf9ddbfd8e5e231e4f0cd716e)

Exceptions:
- (def)configs patches
- github workflows patches
- applied & reverted patches
- readme patches
- wireless patches

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2025-05-21 11:32:18 +02:00

89 lines
2.6 KiB
Diff

From 2d693f4d08ff72e0ccc8a4d3bb3ba6e52f15c9c9 Mon Sep 17 00:00:00 2001
From: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Date: Mon, 13 Jan 2025 17:29:27 +0100
Subject: [PATCH] drm/v3d: CPU job submissions shouldn't affect V3D GPU clock
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We can avoid calling the v3d_clock_up_put and v3d_clock_up_get
when a job is submitted to a CPU queue. We don't need to change
the V3D core frequency to run a CPU job as it is executed on
the CPU. This way we avoid delaying timestamps CPU jobs by 4.5ms
that is the time that it takes the firmware to increase the V3D
core frequency.
Fixes: fe6a858096c1 ("drm/v3d: Correct clock settng calls to new APIs")
Signed-off-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Reviewed-by: Maíra Canal <mcanal@igalia.com>
---
drivers/gpu/drm/v3d/v3d_submit.c | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
--- a/drivers/gpu/drm/v3d/v3d_submit.c
+++ b/drivers/gpu/drm/v3d/v3d_submit.c
@@ -125,9 +125,9 @@ v3d_lookup_bos(struct drm_device *dev,
}
static void
-v3d_job_free(struct kref *ref)
+v3d_job_free_common(struct v3d_job *job,
+ bool is_gpu_job)
{
- struct v3d_job *job = container_of(ref, struct v3d_job, refcount);
struct v3d_dev *v3d = job->v3d;
int i;
@@ -140,7 +140,8 @@ v3d_job_free(struct kref *ref)
dma_fence_put(job->irq_fence);
dma_fence_put(job->done_fence);
- v3d_clock_up_put(v3d);
+ if (is_gpu_job)
+ v3d_clock_up_put(v3d);
if (job->perfmon)
v3d_perfmon_put(job->perfmon);
@@ -149,6 +150,22 @@ v3d_job_free(struct kref *ref)
}
static void
+v3d_job_free(struct kref *ref)
+{
+ struct v3d_job *job = container_of(ref, struct v3d_job, refcount);
+
+ v3d_job_free_common(job, true);
+}
+
+static void
+v3d_cpu_job_free(struct kref *ref)
+{
+ struct v3d_job *job = container_of(ref, struct v3d_job, refcount);
+
+ v3d_job_free_common(job, false);
+}
+
+static void
v3d_render_job_free(struct kref *ref)
{
struct v3d_render_job *job = container_of(ref, struct v3d_render_job,
@@ -242,8 +259,9 @@ v3d_job_init(struct v3d_dev *v3d, struct
if (ret && ret != -ENOENT)
goto fail_deps;
}
+ if (queue != V3D_CPU)
+ v3d_clock_up_get(v3d);
- v3d_clock_up_get(v3d);
kref_init(&job->refcount);
return 0;
@@ -1350,7 +1368,7 @@ v3d_submit_cpu_ioctl(struct drm_device *
trace_v3d_submit_cpu_ioctl(&v3d->drm, cpu_job->job_type);
ret = v3d_job_init(v3d, file_priv, &cpu_job->base,
- v3d_job_free, 0, &se, V3D_CPU);
+ v3d_cpu_job_free, 0, &se, V3D_CPU);
if (ret) {
v3d_job_deallocate((void *)&cpu_job);
goto fail;