drivers/gpu/drm/etnaviv/etnaviv_buffer.h
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/etnaviv/etnaviv_buffer.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/etnaviv/etnaviv_buffer.h- Extension
.h- Size
- 2579 bytes
- Lines
- 100
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
etnaviv_cmdbuf.hetnaviv_gpu.hetnaviv_gem.hetnaviv_mmu.hcommon.xml.hlinux/printk.hstate.xml.hstate_blt.xml.hstate_hi.xml.hstate_3d.xml.hcmdstream.xml.h
Detected Declarations
function Copyrightfunction CMD_LOAD_STATEfunction CMD_LOAD_STATES_STARTfunction CMD_ENDfunction CMD_WAITfunction CMD_LINKfunction CMD_STALLfunction CMD_SEM
Annotated Snippet
// 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 "etnaviv_gpu.h"
#include "etnaviv_gem.h"
#include "etnaviv_mmu.h"
#include "common.xml.h"
#include "linux/printk.h"
#include "state.xml.h"
#include "state_blt.xml.h"
#include "state_hi.xml.h"
#include "state_3d.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_LOAD_STATES_START(struct etnaviv_cmdbuf *buffer, u32 reg,
u32 nvalues)
{
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_OFFSET(index) |
VIV_FE_LOAD_STATE_HEADER_COUNT(nvalues));
}
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));
}
Annotation
- Immediate include surface: `etnaviv_cmdbuf.h`, `etnaviv_gpu.h`, `etnaviv_gem.h`, `etnaviv_mmu.h`, `common.xml.h`, `linux/printk.h`, `state.xml.h`, `state_blt.xml.h`.
- Detected declarations: `function Copyright`, `function CMD_LOAD_STATE`, `function CMD_LOAD_STATES_START`, `function CMD_END`, `function CMD_WAIT`, `function CMD_LINK`, `function CMD_STALL`, `function CMD_SEM`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.