[6.21 ARM] Flipbuffers() miss vsync / unstable framerate
Posted: Mon Jan 05, 2026 7:16 pm
PureBasic 6.21 - C Backend (Linux - arm64)
I run the code on Windows I got something like this ( with a Full-HD monitor with 60hz):
Time before FlipBuffer: 1-2 ms
Time before ClearBuffers: 17ms
Time after ClearBuffers: 17ms
Time always from start of the loop.
When I run the code on a Raspberry Pi 500+ (is technical a PI5 with SSD) und PI-OS 64Bit with a Full-HD monitor with 60hz:
Time before Flipbuffers: 1-2ms
Time before ClearBuffers: 1-2ms
Time after Clearbuffers: 17 / 33 ms
Flipbuffers doesn't wait for anything.
ClearScreen wait for VSYNC - and seems to miss about every second frame the vsync... times flips between 17 and 33ms here.
When you lower the #width and #height to 200, the frametime is stable to 17ms. But with 1000x800 it has an instable framerate.
Clearing a 1000x800 pixel buffer should not be the problem, even a PI5 should do this under a milllisecond.
switch between PB_Screen_WaitSynchronization, PB_Screen_noSynchronization and PB_Screen_SmartSynchronization doesn't have any effect.
Code: Select all
InitSprite()
#width=1000
#height=800
OpenWindow(1,0,0,#width+200,#height,"vysnc-test",#PB_Window_SystemMenu)
EditorGadget(1,#width,0,200,#height)
OpenWindowedScreen(WindowID(1),0,0,#width,#height,#False,0,0,#PB_Screen_WaitSynchronization)
Repeat
start=ElapsedMilliseconds()
waitevent=start+burn
Repeat
event=WindowEvent()
If event=#PB_Event_CloseWindow
End
EndIf
Until event=0
Delay(1)
t1=ElapsedMilliseconds()-start
FlipBuffers()
t2=ElapsedMilliseconds()-start
ClearScreen(#Black)
t3=ElapsedMilliseconds()-start
SetGadgetText(1,
"Before FlipBuffers:"+RSet(Str(t1),3,"0")+ #LF$+
"Before ClearScreen:"+RSet(Str(t2),3,"0")+ #LF$+
"After ClearScreen:"+RSet(Str(t3),3,"0")+ #LF$)
ForEver
Time before FlipBuffer: 1-2 ms
Time before ClearBuffers: 17ms
Time after ClearBuffers: 17ms
Time always from start of the loop.
When I run the code on a Raspberry Pi 500+ (is technical a PI5 with SSD) und PI-OS 64Bit with a Full-HD monitor with 60hz:
Time before Flipbuffers: 1-2ms
Time before ClearBuffers: 1-2ms
Time after Clearbuffers: 17 / 33 ms
Flipbuffers doesn't wait for anything.
ClearScreen wait for VSYNC - and seems to miss about every second frame the vsync... times flips between 17 and 33ms here.
When you lower the #width and #height to 200, the frametime is stable to 17ms. But with 1000x800 it has an instable framerate.
Clearing a 1000x800 pixel buffer should not be the problem, even a PI5 should do this under a milllisecond.
switch between PB_Screen_WaitSynchronization, PB_Screen_noSynchronization and PB_Screen_SmartSynchronization doesn't have any effect.