Modules | Files | Data Structures | Typedefs | Enumerations | Functions | Variables
Display Subsystem

Video interface system for configuring video output modes and displaying rendered graphics. More...


 Console Support
 Software console emulation for debugging and simple text output.
 2D Graphics
 Software routines for manipulating graphics in a display context.
 Hardware Display Interface
 Interface to the hardware sprite/triangle rasterizer (RDP).


file  display.c
 Display Subsystem.
file  display.h
 Display Subsystem.

Data Structures

struct  resolution_t
 Video resolution structure. More...


typedef surface_tdisplay_context_t
 Display context (DEPRECATED: Use surface_t instead) More...


enum  bitdepth_t { DEPTH_16_BPP , DEPTH_32_BPP }
 Valid bit depths. More...
 Valid gamma correction settings. More...
 Valid antialiasing settings. More...


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. More...
void display_close ()
 Close the display. More...
surface_tdisplay_lock (void)
 Lock a display buffer for rendering. More...
void display_show (surface_t *surf)
 Display a previously locked buffer. More...
uint32_t display_get_width (void)
 Get the currently configured width of the display in pixels.
uint32_t display_get_height (void)
 Get the currently configured height of the display in pixels.
uint32_t display_get_bitdepth (void)
 Get the currently configured bitdepth of the display (in bytes per pixels)
uint32_t display_get_num_buffers (void)
 Get the currently configured number of buffers.


const resolution_t RESOLUTION_256x240 = {256, 240, false}
 256x240 mode
const resolution_t RESOLUTION_320x240 = {320, 240, false}
 320x240 mode
const resolution_t RESOLUTION_512x240 = {512, 240, false}
 512x240 mode, high-res progressive
const resolution_t RESOLUTION_640x240 = {640, 240, false}
 640x240 mode, high-res progressive
const resolution_t RESOLUTION_512x480 = {512, 480, true}
 512x480 mode, interlaced
const resolution_t RESOLUTION_640x480 = {640, 480, true}
 640x480 mode, interlaced

Detailed Description

Video interface system for configuring video output modes and displaying rendered graphics.

The display subsystem handles interfacing with the video interface (VI) and the hardware rasterizer (RDP) to allow software and hardware graphics operations. It consists of the Display Subsystem, the 2D Graphics and the Hardware Display Interface modules. A separate module, the Console Support, provides a rudimentary console for developers. Only the display subsystem or the console can be used at the same time. However, commands to draw console text to the display subsystem are available.

The display subsystem module is responsible for initializing the proper video mode for displaying 2D, 3D and software graphics. To set up video on the N64, code should call display_init with the appropriate options. Once the display has been set, a surface can be requested from the display subsystem using display_lock. To draw to the acquired surface, code should use functions present in the 2D Graphics and the Hardware Display Interface modules. Once drawing to a surface is complete, the rendered graphic can be displayed to the screen using display_show. Once code has finished rendering all graphics, display_close can be used to shut down the display subsystem.

Data Structure Documentation

◆ resolution_t

struct resolution_t

Video resolution structure.

You can either use one of the pre-defined constants (such as RESOLUTION_320x240) or define a custom resolution.

Data Fields
int32_t width Screen width (must be between 1 and 800)
int32_t height Screen height (must be between 1 and 600)
bool interlaced True if interlaced mode enabled.

Typedef Documentation

◆ display_context_t

Display context (DEPRECATED: Use surface_t instead)

See also

Enumeration Type Documentation

◆ bitdepth_t

enum bitdepth_t

Valid bit depths.


16 bits per pixel (5-5-5-1)


32 bits per pixel (8-8-8-8)

◆ gamma_t

enum gamma_t

Valid gamma correction settings.


Uncorrected gamma.


Corrected gamma.


Corrected gamma with hardware dither.

◆ antialias_t

Valid antialiasing settings.


No anti-aliasing.


Resampling anti-aliasing.


Anti-aliasing and resampling with fetch-on-need.


Anti-aliasing and resampling with fetch-always.

Function Documentation

◆ display_init()

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.

Initialize video system. This sets up a double, triple, or multiple buffered drawing surface which can be blitted or rendered to using software or hardware.

[in]resThe requested resolution. Use eiter one of the pre-defined resolution (such as RESOLUTION_320x240) or define a custom one.
[in]bitThe requested bit depth (DEPTH_16_BPP or DEPTH_32_BPP)
[in]num_buffersNumber of buffers, usually 2 or 3, but can be more. Triple buffering is recommended in case the application cannot hold a steady full framerate, so that slowdowns don't impact too much.
[in]gammaThe requested gamma setting
[in]aaThe requested anti-aliasing setting

◆ display_close()

void display_close ( )

Close the display.

Close a display and free buffer memory associated with it.

◆ display_lock()

surface_t * display_lock ( void  )

Lock a display buffer for rendering.

Grab a surface that is safe for drawing. If none is available then this will return 0, without blocking.

When you are done drawing on the buffer, use display_show to unlock the surface and schedule the buffer to be displayed on the screen during next vblank.

It is possible to lock more than a display buffer at the same time, for instance to begin working on a new frame while the previous one is still being rendered in parallel through RDP. It is important to notice that surfaces will always be shown on the screen in locking order, irrespective of the order display_show is called.

A valid surface to render to or NULL if none is available.

◆ display_show()

void display_show ( surface_t surf)

Display a previously locked buffer.

Display a previously-locked surface to the screen on the next vblank. The surface should be locked via display_lock.

This function does not accept any arbitrary surface, but only those returned by display_lock.

[in]surfA surface to show (previously retrieved using display_lock)