[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH9NwWe5oD7YRnnP5jKY8L+YoeVYsU5NLKUyerXpZrFU16So4g@mail.gmail.com>
Date: Fri, 28 Nov 2025 09:56:00 +0100
From: Christian Gmeiner <christian.gmeiner@...il.com>
To: gert.wollny@...labora.com
Cc: Lucas Stach <l.stach@...gutronix.de>, Russell King <linux+etnaviv@...linux.org.uk>,
David Airlie <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>,
Marek Vasut <marek.vasut+renesas@...lbox.org>, etnaviv@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 2/5] drm/etnaviv: move some functions to a header to be
able to use them externally
Am Mi., 19. Nov. 2025 um 17:43 Uhr schrieb <gert.wollny@...labora.com>:
>
> From: Gert Wollny <gert.wollny@...labora.com>
>
> v2: Add license info to header
>
> v3: remove unused headers (Christian Gmainer)
>
> Signed-off-by: Gert Wollny <gert.wollny@...labora.com>
> ---
> drivers/gpu/drm/etnaviv/etnaviv_buffer.c | 71 +--------------------
> drivers/gpu/drm/etnaviv/etnaviv_buffer.h | 79 ++++++++++++++++++++++++
> 2 files changed, 80 insertions(+), 70 deletions(-)
> create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_buffer.h
>
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
> index 384df1659..829f8497d 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
> @@ -9,6 +9,7 @@
> #include "etnaviv_gpu.h"
> #include "etnaviv_gem.h"
> #include "etnaviv_mmu.h"
> +#include "etnaviv_buffer.h"
>
> #include "common.xml.h"
> #include "state.xml.h"
> @@ -17,76 +18,6 @@
> #include "state_3d.xml.h"
> #include "cmdstream.xml.h"
>
> -/*
> - * Command Buffer helper:
> - */
> -
> -
> -static inline void OUT(struct etnaviv_cmdbuf *buffer, u32 data)
> -{
> - u32 *vaddr = (u32 *)buffer->vaddr;
> -
> - BUG_ON(buffer->user_size >= buffer->size);
> -
> - vaddr[buffer->user_size / 4] = data;
> - buffer->user_size += 4;
> -}
> -
> -static inline void CMD_LOAD_STATE(struct etnaviv_cmdbuf *buffer,
> - u32 reg, u32 value)
> -{
> - u32 index = reg >> VIV_FE_LOAD_STATE_HEADER_OFFSET__SHR;
> -
> - buffer->user_size = ALIGN(buffer->user_size, 8);
> -
> - /* write a register via cmd stream */
> - OUT(buffer, VIV_FE_LOAD_STATE_HEADER_OP_LOAD_STATE |
> - VIV_FE_LOAD_STATE_HEADER_COUNT(1) |
> - VIV_FE_LOAD_STATE_HEADER_OFFSET(index));
> - OUT(buffer, value);
> -}
> -
> -static inline void CMD_END(struct etnaviv_cmdbuf *buffer)
> -{
> - buffer->user_size = ALIGN(buffer->user_size, 8);
> -
> - OUT(buffer, VIV_FE_END_HEADER_OP_END);
> -}
> -
> -static inline void CMD_WAIT(struct etnaviv_cmdbuf *buffer,
> - unsigned int waitcycles)
> -{
> - buffer->user_size = ALIGN(buffer->user_size, 8);
> -
> - OUT(buffer, VIV_FE_WAIT_HEADER_OP_WAIT | waitcycles);
> -}
> -
> -static inline void CMD_LINK(struct etnaviv_cmdbuf *buffer,
> - u16 prefetch, u32 address)
> -{
> - buffer->user_size = ALIGN(buffer->user_size, 8);
> -
> - OUT(buffer, VIV_FE_LINK_HEADER_OP_LINK |
> - VIV_FE_LINK_HEADER_PREFETCH(prefetch));
> - OUT(buffer, address);
> -}
> -
> -static inline void CMD_STALL(struct etnaviv_cmdbuf *buffer,
> - u32 from, u32 to)
> -{
> - buffer->user_size = ALIGN(buffer->user_size, 8);
> -
> - OUT(buffer, VIV_FE_STALL_HEADER_OP_STALL);
> - OUT(buffer, VIV_FE_STALL_TOKEN_FROM(from) | VIV_FE_STALL_TOKEN_TO(to));
> -}
> -
> -static inline void CMD_SEM(struct etnaviv_cmdbuf *buffer, u32 from, u32 to)
> -{
> - CMD_LOAD_STATE(buffer, VIVS_GL_SEMAPHORE_TOKEN,
> - VIVS_GL_SEMAPHORE_TOKEN_FROM(from) |
> - VIVS_GL_SEMAPHORE_TOKEN_TO(to));
> -}
> -
> static void etnaviv_cmd_select_pipe(struct etnaviv_gpu *gpu,
> struct etnaviv_cmdbuf *buffer, u8 pipe)
> {
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_buffer.h b/drivers/gpu/drm/etnaviv/etnaviv_buffer.h
> new file mode 100644
> index 000000000..4cf77cdee
> --- /dev/null
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_buffer.h
> @@ -0,0 +1,79 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2014-2025 Etnaviv Project
> + */
> +
> +#ifndef etnaviv_buffer_h
> +#define etnaviv_buffer_h
> +
You missed my comment from the previous review.
> +#include "etnaviv_cmdbuf.h"
> +
> +#include "common.xml.h"
> +#include "state.xml.h"
> +#include "cmdstream.xml.h"
> +
> +static inline void OUT(struct etnaviv_cmdbuf *buffer, u32 data)
> +{
> + u32 *vaddr = (u32 *)buffer->vaddr;
> +
> + BUG_ON(buffer->user_size >= buffer->size);
> +
> + vaddr[buffer->user_size / 4] = data;
> + buffer->user_size += 4;
> +}
> +
> +static inline void CMD_LOAD_STATE(struct etnaviv_cmdbuf *buffer, u32 reg,
> + u32 value)
> +{
> + u32 index = reg >> VIV_FE_LOAD_STATE_HEADER_OFFSET__SHR;
> +
> + buffer->user_size = ALIGN(buffer->user_size, 8);
> +
> + /* write a register via cmd stream */
> + OUT(buffer, VIV_FE_LOAD_STATE_HEADER_OP_LOAD_STATE |
> + VIV_FE_LOAD_STATE_HEADER_COUNT(1) |
> + VIV_FE_LOAD_STATE_HEADER_OFFSET(index));
> + OUT(buffer, value);
> +}
> +
> +static inline void CMD_END(struct etnaviv_cmdbuf *buffer)
> +{
> + buffer->user_size = ALIGN(buffer->user_size, 8);
> +
> + OUT(buffer, VIV_FE_END_HEADER_OP_END);
> +}
> +
> +static inline void CMD_WAIT(struct etnaviv_cmdbuf *buffer,
> + unsigned int waitcycles)
> +{
> + buffer->user_size = ALIGN(buffer->user_size, 8);
> +
> + OUT(buffer, VIV_FE_WAIT_HEADER_OP_WAIT | waitcycles);
> +}
> +
> +static inline void CMD_LINK(struct etnaviv_cmdbuf *buffer, u16 prefetch,
> + u32 address)
> +{
> + buffer->user_size = ALIGN(buffer->user_size, 8);
> +
> + OUT(buffer,
> + VIV_FE_LINK_HEADER_OP_LINK | VIV_FE_LINK_HEADER_PREFETCH(prefetch));
> + OUT(buffer, address);
> +}
> +
> +static inline void CMD_STALL(struct etnaviv_cmdbuf *buffer, u32 from, u32 to)
> +{
> + buffer->user_size = ALIGN(buffer->user_size, 8);
> +
> + OUT(buffer, VIV_FE_STALL_HEADER_OP_STALL);
> + OUT(buffer, VIV_FE_STALL_TOKEN_FROM(from) | VIV_FE_STALL_TOKEN_TO(to));
> +}
> +
> +static inline void CMD_SEM(struct etnaviv_cmdbuf *buffer, u32 from, u32 to)
> +{
> + CMD_LOAD_STATE(buffer, VIVS_GL_SEMAPHORE_TOKEN,
> + VIVS_GL_SEMAPHORE_TOKEN_FROM(from) |
> + VIVS_GL_SEMAPHORE_TOKEN_TO(to));
> +}
> +
> +#endif
> --
> 2.51.0
>
In order to save you from doing another round, I will fix the
last nit, if that is okay for you.
Reviewed-by: Christian Gmeiner <cgmeiner@...lia.com>
--
greets
--
Christian Gmeiner, MSc
https://christian-gmeiner.info/privacypolicy
Powered by blists - more mailing lists