[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241002104006.5e2f744b@collabora.com>
Date: Wed, 2 Oct 2024 10:40:06 +0200
From: Boris Brezillon <boris.brezillon@...labora.com>
To: Adrián Larumbe <adrian.larumbe@...labora.com>
Cc: Steven Price <steven.price@....com>, Liviu Dudau <liviu.dudau@....com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, Maxime Ripard
<mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>, David Airlie
<airlied@...il.com>, Simona Vetter <simona@...ll.ch>, Sumit Semwal
<sumit.semwal@...aro.org>, Christian König
<christian.koenig@....com>, kernel@...labora.com,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
linux-media@...r.kernel.org, linaro-mm-sig@...ts.linaro.org
Subject: Re: [PATCH v8 3/5] drm/panthor: add DRM fdinfo support
On Tue, 24 Sep 2024 00:06:23 +0100
Adrián Larumbe <adrian.larumbe@...labora.com> wrote:
> +static void update_fdinfo_stats(struct panthor_job *job)
> +{
> + struct panthor_group *group = job->group;
> + struct panthor_queue *queue = group->queues[job->queue_idx];
> + struct panthor_gpu_usage *fdinfo = &group->fdinfo.data;
> + struct panthor_job_profiling_data *times;
> +
> + times = (struct panthor_job_profiling_data *)
> + ((unsigned long) queue->profiling.slots->kmap +
> + (job->profiling.slot * sizeof(struct panthor_job_profiling_data)));
The casting done here is a bit of a mess, so I replaced it by:
struct panthor_job_profiling_data *slots = queue->profiling.slots->kmap;
struct panthor_job_profiling_data *data = &slots[job->profiling.slot];
> +
> + mutex_lock(&group->fdinfo.lock);
> + if (job->profiling.mask & PANTHOR_DEVICE_PROFILING_CYCLES)
> + fdinfo->cycles += times->cycles.after - times->cycles.before;
> + if (job->profiling.mask & PANTHOR_DEVICE_PROFILING_TIMESTAMP)
> + fdinfo->time += times->time.after - times->time.before;
> + mutex_unlock(&group->fdinfo.lock);
> +}
Powered by blists - more mailing lists