Commit e5e3d7bf authored by Maíra Canal's avatar Maíra Canal
Browse files

drm/v3d: Store a pointer to `struct v3d_file_priv` inside each job



Instead of storing a pointer to the DRM file data, store a pointer
directly to the private V3D file struct. No functional change, this
commit only avoids multiple levels of pointer indirection and makes
the code more straightforward.

Reviewed-by: default avatarIago Toral Quiroga <itoral@igalia.com>
Reviewed-by: default avatarMelissa Wen <mwen@igalia.com>
Link: https://lore.kernel.org/r/20250826-v3d-queue-lock-v3-1-979efc43e490@igalia.com


Signed-off-by: default avatarMaíra Canal <mcanal@igalia.com>
parent f4028ef6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -327,9 +327,9 @@ struct v3d_job {
	struct v3d_perfmon *perfmon;

	/* File descriptor of the process that submitted the job that could be used
	 * for collecting stats by process of GPU usage.
	 * to collect per-process information about the GPU.
	 */
	struct drm_file *file;
	struct v3d_file_priv *file_priv;

	/* Callback for the freeing of the job on refcount going to 0. */
	void (*free)(struct kref *ref);
+5 −5
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ static void
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_file_priv *file = job->file_priv;
	struct v3d_stats *global_stats = &v3d->queue[queue].stats;
	struct v3d_stats *local_stats = &file->stats[queue];
	u64 now = local_clock();
@@ -197,7 +197,7 @@ void
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_file_priv *file = job->file_priv;
	struct v3d_stats *global_stats = &v3d->queue[queue].stats;
	u64 now = local_clock();
	unsigned long flags;
@@ -574,7 +574,7 @@ static void
v3d_reset_performance_queries(struct v3d_cpu_job *job)
{
	struct v3d_performance_query_info *performance_query = &job->performance_query;
	struct v3d_file_priv *v3d_priv = job->base.file->driver_priv;
	struct v3d_file_priv *v3d_priv = job->base.file_priv;
	struct v3d_dev *v3d = job->base.v3d;
	struct v3d_perfmon *perfmon;

@@ -604,7 +604,7 @@ v3d_write_performance_query_result(struct v3d_cpu_job *job, void *data,
{
	struct v3d_performance_query_info *performance_query =
						&job->performance_query;
	struct v3d_file_priv *v3d_priv = job->base.file->driver_priv;
	struct v3d_file_priv *v3d_priv = job->base.file_priv;
	struct v3d_performance_query *perf_query =
			&performance_query->queries[query];
	struct v3d_dev *v3d = job->base.v3d;
@@ -722,7 +722,7 @@ static enum drm_gpu_sched_stat
v3d_gpu_reset_for_timeout(struct v3d_dev *v3d, struct drm_sched_job *sched_job)
{
	struct v3d_job *job = to_v3d_job(sched_job);
	struct v3d_file_priv *v3d_priv = job->file->driver_priv;
	struct v3d_file_priv *v3d_priv = job->file_priv;
	enum v3d_queue q;

	mutex_lock(&v3d->reset_lock);
+1 −1
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@ v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv,

	job->v3d = v3d;
	job->free = free;
	job->file = file_priv;
	job->file_priv = v3d_priv;

	ret = drm_sched_job_init(&job->base, &v3d_priv->sched_entity[queue],
				 1, v3d_priv, file_priv->client_id);