From ba7cefc529f4ab47fd1a239fba49cd50dbbe4cc8 Mon Sep 17 00:00:00 2001 From: aliaspider Date: Sun, 29 Jun 2014 05:45:36 +0100 Subject: [PATCH] (PSP) add BIG_STACK makefile option fix overflow in VFPU resampler when input_frames is 0 add support for GU_PSM_5551 pixel format when using hardware rendering --- Makefile.psp1 | 16 +++++++++++----- audio/cc_resampler.c | 4 ++-- frontend/platform/platform_psp.c | 3 +++ psp1/psp1_video.c | 11 ++++------- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Makefile.psp1 b/Makefile.psp1 index 7d562413f5..d4fb156ce2 100644 --- a/Makefile.psp1 +++ b/Makefile.psp1 @@ -1,8 +1,10 @@ -BUILD_PRX = 1 -DEBUG = 0 -HAVE_KERNEL_PRX = 1 -HAVE_FILE_LOGGER = 0 -HAVE_THREADS = 1 +BUILD_PRX = 1 +DEBUG = 0 +HAVE_KERNEL_PRX = 1 +HAVE_FILE_LOGGER = 0 +HAVE_THREADS = 1 +BIG_STACK = 0 +WHOLE_ARCHIVE_LINK = 0 TARGET = retroarchpsp @@ -39,6 +41,10 @@ ifeq ($(HAVE_KERNEL_PRX), 1) CFLAGS += -DHAVE_KERNEL_PRX endif +ifeq ($(BIG_STACK), 1) +CFLAGS += -DBIG_STACK +endif + CFLAGS += $(RARCH_DEFINES) diff --git a/audio/cc_resampler.c b/audio/cc_resampler.c index 7b271a9d1e..432de7b740 100644 --- a/audio/cc_resampler.c +++ b/audio/cc_resampler.c @@ -72,6 +72,8 @@ static void resampler_CC_process(void *re_, struct resampler_data *data) { while (fraction < ratio) { + if (inp == inp_max) + goto done; __asm__ ( ".set push \n" ".set noreorder \n" @@ -105,8 +107,6 @@ static void resampler_CC_process(void *re_, struct resampler_data *data) : "r"(inp)); inp++; - if (inp == inp_max) - goto done; } __asm__ ( ".set push \n" diff --git a/frontend/platform/platform_psp.c b/frontend/platform/platform_psp.c index f3d981f62d..d6366b7e99 100644 --- a/frontend/platform/platform_psp.c +++ b/frontend/platform/platform_psp.c @@ -35,6 +35,9 @@ PSP_MODULE_INFO("RetroArch PSP", 0, 1, 1); PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER|THREAD_ATTR_VFPU); +#ifdef BIG_STACK +PSP_MAIN_THREAD_STACK_SIZE_KB(4*1024); +#endif PSP_HEAP_SIZE_MAX(); char eboot_path[512]; diff --git a/psp1/psp1_video.c b/psp1/psp1_video.c index bd65d360cf..2d413c687a 100644 --- a/psp1/psp1_video.c +++ b/psp1/psp1_video.c @@ -187,7 +187,7 @@ static void *psp_init(const video_info_t *video, psp->draw_buffer = SCEGU_VRAM_BP_0; psp->bpp_log2 = 1; - pixel_format = GU_PSM_5650; + pixel_format = (g_extern.system.pix_fmt == RETRO_PIXEL_FORMAT_0RGB1555)? GU_PSM_5551 : GU_PSM_5650 ; lut_pixel_format = GU_PSM_T16; displayBuffer = SCEGU_VRAM_BP_1; @@ -282,7 +282,8 @@ static bool psp_frame(void *data, const void *frame, if (!width || !height) return false; - sceGuSync(0, 0); + if (!(((uint32_t)frame&0x04000000) || (frame == RETRO_HW_FRAME_BUFFER_VALID))) // let the core decide when to sync when HW_RENDER + sceGuSync(0, 0); pspDebugScreenSetBase(psp->draw_buffer); @@ -336,7 +337,7 @@ static bool psp_frame(void *data, const void *frame, sceGuStart(GU_DIRECT, psp->main_dList); - if ((uint32_t)frame&0x04000000) // frame in VRAM ? texture/palette was set in core so draw directly + if (((uint32_t)frame&0x04000000) || (frame == RETRO_HW_FRAME_BUFFER_VALID)) // frame in VRAM ? texture/palette was set in core so draw directly { sceGuClear(GU_COLOR_BUFFER_BIT); sceGuDrawArray(GU_SPRITES, GU_TEXTURE_16BIT | GU_COLOR_4444 | GU_VERTEX_16BIT | GU_TRANSFORM_2D, 2, NULL, (void*)(psp->frame_coords)); @@ -481,10 +482,6 @@ static void psp_set_texture_enable(void *data, bool state, bool full_screen) static const video_poke_interface_t psp_poke_interface = { NULL, /* set_filtering */ -#ifdef HAVE_FBO - NULL, /* get_current_framebuffer */ - NULL, /* get_proc_address */ -#endif NULL, NULL, #ifdef HAVE_MENU