Visual Stimuli Off by Factor of Refresh Rate

Linux - Ubuntu 24.04.3
Kernel Version: 6.8.0-85-generic
System: OptiPlex 7090 (0A52)
Processor: Intel Core i9-10900
GPU: Advanced Micro Devices, Inc. [AMD/ATI] Lexa [Radeon 540X/550X/630 / RX 640 / E9171 MCM]
GNU Octave, 8.4.0
Psychtoolbox-3

I am having issues getting consistent visual stimulus timing. I am using BioSemi ActiviewTwo System’s photo sensor to test the duration of my visual stimuli. I noticed that the duration of my images will be off by a factor of the refresh rate. So I performed VBL Testing. I was getting missed flips and thought maybe my GPU couldn’t handle the higher refresh rate. When I adjusted my refresh rate and resolution I didn’t have any more missed flips ( from 2560x1440 at 143.91Hz → 1600x900 at 60.00Hz). However, when I do photo sensor testing at these new settings I am still having the same issues with my duration being off by a factor of the new refresh rate. Is this likely a hardware issue? What are some other possible reasons or ways to troubleshoot this? Thank-you for any insight you can provide!

(Below are the outputs for VBL tests at the different display settings)

Display Settings: Resolution 2560x1440 at 143.91Hz refresh
VBLSyncTest(1000, 0, 0.6, 0, 0, 1, 0)

Output:
PTB-INFO: This is Psychtoolbox-3 for GNU/Linux X11, under GNU/Octave 64-Bit (Version 3.0.19 - Build date: Apr 1 2024).
PTB-INFO: OS support status: Linux 6.8.0-85-generic Supported.
PTB-INFO: Type ‘PsychtoolboxVersion’ for more detailed version information.
PTB-INFO: Most parts of the Psychtoolbox distribution are licensed to you under terms of the MIT License, with
PTB-INFO: some restrictions. See file ‘License.txt’ in the Psychtoolbox root folder for the exact licensing conditions.

PTB-INFO: For information about paid support, support memberships and other commercial services, please type
PTB-INFO: ‘PsychPaidSupportAndServices’.

PTB-INFO: Connected to Advanced Micro Devices, Inc. [AMD/ATI] Lexa [Radeon 540X/550X/630 / RX 640 / E9171 MCM] GPU with DCE-11.0 display engine [6 heads].

