[PATCH] drm/etnaviv: remove unnecessary cache flushes on pipe switch

Christian Gmeiner christian.gmeiner at gmail.com
Fri Jun 27 09:00:04 UTC 2025


>
> The current pipe switch sequence is ported from the Vivante driver,
> which does flush some caches before switching to another pipe. This
> however, is not necessary with etnaviv, as we always flush all write
> caches before completion of a cmdstream. Thus the caches are already
> clean before execution of the next cmdstream, which may
> trigger a pipe switch, is started.
>
> Drop the unnecessary cache flushes. This also avoids sending a stall
> command into a GPU where the active pipe has not been selected, yet.
>
> Signed-off-by: Lucas Stach <l.stach at pengutronix.de>

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

> ---
>  drivers/gpu/drm/etnaviv/etnaviv_buffer.c | 21 +--------------------
>  1 file changed, 1 insertion(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
> index b13a17276d07..09c5d1d0271c 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
> @@ -90,25 +90,6 @@ static inline void CMD_SEM(struct etnaviv_cmdbuf *buffer, u32 from, u32 to)
>  static void etnaviv_cmd_select_pipe(struct etnaviv_gpu *gpu,
>         struct etnaviv_cmdbuf *buffer, u8 pipe)
>  {
> -       u32 flush = 0;
> -
> -       lockdep_assert_held(&gpu->lock);
> -
> -       /*
> -        * This assumes that if we're switching to 2D, we're switching
> -        * away from 3D, and vice versa.  Hence, if we're switching to
> -        * the 2D core, we need to flush the 3D depth and color caches,
> -        * otherwise we need to flush the 2D pixel engine cache.
> -        */
> -       if (gpu->exec_state == ETNA_PIPE_2D)
> -               flush = VIVS_GL_FLUSH_CACHE_PE2D;
> -       else if (gpu->exec_state == ETNA_PIPE_3D)
> -               flush = VIVS_GL_FLUSH_CACHE_DEPTH | VIVS_GL_FLUSH_CACHE_COLOR;
> -
> -       CMD_LOAD_STATE(buffer, VIVS_GL_FLUSH_CACHE, flush);
> -       CMD_SEM(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_PE);
> -       CMD_STALL(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_PE);
> -
>         CMD_LOAD_STATE(buffer, VIVS_GL_PIPE_SELECT,
>                        VIVS_GL_PIPE_SELECT_PIPE(pipe));
>  }
> @@ -382,7 +363,7 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
>
>                 /* pipe switch commands */
>                 if (switch_context)
> -                       extra_dwords += 4;
> +                       extra_dwords += 1;
>
>                 /* PTA load command */
>                 if (switch_mmu_context && gpu->sec_mode == ETNA_SEC_KERNEL)
> --
> 2.39.5
>


-- 
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy


More information about the dri-devel mailing list