libdragon
Defines | Functions | Variables
display.c File Reference

Display Subsystem. More...

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

Defines

#define NUM_BUFFERS   3
 Maximum number of video backbuffers.
#define REGISTER_BASE   0xA4400000
 Register location in memory of VI.
#define REGISTER_COUNT   14
 Number of 32-bit registers at the register base.
#define TV_TYPE_LOC   0x80000300
 Memory location to read which determines the TV type.
#define UNCACHED_ADDR(x)   ((void *)(((uint32_t)(x)) | 0xA0000000))
 Return the uncached memory address of a cached address.
#define ALIGN_16BYTE(x)   ((void *)(((uint32_t)(x)+15) & 0xFFFFFFF0))
 Align a memory address to 16 byte offset.

Functions

static void __write_registers (uint32_t const *const registers)
 Write a set of video registers to the VI.
static void __write_dram_register (void const *const dram_val)
 Update the framebuffer pointer in the VI.
static void __display_callback ()
 Interrupt handler for vertical blank.
void display_init (resolution_t res, bitdepth_t bit, uint32_t num_buffers, gamma_t gamma, antialias_t aa)
 Initialize the display to a particular resolution and bit depth.
void display_init_ex (tvtype_t tv, resolution_t res, bitdepth_t bit, uint32_t num_buffers, gamma_t gamma, antialias_t aa)
 Initialize the display to a particular tv type, resolution, and bit depth.
void display_close ()
 Close the display.
display_context_t display_lock ()
 Lock a display buffer for rendering.
void display_show (display_context_t disp)
 Display a previously locked buffer.

Variables

static void * buffer [NUM_BUFFERS]
 Video buffer pointers.
uint32_t __bitdepth
 Currently active bit depth.
uint32_t __width
 Currently active video width (calculated)
uint32_t __height
 Currently active video height (calculated)
uint32_t __buffers = NUM_BUFFERS
 Number of active buffers.
void * __safe_buffer [NUM_BUFFERS]
 Pointer to uncached 16-bit aligned version of buffers.
uint32_t __registers [REGISTER_COUNT *2]
 Current VI register settings (for two fields)
static int now_showing = -1
 Currently displayed buffer.
static int show_next = -1
 Complete drawn buffer to display next.
static int now_drawing = -1
 Buffer currently being drawn on.

Detailed Description

Display Subsystem.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines