Re: [PATCH 1/2] drm/panfrost: Enable cycle counting when perfcnt is enabled
From: Boris Brezillon
Date: Fri Oct 16 2026 - 03:24:45 EST
On Thu, 15 Oct 2026 19:22:31 +0100
Adrián Larumbe <adrian.larumbe@xxxxxxxxxxxxx> wrote:
> From: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx>
>
> If we don't do that, we end up with invalid timestamps in the block
> headers.
>
> Fixes: 7786fd108777 ("drm/panfrost: Expose performance counters through unstable ioctls")
> Signed-off-by: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx>
Let's make sure this is merged in the same release the perfcnt uAPI
changes are in, so userspace can check the driver version to know if
the fix is present or not (we have a workaround in mesa for that which
we can drop when the fix is in).
> ---
> drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c
> index a9def452d5ef..b26da057a1a0 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c
> @@ -17,6 +17,7 @@
> #include "panfrost_device.h"
> #include "panfrost_features.h"
> #include "panfrost_gem.h"
> +#include "panfrost_gpu.h"
> #include "panfrost_issues.h"
> #include "panfrost_job.h"
> #include "panfrost_mmu.h"
> @@ -52,6 +53,7 @@ static void panfrost_perfcnt_hw_disable(struct panfrost_device *pfdev)
> gpu_write(pfdev, GPU_PRFCNT_TILER_EN, 0);
>
> if (perfcnt->owns_as_ref) {
> + panfrost_cycle_counter_put(pfdev);
> panfrost_mmu_as_put(pfdev, perfcnt->mapping->mmu);
> perfcnt->owns_as_ref = false;
> }
> @@ -84,6 +86,7 @@ static int panfrost_perfcnt_hw_enable(struct panfrost_device *pfdev)
> return ret;
>
> perfcnt->owns_as_ref = true;
> + panfrost_cycle_counter_get(pfdev);
>
> as = ret;
> cfg = GPU_PERFCNT_CFG_AS(as) |
>