diff --git a/ps4_libkernel/ps4_time.pas b/ps4_libkernel/ps4_time.pas index e069273..043ac30 100644 --- a/ps4_libkernel/ps4_time.pas +++ b/ps4_libkernel/ps4_time.pas @@ -421,5 +421,16 @@ begin Result:=0; end; +Procedure Init; +var + min,max,cur:ULONG; +begin + NtQueryTimerResolution(@min,@max,@cur); + NtSetTimerResolution(max,True,@cur); +end; + +initialization + Init; + end. diff --git a/ps4_libscevideoout.pas b/ps4_libscevideoout.pas index ee7d8f0..574a654 100644 --- a/ps4_libscevideoout.pas +++ b/ps4_libscevideoout.pas @@ -995,6 +995,8 @@ var elap:QWORD; time:DWORD; + + //t1,t2:QWORD; begin bufferIndex:=node^.u.bufferIndex; flipMode :=node^.u.flipMode ; @@ -1094,16 +1096,22 @@ begin time:=0; end; + //SwSaveTime(t1); + ps4_usleep(time); //Sleep(_usec2msec(time)); + //t2:=SwTimePassedUnits(t1); + //t2:=(t2+9) div 10; + //Writeln('elap=',elap,' time=',time,' usleep=',t2); + if (FGpuFlip<>nil) then begin - //FGpuFlip.IsComplite(FcurrentBuffer); - While (not FGpuFlip.IsComplite(FcurrentBuffer)) do - begin - ps4_usleep(150); - end; + FGpuFlip.IsComplite(FcurrentBuffer); + //While (not FGpuFlip.IsComplite(FcurrentBuffer)) do + //begin + // ps4_usleep(150); + //end; end; end; diff --git a/rtl/ntapi.pas b/rtl/ntapi.pas index fd4afa8..82dc13b 100644 --- a/rtl/ntapi.pas +++ b/rtl/ntapi.pas @@ -81,6 +81,18 @@ function NtQueryPerformanceCounter( Frequency:PLARGE_INTEGER ):DWORD; stdcall; external 'ntdll'; +function NtQueryTimerResolution( + MinimumResolution:PULONG; + MaximumResolution:PULONG; + CurrentResolution:PULONG + ):DWORD; stdcall; external 'ntdll'; + +function NtSetTimerResolution( + DesiredResolution:ULONG; + SetResolution:BOOL; + CurrentResolution:PULONG + ):DWORD; stdcall; external 'ntdll'; + implementation end.