summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/v3d/v3d_sched.c
diff options
context:
space:
mode:
authorMaíra Canal <mcanal@igalia.com>2024-04-20 23:32:11 +0200
committerMaíra Canal <mcanal@igalia.com>2024-04-24 00:32:47 +0200
commitda483d079bacceba6c999b4bb2b4c488ead12ed8 (patch)
tree5d509b995f619a01f27181deaa0adfa5bff86c46 /drivers/gpu/drm/v3d/v3d_sched.c
parentdrm/v3d: Create a struct to store the GPU stats (diff)
downloadlinux-da483d079bacceba6c999b4bb2b4c488ead12ed8.tar.xz
linux-da483d079bacceba6c999b4bb2b4c488ead12ed8.zip
drm/v3d: Create function to update a set of GPU stats
Given a set of GPU stats, that is, a `struct v3d_stats` related to a queue in a given context, create a function that can update this set of GPU stats. Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240420213632.339941-5-mcanal@igalia.com
Diffstat (limited to 'drivers/gpu/drm/v3d/v3d_sched.c')
-rw-r--r--drivers/gpu/drm/v3d/v3d_sched.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/gpu/drm/v3d/v3d_sched.c b/drivers/gpu/drm/v3d/v3d_sched.c
index b6b5542c3fcf..b9614944931c 100644
--- a/drivers/gpu/drm/v3d/v3d_sched.c
+++ b/drivers/gpu/drm/v3d/v3d_sched.c
@@ -118,6 +118,14 @@ v3d_job_start_stats(struct v3d_job *job, enum v3d_queue queue)
global_stats->start_ns = now;
}
+static void
+v3d_stats_update(struct v3d_stats *stats, u64 now)
+{
+ stats->enabled_ns += now - stats->start_ns;
+ stats->jobs_completed++;
+ stats->start_ns = 0;
+}
+
void
v3d_job_update_stats(struct v3d_job *job, enum v3d_queue queue)
{
@@ -127,13 +135,8 @@ v3d_job_update_stats(struct v3d_job *job, enum v3d_queue queue)
struct v3d_stats *local_stats = &file->stats[queue];
u64 now = local_clock();
- local_stats->enabled_ns += now - local_stats->start_ns;
- local_stats->jobs_completed++;
- local_stats->start_ns = 0;
-
- global_stats->enabled_ns += now - global_stats->start_ns;
- global_stats->jobs_completed++;
- global_stats->start_ns = 0;
+ v3d_stats_update(local_stats, now);
+ v3d_stats_update(global_stats, now);
}
static struct dma_fence *v3d_bin_job_run(struct drm_sched_job *sched_job)