(GX) Video optimizations
This commit is contained in:
parent
dfc9f6953e
commit
5bfc46db2d
|
@ -240,7 +240,7 @@ void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines)
|
||||||
GX_SetFieldMode(gx_mode.field_rendering, (gx_mode.viHeight == 2 * gx_mode.xfbHeight) ? GX_ENABLE : GX_DISABLE);
|
GX_SetFieldMode(gx_mode.field_rendering, (gx_mode.viHeight == 2 * gx_mode.xfbHeight) ? GX_ENABLE : GX_DISABLE);
|
||||||
GX_SetPixelFmt(GX_PF_RGB8_Z24, GX_ZC_LINEAR);
|
GX_SetPixelFmt(GX_PF_RGB8_Z24, GX_ZC_LINEAR);
|
||||||
__GX_InvalidateTexAll(__gx);
|
__GX_InvalidateTexAll(__gx);
|
||||||
GX_Flush();
|
__GX_Flush(__gx);
|
||||||
_CPU_ISR_Restore(level);
|
_CPU_ISR_Restore(level);
|
||||||
|
|
||||||
RARCH_LOG("GX Resolution: %dx%d (%s)\n", gx_mode.fbWidth, gx_mode.efbHeight, (gx_mode.viTVMode & 3) == VI_INTERLACE ? "interlaced" : "progressive");
|
RARCH_LOG("GX Resolution: %dx%d (%s)\n", gx_mode.fbWidth, gx_mode.efbHeight, (gx_mode.viTVMode & 3) == VI_INTERLACE ? "interlaced" : "progressive");
|
||||||
|
@ -337,16 +337,16 @@ static void init_texture(void *data, unsigned width, unsigned height)
|
||||||
struct __gx_texobj *fb_ptr = (struct __gx_texobj*)&g_tex.obj;
|
struct __gx_texobj *fb_ptr = (struct __gx_texobj*)&g_tex.obj;
|
||||||
struct __gx_texobj *menu_ptr = (struct __gx_texobj*)&menu_tex.obj;
|
struct __gx_texobj *menu_ptr = (struct __gx_texobj*)&menu_tex.obj;
|
||||||
__GX_InitTexObj(fb_ptr, g_tex.data, width, height, (gx->rgb32) ? GX_TF_RGBA8 : gx->rgui_texture_enable ? GX_TF_RGB5A3 : GX_TF_RGB565, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
__GX_InitTexObj(fb_ptr, g_tex.data, width, height, (gx->rgb32) ? GX_TF_RGBA8 : gx->rgui_texture_enable ? GX_TF_RGB5A3 : GX_TF_RGB565, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||||
GX_InitTexObjFilterMode(&g_tex.obj, g_filter, g_filter);
|
__GX_InitTexObjFilterMode(fb_ptr, g_filter, g_filter);
|
||||||
__GX_InitTexObj(menu_ptr, menu_tex.data, rgui_w, rgui_h, GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
__GX_InitTexObj(menu_ptr, menu_tex.data, rgui_w, rgui_h, GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||||
GX_InitTexObjFilterMode(&menu_tex.obj, g_filter, g_filter);
|
__GX_InitTexObjFilterMode(menu_ptr, g_filter, g_filter);
|
||||||
__GX_InvalidateTexAll(__gx);
|
__GX_InvalidateTexAll(__gx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_vtx(void *data)
|
static void init_vtx(struct __gx_regdef *__gx, void *data)
|
||||||
{
|
{
|
||||||
GX_SetCullMode(GX_CULL_NONE);
|
__GX_SetCullMode(__gx, GX_CULL_NONE);
|
||||||
GX_SetClipMode(GX_CLIP_DISABLE);
|
__GX_SetClipMode(GX_CLIP_DISABLE);
|
||||||
GX_SetPixelFmt(GX_PF_RGB8_Z24, GX_ZC_LINEAR);
|
GX_SetPixelFmt(GX_PF_RGB8_Z24, GX_ZC_LINEAR);
|
||||||
GX_SetZMode(GX_ENABLE, GX_ALWAYS, GX_ENABLE);
|
GX_SetZMode(GX_ENABLE, GX_ALWAYS, GX_ENABLE);
|
||||||
GX_SetColorUpdate(GX_TRUE);
|
GX_SetColorUpdate(GX_TRUE);
|
||||||
|
@ -380,7 +380,7 @@ static void init_vtx(void *data)
|
||||||
|
|
||||||
DCFlushRange(g_tex.data, 4 * 4 * 4);
|
DCFlushRange(g_tex.data, 4 * 4 * 4);
|
||||||
init_texture(data, 4, 4); // for menu texture
|
init_texture(data, 4, 4); // for menu texture
|
||||||
GX_Flush();
|
GX_Flush(__gx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void build_disp_list(void)
|
static void build_disp_list(void)
|
||||||
|
@ -439,6 +439,7 @@ static void gx_restart(void) { }
|
||||||
static void *gx_init(const video_info_t *video,
|
static void *gx_init(const video_info_t *video,
|
||||||
const input_driver_t **input, void **input_data)
|
const input_driver_t **input, void **input_data)
|
||||||
{
|
{
|
||||||
|
struct __gx_regdef *__gx = (struct __gx_regdef*)__gxregs;
|
||||||
g_vsync = video->vsync;
|
g_vsync = video->vsync;
|
||||||
|
|
||||||
if (driver.video_data)
|
if (driver.video_data)
|
||||||
|
@ -476,7 +477,7 @@ static void *gx_init(const video_info_t *video,
|
||||||
GX_Init(gx_fifo, sizeof(gx_fifo));
|
GX_Init(gx_fifo, sizeof(gx_fifo));
|
||||||
|
|
||||||
setup_video_mode(gx);
|
setup_video_mode(gx);
|
||||||
init_vtx(gx);
|
init_vtx(__gx, gx);
|
||||||
build_disp_list();
|
build_disp_list();
|
||||||
|
|
||||||
gx->vp.full_width = gx_mode.fbWidth;
|
gx->vp.full_width = gx_mode.fbWidth;
|
||||||
|
@ -976,7 +977,7 @@ static bool gx_frame(void *data, const void *frame,
|
||||||
}
|
}
|
||||||
|
|
||||||
__GX_CopyDisp(__gx, g_framebuf[g_current_framebuf], clear_efb);
|
__GX_CopyDisp(__gx, g_framebuf[g_current_framebuf], clear_efb);
|
||||||
GX_Flush();
|
__GX_Flush(__gx);
|
||||||
VIDEO_SetNextFramebuffer(g_framebuf[g_current_framebuf]);
|
VIDEO_SetNextFramebuffer(g_framebuf[g_current_framebuf]);
|
||||||
VIDEO_Flush();
|
VIDEO_Flush();
|
||||||
|
|
||||||
|
|
|
@ -119,6 +119,8 @@ __gx->dispCopyWH = (__gx->dispCopyWH&~0xff000000)|(_SHIFTL(0x4a,24,8))
|
||||||
__gx->dispCopyDst = (__gx->dispCopyDst&~0x3ff)|(_SHIFTR(wd,4,10)); \
|
__gx->dispCopyDst = (__gx->dispCopyDst&~0x3ff)|(_SHIFTR(wd,4,10)); \
|
||||||
__gx->dispCopyDst = (__gx->dispCopyDst&~0xff000000)|(_SHIFTL(0x4d,24,8))
|
__gx->dispCopyDst = (__gx->dispCopyDst&~0xff000000)|(_SHIFTL(0x4d,24,8))
|
||||||
|
|
||||||
|
#define __GX_SetClipMode(mode) GX_LOAD_XF_REG(0x1005,(mode&1))
|
||||||
|
|
||||||
static inline void __GX_CopyDisp(struct __gx_regdef *__gx, void *dest,u8 clear)
|
static inline void __GX_CopyDisp(struct __gx_regdef *__gx, void *dest,u8 clear)
|
||||||
{
|
{
|
||||||
u8 clflag;
|
u8 clflag;
|
||||||
|
@ -517,6 +519,20 @@ static void __GX_SendFlushPrim(struct __gx_regdef *__gx)
|
||||||
__gx->xfFlush = 1;
|
__gx->xfFlush = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define __GX_InitTexObjFilterMode(ptr, minfilt, magfilt) \
|
||||||
|
{ \
|
||||||
|
static u8 GX2HWFiltConv[] = {0x00,0x04,0x01,0x05,0x02,0x06,0x00,0x00}; \
|
||||||
|
ptr->tex_filt = (ptr->tex_filt&~0x10)|(_SHIFTL((magfilt==GX_LINEAR?1:0),4,1)); \
|
||||||
|
ptr->tex_filt = (ptr->tex_filt&~0xe0)|(_SHIFTL(GX2HWFiltConv[minfilt],5,3)); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define __GX_SetCullMode(__gx, mode) \
|
||||||
|
{ \
|
||||||
|
static u8 cm2hw[] = { 0, 2, 1, 3 }; \
|
||||||
|
__gx->genMode = (__gx->genMode&~0xC000)|(_SHIFTL(cm2hw[mode],14,2)); \
|
||||||
|
__gx->dirtyState |= 0x0004; \
|
||||||
|
}
|
||||||
|
|
||||||
#define __GX_CallDispList(__gx, list, nbytes) \
|
#define __GX_CallDispList(__gx, list, nbytes) \
|
||||||
if(__gx->dirtyState) \
|
if(__gx->dirtyState) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -529,3 +545,16 @@ static void __GX_SendFlushPrim(struct __gx_regdef *__gx)
|
||||||
FIFO_PUTU8(0x40); /*call displaylist */ \
|
FIFO_PUTU8(0x40); /*call displaylist */ \
|
||||||
FIFO_PUTU32(MEM_VIRTUAL_TO_PHYSICAL(list)); \
|
FIFO_PUTU32(MEM_VIRTUAL_TO_PHYSICAL(list)); \
|
||||||
FIFO_PUTU32(nbytes)
|
FIFO_PUTU32(nbytes)
|
||||||
|
|
||||||
|
#define __GX_Flush(__gx) \
|
||||||
|
if(__gx->dirtyState) \
|
||||||
|
__GX_SetDirtyState(__gx); \
|
||||||
|
wgPipe->U32 = 0; \
|
||||||
|
wgPipe->U32 = 0; \
|
||||||
|
wgPipe->U32 = 0; \
|
||||||
|
wgPipe->U32 = 0; \
|
||||||
|
wgPipe->U32 = 0; \
|
||||||
|
wgPipe->U32 = 0; \
|
||||||
|
wgPipe->U32 = 0; \
|
||||||
|
wgPipe->U32 = 0; \
|
||||||
|
ppcsync()
|
||||||
|
|
23
gx/ppc_asm.h
23
gx/ppc_asm.h
|
@ -18,6 +18,29 @@
|
||||||
__asm__ volatile ("stwbrx %0,%1,%2" : : "r"(value), "b%"(index), "r"(base) : "memory")
|
__asm__ volatile ("stwbrx %0,%1,%2" : : "r"(value), "b%"(index), "r"(base) : "memory")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _sync
|
||||||
|
#define _sync() asm volatile("sync")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _nop
|
||||||
|
#define _nop() asm volatile("nop")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ppcsync
|
||||||
|
#define ppcsync() asm volatile("sc")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ppchalt
|
||||||
|
#define ppchalt() ({ \
|
||||||
|
asm volatile("sync"); \
|
||||||
|
while(1) { \
|
||||||
|
asm volatile("nop"); \
|
||||||
|
asm volatile("li 3,0"); \
|
||||||
|
asm volatile("nop"); \
|
||||||
|
} \
|
||||||
|
})
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef GEKKO
|
#ifdef GEKKO
|
||||||
|
|
||||||
#ifndef _CPU_ISR_Enable
|
#ifndef _CPU_ISR_Enable
|
||||||
|
|
Loading…
Reference in New Issue