[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH9NwWfuBF=fZMxU2QnGVWkeXqk-y8NiATjhixY-JS6xxmc-oQ@mail.gmail.com>
Date: Mon, 10 Nov 2025 16:53:39 +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>, etnaviv@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 2/5] drm/etnaviv: move some functions to a header to be
able to use them externally
Hi, thanks for the patch.
>
> From: Gert Wollny <gert.wollny@...labora.com>
>
> v2: Add license info to header
>
> Signed-off-by: Gert Wollny <gert.wollny@...labora.com>
> ---
> drivers/gpu/drm/etnaviv/etnaviv_buffer.c | 71 +------------------
> drivers/gpu/drm/etnaviv/etnaviv_buffer.h | 86 ++++++++++++++++++++++++
> 2 files changed, 87 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 d4f1307d574f..5be9978e34d9 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
> @@ -10,6 +10,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"
> @@ -18,76 +19,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 000000000000..ae1ba1db6c8a
> --- /dev/null
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_buffer.h
> @@ -0,0 +1,86 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2014-2025 Etnaviv Project
> + */
> +
> +#ifndef etnaviv_buffer_h
> +#define etnaviv_buffer_h
#ifndef __ETNAVIV_BUFFER_H__
#define __ETNAVIV_BUFFER_H__
> +
> +#include "etnaviv_cmdbuf.h"
> +#include "etnaviv_gpu.h"
I don't think we need this include."
> +#include "etnaviv_gem.h"
I don't think we need this include."
> +#include "etnaviv_mmu.h"
I don't think we need this include."
> +
> +#include "common.xml.h"
> +#include "linux/printk.h"
I don't think we need this include."
> +#include "state.xml.h"
> +#include "state_blt.xml.h"
I don't think we need this include."
> +#include "state_hi.xml.h"
I don't think we need this include."
> +#include "state_3d.xml.h"
I don't think we need this include."
> +#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
>
--
greets
--
Christian Gmeiner, MSc
https://christian-gmeiner.info/privacypolicy
Powered by blists - more mailing lists