mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 17:13:52 +02:00
drm/etnaviv: move some functions to a header to be able to use them externally
v2: Add license info to header v3: remove unused headers (Christian Gmainer) [cgmeiner: improve include guard] Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com> Tested-by: Marek Vasut <marek.vasut@mailbox.org> # STM32MP255C DHCOS DHSBC Link: https://patch.msgid.link/20251119164624.9297-3-gert.wollny@collabora.com Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
This commit is contained in:
parent
a8fffbe7de
commit
9934873be0
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
79
drivers/gpu/drm/etnaviv/etnaviv_buffer.h
Normal file
79
drivers/gpu/drm/etnaviv/etnaviv_buffer.h
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright (C) 2014-2025 Etnaviv Project
|
||||
*/
|
||||
|
||||
#ifndef __ETNAVIV_BUFFER_H__
|
||||
#define __ETNAVIV_BUFFER_H__
|
||||
|
||||
#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 /* __ETNAVIV_BUFFER_H__ */
|
||||
Loading…
Reference in New Issue
Block a user