7#ifndef __LIBDRAGON_RDPQ_INTERNAL_H
8#define __LIBDRAGON_RDPQ_INTERNAL_H
12#include "../rspq/rspq_internal.h"
58 uint8_t cycle_type_frozen : 2;
73typedef struct rdpq_block_s {
76 uint32_t cmds[] __attribute__((aligned(8)));
84typedef struct rdpq_block_state_s {
125void __rdpq_write8(uint32_t cmd_id, uint32_t arg0, uint32_t arg1);
126void __rdpq_write16(uint32_t cmd_id, uint32_t arg0, uint32_t arg1, uint32_t arg2, uint32_t arg3);
134#define __rdpcmd_count_words2(rdp_cmd_id, arg0, ...) nwords += __COUNT_VARARGS(__VA_ARGS__) + 1;
135#define __rdpcmd_count_words(arg) __rdpcmd_count_words2 arg
137#define __rdpcmd_write_arg(arg) *ptr++ = arg;
138#define __rdpcmd_write2(rdp_cmd_id, arg0, ...) \
139 *ptr++ = (RDPQ_OVL_ID + ((rdp_cmd_id)<<24)) | (arg0); \
140 __CALL_FOREACH_BIS(__rdpcmd_write_arg, ##__VA_ARGS__);
141#define __rdpcmd_write(arg) __rdpcmd_write2 arg
143#define __rspcmd_write(...) ({ rspq_write(RDPQ_OVL_ID, __VA_ARGS__ ); })
162#define rdpq_passthrough_write(rdp_cmd) ({ \
163 if (__builtin_expect(rspq_in_block(), 0)) { \
164 extern rdpq_block_state_t rdpq_block_state; \
165 int nwords = 0; __rdpcmd_count_words(rdp_cmd); \
166 if (__builtin_expect(rdpq_block_state.wptr + nwords > rdpq_block_state.wend, 0)) \
167 __rdpq_block_next_buffer(); \
168 volatile uint32_t *ptr = rdpq_block_state.wptr; \
169 __rdpcmd_write(rdp_cmd); \
170 __rdpq_block_update((uint32_t*)ptr); \
172 __rspcmd_write rdp_cmd; \
rdpq_tracking_t tracking
Tracking state at the end of a block (this is populated only on the first link)
Definition rdpq_internal.h:75
rdpq_block_t * __rdpq_block_end()
Finish creation of a RDP block.
Definition rdpq.c:716
void __rdpq_autosync_change(uint32_t res)
Autosync engine: mark certain resources as being changed.
Definition rdpq.c:588
volatile uint32_t * wptr
During block creation, current write pointer within the RDP buffer.
Definition rdpq_internal.h:86
void __rdpq_autosync_use(uint32_t res)
Autosync engine: mark certain resources as in use.
Definition rdpq_internal.h:119
bool __rdpq_inited
True if the rdpq module was inited.
Definition rdpq.c:399
uint8_t cycle_type_known
0=unknown, 1=standard, 2=copy/fill
Definition rdpq_internal.h:57
rdpq_block_t * next
Link to next buffer (or NULL if this is the last one for this block)
Definition rdpq_internal.h:74
void __rdpq_block_begin()
Initialize RDP block mangament.
Definition rdpq.c:625
volatile uint32_t * pending_wend
Previous wend, swapped out to go back to dynamic buffer.
Definition rdpq_internal.h:92
void rdpq_triangle_rsp(const rdpq_trifmt_t *fmt, const float *v1, const float *v2, const float *v3)
RDP triangle primitive assembled on the RSP.
Definition rdpq_tri.c:466
void __rdpq_block_run(rdpq_block_t *block)
Notify that a rspq block was run (called by rspq_block_run).
Definition rdpq.c:741
rdpq_tracking_t rdpq_tracking
Tracking state of RDP.
Definition rdpq.c:408
void __rdpq_write16(uint32_t cmd_id, uint32_t arg0, uint32_t arg1, uint32_t arg2, uint32_t arg3)
Write a standard 16-byte RDP command
Definition rdpq.c:936
uint32_t autosync
State of the autosync engine.
Definition rdpq_internal.h:53
void __rdpq_block_free(rdpq_block_t *block)
Free a block.
Definition rdpq.c:795
rdpq_block_t * last_node
Point to the RDP block being created.
Definition rdpq_internal.h:94
void __rdpq_block_reserve(int num_rdp_commands)
Reserve space in the RDP static buffer for a number of RDP commands.
Definition rdpq.c:813
void __rdpq_block_next_buffer(void)
Allocate a new RDP block buffer, chaining it to the current one (if any)
Definition rdpq.c:647
bool mode_freeze
True if the mode changes are currently frozen.
Definition rdpq_internal.h:55
volatile uint32_t * pending_wptr
Previous wptr, swapped out to go back to dynamic buffer.
Definition rdpq_internal.h:90
rdpq_block_t * first_node
Point to the first link of the RDP block being created.
Definition rdpq_internal.h:96
volatile uint32_t * wend
During block creation, pointer to the end of the RDP buffer.
Definition rdpq_internal.h:88
void rdpq_triangle_cpu(const rdpq_trifmt_t *fmt, const float *v1, const float *v2, const float *v3)
RDP triangle primitive assembled on the CPU.
Definition rdpq_tri.c:411
volatile uint32_t * last_rdp_append_buffer
Definition rdpq_internal.h:104
void rdpq_fence(void)
Public rdpq_fence API, redefined it.
Definition rdpq.c:517
void __rdpq_write8(uint32_t cmd_id, uint32_t arg0, uint32_t arg1)
Write a standard 8-byte RDP command.
Definition rdpq.c:904
rdpq_tracking_t previous_tracking
Tracking state before starting building the block.
Definition rdpq_internal.h:108
int bufsize
Current buffer size for RDP blocks.
Definition rdpq_internal.h:98
void __rdpq_block_update(volatile uint32_t *wptr)
Set a new RDP write pointer, and enqueue a RSP command to run the buffer until there.
Definition rdpq.c:862
RDP block management state.
Definition rdpq_internal.h:84
A buffer that piggybacks onto rspq_block_t to store RDP commands.
Definition rdpq_internal.h:73
RDP tracking state.
Definition rdpq_internal.h:40
Format descriptor of a triangle.
Definition rdpq_tri.h:34