From: Steven Price <steven.price@arm.com>
To: Mary Guillemard <mary.guillemard@collabora.com>,
linux-kernel@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org, kernel@collabora.com,
Boris Brezillon <boris.brezillon@collabora.com>,
Rob Herring <robh@kernel.org>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>
Subject: Re: [PATCH 1/3] drm/panfrost: Add SYSTEM_TIMESTAMP and SYSTEM_TIMESTAMP_FREQUENCY parameters
Date: Thu, 8 Aug 2024 11:23:51 +0100 [thread overview]
Message-ID: <37be0bd0-219d-4e46-b17e-cde7f960becb@arm.com> (raw)
In-Reply-To: <20240807160900.149154-2-mary.guillemard@collabora.com>
On 07/08/2024 17:08, Mary Guillemard wrote:
> Expose system timestamp and frequency supported by the GPU.
>
> Mali uses the generic arch timer as GPU system time so we currently
> wire cntvct_el0 and cntfrq_el0 respectively to those parameters.
> We could have directly read those values from userland but handling
> this here allows us to be future proof in case of errata related to
> timers for example.
I'm not sure what the benefit is for the kernel driver providing these
(and only on some systems)? The user space driver is still going to need
code to deal with the problematic systems.
> This new uAPI will be used in Mesa to implement timestamp queries and
> VK_KHR_calibrated_timestamps.
VK_KHR_calibrated_timestamps says it should query 'quasi simultaneously
from two time domains' - but this is purely providing an interface to
read a single counter at a time.
It _may_ be useful to report the GPU's view of time and at the same time
(or as near as possible) the architectural counters. That can be used to
deal with drift between the GPU's counters and arch counters[1].
In general we try to avoid providing an interface to something which is
unrelated to the GPU, especially when user space already has a mechanism.
Steve
[1] See Mihail's response to the panthor patches for details of
differences that might occur.
> Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
> ---
> drivers/gpu/drm/panfrost/panfrost_drv.c | 17 +++++++++++++++++
> include/uapi/drm/panfrost_drm.h | 2 ++
> 2 files changed, 19 insertions(+)
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
> index 671eed4ad890..d94c9bf5a7f9 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_drv.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
> @@ -69,6 +69,23 @@ static int panfrost_ioctl_get_param(struct drm_device *ddev, void *data, struct
> PANFROST_FEATURE_ARRAY(JS_FEATURES, js_features, 15);
> PANFROST_FEATURE(NR_CORE_GROUPS, nr_core_groups);
> PANFROST_FEATURE(THREAD_TLS_ALLOC, thread_tls_alloc);
> +
> + case DRM_PANFROST_PARAM_SYSTEM_TIMESTAMP:
> +#ifdef CONFIG_ARM_ARCH_TIMER
> + param->value = __arch_counter_get_cntvct();
> +#else
> + param->value = 0;
> +#endif
> + break;
> +
> + case DRM_PANFROST_PARAM_SYSTEM_TIMESTAMP_FREQUENCY:
> +#ifdef CONFIG_ARM_ARCH_TIMER
> + param->value = arch_timer_get_cntfrq();
> +#else
> + param->value = 0;
> +#endif
> + break;
> +
> default:
> return -EINVAL;
> }
> diff --git a/include/uapi/drm/panfrost_drm.h b/include/uapi/drm/panfrost_drm.h
> index 9f231d40a146..52b050e2b660 100644
> --- a/include/uapi/drm/panfrost_drm.h
> +++ b/include/uapi/drm/panfrost_drm.h
> @@ -172,6 +172,8 @@ enum drm_panfrost_param {
> DRM_PANFROST_PARAM_NR_CORE_GROUPS,
> DRM_PANFROST_PARAM_THREAD_TLS_ALLOC,
> DRM_PANFROST_PARAM_AFBC_FEATURES,
> + DRM_PANFROST_PARAM_SYSTEM_TIMESTAMP,
> + DRM_PANFROST_PARAM_SYSTEM_TIMESTAMP_FREQUENCY,
> };
>
> struct drm_panfrost_get_param {
next prev parent reply other threads:[~2024-08-08 10:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-07 16:08 [PATCH 0/3] drm/panfrost: Wire cycle counters and timestamp info to userspace Mary Guillemard
2024-08-07 16:08 ` [PATCH 1/3] drm/panfrost: Add SYSTEM_TIMESTAMP and SYSTEM_TIMESTAMP_FREQUENCY parameters Mary Guillemard
2024-08-08 10:23 ` Steven Price [this message]
2024-08-08 10:46 ` Mary Guillemard
2024-08-08 13:06 ` kernel test robot
2024-08-07 16:08 ` [PATCH 2/3] drm/panfrost: Add cycle counter job requirement Mary Guillemard
2024-08-08 10:23 ` Steven Price
2024-08-07 16:08 ` [PATCH 3/3] drm/panfrost: Handle JD_REQ_CYCLE_COUNT Mary Guillemard
2024-08-08 10:23 ` Steven Price
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=37be0bd0-219d-4e46-b17e-cde7f960becb@arm.com \
--to=steven.price@arm.com \
--cc=airlied@gmail.com \
--cc=boris.brezillon@collabora.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mary.guillemard@collabora.com \
--cc=mripard@kernel.org \
--cc=robh@kernel.org \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox