RetroArch
Classes | Macros | Typedefs | Enumerations | Functions | Variables
gx_gfx.c File Reference
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include <gccore.h>
#include <ogcsys.h>
#include <libretro.h>
#include <streams/interface_stream.h>
#include "../font_driver.h"
#include "../drivers_font_renderer/bitmap.h"
#include "../../defines/gx_defines.h"
#include "../../configuration.h"
#include "../../driver.h"
Include dependency graph for gx_gfx.c:

Classes

struct  gx_overlay_data
 
struct  gx_video
 

Macros

#define _CPU_ISR_Disable(_isr_cookie)
 
#define _CPU_ISR_Restore(_isr_cookie)
 
#define BLIT_LINE_16_CONV(x)   (0x80008000 | (((x) & 0xFFC0FFC0) >> 1) | ((x) & 0x001F001F))
 

Typedefs

typedef struct gx_video gx_video_t
 

Enumerations

enum  {
  GX_RESOLUTIONS_DEFAULT = 0, GX_RESOLUTIONS_512_192, GX_RESOLUTIONS_598_200, GX_RESOLUTIONS_640_200,
  GX_RESOLUTIONS_384_224, GX_RESOLUTIONS_448_224, GX_RESOLUTIONS_480_224, GX_RESOLUTIONS_512_224,
  GX_RESOLUTIONS_576_224, GX_RESOLUTIONS_608_224, GX_RESOLUTIONS_640_224, GX_RESOLUTIONS_340_232,
  GX_RESOLUTIONS_512_232, GX_RESOLUTIONS_512_236, GX_RESOLUTIONS_336_240, GX_RESOLUTIONS_352_240,
  GX_RESOLUTIONS_384_240, GX_RESOLUTIONS_512_240, GX_RESOLUTIONS_530_240, GX_RESOLUTIONS_608_240,
  GX_RESOLUTIONS_640_240, GX_RESOLUTIONS_512_384, GX_RESOLUTIONS_598_400, GX_RESOLUTIONS_640_400,
  GX_RESOLUTIONS_384_448, GX_RESOLUTIONS_448_448, GX_RESOLUTIONS_480_448, GX_RESOLUTIONS_512_448,
  GX_RESOLUTIONS_576_448, GX_RESOLUTIONS_608_448, GX_RESOLUTIONS_640_448, GX_RESOLUTIONS_340_464,
  GX_RESOLUTIONS_512_464, GX_RESOLUTIONS_512_472, GX_RESOLUTIONS_352_480, GX_RESOLUTIONS_384_480,
  GX_RESOLUTIONS_512_480, GX_RESOLUTIONS_530_480, GX_RESOLUTIONS_608_480, GX_RESOLUTIONS_640_480,
  GX_RESOLUTIONS_LAST = GX_RESOLUTIONS_640_480
}
 

Functions

syssram__SYS_LockSram (void)
 
u32 __SYS_UnlockSram (u32 write)
 
struct {
   uint32_t   data [240 *200]
 
   GXTexObj   obj
 
ATTRIBUTE_ALIGN (32)
 
static void retrace_callback (u32 retrace_count)
 
static bool gx_isValidXOrigin (int origin)
 
static bool gx_isValidYOrigin (int origin)
 
static void gx_set_video_mode (void *data, unsigned fbWidth, unsigned lines, bool fullscreen)
 
static void gx_set_aspect_ratio (void *data, unsigned aspect_ratio_idx)
 
static void gx_get_video_output_size (void *data, unsigned *width, unsigned *height)
 
static void setup_video_mode (gx_video_t *gx)
 
static void init_texture (void *data, unsigned width, unsigned height)
 
static void init_vtx (void *data, const video_info_t *video)
 
static void build_disp_list (void)
 
static voidgx_init (const video_info_t *video, const input_driver_t **input, void **input_data)
 
static void update_texture_asm (const uint32_t *src, const uint32_t *dst, unsigned width, unsigned height, unsigned pitch)
 
static void convert_texture16 (const uint32_t *_src, uint32_t *_dst, unsigned width, unsigned height, unsigned pitch)
 
static void convert_texture16_conv (const uint32_t *_src, uint32_t *_dst, unsigned width, unsigned height, unsigned pitch)
 
static void convert_texture32 (const uint32_t *_src, uint32_t *_dst, unsigned width, unsigned height, unsigned pitch)
 
static void gx_resize (void *data)
 
static void gx_blit_line (gx_video_t *gx, unsigned x, unsigned y, const char *message)
 
static void gx_set_nonblock_state (void *data, bool state)
 
static bool gx_alive (void *data)
 
static bool gx_focus (void *data)
 
static bool gx_suppress_screensaver (void *data, bool enable)
 
static void gx_set_rotation (void *data, unsigned orientation)
 
static void gx_set_texture_frame (void *data, const void *frame, bool rgb32, unsigned width, unsigned height, float alpha)
 
static void gx_set_texture_enable (void *data, bool enable, bool full_screen)
 
static void gx_apply_state_changes (void *data)
 
static void gx_viewport_info (void *data, struct video_viewport *vp)
 
static bool gx_read_viewport (void *data, uint8_t *buffer, bool is_idle)
 
static void gx_get_video_output_prev (void *data)
 
static void gx_get_video_output_next (void *data)
 
static void gx_get_poke_interface (void *data, const video_poke_interface_t **iface)
 
static void gx_free (void *data)
 
static bool gx_frame (void *data, const void *frame, unsigned width, unsigned height, uint64_t frame_count, unsigned pitch, const char *msg, video_frame_info_t *video_info)
 
static bool gx_set_shader (void *data, enum rarch_shader_type type, const char *path)
 

Variables

struct {
   uint32_t *   data
 
   unsigned   width
 
   unsigned   height
 
   GXTexObj   obj
 
g_tex
 
static OSCond g_video_cond
 
static volatile bool g_draw_done = false
 
static bool g_vsync = false
 
int8_t gx_system_xOrigin
 
int8_t gx_used_system_xOrigin
 
int8_t gx_xOriginNeg
 
int8_t gx_xOriginPos
 
int8_t gx_yOriginNeg
 
int8_t gx_yOriginPos
 
static uint16_t gx_xOrigin = 0
 
static uint16_t gx_yOrigin = 0
 
static unsigned g_current_framebuf = 0
 
static uint32_t g_orientation = 0
 
static uint32_t retraceCount = 0
 
static uint32_t referenceRetraceCount = 0
 
static unsigned gx_old_width = 0
 
static unsigned gx_old_height = 0
 
static size_t display_list_size
 
GXRModeObj gx_mode
 
enum { ... }  ATTRIBUTE_ALIGN
 
unsigned menu_gx_resolutions [][2]
 
static unsigned max_height
 
static const video_poke_interface_t gx_poke_interface
 
video_driver_t video_gx
 

Macro Definition Documentation

◆ _CPU_ISR_Disable

#define _CPU_ISR_Disable (   _isr_cookie)
Value:
{ register u32 _disable_mask = 0; \
_isr_cookie = 0; \
__asm__ __volatile__ ( \
"mfmsr %0\n" \
"rlwinm %1,%0,0,17,15\n" \
"mtmsr %1\n" \
"extrwi %0,%0,1,16" \
: "=&r" ((_isr_cookie)), "=&r" ((_disable_mask)) \
: "0" ((_isr_cookie)), "1" ((_disable_mask)) \
); \
}
uint32_t u32
32bit unsigned integer
Definition: gctypes.h:19

◆ _CPU_ISR_Restore

#define _CPU_ISR_Restore (   _isr_cookie)
Value:
{ register u32 _enable_mask = 0; \
__asm__ __volatile__ ( \
" cmpwi %0,0\n" \
" beq 1f\n" \
" mfmsr %1\n" \
" ori %1,%1,0x8000\n" \
" mtmsr %1\n" \
"1:" \
: "=r"((_isr_cookie)),"=&r" ((_enable_mask)) \
: "0"((_isr_cookie)),"1" ((_enable_mask)) \
); \
}
uint32_t u32
32bit unsigned integer
Definition: gctypes.h:19

◆ BLIT_LINE_16_CONV

#define BLIT_LINE_16_CONV (   x)    (0x80008000 | (((x) & 0xFFC0FFC0) >> 1) | ((x) & 0x001F001F))

Typedef Documentation

◆ gx_video_t

typedef struct gx_video gx_video_t

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
GX_RESOLUTIONS_DEFAULT 
GX_RESOLUTIONS_512_192 
GX_RESOLUTIONS_598_200 
GX_RESOLUTIONS_640_200 
GX_RESOLUTIONS_384_224 
GX_RESOLUTIONS_448_224 
GX_RESOLUTIONS_480_224 
GX_RESOLUTIONS_512_224 
GX_RESOLUTIONS_576_224 
GX_RESOLUTIONS_608_224 
GX_RESOLUTIONS_640_224 
GX_RESOLUTIONS_340_232 
GX_RESOLUTIONS_512_232 
GX_RESOLUTIONS_512_236 
GX_RESOLUTIONS_336_240 
GX_RESOLUTIONS_352_240 
GX_RESOLUTIONS_384_240 
GX_RESOLUTIONS_512_240 
GX_RESOLUTIONS_530_240 
GX_RESOLUTIONS_608_240 
GX_RESOLUTIONS_640_240 
GX_RESOLUTIONS_512_384 
GX_RESOLUTIONS_598_400 
GX_RESOLUTIONS_640_400 
GX_RESOLUTIONS_384_448 
GX_RESOLUTIONS_448_448 
GX_RESOLUTIONS_480_448 
GX_RESOLUTIONS_512_448 
GX_RESOLUTIONS_576_448 
GX_RESOLUTIONS_608_448 
GX_RESOLUTIONS_640_448 
GX_RESOLUTIONS_340_464 
GX_RESOLUTIONS_512_464 
GX_RESOLUTIONS_512_472 
GX_RESOLUTIONS_352_480 
GX_RESOLUTIONS_384_480 
GX_RESOLUTIONS_512_480 
GX_RESOLUTIONS_530_480 
GX_RESOLUTIONS_608_480 
GX_RESOLUTIONS_640_480 
GX_RESOLUTIONS_LAST 

Function Documentation

◆ __SYS_LockSram()

syssram* __SYS_LockSram ( void  )
Here is the caller graph for this function:

◆ __SYS_UnlockSram()

u32 __SYS_UnlockSram ( u32  write)
Here is the caller graph for this function:

◆ ATTRIBUTE_ALIGN()

static struct @240 ATTRIBUTE_ALIGN ( 32  )
static

◆ build_disp_list()

static void build_disp_list ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_texture16()

static void convert_texture16 ( const uint32_t _src,
uint32_t _dst,
unsigned  width,
unsigned  height,
unsigned  pitch 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_texture16_conv()

static void convert_texture16_conv ( const uint32_t _src,
uint32_t _dst,
unsigned  width,
unsigned  height,
unsigned  pitch 
)
static
Here is the caller graph for this function:

◆ convert_texture32()

static void convert_texture32 ( const uint32_t _src,
uint32_t _dst,
unsigned  width,
unsigned  height,
unsigned  pitch 
)
static
Here is the caller graph for this function:

◆ gx_alive()

static bool gx_alive ( void data)
static
Here is the call graph for this function:

◆ gx_apply_state_changes()

static void gx_apply_state_changes ( void data)
static

◆ gx_blit_line()

static void gx_blit_line ( gx_video_t gx,
unsigned  x,
unsigned  y,
const char *  message 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gx_focus()

static bool gx_focus ( void data)
static
Here is the call graph for this function:

◆ gx_frame()

static bool gx_frame ( void data,
const void frame,
unsigned  width,
unsigned  height,
uint64_t  frame_count,
unsigned  pitch,
const char *  msg,
video_frame_info_t video_info 
)
static
Here is the call graph for this function:

◆ gx_free()

static void gx_free ( void data)
static
Here is the call graph for this function:

◆ gx_get_poke_interface()

static void gx_get_poke_interface ( void data,
const video_poke_interface_t **  iface 
)
static
Here is the call graph for this function:

◆ gx_get_video_output_next()

static void gx_get_video_output_next ( void data)
static
Here is the call graph for this function:

◆ gx_get_video_output_prev()

static void gx_get_video_output_prev ( void data)
static
Here is the call graph for this function:

◆ gx_get_video_output_size()

static void gx_get_video_output_size ( void data,
unsigned *  width,
unsigned *  height 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gx_init()

static void* gx_init ( const video_info_t video,
const input_driver_t **  input,
void **  input_data 
)
static
Here is the call graph for this function:

◆ gx_isValidXOrigin()

static bool gx_isValidXOrigin ( int  origin)
static
Here is the caller graph for this function:

◆ gx_isValidYOrigin()

static bool gx_isValidYOrigin ( int  origin)
static
Here is the caller graph for this function:

◆ gx_read_viewport()

static bool gx_read_viewport ( void data,
uint8_t buffer,
bool  is_idle 
)
static
Here is the call graph for this function:

◆ gx_resize()

static void gx_resize ( void data)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gx_set_aspect_ratio()

static void gx_set_aspect_ratio ( void data,
unsigned  aspect_ratio_idx 
)
static
Here is the call graph for this function:

◆ gx_set_nonblock_state()

static void gx_set_nonblock_state ( void data,
bool  state 
)
static
Here is the call graph for this function:

◆ gx_set_rotation()

static void gx_set_rotation ( void data,
unsigned  orientation 
)
static

◆ gx_set_shader()

static bool gx_set_shader ( void data,
enum rarch_shader_type  type,
const char *  path 
)
static
Here is the call graph for this function:

◆ gx_set_texture_enable()

static void gx_set_texture_enable ( void data,
bool  enable,
bool  full_screen 
)
static
Here is the call graph for this function:

◆ gx_set_texture_frame()

static void gx_set_texture_frame ( void data,
const void frame,
bool  rgb32,
unsigned  width,
unsigned  height,
float  alpha 
)
static
Here is the call graph for this function:

◆ gx_set_video_mode()

static void gx_set_video_mode ( void data,
unsigned  fbWidth,
unsigned  lines,
bool  fullscreen 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gx_suppress_screensaver()

static bool gx_suppress_screensaver ( void data,
bool  enable 
)
static
Here is the call graph for this function:

◆ gx_viewport_info()

static void gx_viewport_info ( void data,
struct video_viewport vp 
)
static

◆ init_texture()

static void init_texture ( void data,
unsigned  width,
unsigned  height 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_vtx()

static void init_vtx ( void data,
const video_info_t video 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ retrace_callback()

static void retrace_callback ( u32  retrace_count)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup_video_mode()

static void setup_video_mode ( gx_video_t gx)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_texture_asm()

static void update_texture_asm ( const uint32_t src,
const uint32_t dst,
unsigned  width,
unsigned  height,
unsigned  pitch 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ ATTRIBUTE_ALIGN

static dvddrvinfo __dvd_driveinfo ATTRIBUTE_ALIGN

◆ data

uint32_t data[240 *200]

◆ display_list_size

size_t display_list_size
static

◆ g_current_framebuf

unsigned g_current_framebuf = 0
static

◆ g_draw_done

volatile bool g_draw_done = false
static

◆ g_orientation

uint32_t g_orientation = 0
static

◆ g_tex

struct { ... } g_tex

◆ g_video_cond

OSCond g_video_cond
static

◆ g_vsync

bool g_vsync = false
static

◆ gx_mode

GXRModeObj gx_mode

◆ gx_old_height

unsigned gx_old_height = 0
static

◆ gx_old_width

unsigned gx_old_width = 0
static

◆ gx_poke_interface

const video_poke_interface_t gx_poke_interface
static
Initial value:
= {
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
}
static void gx_apply_state_changes(void *data)
Definition: gx_gfx.c:1219
static void gx_set_texture_frame(void *data, const void *frame, bool rgb32, unsigned width, unsigned height, float alpha)
Definition: gx_gfx.c:1190
static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines, bool fullscreen)
Definition: gx_gfx.c:286
static void gx_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
Definition: gx_gfx.c:529
#define NULL
Pointer to 0.
Definition: gctypes.h:65
static void gx_get_video_output_next(void *data)
Definition: gx_gfx.c:1253
static void gx_set_texture_enable(void *data, bool enable, bool full_screen)
Definition: gx_gfx.c:1204
static void gx_get_video_output_size(void *data, unsigned *width, unsigned *height)
Definition: gx_gfx.c:561
static void gx_get_video_output_prev(void *data)
Definition: gx_gfx.c:1240

◆ gx_system_xOrigin

int8_t gx_system_xOrigin

◆ gx_used_system_xOrigin

int8_t gx_used_system_xOrigin

◆ gx_xOrigin

uint16_t gx_xOrigin = 0
static

◆ gx_xOriginNeg

int8_t gx_xOriginNeg

◆ gx_xOriginPos

int8_t gx_xOriginPos

◆ gx_yOrigin

uint16_t gx_yOrigin = 0
static

◆ gx_yOriginNeg

int8_t gx_yOriginNeg

◆ gx_yOriginPos

int8_t gx_yOriginPos

◆ height

unsigned height

◆ max_height

unsigned max_height
static

◆ menu_gx_resolutions

unsigned menu_gx_resolutions[][2]

◆ obj

◆ referenceRetraceCount

uint32_t referenceRetraceCount = 0
static

◆ retraceCount

uint32_t retraceCount = 0
static

◆ video_gx

video_driver_t video_gx
Initial value:
= {
NULL,
"gx",
NULL,
NULL,
}
static void * gx_init(const video_info_t *video, const input_driver_t **input, void **input_data)
Definition: gx_gfx.c:752
static void gx_viewport_info(void *data, struct video_viewport *vp)
Definition: gx_gfx.c:1227
static bool gx_set_shader(void *data, enum rarch_shader_type type, const char *path)
Definition: gx_gfx.c:1652
static bool gx_frame(void *data, const void *frame, unsigned width, unsigned height, uint64_t frame_count, unsigned pitch, const char *msg, video_frame_info_t *video_info)
Definition: gx_gfx.c:1502
static bool gx_focus(void *data)
Definition: gx_gfx.c:1167
static void gx_free(void *data)
Definition: gx_gfx.c:1480
#define NULL
Pointer to 0.
Definition: gctypes.h:65
static void gx_set_rotation(void *data, unsigned orientation)
Definition: gx_gfx.c:1181
static bool gx_suppress_screensaver(void *data, bool enable)
Definition: gx_gfx.c:1173
static bool gx_alive(void *data)
Definition: gx_gfx.c:1161
static bool gx_read_viewport(void *data, uint8_t *buffer, bool is_idle)
Definition: gx_gfx.c:1233
static void gx_get_poke_interface(void *data, const video_poke_interface_t **iface)
Definition: gx_gfx.c:1292
static void gx_set_nonblock_state(void *data, bool state)
Definition: gx_gfx.c:1155

◆ width

unsigned width