(PSP1) Correct video_init function so that it is no longer reentrant

This commit is contained in:
twinaphex 2014-05-29 22:51:52 +02:00
parent 622ac28995
commit 94fbb99410

View File

@ -111,23 +111,16 @@ static void *psp_init(const video_info_t *video,
{
// to-do : add ASSERT() checks or use main RAM if VRAM is too low for desired video->input_scale
void *pspinput;
psp1_video_t *psp=driver.video_data;
int pixel_format, lut_pixel_format, lut_block_count;
unsigned int red_shift, color_mask;
void *displayBuffer, *LUT_r, *LUT_b;
psp1_video_t *psp = (psp1_video_t*)calloc(1, sizeof(psp1_video_t));
if (!psp)
{
// first time init
psp = (psp1_video_t*)calloc(1, sizeof(psp1_video_t));
return NULL;
if (!psp)
goto error;
}
if(!psp->main_dList) // either first time init or psp_free was called
{
sceGuInit();
psp->main_dList = memalign(16, 256); // make sure to allocate more space if bigger display lists are needed.
psp->frame_dList = memalign(16, 256);
psp->rgui.dList = memalign(16, 256);
@ -151,15 +144,9 @@ static void *psp_init(const video_info_t *video,
psp->frame_coords->v1.u = 256;
psp->frame_coords->v1.v = 240;
}
psp->vsync = video->vsync;
psp->rgb32 = video->rgb32;
int pixel_format, lut_pixel_format, lut_block_count;
unsigned int red_shift, color_mask;
void *displayBuffer, *LUT_r, *LUT_b;
if(psp->rgb32)
{
uint32_t* LUT_r_local = (uint32_t*)(SCEGU_VRAM_BP32_2);
@ -215,7 +202,6 @@ static void *psp_init(const video_info_t *video,
}
sceDisplayWaitVblankStart(); // TODO : check if necessary
sceGuDisplay(GU_FALSE);
@ -241,8 +227,6 @@ static void *psp_init(const video_info_t *video,
pspDebugScreenSetColorMode(pixel_format);
pspDebugScreenSetBase(psp->draw_buffer);
// fill frame_dList :
sceGuStart(GU_CALL, psp->frame_dList);
@ -275,7 +259,6 @@ static void *psp_init(const video_info_t *video,
*input_data = pspinput;
}
return psp;
error:
RARCH_ERR("PSP1 video could not be initialized.\n");