52static const char*
s_tag =
"DRW";
176 const int32_t dx = line->
x1 - line->
x0;
177 const int32_t dy = line->
y1 - line->
y0;
220 const int32_t min_x = (line->
x0 < line->
x1) ? line->
x0 : line->
x1;
221 const int32_t max_x = (line->
x0 > line->
x1) ? line->
x0 : line->
x1;
222 const int32_t min_y = (line->
y0 < line->
y1) ? line->
y0 : line->
y1;
223 const int32_t max_y = (line->
y0 > line->
y1) ? line->
y0 : line->
y1;
224 const uint32_t span_x = (uint32_t)(max_x - min_x) + (uint32_t)line->
width_px;
225 const uint32_t span_y = (uint32_t)(max_y - min_y) + (uint32_t)line->
width_px;
253 int32_t min_x = (tri->
x0 < tri->
x1) ? tri->
x0 : tri->
x1;
254 if (tri->
x2 < (int16_t)min_x) {
257 int32_t max_x = (tri->
x0 > tri->
x1) ? tri->
x0 : tri->
x1;
258 if (tri->
x2 > (int16_t)max_x) {
261 int32_t min_y = (tri->
y0 < tri->
y1) ? tri->
y0 : tri->
y1;
262 if (tri->
y2 < (int16_t)min_y) {
265 int32_t max_y = (tri->
y0 > tri->
y1) ? tri->
y0 : tri->
y1;
266 if (tri->
y2 > (int16_t)max_y) {
269 const uint32_t span_x = (uint32_t)(max_x - min_x);
270 const uint32_t span_y = (uint32_t)(max_y - min_y);
314 if (dlist_addr ==
nullptr) {
345typedef enum : uint8_t {
414 if (cap_words == 0U) {
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
bool priv_ra8_drw_internal_rect_off_surface(const ra8_drw_rect_t *rect)
Reject a rectangle that would rasterize outside the framebuffer.
bool priv_ra8_drw_internal_rect_above_max(uint16_t max_w, uint16_t max_h, uint16_t width, uint16_t height)
Pure rect-above-max predicate – see header for full contract.
uint32_t priv_ra8_drw_internal_origin(void)
Implementation of priv_ra8_drw_internal_origin() – shadow read.
void priv_program_rect_bbox(const ra8_drw_rect_t *rect)
Programme the bounding box that describes an axis-aligned rect.
uint32_t priv_ra8_drw_internal_rect_origin(const ra8_drw_rect_t *rect)
Framebuffer byte address of a rectangle's top-left pixel.
bool priv_ra8_drw_internal_rect_below_min(uint16_t min_dim, uint16_t width, uint16_t height)
Pure rect-below-min predicate – see header for full contract.
void priv_ra8_drw_internal_color1_write(uint32_t argb8888)
Implementation of priv_ra8_drw_internal_color1_write() – MMIO + shadow.
2D Drawing Engine (DRW / D/AVE 2D) HAL driver – public API
2D Drawing Engine (DRW / D/AVE 2D) display-list builder – public API
ra8_err_t ra8_drw_run_dlist(const uint32_t *dlist_addr)
Trigger execution of a display list.
ra8_err_t ra8_drw_draw_line(const ra8_drw_line_t *line)
Issue an anti-aliased line stroke between two points.
ra8_err_t ra8_drw_fill_rect(const ra8_drw_rect_t *rect)
Issue a solid-fill rectangle blit into the framebuffer.
ra8_err_t ra8_drw_dlist_end(ra8_drw_dlist_t *dl)
Close a display list with its terminator word.
ra8_err_t ra8_drw_perf_read(ra8_drw_perfcounter_id_t id, uint32_t *out)
Read one PERFCOUNTk register.
ra8_err_t ra8_drw_blit_textured_rect(const ra8_drw_rect_t *rect)
Blit a textured rectangle (texture must be programmed first).
ra8_err_t ra8_drw_perf_reset(ra8_drw_perfcounter_id_t id)
Reset one PERFCOUNTk register to zero.
ra8_drw_dlist_span_t
Word spans of the display-list entries the builder emits.
@ k_ra8_drw_dlist_fill_regs
COLOR1, SIZE, CONTROL, ORIGIN.
@ k_ra8_drw_dlist_fill_words
4 * 2 + 1 wait word.
@ k_ra8_drw_dlist_entry_words
1-register entry: tag + value.
@ k_ra8_drw_dlist_special_words
Wait or terminate word.
static void internal_dlist_put_reg(ra8_drw_dlist_t *dl, ra8_drw_dlr_index_t idx, uint32_t val)
Append a single-register display-list entry to the builder buffer.
ra8_err_t ra8_drw_dlist_begin(ra8_drw_dlist_t *dl, uint32_t *buf, uint32_t cap_words)
Bind a display-list builder to a caller-owned word buffer.
ra8_err_t ra8_drw_dlist_add_fill(ra8_drw_dlist_t *dl, const ra8_drw_rect_t *rect)
Append one solid-rectangle fill primitive to a display list.
static void internal_program_line_limiters(const ra8_drw_line_t *line)
Program L1..L4 START/XADD/YADD for a stroked line.
static void internal_dlist_put_special(ra8_drw_dlist_t *dl, uint32_t arg)
Append a display-list special word (wait or terminate).
ra8_err_t ra8_drw_perf_arm(ra8_drw_perftrigger_t event_ctr1, ra8_drw_perftrigger_t event_ctr2)
Programme PERFTRIGGER for the two performance counters and reset both PERFCOUNTk registers.
ra8_err_t ra8_drw_draw_triangle(const ra8_drw_triangle_t *tri)
Issue an anti-aliased filled triangle.
ra8_err_t ra8_drw_dlist_run(const ra8_drw_dlist_t *dl)
Trigger a built display list (writes DLISTSTART).
Test-access surface for ra8_drw internal helpers (MC/DC).
@ k_ra8_drw_internal_perfev_max
0x1F is "every clock".
static int32_t internal_iabs(int32_t v)
Compute integer absolute value with no library calls.
@ k_ra8_drw_internal_align_mask
4-byte alignment.
static uint32_t internal_to_subpixel(int32_t px)
Convert a signed pixel coordinate to the DRW Q12.4 sub-pixel grid.
2D Drawing Engine (DRW / D/AVE 2D) register layout for the RA8D2
@ k_ra8_drw_off_origin
W: Framebuffer base address.
@ k_ra8_drw_off_l1start
W: Limiter 1 start.
@ k_ra8_drw_off_l3xadd
W: Limiter 3 X-axis increment.
@ k_ra8_drw_off_lvxaddi
W: V limiter X integer.
@ k_ra8_drw_off_l1yadd
W: Limiter 1 Y-axis increment.
@ k_ra8_drw_off_l4yadd
W: Limiter 4 Y-axis increment.
@ k_ra8_drw_off_lvyaddi
W: V limiter Y integer.
@ k_ra8_drw_off_lvstarti
W: V limiter start integer.
@ k_ra8_drw_off_luyadd
W: U limiter Y increment.
@ k_ra8_drw_off_l4start
W: Limiter 4 start.
@ k_ra8_drw_off_l1band
W: Limiter 1 band width.
@ k_ra8_drw_off_cachectl
W: Cache enable / flush.
@ k_ra8_drw_off_perfcount2
RW: Performance counter 2.
@ k_ra8_drw_off_l3start
W: Limiter 3 start.
@ k_ra8_drw_off_size
W: Bounding box (W,H).
@ k_ra8_drw_off_dliststart
W: Display list start address.
@ k_ra8_drw_off_control
W: Geometry control.
@ k_ra8_drw_off_lvstartf
W: V limiter start fraction.
@ k_ra8_drw_off_l2xadd
W: Limiter 2 X-axis increment.
@ k_ra8_drw_off_lvyxaddf
W: V limiter X/Y fraction.
@ k_ra8_drw_off_l2yadd
W: Limiter 2 Y-axis increment.
@ k_ra8_drw_off_l2band
W: Limiter 2 band width.
@ k_ra8_drw_off_perfcount1
RW: Performance counter 1.
@ k_ra8_drw_off_perftrigger
W: Performance trigger select.
@ k_ra8_drw_off_l1xadd
W: Limiter 1 X-axis increment.
@ k_ra8_drw_off_luxadd
W: U limiter X increment.
@ k_ra8_drw_off_l2start
W: Limiter 2 start.
@ k_ra8_drw_off_l4xadd
W: Limiter 4 X-axis increment.
@ k_ra8_drw_off_lustart
W: U limiter start.
@ k_ra8_drw_off_l3yadd
W: Limiter 3 Y-axis increment.
@ k_ra8_drw_perftrigger2_pos
Counter-2 selector pos.
@ k_ra8_drw_size_height_pos
SIZEY in upper half-word.
static volatile uint32_t * ra8_drw_reg32(ra8_drw_off_t off)
Pointer to a 32-bit register inside the DRW block.
ra8_drw_perfcounter_id_t
Selector for the two PERFCOUNTk registers.
@ k_ra8_drw_perfctr_1
PERFCOUNT1 @ +0xCC.
@ k_ra8_drw_perfctr_2
PERFCOUNT2 @ +0xD0.
@ k_ra8_drw_subpixel_unit
1 pixel value (1 << 4).
ra8_drw_perftrigger_t
Internal events that increment a PERFCOUNT register.
@ k_ra8_drw_max_height_px
HUM 62.2.29 SIZEY max.
@ k_ra8_drw_min_dim_px
Zero-sized rect rejected.
@ k_ra8_drw_max_width_px
HUM 62.2.29 SIZEX max.
@ k_ra8_drw_dlr_eol_byte
End-of-list low byte marker.
@ k_ra8_drw_dlr_arg_terminate
Arg: terminate the list.
@ k_ra8_drw_dlr_arg_wait
Arg: wait pipe+cache, go on.
@ k_ra8_drw_dlr_tag_one_index
1-register entry tag base.
@ k_ra8_drw_dlr_eol_arg_pos
End-of-list argument shift.
@ k_ra8_drw_cachectl_all_flush
RA8 DRW cachectl all flush.
@ k_ra8_drw_cachectl_all_en
RA8 DRW cachectl all en.
@ k_ra8_drw_cachectl_cflushtx
Texture cache flush.
@ k_ra8_drw_cachectl_cflushfx
FB cache flush.
ra8_drw_dlr_index_t
Register indices a display-list entry addresses (byte offset / 4).
@ k_ra8_drw_dlr_idx_color1
COLOR1 (HUM Ch 62.2.7, 0x64/4).
@ k_ra8_drw_dlr_idx_control
CONTROL (HUM Ch 62.2.1, 0x00/4).
@ k_ra8_drw_dlr_idx_origin
ORIGIN (HUM Ch 62.2.31, 0x80/4).
@ k_ra8_drw_dlr_idx_size
SIZE (HUM Ch 62.2.29, 0x78/4).
@ k_ra8_drw_control_line_quad
RA8 DRW control line quad.
@ k_ra8_drw_control_triangle
RA8 DRW control triangle.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_no_mem
Static buffer exhausted (no dynamic memory on this project).
@ k_ra8_err_invalid_arg
Invalid function argument.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Builder state for composing a DRW display list in a caller buffer.
uint32_t cap_words
Buffer capacity in 32-bit words.
uint32_t * buf
Caller word buffer, 4-byte aligned, in SRAM.
bool overflow
A request exceeded the buffer capacity.
bool terminated
ra8_drw_dlist_end has closed the list.
uint32_t count
Words emitted so far (<= cap_words).
Anti-aliased line parameters.
int16_t y1
End-point 1 Y in pixels.
uint16_t width_px
Stroke width in pixels.
uint32_t color_argb8888
0xAARRGGBB stroke colour.
int16_t y0
End-point 0 Y in pixels.
int16_t x0
End-point 0 X in pixels.
int16_t x1
End-point 1 X in pixels.
Rectangle parameters for ra8_drw_fill_rect.
uint16_t height_px
Height in pixels.
uint32_t color_argb8888
0xAARRGGBB fill colour.
uint16_t width_px
Width in pixels.
Anti-aliased filled triangle parameters.
uint32_t color_argb8888
Fill colour.