aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/v3d/v3d_sched.c
diff options
context:
space:
mode:
authorMaíra Canal <[email protected]>2024-04-20 18:32:10 -0300
committerMaíra Canal <[email protected]>2024-04-23 19:32:46 -0300
commitb136b1953f201542ae5cdfee4b35e9a2e4aa16fa (patch)
tree288713b26ffcd069669079e83f435c37e7dbcca6 /drivers/gpu/drm/v3d/v3d_sched.c
parent52ce97765cc71708acfd2a66b71e6cd3abb096d8 (diff)
drm/v3d: Create a struct to store the GPU stats
This will make it easier to instantiate the GPU stats variables and it will create a structure where we can store all the variables that refer to GPU stats. Note that, when we created the struct `v3d_stats`, we renamed `jobs_sent` to `jobs_completed`. This better express the semantics of the variable, as we are only accounting jobs that have been completed. Signed-off-by: Maíra Canal <[email protected]> Reviewed-by: Tvrtko Ursulin <[email protected]> Reviewed-by: Jose Maria Casanova Crespo <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Diffstat (limited to 'drivers/gpu/drm/v3d/v3d_sched.c')
-rw-r--r--drivers/gpu/drm/v3d/v3d_sched.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/gpu/drm/v3d/v3d_sched.c b/drivers/gpu/drm/v3d/v3d_sched.c
index 8ca61bcd4b1c..b6b5542c3fcf 100644
--- a/drivers/gpu/drm/v3d/v3d_sched.c
+++ b/drivers/gpu/drm/v3d/v3d_sched.c
@@ -110,10 +110,12 @@ v3d_job_start_stats(struct v3d_job *job, enum v3d_queue queue)
{
struct v3d_dev *v3d = job->v3d;
struct v3d_file_priv *file = job->file->driver_priv;
+ struct v3d_stats *global_stats = &v3d->queue[queue].stats;
+ struct v3d_stats *local_stats = &file->stats[queue];
u64 now = local_clock();
- file->start_ns[queue] = now;
- v3d->queue[queue].start_ns = now;
+ local_stats->start_ns = now;
+ global_stats->start_ns = now;
}
void
@@ -121,15 +123,17 @@ v3d_job_update_stats(struct v3d_job *job, enum v3d_queue queue)
{
struct v3d_dev *v3d = job->v3d;
struct v3d_file_priv *file = job->file->driver_priv;
+ struct v3d_stats *global_stats = &v3d->queue[queue].stats;
+ struct v3d_stats *local_stats = &file->stats[queue];
u64 now = local_clock();
- file->enabled_ns[queue] += now - file->start_ns[queue];
- file->jobs_sent[queue]++;
- file->start_ns[queue] = 0;
+ local_stats->enabled_ns += now - local_stats->start_ns;
+ local_stats->jobs_completed++;
+ local_stats->start_ns = 0;
- v3d->queue[queue].enabled_ns += now - v3d->queue[queue].start_ns;
- v3d->queue[queue].jobs_sent++;
- v3d->queue[queue].start_ns = 0;
+ global_stats->enabled_ns += now - global_stats->start_ns;
+ global_stats->jobs_completed++;
+ global_stats->start_ns = 0;
}
static struct dma_fence *v3d_bin_job_run(struct drm_sched_job *sched_job)