diff mbox series

drm/etnaviv: reduce number of ktime_get calls in IRQ handler

Message ID 20240621200020.491579-1-l.stach@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series drm/etnaviv: reduce number of ktime_get calls in IRQ handler | expand

Commit Message

Lucas Stach June 21, 2024, 8 p.m. UTC
A single IRQ might signal the completion of multiple jobs/fences
at once. There is no point in attaching a new timestamp to each
fence that only differs in when exactly the IRQ handler was able
to process this fence.

Get a single timestamp when the IRQ handler has determined that
there are completed jobs and reuse this for all fences that get
signalled by the handler.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Philipp Zabel June 24, 2024, 12:13 p.m. UTC | #1
On Fr, 2024-06-21 at 22:00 +0200, Lucas Stach wrote:
> A single IRQ might signal the completion of multiple jobs/fences
> at once. There is no point in attaching a new timestamp to each
> fence that only differs in when exactly the IRQ handler was able
> to process this fence.
> 
> Get a single timestamp when the IRQ handler has determined that
> there are completed jobs and reuse this for all fences that get
> signalled by the handler.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp
Christian Gmeiner June 24, 2024, 1:10 p.m. UTC | #2
>
> A single IRQ might signal the completion of multiple jobs/fences
> at once. There is no point in attaching a new timestamp to each
> fence that only differs in when exactly the IRQ handler was able
> to process this fence.
>
> Get a single timestamp when the IRQ handler has determined that
> there are completed jobs and reuse this for all fences that get
> signalled by the handler.
>
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>

Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>

> ---
>  drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> index 7502c55199b8..7c7f97793ddd 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> @@ -1548,6 +1548,7 @@ static irqreturn_t irq_handler(int irq, void *data)
>         u32 intr = gpu_read(gpu, VIVS_HI_INTR_ACKNOWLEDGE);
>
>         if (intr != 0) {
> +               ktime_t now = ktime_get();
>                 int event;
>
>                 pm_runtime_mark_last_busy(gpu->dev);
> @@ -1597,7 +1598,7 @@ static irqreturn_t irq_handler(int irq, void *data)
>                          */
>                         if (fence_after(fence->seqno, gpu->completed_fence))
>                                 gpu->completed_fence = fence->seqno;
> -                       dma_fence_signal(fence);
> +                       dma_fence_signal_timestamp(fence, now);
>
>                         event_free(gpu, event);
>                 }
> --
> 2.39.2
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 7502c55199b8..7c7f97793ddd 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -1548,6 +1548,7 @@  static irqreturn_t irq_handler(int irq, void *data)
 	u32 intr = gpu_read(gpu, VIVS_HI_INTR_ACKNOWLEDGE);
 
 	if (intr != 0) {
+		ktime_t now = ktime_get();
 		int event;
 
 		pm_runtime_mark_last_busy(gpu->dev);
@@ -1597,7 +1598,7 @@  static irqreturn_t irq_handler(int irq, void *data)
 			 */
 			if (fence_after(fence->seqno, gpu->completed_fence))
 				gpu->completed_fence = fence->seqno;
-			dma_fence_signal(fence);
+			dma_fence_signal_timestamp(fence, now);
 
 			event_free(gpu, event);
 		}