PTB-INFO: OpenGL-Renderer is AMD :: AMD Radeon RX 640 (radeonsi, polaris12, ACO, DRM 3.57, 6.8.0-85-generic) :: 4.6 (Compatibility Profile) Mesa 25.0.7-0ubuntu0.24.04.2
PTB-INFO: VBL startline = 1440 , VBL Endline = 1541
PTB-INFO: Measured monitor refresh interval from beamposition = 6.948880 ms [143.908087 Hz].
PTB-INFO: Will try to use OS-Builtin OpenML sync control support for accurate Flip timestamping.
PTB-INFO: Measured monitor refresh interval from VBLsync = 6.948876 ms [143.908158 Hz]. (50 valid samples taken, stddev=0.000515 ms.)
PTB-INFO: Reported monitor refresh interval from operating system = 6.948739 ms [143.910995 Hz].
PTB-INFO: Small deviations between reported values are normal and no reason to worry.
The refresh interval reported by the operating system is 6.94444 ms.
libptbdrawtext_ftgl: External ‘DrawText’ text rendering plugin initialized.
libptbdrawtext_ftgl: Maximum number of cacheable fonts is 40, minimum number of supported concurrent windows is 10.
libptbdrawtext_ftgl: This plugin uses multiple excellent free software libraries to do its work:
libptbdrawtext_ftgl: OGLFT (http://oglft.sourceforge.net/) the OpenGL-FreeType library.
libptbdrawtext_ftgl: The FreeType-2 (http://freetype.sourceforge.net/) library.
libptbdrawtext_ftgl: The FontConfig (http://www.fontconfig.org) library. Version Id: 21500
libptbdrawtext_ftgl: Thanks!

Measured refresh interval, as reported by “GetFlipInterval” is 6.94888 ms. (nsamples = 0, stddev = 0.00000 ms)

INFO: PTB’s Screen(‘Flip’, 10) command seems to have missed the requested stimulus presentation deadline
INFO: a total of 96 times out of a total of 1007 flips during this session.

INFO: This number is fairly accurate (and indicative of real timing problems in your own code or your system)
INFO: if you provided requested stimulus onset times with the ‘when’ argument of Screen(‘Flip’, window [, when]);
INFO: If you called Screen(‘Flip’, window); without the ‘when’ argument, this count is more of a ‘‘mild’’ indicator
INFO: of timing behaviour than a hard reliable measurement. Large numbers may indicate problems and should at least
INFO: deserve your closer attention. Cfe. ‘help SyncTrouble’, the FAQ section at www.psychtoolbox.org and the
INFO: examples in the PDF presentation in PsychDocumentation/Psychtoolbox3-Slides.pdf for more info and timing tips.

PTB missed 95 out of 1000 stimulus presentation deadlines.
One missed deadline is ok and an artifact of the measurement.
PTB completed 0 stimulus presentations before the requested target time.
Have a look at the plots for more details…

Display Settings: Resolution 1600x900 at 60.00Hz
VBLSyncTest(1000, 0, 0.6, 0, 0, 1, 0)

Output:
PTB-INFO: This is Psychtoolbox-3 for GNU/Linux X11, under GNU/Octave 64-Bit (Version 3.0.19 - Build date: Apr 1 2024).
PTB-INFO: OS support status: Linux 6.8.0-85-generic Supported.
PTB-INFO: Type ‘PsychtoolboxVersion’ for more detailed version information.
PTB-INFO: Most parts of the Psychtoolbox distribution are licensed to you under terms of the MIT License, with
PTB-INFO: some restrictions. See file ‘License.txt’ in the Psychtoolbox root folder for the exact licensing conditions.

PTB-INFO: For information about paid support, support memberships and other commercial services, please type
PTB-INFO: ‘PsychPaidSupportAndServices’.

PTB-INFO: Connected to Advanced Micro Devices, Inc. [AMD/ATI] Lexa [Radeon 540X/550X/630 / RX 640 / E9171 MCM] GPU with DCE-11.0 display engine [6 heads].

PTB-INFO: OpenGL-Renderer is AMD :: AMD Radeon RX 640 (radeonsi, polaris12, ACO, DRM 3.57, 6.8.0-85-generic) :: 4.6 (Compatibility Profile) Mesa 25.0.7-0ubuntu0.24.04.2
PTB-INFO: VBL startline = 900 , VBL Endline = 998
PTB-INFO: Measured monitor refresh interval from beamposition = 16.666855 ms [59.999322 Hz].
PTB-INFO: Will try to use OS-Builtin OpenML sync control support for accurate Flip timestamping.
PTB-INFO: Measured monitor refresh interval from VBLsync = 16.666889 ms [59.999199 Hz]. (50 valid samples taken, stddev=0.000519 ms.)
PTB-INFO: Reported monitor refresh interval from operating system = 16.666667 ms [60.000000 Hz].
PTB-INFO: Small deviations between reported values are normal and no reason to worry.
The refresh interval reported by the operating system is 16.66667 ms.
libptbdrawtext_ftgl: External ‘DrawText’ text rendering plugin initialized.
libptbdrawtext_ftgl: Maximum number of cacheable fonts is 40, minimum number of supported concurrent windows is 10.
libptbdrawtext_ftgl: This plugin uses multiple excellent free software libraries to do its work:
libptbdrawtext_ftgl: OGLFT (http://oglft.sourceforge.net/) the OpenGL-FreeType library.
libptbdrawtext_ftgl: The FreeType-2 (http://freetype.sourceforge.net/) library.
libptbdrawtext_ftgl: The FontConfig (http://www.fontconfig.org) library. Version Id: 21500
libptbdrawtext_ftgl: Thanks!

Measured refresh interval, as reported by “GetFlipInterval” is 16.66689 ms. (nsamples = 0, stddev = 0.00000 ms)
PTB missed 0 out of 1000 stimulus presentation deadlines.
One missed deadline is ok and an artifact of the measurement.
PTB completed 0 stimulus presentations before the requested target time.
Have a look at the plots for more details…

Output looks like a perfectly working system, timing-wise, and the graphics card of the Polaris gpu family is one of the most well-tested gpu’s, so it is unlikely to be a software or hardware problem on the computers side.

That said, using VBLSyncTest(1000, 0, 0.6, ...) will intentionally introduce random timing jitter on the side of the test scripts cpu execution of up to 60% (=0.6) of a video refresh duration. A simple VBLSyncTest(1000, 0) without artificial timing noise introduced should fare better, and hopefully get to almost zero missed flips even at 2560x1440@144 Hz. My own main test machine runs that resolution and refresh rate reliably on comparable hardware without missing/skipping frames.

So a few things to consider:

  • If this is a digital flat panel screen, like most screens nowadays, always run it at its native resolution and refresh rate, or the panel might perform rescaling and resampling of the video signal, which can introduce random or long (multi-frame) delays. If 2560x1440@144 Hz is the highest your display can do, then use that for best timing. If you need smaller resolution etc. see help PanelfitterDemo for ways to let Psychtoolbox take care of it.
  • Maybe your script is written suboptimally, if VBLSyncTest works fine, leading to skipped frames? That should be reflected in the returned Flip timestamps though.
  • Where is the photo-sensor placed? Needs to be at the top-left corner for its timestamps to coincide closely with what Flip reports. Placing it at the bottom would add 1 video refresh duration lag.

If none of this helps then it is likely a problem with your display monitor, either a slow panel or some suboptimal configuration. Psychtoolbox timestamps can only tell you when the video signal reaches the output of your graphics card ~ input of your monitor. It can’t account for extra delays in the monitors electronics or display panel. On a properly working setup, the timestamp difference between Flip timestamps and a proper photo-sensor should be well below 1 millisecond.