void psp_cv_wait_vsync() { # if 0 //ZX: TO_BE_DONE ! # ifndef LINUX_MODE static int loc_pv = 0; int cv = sceDisplayGetVcount(); if (loc_pv == cv) { sceDisplayWaitVblankCB(); } loc_pv = sceDisplayGetVcount(); # endif # endif }
void testCycleLatch(int cycle) { SceCtrlLatch latch; // Ignore it this time, to reset it. sceCtrlReadLatch(&latch); sceDisplayWaitVblank(); sceCtrlSetSamplingCycle(cycle); int vcountBefore = sceDisplayGetVcount(); sceKernelDelayThread(166666); int vcountAfter = sceDisplayGetVcount(); int after = sceCtrlReadLatch(&latch); // Keeping it approximate because timing is hard to get millisecond accurate. schedf("%d cycle: %dx\n", cycle, (after + 5) / (vcountAfter - vcountBefore)); }
/*------------------------------------------------------------------------------*/ void debug_printf( const char *arg, ... ) { char tmp[DEBUG_BUFF_SIZE]; int intc = pspSdkDisableInterrupts(); if ( debug_disp_flag != 0 ){ debug_disp_flag = 0; sprintf( DebugData.buff, "0x%08x\n", sceDisplayGetVcount() ); } va_list ap; va_start( ap, arg ); vsprintf( tmp, arg, ap ); if ( strlen(DebugData.buff) + strlen(tmp) < DEBUG_BUFF_SIZE ){ strcat( DebugData.buff, tmp ); } pspSdkEnableInterrupts( intc ); }
void checkDispatchInterrupt() { dispatchCheckpoint("Interrupts while dispatch disabled:"); sceKernelRegisterSubIntrHandler(PSP_VBLANK_INT, 0, &vblankCallback, NULL); sceKernelEnableSubIntr(PSP_VBLANK_INT, 0); ++ignoreResched; int state = sceKernelSuspendDispatchThread(); int base = sceDisplayGetVcount(); int i, j; for (i = 0; i < 1000; ++i) { if (sceDisplayGetVcount() > base + 3) { break; } for (j = 0; j < 10000; ++j) continue; } dispatchCheckpoint("vblanks=%d", sceDisplayGetVcount() - base); sceKernelResumeDispatchThread(state); --ignoreResched; base = sceDisplayGetVcount(); for (i = 0; i < 1000; ++i) { if (sceDisplayGetVcount() > base + 3) { break; } for (j = 0; j < 10000; ++j) continue; } dispatchCheckpoint("vblanks=%d", sceDisplayGetVcount() - base); sceKernelDisableSubIntr(PSP_VBLANK_INT, 0); sceKernelReleaseSubIntrHandler(PSP_VBLANK_INT, 0); flushschedf(); }