Eyelink calibration freeze in fullscreen on Apple Silicon Macs

Hi all, I’m having a problem getting Eyelink calibration to work in fullscreen mode on Apple Silicon setup with the new version of psychtoolbox.

Setup:
• Eye tracker: Eyelink 1000 Plus (v 5.15)
• Computer: Apple M2 Ultra Mac Pro
• OS: macOS Sequoia 15.7
• MATLAB: R2025b (native Apple Silicon)
• Psychtoolbox: 3.0.22

Problem: When running any code with eyetracking in fullscreen mode, calibration never progresses to the marker screen and the following error appears:
PTB-ERROR: PsychPipelineProcessMacros: IMAGINGPIPE_FLIPWHEN variable assignment failed in runtime! skipped slot

The screen freezes at this point. I believe it is this script that is hanging – EyelinkDoTrackerSetup.

If I run the exact same code in windowed mode, everything works fine (even if the window is only one pixel smaller than fullscreen). This happens across all Eyelink scripts, including Psychtoolbox’s demo scripts, so it’s not an issue specific to my own code.

Other setups tested:
• MATLAB R2024b (native Silicon) + PTB 3.0.22 → same error in fullscreen, works in windowed mode.
• Intel MATLAB R2025b (via Rosetta 2) + PTB 3.0.22 → same behavior: fullscreen fails, windowed mode works.
Intel MATLAB R2025b (via Rosetta 2) + PTB 3.0.19 → fullscreen calibration works perfectly.
So fullscreen calibration seems to fail only with Psychtoolbox 3.0.22 on Apple Silicon (both native and Intel MATLAB), while older PTB 3.0.19 behaves normally.

I saw that this post had a similar error, I tried to implement the fix but it did not resolve my issue. PTB-ERROR: IMAGINGPIPE_FLIPTWHEN variable assignment failed on macOS (works on Windows) - #9 by mariokleiner

Any help will be greatly appeatiated, thanks!

Support token: 5Z943-Z9-2025111113444:9bc44da4bcd742adbd571dc38967495346d1aa44bd15ca406a21ce4a5733e30c

GPU and display info:
• Chipset Model: Apple M2 Ultra
• Type: GPU (Built-in)
• Metal Support: Metal 3
• Displays: G2480: 1920 × 1080 @ 120 Hz (Main Display, online); PROPixx:Ctrl: 1920 × 1080 @ 120 Hz (online)

So, the bug is exactly the same as the one you linked.

The reason the problem doesn’t happen in windowed mode is because then a different code-path via NSOpenGL is taken → This one doesn’t have that problem of being affected by the Matlab design defect with nested functions, but instead visual stimulation timing and timestamping is totally broken on that path, so it is not useful for anything requiring correct timing! The reason it “worked” on PTB 3.0.19, which is absolutely not meant to be used on Apple Silicon Macs and unfit for it in many ways, is that with 3.0.19 and earlier, Psychtoolbox always uses the “windowed / non-fullscreen” fallback - the same code that v3.0.20 and later use for windowed windows. Therefore it seems to work, but has the same completely broken timing as with PTB 3.0.20 and later for non-fullscreen windows.

The trigger for the failure with anything involving Eyelink’s tracker setup and calibration functions is that these functions use PsychEyelinkDispatchCallback() and that function has various nested functions in it for totally pointless and avoidable reasons. I didn’t notice the problem, because the test scripts I use in Eyelink dummy mode for testing that function without an actual Eyelink tracker only opened a non-fullscreen windowed window and so didn’t trigger the bug :confused:

I have now rewritten the function to no longer use nested functions and in my simulated test with Eyelink dummy mode things now behave correctly. This will be part of the next PTB release, but for now you can fetch the function from the following download link and replace your copy of it in the Psychtoolbox/PsychHardware/EyelinkToolbox/EyelinkBasic/ folder:

https://github.com/kleinerm/Psychtoolbox-3/raw/refs/heads/master/Psychtoolbox/PsychHardware/EyelinkToolbox/EyelinkBasic/PsychEyelinkDispatchCallback.m

Anyhow, the fix on Apple Silicon with a suitable PTB 3.0.22 is to avoid using any nested functions in parent functions that call Screen('Flip', ...) or Screen('Drawingfinished', ...) or various things involving external display backends or the imaging pipeline. Or to use that hack described in the post you linked.

Unfortunately, a quick check shows that SR-Research made generous and mostly pointless use of nested helper functions in all their Eyelink demos with the big Eyelink toolbox update from a year ago. They couldn’t know that this was a bad idea, as the Matlab design bug that causes the mayhem wasn’t known to us at that time, and Apple Silicon Support didn’t exist at that time in Psychtoolbox. So it was just inelegant and clumsy coding at that time. Now it is something that breaks every Eyelink demo in the Eyelink toolbox on macOS for Apple Silicon Macs.

Update: I think I’ve rewritten all those demos for Matlab + macOS + Apple Silicon Mac compatibility now. Will be part of the next PTB update.

At least your own scripts should work with the bug fix, as long as you avoid nested functions. The bug also doesn’t happen on Octave btw., as that treats nested functions differently, but has its own share of problems with them. Nested functions are just a bad idea…

However, as a more general comment, given you try to use eye tracking with a fast eyetracker, where timing often matters: I would not neccessarily recommend the Psychtoolbox for Apple Silicon in production for research grade data collection that requires precise visual stimulation timing. It is not functionally quite at the same level as other Psychtoolbox variants for other OS + hardware combos. And there are known glitches, caused by various Apple macOS bugs on Apple Silicon. Ironing those out will take more time. Sometimes, due to rather unclear causes, you can see PsychVulkan warnings about timestamping failures, which are accompanied by glitches in visual stimulation. Most often after no flip has happened for a while.

I’d also not recommend upgrading to macOS 26 if the other report of Keith holds true: Timing fails on Mac OS 26.1 Beta