libdragon
Data Structures | Defines | Functions | Variables
rdp.c File Reference

Hardware Display Interface. More...

#include <stdint.h>
#include <malloc.h>
#include <string.h>
#include "libdragon.h"

Data Structures

struct  sprite_cache
 Cached sprite structure. More...

Defines

#define __get_buffer(x)   __safe_buffer[(x)-1]
 Grab the texture buffer given a display context.
#define RINGBUFFER_SIZE   4096
 Size of the internal ringbuffer that holds pending RDP commands.
#define RINGBUFFER_SLACK   1024
 Size of the slack are of the ring buffer.

Functions

static void __rdp_interrupt ()
 RDP interrupt handler.
static uint32_t __rdp_round_to_power (uint32_t number)
 Given a number, rount to a power of two.
static uint32_t __rdp_log2 (uint32_t number)
 Integer log base two of a number.
static uint32_t __rdp_ringbuffer_size (void)
 Return the size of the current command buffered in the ring buffer.
static void __rdp_ringbuffer_queue (uint32_t data)
 Queue 32 bits of a command to the ring buffer.
static void __rdp_ringbuffer_send (void)
 Send a completed command to the RDP that is queued in the ring buffer.
void rdp_init (void)
 Initialize the RDP system.
void rdp_close (void)
 Close the RDP system.
void rdp_attach_display (display_context_t disp)
 Attach the RDP to a display context.
void rdp_detach_display (void)
 Detach the RDP from a display context.
void rdp_sync (sync_t sync)
 Perform a sync operation.
void rdp_set_clipping (uint32_t tx, uint32_t ty, uint32_t bx, uint32_t by)
 Set the hardware clipping boundary.
void rdp_set_default_clipping (void)
 Set the hardware clipping boundary to the entire screen.
void rdp_enable_primitive_fill (void)
 Enable display of 2D filled (untextured) rectangles.
void rdp_enable_texture_copy (void)
 Enable display of 2D sprites.
static uint32_t __rdp_load_texture (uint32_t texslot, uint32_t texloc, mirror_t mirror_enabled, sprite_t *sprite, int sl, int tl, int sh, int th)
 Load a texture from RDRAM into RDP TMEM.
uint32_t rdp_load_texture (uint32_t texslot, uint32_t texloc, mirror_t mirror_enabled, sprite_t *sprite)
 Load a sprite into RDP TMEM.
uint32_t rdp_load_texture_stride (uint32_t texslot, uint32_t texloc, mirror_t mirror_enabled, sprite_t *sprite, int offset)
 Load part of a sprite into RDP TMEM.
void rdp_draw_textured_rectangle_scaled (uint32_t texslot, int tx, int ty, int bx, int by, double x_scale, double y_scale)
 Draw a textured rectangle with a scaled texture.
void rdp_draw_textured_rectangle (uint32_t texslot, int tx, int ty, int bx, int by)
 Draw a textured rectangle.
void rdp_draw_sprite (uint32_t texslot, int x, int y)
 Draw a texture to the screen as a sprite.
void rdp_draw_sprite_scaled (uint32_t texslot, int x, int y, double x_scale, double y_scale)
 Draw a texture to the screen as a scaled sprite.
void rdp_set_primitive_color (uint32_t color)
 Set the primitive draw color for subsequent filled primitive operations.
void rdp_draw_filled_rectangle (int tx, int ty, int bx, int by)
 Draw a filled rectangle.
void rdp_set_texture_flush (flush_t flush)
 Set the flush strategy for texture loads.

Variables

uint32_t __bitdepth
 Currently active bit depth.
uint32_t __width
 Currently active video width (calculated)
uint32_t __height
 Currently active video height (calculated)
void * __safe_buffer []
 Pointer to uncached 16-bit aligned version of buffers.
static uint32_t rdp_ringbuffer [RINGBUFFER_SIZE/4]
 Ringbuffer where partially assembled commands will be placed before sending to the RDP.
static uint32_t rdp_start = 0
 Start of the command in the ringbuffer.
static uint32_t rdp_end = 0
 End of the command in the ringbuffer.
static flush_t flush_strategy = FLUSH_STRATEGY_AUTOMATIC
 The current cache flushing strategy.
static volatile uint32_t wait_intr = 0
 Interrupt wait flag.
static sprite_cache cache [8]
 Array of cached textures in RDP TMEM indexed by the RDP texture slot.

Detailed Description

Hardware Display Interface.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines