macOS PTB users: Petition Apple at WWDC?

At this year’s WWDC, developer forums will be open for posting messages with improved tagging and search. Mario recently tried and failed to get Metal on Vulkan support working for PTB, with critical timing bugs blocking any progress. From the logs, I understand that the problems lie not with the Vulkan wrapper, but with Metal directly. Without those bugs fixed there is little hope for any longer-term options for PTB…

macOS is still my preferred OS for general use, but I have firmly switched to Ubuntu for all experimental work. But I know given PTB’s roots there are some dedicated macOS users who would love to see a more reliable PTB on macOS, even if just for developing tasks rather than data collection.

Therefore I wonder if the macOS users would think that posting a thread to the WWDC forums, where the problem is clearly laid out and make an appeal on the hope an Apple engineer may stop by and give it some time. I think the prospects are low given the niche that is high-fidelity timing, and that many Apple Radar bugs seem to never get fixed, and getting feedback on bugs rarely happens. But maybe there are some engineers at WWDC who could be persuaded on a whim and at least take a look and give some public feedback? Perhaps @denis.pelli could make the first post and we could link to the specific commit and documentation comments that Mario has detailed.

A fishing trip in turbulent waters trying to catch a rare fish for sure… What do other macOS users think?

2 Likes

Yes, tell me what to do. I prefer Macs because I find them easy to administer and they tend to last much longer before breaking down than the PCs in my lab. Like you, all my stimulus computers are either old (running Mac OS Snow Leopard; the good old days) or are Linux.

Best
Steve

We can draft a post here (I’ll start one in a few days if nobody else does), edit it, then one of us who has an Apple account with a developer registration (doesn’t need to be paid as far as I know), can post and those who are interested can follow up there… I highly suspect the thread will sink to the bottom of the Sea, Apple has shown no interest in following up and doing the minimum to keep their GPU drivers bug free, they are a company focused on the shiny future, and drop their responsibilities to “Pro” users whenever it suits them. Though that leads to some great computing devices, the constant churn isn’t really suitable for scientific projects where stability and consistency are far more important than “shiny”. But hey, there ain’t much to lose…

I think Mario summarises his frustrations in great detail here: Using toolbox with Big Sur and M1 MacBook? - #18 by matt_j_dunn

If anyone can gain access to a graphics engineer at WWDC, this would be a useful place to direct them, though some of the invective probably won’t induce someone who doesn’t appreciate a challenge…

Like others in that thread, I am working towards using a Linux machine (considering a RPi 4 with Octave) as dedicated hardware for stimulus presentation, communicating with my experiment-control machine. Fortunately in my case, I do not have a critical need for high-precision graphics timing, so I really haven’t gone all-in yet.

Mario details the current sad state of the support here:

I think if an engineer isn’t enthused by a challenge, they wouldn’t bother either way. Mario’s summary:

The main motivator was to access Metal’s timed presentation scheduling, and even more critical for us, the timestamping of when a swapchain image was truly presented onscreen. Iow. the MTLDrawable presentAtTime: when, MTLDrawable:addPresentedHandler, and MTLDrawable:presentedTime api’s. These are exposed by MoltenVK’s VK_GOOGLE_display_timing extension.

I could only test this on macOS 10.15.7 on AMD and Intel gpu’s (MBP Retina 15" 2017), but on that machine + OS combo, Metals timestamping and presentation scheduling proved to be very unreliable and underwhelming in performance, even now that i fixed MVK in that other pull request. As far as dozens of hours of testing and tinkering go, this is not a fault or bug of MoltenVK, but of Metal on Catalina itself. I also downloaded some of Apples “best practices” Metal sample XCode projects, traced their execution via the macOS Performance Tools - the Metal Performance Trace and Game trace templates, to watch application api calls, driver processing, gpu processing of command buffers, when drawable surfaces get scheduled for present, and actually presented in relation to vsync etc. If those went through the compositor/Windowserver or not, DirectToDisplay or not etc. I also used external measurement equipment and procedures of Psychtoolbox to compare Metal reported timestamps against ground truth etc. etc. I hacked Apples “best practices” Metal sample code to add presentAtTime, callbacks etc., to replicate the MoltenVK setup independently. Long story short, all the limtations and bugs i encountered with my Psychtoolbox+Vulkan+MoltenVK+Metal implementation also happened with the independent Apple Metal-only Obj-C sample code. This tells me we are not dealing with MoltenVK bugs or limitations, but macOS Metal brokeness.

DRAFT (feedback welcome)

The Psychophysics Toolbox (PTB) is a cross-platform fully open source software extension for MATLAB and Octave that has powered tens of thousands of research studies (as of April 23rd 2020, 25,635 papers cite PTB) spanning from low-level biological to high level psychological investigations on how the brain / higher cognitive frameworks process sensory information. This software has made, and continues to make, a substantial contribution to studies that expand our understanding of perception, cognition and behavior across Biology, Medicine and Psychology.

Historically, it first grew on Mac OS9 and for many years Mac OS X was the most robust and reliable OS on which to use it; leading to a vibrant community of research scientists who depended on OS X. Sadly, over the years, macOS has become less robust for PTB’s requirements and workarounds like custom kernel extensions are becoming close to impossible to use. PTB depends on methods to determine as precisely as possible when the GPU sends its buffer to a display. We recognize this is a requirement not shared by more commercial uses of graphics programming, although it is becoming increasingly important for performance measurement and optimisation for gaming.

Most research scientists are not systems programmers, and spend most of their time doing science. Open source research software is hard to maintain and there are not the resources available that a commercial company may have. PTB is built on OpenGL, which is deprecated on macOS. Recently the main PTB developer (who has volunteered for years maintaining PTB), has ported over core parts of the pipeline to Vulkan, which is supported and runs on Linux and Windows. Although macOS uses its own proprietary API there is a translation layer, MoltenVK. The developer tried to use PTB > MoltenVK > Metal backend working on macOS, but encountered major timing bugs, which he determined exist in Metal not the MoltenVK translation layer. This makes macOS unusable at present, and the future prospects of using macOS for this domain of scientific research are not hopeful.

We would be super grateful if a Metal engineer could have a look at the potential bugs.

The summary of the major bugs are outlined in the note available on Github:

To quote the developer’s summary directly:

The main motivator was to access Metal’s timed presentation scheduling, and even more critical for us, the timestamping of when a swapchain image was truly presented onscreen. Iow. the MTLDrawable presentAtTime: when , MTLDrawable:addPresentedHandler , and MTLDrawable:presentedTime api’s. These are exposed by MoltenVK’s VK_GOOGLE_display_timing extension … Long story short, all the limtations and bugs i encountered with my Psychtoolbox+Vulkan+MoltenVK+Metal implementation also happened with the independent Apple Metal-only Obj-C sample code. This tells me we are not dealing with MoltenVK bugs or limitations, but macOS Metal brokeness.

Thank you for your time,

A few comments interspersed, but ofc. you can write to Apple whatever you want…

Probably time to update our stats again. A quick sum-up of the numbers reported under the Google scholar links on our citation page now says 29883 citations.

That’s a very charitable way to describe the state of macOS, or how great it once was, or how long the ok state lasted.

Also a reminder that visual timing is only one of many broken things. HID Input, audio input and video capture is in a fragile state due to security nonsense and bad security UX since 10.15 or so. USB DAQ support is broken in some areas since a decade now. I don’t know how easy it is to still run the PTB kernel driver on macOS 11, but in any case it does no longer support AMD hardware more recent than Polaris. Without the kernel driver, even the best case scenario with Vulkan/Metal working perfectly will be worse in terms of trustworthiness than what we had on macOS 10.

Some work i did recently with vision impaired users suggest also new and severe problems with sound output on macOS 11 as soon as assistive technologies are in use. They have downgraded to a macOS 10.15 machine after many failed attempts at fixing problems, so all we know is there is more trouble in more areas…

It is important for high-end video games, and especially VR and AR apps, but also video players and fluid user interfaces and animations, although the effects of it not working properly are surely more catastrophic to vision science use cases than others. I would leave that “not shared by more commercial …” out and instead emphasize that this is a requirement by other apps the iToys company may or may not care about. But Apple knows this already, otherwise they would not have added api’s to Metal for such purposes. Which makes it even more embarrassing how poorly implemented and tested those api’s are on 10.15.7.

That OpenGL is deprecated is besides the point for this Metal api bug, i’d leave it out.

We do indeed have little resources compared to typical commercial companies, but it would not matter in the case of operating system bugs like these timing bugs - only Apple can fix them, the problem with proprietary operating systems, regardless of how many resources you have.

However, we have even less resources than we could and should have by now, because at least so far our user community, with the exception of about half a dozen labs (thanks!), has not contributed even remotely sufficient amounts of money since our “community membership” offerings have started six months ago. Community memberships that are bought by labs - without them then requesting priority support in exchange - are meant to pay money into a shared pool used for paying my time for general PTB feature development, maintenance and support, as well as for Linux (and other OSS software we depend on) improvements related to PTB’s needs and typical use cases. That also includes dealing with the latest macOS bugs, as far as that is possible and reasonable.

Given that this pool of “community sponsored money” remains mostly empty at this point, and I’ve donated way over 100 hours of my work time in the year 2021 on this little Metal (mis-)adventure alone, and then some more on other macOS problems, and another 120 hours in the year before that, i think that was enough charity towards macOS users for a long time.

So if Apple engineers would listen to your petition and their follow-up would require any collaboration from my side on these issues, first our macOS users would have to pay in advance for my work time and any equipment needed, e.g., suitable test hardware for testing under macOS 11 or later as i don’t have any Macs to spare for macOS 11 or later. Also, my work schedule is pretty much booked out for the next months with work that actually pays at least some of my small salary.

Here’s how i think this will likely play out:

The most likely reply you’ll get is none, or them asking you to file a Radar bug - which they will then ignore indefinitely.

The 2nd most likely reply would be them asking you to verify and prove in detail that these problems actually still exist in the latest versions (or even beta releases) of macOS 11 or macOS 12, because at this point Apple certainly won’t care about non security-critical bugs in macOS 10.15. So somebody should probably first repeat my tests on the latest macOS 11 on suitable Intel macs with suitable AMD or Intel graphics hardware and fully functional PTB kernel driver support and on M1 Macs (on which the kernel driver will never work) + MoltenVK and Vulkan runtime installed, ideally also with hw timing test equipment. Otherwise you may have an even weaker case getting them to do anything.

Download link for the MoltenVK open-source “Vulkan on Metal” driver:

https://vulkan.lunarg.com/sdk/home

Tests that do have optional Vulkan support relevant to timing are, e.g., VBLSyncTest, PerceptualVBLSyncTest, FlipTimingWith…Test, or not timing related the SimpleHDRDemo.

Good luck,
-mario

Hi Ian
Just reading this, after WWDC alas. Yes. Happy to help in any way. My understanding from several sources inside Apple is that they need a bug number to direct attention to a problem. So the first step is to get our bugs filed in their system, and THEN lobby to get an engineer to work on it. Lobbying at WWDC strikes me as a good idea, but still needs a bug number I bet. Mario and I had agreed on a plan to have my then Programmer work with him to file a report but it fell through, as my programmer didn’t have enough macOS savvy.
Best
Denis

Thanks Denis, I think what is needed is someone with some understanding of the macOS graphics system and PTB to spend time to make some simplified test cases, links to the documentation and then submit the bug report. That requires some expertise and one or two (?) weeks of work time, for an approach which has a slim chance of going anywhere, and even if Apple do fix those bugs, will then require more development work on the PTB side. Given we have a working solution (Linux), and a very small userbase left on macOS, it’s challenging to justify. Even for something which I would assume has a much bigger usecase, PTB touchscreen development of Windows, Mario has received almost no financial support. My view is we are just [hopefully] waiting for some young developer/student who is passionate about doing psychophysics and macOS to take this on as a labour of love. With a bug report and an engaged and passionate liason, yes then lobbying at WWDC makes sense; fingers crossed for next year…

What anybody with access to macOS 11 or macOS 12 could do is to do a quick test / a rough assessment, if the problems persist on those OS’es with different hardware.

Get and install the latest MoltenVK/Vulkan runtime:
https://sdk.lunarg.com/sdk/download/latest/mac/vulkan-sdk.dmg

This one now contains the bug fixes and improvements i contributed to this macOS Vulkan driver.

On an IntelMac install the PsychtoolboxKernelDriver, and make sure it is actually working and used by PTB – The beamposition timestamping must work, otherwise some misconfiguration or macOS security BS is getting in the way. On a M1 Mac, don’t bother with the driver, they are lost causes for our fancy stuff.

Run some of our Vulkan tests and just post the output:

If they appear to work nicely, that doesn’t necessarily prove it is working nicely, because some macs are so broken at least on macOS 10 that the only thing that helps is hardware diagnostic equipment like photodiodes, VPixx devices - they produce wrong but self-consistent results, giving the illusion of correctness unless one uses the right equipment and test procedures. Sometimes it even varies by video output port, e.g., works on DisplayPort, breaks silently on HDMI etc.

If the tests fail then we know at least that macOS 11 or 12 are just as broken as macOS 10.15.7.

E.g., run SimpleHDRDemo, or VBLSyncTest, PerceptualVBLSyncTest with their optional ‘useVulkan’ function parameter set to 1.

This first step doesn’t require expertise, just a bit of time and a variety of Mac hardware, and the braveness to install those “operating systems” on their machines.

-mario

Well on macOS 11 on a 2015 iMac — I can still install the PTB kernel extension:

❯ kmutil showloaded --bundle-identifier PsychtoolboxKernelDriver
No variant specified, falling back to release
Index Refs Address            Size       Wired      Name (Version) UUID <Linked Against>
  149    0 0xffffff7f9ccff000 0x8000     0x8000     PsychtoolboxKernelDriver (1.1) 2DA457B8-5775-3657-9A67-1D6DAB2AC5AF <14 5 3>

I disabled SIP and installed and tested with SIP still disabled (I used the older kext signed by CRS). I got a security requestor and entered my password and allowed it. Loading PTB and I use:

setenv('PSYCH_ALLOW_DANGEROUS', '1')

to allow the kernel driver to work with my intel GPU. Using a standard VBLSyncTest without Vulkan and everything looks as if it is working (except the display is wrongly scaled, I only see the bottom quarter of the PTB display, some issue with the panelfitter). However the log shows major timing issues:

>> VBLSyncTest

ans =

     0

PTB-DEBUG: PsychGetScreenDepths(): mode 0 : w x h = 1920 x 1080, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 1 : w x h = 1920 x 1080, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 2 : w x h = 960 x 540, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 3 : w x h = 960 x 540, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 4 : w x h = 2048 x 1152, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 5 : w x h = 2048 x 1152, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 6 : w x h = 1680 x 945, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 7 : w x h = 1680 x 945, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 8 : w x h = 1280 x 720, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 9 : w x h = 1280 x 720, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 10 : w x h = 1024 x 576, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 11 : w x h = 1024 x 576, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 12 : w x h = 2560 x 1440, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 13 : w x h = 2560 x 1440, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 14 : w x h = 2304 x 1296, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 15 : w x h = 2304 x 1296, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 16 : w x h = 1152 x 648, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 17 : w x h = 1152 x 648, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 18 : w x h = 840 x 472, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 19 : w x h = 840 x 472, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 20 : w x h = 3840 x 2160, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 21 : w x h = 3840 x 2160, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 22 : w x h = 1920 x 1080, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 23 : w x h = 1920 x 1080, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 24 : w x h = 4096 x 2304, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 25 : w x h = 4096 x 2304, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 26 : w x h = 3360 x 1890, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 27 : w x h = 3360 x 1890, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 28 : w x h = 2560 x 1440, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 29 : w x h = 2560 x 1440, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 30 : w x h = 2048 x 1152, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 31 : w x h = 2048 x 1152, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 32 : w x h = 2304 x 1296, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 33 : w x h = 2304 x 1296, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 34 : w x h = 1680 x 944, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 35 : w x h = 1680 x 944, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 36 : w x h = 1152 x 648, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 37 : w x h = 1152 x 648, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 38 : w x h = 1024 x 768, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 39 : w x h = 1024 x 768, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 40 : w x h = 800 x 600, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 41 : w x h = 800 x 600, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 42 : w x h = 640 x 480, fps = 0.000000, depth = 24
PTB-DEBUG: PsychGetScreenDepths(): mode 43 : w x h = 640 x 480, fps = 0.000000, depth = 24


PTB-INFO: This is Psychtoolbox-3 for Apple OS X, under Matlab 64-Bit (Version 3.0.17 - Build date: Apr 18 2021).
PTB-INFO: OS support status: OSX version 11.0 is not yet tested or officially supported at all for this Psychtoolbox release.
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 priority support, community membership and commercial services, please type
PTB-INFO: 'PsychPaidSupportAndServices'.

PTB-DEBUG: Display screen [0]:
PTB-DEBUG: (now: 2048x1152@2@d=4@0Hz)
PTB-DEBUG: Allowed modes:
          6720x3780@d=8@0Hz        6720x3780@d=4@0Hz      3360x1890@2@d=8@0Hz      3360x1890@2@d=4@0Hz
          6400x3600@d=8@0Hz        6400x3600@d=4@0Hz      3200x1800@2@d=8@0Hz      3200x1800@2@d=4@0Hz
          6016x3384@d=8@0Hz        6016x3384@d=4@0Hz      3008x1692@2@d=8@0Hz      3008x1692@2@d=4@0Hz
          5120x2880@d=8@0Hz        5120x2880@d=4@0Hz      2560x1440@2@d=8@0Hz      2560x1440@2@d=4@0Hz
          4608x2592@d=8@0Hz        4608x2592@d=4@0Hz      2304x1296@2@d=8@0Hz      2304x1296@2@d=4@0Hz
          4096x2304@d=8@0Hz        4096x2304@d=4@0Hz      2048x1152@2@d=8@0Hz      2048x1152@2@d=4@0Hz
          3840x2160@d=8@0Hz        3840x2160@d=4@0Hz      1920x1080@2@d=8@0Hz      1920x1080@2@d=4@0Hz
          3360x1890@d=8@0Hz        3360x1890@d=4@0Hz       1680x945@2@d=8@0Hz       1680x945@2@d=4@0Hz
          3008x1692@d=8@0Hz        3008x1692@d=4@0Hz       1504x846@2@d=8@0Hz       1504x846@2@d=4@0Hz
          2560x1600@d=8@0Hz        2560x1600@d=4@0Hz       1280x800@2@d=8@0Hz       1280x800@2@d=4@0Hz
          2560x1440@d=8@0Hz        2560x1440@d=4@0Hz       1280x720@2@d=8@0Hz       1280x720@2@d=4@0Hz
          2304x1296@d=8@0Hz        2304x1296@d=4@0Hz       1152x648@2@d=8@0Hz       1152x648@2@d=4@0Hz
          2048x1152@d=8@0Hz        2048x1152@d=4@0Hz       1024x576@2@d=8@0Hz       1024x576@2@d=4@0Hz
          1920x1200@d=8@0Hz        1920x1200@d=4@0Hz        960x600@2@d=8@0Hz        960x600@2@d=4@0Hz
          1920x1080@d=8@0Hz        1920x1080@d=8@0Hz        1920x1080@d=4@0Hz        1920x1080@d=4@0Hz        960x540@2@d=8@0Hz        960x540@2@d=8@0Hz        960x540@2@d=4@0Hz        960x540@2@d=4@0Hz
          1680x1050@d=8@0Hz        1680x1050@d=4@0Hz        840x525@2@d=8@0Hz        840x525@2@d=4@0Hz
           1680x944@d=8@0Hz         1680x944@d=4@0Hz        840x472@2@d=8@0Hz        840x472@2@d=4@0Hz
           1440x900@d=8@0Hz         1440x900@d=4@0Hz        720x450@2@d=8@0Hz        720x450@2@d=4@0Hz
           1280x800@d=8@0Hz         1280x800@d=4@0Hz
           1280x720@d=8@0Hz         1280x720@d=4@0Hz
           1152x648@d=8@0Hz         1152x648@d=4@0Hz
           1024x768@d=8@0Hz         1024x768@d=4@0Hz
            800x600@d=8@0Hz          800x600@d=4@0Hz
            640x480@d=8@0Hz          640x480@d=4@0Hz
  
PTB-DEBUG:PsychOSFixupFramebufferFormatForTiming: screenId 0 already in suitable mode for 8 bpc - Nothing to do.
PTB-INFO: Current backbuffer scaling src size 0 x 0 versus estimated display native / actual backbuffer size 4096 x 2304.
PTB-INFO: Screen 0 - Display unit 0x2, vendorId 0x610, modelId 0xa032, width 479 mm.
PTB-INFO: Screen 0 - Apple iMac16,2 builtin display of width 479 mm detected. Searching for database match...
PTB-INFO: Screen 0 - Apple iMac16,2 builtin display (479 mm): 4096 x 2304 pixels native resolution from internal LUT.
PTB-INFO: Overriding VBL startline for screen 0 to 2304 scanlines from internal lookup table.
PTB-INFO: Using GLEW version 2.1.0 for automatic detection of OpenGL extensions...
PTB-INFO: Fixed point precision integer framebuffer enabled.
PTB-INFO: System Frame buffer provides 8 bits for red channel.
PTB-INFO: System Frame buffer provides 8 bits for green channel.
PTB-INFO: System Frame buffer provides 8 bits for blue channel.
PTB-INFO: System frame buffer provides 8 bits for alpha channel, but effective alpha bits depends on imaging pipeline setup, if any.


OpenGL-Vendor / renderer / version are: Intel Inc. - Intel(R) Iris(TM) Pro Graphics 6200 - 2.1 INTEL-16.4.5


OpenGL-Extensions are: GL_ARB_color_buffer_float GL_ARB_depth_buffer_float GL_ARB_depth_clamp GL_ARB_depth_texture GL_ARB_draw_buffers GL_ARB_draw_elements_base_vertex GL_ARB_draw_instanced GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_framebuffer_object GL_ARB_framebuffer_sRGB GL_ARB_half_float_pixel GL_ARB_half_float_vertex GL_ARB_instanced_arrays GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_query GL_ARB_pixel_buffer_object GL_ARB_point_parameters GL_ARB_point_sprite GL_ARB_provoking_vertex GL_ARB_seamless_cube_map GL_ARB_shader_objects GL_ARB_shader_texture_lod GL_ARB_shading_language_100 GL_ARB_shadow GL_ARB_sync GL_ARB_texture_border_clamp GL_ARB_texture_compression GL_ARB_texture_compression_rgtc GL_ARB_texture_cube_map GL_ARB_texture_env_add GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_float GL_ARB_texture_mirrored_repeat GL_ARB_texture_non_power_of_two GL_ARB_texture_rectangle GL_ARB_texture_rg GL_ARB_transpose_matrix GL_ARB_vertex_array_bgra GL_ARB_vertex_blend GL_ARB_vertex_buffer_object GL_ARB_vertex_program GL_ARB_vertex_shader GL_ARB_window_pos GL_EXT_abgr GL_EXT_bgra GL_EXT_blend_color GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_clip_volume_hint GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_draw_buffers2 GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXT_framebuffer_multisample_blit_scaled GL_EXT_framebuffer_object GL_EXT_framebuffer_sRGB GL_EXT_geometry_shader4 GL_EXT_gpu_program_parameters GL_EXT_gpu_shader4 GL_EXT_multi_draw_arrays GL_EXT_packed_depth_stencil GL_EXT_packed_float GL_EXT_provoking_vertex GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_specular_color GL_EXT_shadow_funcs GL_EXT_stencil_two_side GL_EXT_stencil_wrap GL_EXT_texture_array GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_s3tc GL_EXT_texture_env_add GL_EXT_texture_filter_anisotropic GL_EXT_texture_integer GL_EXT_texture_lod_bias GL_EXT_texture_rectangle GL_EXT_texture_shared_exponent GL_EXT_texture_sRGB GL_EXT_texture_sRGB_decode GL_EXT_timer_query GL_EXT_transform_feedback GL_EXT_vertex_array_bgra GL_APPLE_aux_depth_stencil GL_APPLE_client_storage GL_APPLE_element_array GL_APPLE_fence GL_APPLE_float_pixels GL_APPLE_flush_buffer_range GL_APPLE_flush_render GL_APPLE_object_purgeable GL_APPLE_packed_pixels GL_APPLE_pixel_buffer GL_APPLE_rgb_422 GL_APPLE_row_bytes GL_APPLE_specular_vector GL_APPLE_texture_range GL_APPLE_transform_hint GL_APPLE_vertex_array_object GL_APPLE_vertex_array_range GL_APPLE_vertex_point_size GL_APPLE_vertex_program_evaluators GL_APPLE_ycbcr_422 GL_ATI_separate_stencil GL_ATI_texture_env_combine3 GL_ATI_texture_float GL_ATI_texture_mirror_once GL_IBM_rasterpos_clip GL_NV_blend_square GL_NV_conditional_render GL_NV_depth_clamp GL_NV_fog_distance GL_NV_light_max_exponent GL_NV_texgen_reflection GL_NV_texture_barrier GL_SGIS_generate_mipmap GL_SGIS_texture_edge_clamp GL_SGIS_texture_lod 

PTB-DEBUG: Not running on Mesa graphics library.
PTB-DEBUG: Interrogating Low-level renderer capabilities for onscreen window with handle 10:
Indicator variables: FBO's 1, ATI_texture_float 1, ARB_texture_float 1, Vendor Intel Inc., Renderer Intel(R) Iris(TM) Pro Graphics 6200.
Indicator variables: maxcolorattachments = 8, maxrectangletexturesize = 16384, maxnativealuinstructions = 16384.
GPU supports UYVY - YCrCb texture formats for optimized handling of video content.
GPU supports non-power-of-two textures.
Basic framebuffer objects with rectangle texture rendertargets supported --> RGBA8 rendertargets with blending.
Framebuffer objects support fast blitting between each other.
Framebuffer objects support anti-aliasing via multisampling.
Framebuffer objects support single-pass multisample resolve blits and image rescaling.
Hardware supports floating point textures of 16bpc and 32bpc float format.
Assuming HD graphics core or later: Hardware supports full 16/32 bit floating point textures, frame buffers, filtering and blending, as well as some 32 bit float shading.
Assuming hardware supports native OpenGL primitive smoothing (points, lines).
Float color value 0.5 -> fixed point reads back as 128 ==> Rounds.
No compiled in support for OpenML OML_sync_control extension.
PTB-DEBUG: Interrogation done.

PTB-INFO: Threshold Settings for successfull video refresh calibration are: maxStdDev = 0.200000 msecs, maxDeviation = 10.000000 %, minSamples = 50, maxDuration = 5.000000 secs.
PTB-DEBUG: Screen 0 [head 0]: vbl_start = 2303  vbl_end = 2369.
PTB-INFO: Screen 0 [head 0]: Applying beamposition corrective offsets: vblbias = 0, vbltotal = 2370.


PTB-DEBUG: Output of all acquired samples of calibration run follows:
PTB-DEBUG: Sample 0: 0.000000
PTB-DEBUG: Sample 1: 0.016465
PTB-DEBUG: Sample 2: 0.016878
PTB-DEBUG: Sample 3: 0.016470
PTB-DEBUG: Sample 4: 0.016666
PTB-DEBUG: Sample 5: 0.016652
PTB-DEBUG: Sample 6: 0.016831
PTB-DEBUG: Sample 7: 0.016512
PTB-DEBUG: Sample 8: 0.016802
PTB-DEBUG: Sample 9: 0.016898
PTB-DEBUG: Sample 10: 0.016435
...
PTB-DEBUG: End of calibration data for this run...

PTB-DEBUG: 12 out of 126 samples confirm use of GPU pageflipping for the swap during refresh calibration.
PTB-WARNING: Pageflipping wasn't used consistently during refresh calibration [12 of 126].
PTB-WARNING: Visual presentation timing is broken on your system and all followup tests and workarounds will likely fail.
PTB-WARNING: On this Apple macOS system you probably don't need to even bother asking anybody for help.
PTB-WARNING: Just upgrade to Linux if you care about trustworthy visual timing and stimulation.



PTB-INFO: OpenGL-Renderer is Intel Inc. :: Intel(R) Iris(TM) Pro Graphics 6200 :: 2.1 INTEL-16.4.5
PTB-INFO: Renderer has 1536 MB of VRAM and a maximum 3072 MB of texture memory.
PTB-INFO: VBL startline = 2304 , VBL Endline = 2369
PTB-INFO: Measured monitor refresh interval from beamposition = 16.672284 ms [59.979783 Hz].
PTB-INFO: Will use beamposition query for accurate Flip time stamping.
PTB-INFO: Measured monitor refresh interval from VBLsync = 16.668032 ms [59.995083 Hz]. (125 valid samples taken, stddev=0.199376 ms.)
PTB-INFO: Small deviations between reported values are normal and no reason to worry.
PTB-INFO: Support for fast OffscreenWindows enabled.
PTB-WARNING: GPU reports that pageflipping isn't used - or under our control - for Screen('Flip')! [pflip_status = 0]
PTB-WARNING: Returned Screen('Flip') timestamps might be wrong! Please fix this now (read 'help SyncTrouble').
PTB-WARNING: GPU reports that pageflipping isn't used - or under our control - for Screen('Flip')! [pflip_status = 1]
PTB-WARNING: Returned Screen('Flip') timestamps might be wrong! Please fix this now (read 'help SyncTrouble').
PTB-WARNING: The most likely cause for this is that some kind of desktop compositor is active and interfering.
PTB-WARNING: GPU reports that pageflipping isn't used - or under our control - for Screen('Flip')! [pflip_status = 1]
PTB-WARNING: Returned Screen('Flip') timestamps might be wrong! Please fix this now (read 'help SyncTrouble').
PTB-WARNING: The most likely cause for this is that some kind of desktop compositor is active and interfering.
PTB-WARNING: GPU reports that pageflipping isn't used - or under our control - for Screen('Flip')! [pflip_status = 1]
PTB-WARNING: Returned Screen('Flip') timestamps might be wrong! Please fix this now (read 'help SyncTrouble').
PTB-WARNING: The most likely cause for this is that some kind of desktop compositor is active and interfering.
PTB-WARNING: GPU reports that pageflipping isn't used - or under our control - for Screen('Flip')! [pflip_status = 1]
PTB-WARNING: Returned Screen('Flip') timestamps might be wrong! Please fix this now (read 'help SyncTrouble').
PTB-WARNING: The most likely cause for this is that some kind of desktop compositor is active and interfering.
PTB-WARNING: GPU reports that pageflipping isn't used - or under our control - for Screen('Flip')! [pflip_status = 1]
PTB-WARNING: Returned Screen('Flip') timestamps might be wrong! Please fix this now (read 'help SyncTrouble').
PTB-WARNING: The most likely cause for this is that some kind of desktop compositor is active and interfering.
The refresh interval reported by the operating system is 16.66667 ms.
PTB-DEBUG: Allocated unicode string: 77.000000 101.000000 97.000000 115.000000 117.000000 114.000000 105.000000 110.000000 103.000000 32.000000 109.000000 111.000000 110.000000 105.000000 116.000000 111.000000 114.000000 32.000000 114.000000 101.000000 102.000000 114.000000 101.000000 115.000000 104.000000 32.000000 105.000000 110.000000 116.000000 101.000000 114.000000 118.000000 97.000000 108.000000 46.000000 46.000000 46.000000 32.000000 84.000000 104.000000 105.000000 115.000000 32.000000 99.000000 97.000000 110.000000 32.000000 116.000000 97.000000 107.000000 101.000000 32.000000 117.000000 112.000000 32.000000 116.000000 111.000000 32.000000 50.000000 48.000000 32.000000 115.000000 101.000000 99.000000 111.000000 110.000000 100.000000 115.000000 46.000000 46.000000 46.000000 
CGRect: x 1.781250 , y 0.035156, w 738.726562, h 22.523438
Measured refresh interval, as reported by "GetFlipInterval" is 16.66803 ms. (nsamples = 0, stddev = 0.00000 ms)
PTB-WARNING: GPU reports that pageflipping isn't used - or under our control - for Screen('Flip')! [pflip_status = 1]
PTB-WARNING: Returned Screen('Flip') timestamps might be wrong! Please fix this now (read 'help SyncTrouble').
PTB-WARNING: The most likely cause for this is that some kind of desktop compositor is active and interfering.
PTB-WARNING: GPU reports that pageflipping isn't used - or under our control - for Screen('Flip')! [pflip_status = 1]
PTB-WARNING: Returned Screen('Flip') timestamps might be wrong! Please fix this now (read 'help SyncTrouble').
PTB-WARNING: The most likely cause for this is that some kind of desktop compositor is active and interfering.
PTB-WARNING: GPU reports that pageflipping isn't used - or under our control - for Screen('Flip')! [pflip_status = 1]
PTB-WARNING: Returned Screen('Flip') timestamps might be wrong! Please fix this now (read 'help SyncTrouble').
PTB-WARNING: The most likely cause for this is that some kind of desktop compositor is active and interfering.
............................repeats 600 times

ans =

    9.0000

PTB-DEBUG: In ScreenCloseAllWindows(): Destroying window 0
Hookchain 'CloseOnscreenWindowPostGLShutdown' : Slot 0: Id='Shutdown window callback into PsychJavaSwingCleanup().' : Runtime-Function : Evalstring= PsychJavaSwingCleanup;
PTB-DEBUG: Display screen [0]:
PTB-DEBUG: (now: 2048x1152@2@d=4@0Hz)
PTB-DEBUG: Allowed modes:
          6720x3780@d=8@0Hz        6720x3780@d=4@0Hz      3360x1890@2@d=8@0Hz      3360x1890@2@d=4@0Hz
          6400x3600@d=8@0Hz        6400x3600@d=4@0Hz      3200x1800@2@d=8@0Hz      3200x1800@2@d=4@0Hz
          6016x3384@d=8@0Hz        6016x3384@d=4@0Hz      3008x1692@2@d=8@0Hz      3008x1692@2@d=4@0Hz
          5120x2880@d=8@0Hz        5120x2880@d=4@0Hz      2560x1440@2@d=8@0Hz      2560x1440@2@d=4@0Hz
          4608x2592@d=8@0Hz        4608x2592@d=4@0Hz      2304x1296@2@d=8@0Hz      2304x1296@2@d=4@0Hz
          4096x2304@d=8@0Hz        4096x2304@d=4@0Hz      2048x1152@2@d=8@0Hz      2048x1152@2@d=4@0Hz
          3840x2160@d=8@0Hz        3840x2160@d=4@0Hz      1920x1080@2@d=8@0Hz      1920x1080@2@d=4@0Hz
          3360x1890@d=8@0Hz        3360x1890@d=4@0Hz       1680x945@2@d=8@0Hz       1680x945@2@d=4@0Hz
          3008x1692@d=8@0Hz        3008x1692@d=4@0Hz       1504x846@2@d=8@0Hz       1504x846@2@d=4@0Hz
          2560x1600@d=8@0Hz        2560x1600@d=4@0Hz       1280x800@2@d=8@0Hz       1280x800@2@d=4@0Hz
          2560x1440@d=8@0Hz        2560x1440@d=4@0Hz       1280x720@2@d=8@0Hz       1280x720@2@d=4@0Hz
          2304x1296@d=8@0Hz        2304x1296@d=4@0Hz       1152x648@2@d=8@0Hz       1152x648@2@d=4@0Hz
          2048x1152@d=8@0Hz        2048x1152@d=4@0Hz       1024x576@2@d=8@0Hz       1024x576@2@d=4@0Hz
          1920x1200@d=8@0Hz        1920x1200@d=4@0Hz        960x600@2@d=8@0Hz        960x600@2@d=4@0Hz
          1920x1080@d=8@0Hz        1920x1080@d=8@0Hz        1920x1080@d=4@0Hz        1920x1080@d=4@0Hz        960x540@2@d=8@0Hz        960x540@2@d=8@0Hz        960x540@2@d=4@0Hz        960x540@2@d=4@0Hz
          1680x1050@d=8@0Hz        1680x1050@d=4@0Hz        840x525@2@d=8@0Hz        840x525@2@d=4@0Hz
           1680x944@d=8@0Hz         1680x944@d=4@0Hz        840x472@2@d=8@0Hz        840x472@2@d=4@0Hz
           1440x900@d=8@0Hz         1440x900@d=4@0Hz        720x450@2@d=8@0Hz        720x450@2@d=4@0Hz
           1280x800@d=8@0Hz         1280x800@d=4@0Hz
           1280x720@d=8@0Hz         1280x720@d=4@0Hz
           1152x648@d=8@0Hz         1152x648@d=4@0Hz
           1024x768@d=8@0Hz         1024x768@d=4@0Hz
            800x600@d=8@0Hz          800x600@d=4@0Hz
            640x480@d=8@0Hz          640x480@d=4@0Hz
  
PTB-DEBUG:PsychOSFixupFramebufferFormatForTiming: Called on screenId 0 with fix disable request while fix is already disabled. No-Op.
PTB missed 0 out of 600 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...

Just out of curiosity I tried it with Vulkan, to see this basically blocked MATLAB for several minutes.

>> VBLSyncTest([], [], [], [], [], [], [], [], true, 0)

ans =

     0

PsychVulkanCore-INFO: Vulkan instance (version 1.2.182) created.
PsychVulkan-INFO: Onscreen window at rect [0, 0, 2048, 1152] is aligned with fullscreen exclusive output for screenId 0.


PTB-INFO: This is Psychtoolbox-3 for Apple OS X, under Matlab 64-Bit (Version 3.0.17 - Build date: Apr 18 2021).
PTB-INFO: OS support status: OSX version 11.0 is not yet tested or officially supported at all for this Psychtoolbox release.
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 priority support, community membership and commercial services, please type
PTB-INFO: 'PsychPaidSupportAndServices'.

PTB-INFO: External display method is in use for this window. Running short and lenient timing tests only.


PTB-INFO: OpenGL-Renderer is Intel Inc. :: Intel(R) Iris(TM) Pro Graphics 6200 :: 2.1 INTEL-16.4.5
PTB-INFO: Renderer has 1536 MB of VRAM and a maximum 3072 MB of texture memory.
PTB-INFO: VBL startline = 2304 , VBL Endline = -1
PTB-INFO: Beamposition queries unsupported or defective on this system. Screen('Flip') timestamping will
PTB-INFO: fully rely on mechanisms in the external display backend, with unknown precision and reliability.
PTB-INFO: Measured monitor refresh interval from VBLsync = 0.000000 ms [inf Hz]. (0 valid samples taken, stddev=0.000000 ms.)
PTB-INFO: Small deviations between reported values are normal and no reason to worry.
PTB-INFO: All display tests and calibrations disabled. Assuming a refresh interval of 60.000000 Hz. Timing will be inaccurate!
PTB-INFO: Psychtoolbox imaging pipeline starting up for window with requested imagingmode 3146753 ...
PTB-INFO: Will use 8 bits per color component framebuffer for stimulus drawing.
PTB-INFO: Will use 8 bits per color component framebuffer for stimulus post-processing (if any).
PTB-INFO: No image processing needed. Enabling zero-copy redirected output mode.
PTB-INFO: Using external textures as sinks for redirected output mode.
PsychVulkan-INFO: OpenGL implementation does not support OpenGL-Vulkan interop semaphores. Enabling operation without semaphores on gpu 1.
PsychVulkan-INFO: 8 bpc linear precision framebuffer will be used.
PsychVulkan-DEBUG: Delta between Vulkan and reference timestamps is -3457.929000 usecs.
PsychVulkanCore-ERROR: PsychPresent(1): fpGetPastPresentationTimingGOOGLE failed to retrieve timestamp! Timed out.
PsychVulkanCore-ERROR: 'Present' operation failed for some reason! Trying to keep going, brace for impact!
PsychVulkanCore-ERROR: PsychPresent(1): fpGetPastPresentationTimingGOOGLE failed to retrieve timestamp! Timed out.
PsychVulkanCore-ERROR: 'Present' operation failed for some reason! Trying to keep going, brace for impact!
PsychVulkanCore-ERROR: PsychPresent(1): fpGetPastPresentationTimingGOOGLE failed to retrieve timestamp! Timed out.
PsychVulkanCore-ERROR: 'Present' operation failed for some reason! Trying to keep going, brace for impact!
PsychVulkanCore-ERROR: PsychPresent(1): fpGetPastPresentationTimingGOOGLE failed to retrieve timestamp! Timed out.
PsychVulkanCore-ERROR: 'Present' operation failed for some reason! Trying to keep going, brace for impact!
PsychVulkanCore-ERROR: PsychPresent(1): fpGetPastPresentationTimingGOOGLE failed to retrieve timestamp! Timed out.
PsychVulkanCore-ERROR: 'Present' operation failed for some reason! Trying to keep going, brace for impact!
The refresh interval reported by the operating system is 16.66667 ms.
Measured refresh interval, as reported by "GetFlipInterval" is 16.66667 ms. (nsamples = 1, stddev = 0.00000 ms)
PsychVulkanCore-ERROR: PsychPresent(1): fpGetPastPresentationTimingGOOGLE failed to retrieve timestamp! Timed out.
PsychVulkanCore-ERROR: 'Present' operation failed for some reason! Trying to keep going, brace for impact!
PsychVulkanCore-ERROR: PsychPresent(1): fpGetPastPresentationTimingGOOGLE failed to retrieve timestamp! Timed out.
PsychVulkanCore-ERROR: 'Present' operation failed for some reason! Trying to keep going, brace for impact!
.....

that happens for each of the 600 flips and it takes minutes for it to finish…

Good. My assumption is that using the kernel driver on Intel gfx is probably ok, given that i never observed or heard of a malfunction, and now Apple probably won’t ever release a Mac with a new Intel chip again.

Yes, those are catastrophically bad results, the kernel driver based diagnostic is certainly right with that. This despite the fact that a iMac specific workaround was correctly enabled. Seems the desktop compositor is running an badly interfering, causing utterly broken and useless timing. One thing you can try is trying all different resolution settings and rerun the test after a clear all each time. Maybe one of them works. I think i had some of this on my MBP with Retina panel.

Then if you find one, you could try that one with the Vulkan tests as well.

Did you use some SkipSyncTests 2 setting or PsychDebugWindowConfiguration or similar? This should do better, ie. beamposition timestamping should still work.

This first timestamp looks ok’ish, the 3.4 msecs error is because beamposition timestamping got disabled, otherwise one would hope for a slightly lower error. This may mean that whoever implemented this for Intel graphics at Apple now finally masters the fine primary school art of basic multiplication, as timestamps on Intel graphics are no longer off by a factor of 1000x – being able to multiply is a beautiful and underrated skill for a software engineer…

And then it turns into trash even worse than on macOS 10.15.7 Catalina…

Can you rerun after a clear all but with PsychVulkan('Verbosity', 8)?

Another thing one can try is commenting out line 592 of PsychVulkan.m, ie. this one:
flags = mor(flags, 2);
On Catalina this would make things worse, but who knows, and it can’t get worse on your system anyway. Running PerceptualVBLSyncTest with the usevulkan 1 flag is also interesting. On Catalina it can run at at most 30 fps on a 60 Hz display, making it a non-starter from the beginning.

The question here is basically if all the Vulkan brokeness is caused by the same problem that causes the OpenGL brokeness and simply finding the magic right screen resolution will fix both standard and Vulkan - or at least fix standard and make Vulkan less worse than on Catalina, or if both are broken in different but catastrophic ways and that machine is utterly unusable under macOS 11.

Edit: I should also clarify that when we talk about Vulkan on macOS we actually talk about Apple’s proprietary Metal api and implementation, as Vulkan on macOS is just a very thin and simple Vulkan to Metal translator. Any bug we find with our Vulkan backend on macOS would also apply to any other timing or control sensitive Metal graphics application on macOS. Given that these Metal api’s are supposed to be easy to use, with no strings attached, we already know from these results that macOS 11’s Metal implementation is broken, because by definition, this should work with any display configuration and type, any video settings etc. in all conceivable cases, and it clearly doesn’t. So the question is just “how badly broken is it?” and “is any of this salvageable?”

-mario

@Ian-Max-Andolina Any updates about this?

I can’t find a resolution that works (ResolutionTest for the list, then using e.g. SetResolution(0,4096,2304). My iMac is 4096 × 2304 native with HiDPI “optimal” at 2048 × 1152 and I tried both plus even divisions downwards. I can’t get PTB to show the whole screen properly at all on this machine, I always only see the bottom left quarter. I tried toggling PsychImaging('AddTask', 'General', 'UseRetinaResolution'); in VBLSyncTest.m but it makes no difference, and other fullscreen demos have the same issue. OK, installing SwitchResX and now I can enable “true” 4096 × 2304 non-HiDPI and finally I can see the screen as is, and now BeamPosition timing works:

>> clear all
>> Screen('Preference', 'SkipSyncTests', 0)
PTB-INFO: Connection to Psychtoolbox kernel support driver instance #0 (Revision 1) established.

ans =

     0

>> VBLSyncTest(30)

ans =

     0



PTB-INFO: This is Psychtoolbox-3 for Apple OS X, under Matlab 64-Bit (Version 3.0.17 - Build date: Apr 18 2021).
PTB-INFO: OS support status: OSX version 11.0 is not yet tested or officially supported at all for this Psychtoolbox release.
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 priority support, community membership and commercial services, please type
PTB-INFO: 'PsychPaidSupportAndServices'.



PTB-INFO: OpenGL-Renderer is Intel Inc. :: Intel(R) Iris(TM) Pro Graphics 6200 :: 2.1 INTEL-16.5.2
PTB-INFO: Renderer has 1536 MB of VRAM and a maximum 3072 MB of texture memory.
PTB-INFO: VBL startline = 2304 , VBL Endline = 2369
PTB-INFO: Measured monitor refresh interval from beamposition = 16.672262 ms [59.979863 Hz].
PTB-INFO: Will use beamposition query for accurate Flip time stamping.
PTB-INFO: Measured monitor refresh interval from VBLsync = 16.671008 ms [59.984374 Hz]. (50 valid samples taken, stddev=0.051749 ms.)
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.

Measured refresh interval, as reported by "GetFlipInterval" is 16.67101 ms. (nsamples = 0, stddev = 0.00000 ms)

PTB missed 1 out of 30 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...

OSXCompositorIdiocyTest() works fine too; using SwitchRexX is the only way to get this.

I didn’t change this in the original tests, are you suggesting I enable it or are you suggesting it should have worked if I hadn’t enabled it? Anyway, with native resolution BeamPosition timing works, so testing with Vulkan (limiting frame number as it takes too long otherwise):

>> PsychVulkan('Verbosity', 8)

ans =

     3

>> VBLSyncTest(30, [], [], [], [], [], [], [], true, 0)

ans =

     0

PsychVulkanCore-INFO: At startup there are 12 Vulkan instance extensions available.
PsychVulkanCore-INFO: Found and enabled 0. instance extension 'VK_KHR_surface'.
PsychVulkanCore-INFO: Found and enabled 1. instance extension 'VK_KHR_get_surface_capabilities2'.
PsychVulkanCore-INFO: Found and enabled 2. instance extension 'VK_KHR_external_memory_capabilities'.
PsychVulkanCore-INFO: Found and enabled 3. instance extension 'VK_KHR_external_semaphore_capabilities'.
PsychVulkanCore-INFO: Found and enabled 4. instance extension 'VK_KHR_get_physical_device_properties2'.
PsychVulkanCore-INFO: Found and enabled 5. instance extension 'VK_EXT_debug_utils'.
PsychVulkanCore-INFO: Found and enabled 6. instance extension 'VK_EXT_metal_surface'.
PsychVulkanCore-INFO: Found and enabled 7. instance extension 'VK_EXT_swapchain_colorspace'.
PsychVulkanCore-INFO: Vulkan instance (version 1.2.182) created.
PsychVulkanCore-INFO: At startup there are 1 Vulkan devices available.
PsychVulkanCore-INFO: GPU 0: 'Intel(R) Iris(TM) Pro Graphics 6200' : Vulkan 1.1.182 : VendorId 0x8086 : DeviceId 0x1622 : Integrated graphics chip.
PsychVulkanCore-INFO: GPU 0: Driver 'MoltenVK' [1.1.4] : Driver version 0x2778
PsychVulkanCore-INFO: GPU 0: Probing 53 device extensions against required set.
PsychVulkanCore-INFO: Found and enabled 0. device extension 'VK_KHR_swapchain'.
PsychVulkanCore-INFO: Found and enabled 1. device extension 'VK_KHR_external_memory'.
PsychVulkanCore-INFO: Found and enabled 2. device extension 'VK_KHR_external_semaphore'.
PsychVulkanCore-INFO: Found and enabled 3. device extension 'VK_KHR_maintenance1'.
PsychVulkanCore-INFO: Found and enabled 4. device extension 'VK_KHR_portability_subset'.
PsychVulkanCore-INFO: Found and enabled 5. device extension 'VK_EXT_hdr_metadata'.
PsychVulkanCore-INFO: Device extension 'VK_AMD_display_native_hdr' is not supported.
PsychVulkanCore-INFO: Found and enabled 6. device extension 'VK_GOOGLE_display_timing'.
PsychVulkanCore-INFO: GPU 0: ACCEPTED AND ACTIVATED! Count now 1
PsychVulkan-INFO: Onscreen window at rect [0, 0, 4096, 2304] is aligned with fullscreen exclusive output for screenId 0.


PTB-INFO: This is Psychtoolbox-3 for Apple OS X, under Matlab 64-Bit (Version 3.0.17 - Build date: Apr 18 2021).
PTB-INFO: OS support status: OSX version 11.0 is not yet tested or officially supported at all for this Psychtoolbox release.
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 priority support, community membership and commercial services, please type
PTB-INFO: 'PsychPaidSupportAndServices'.

PTB-INFO: External display method is in use for this window. Running short and lenient timing tests only.
PTB-WARNING: Pageflipping wasn't used consistently during refresh calibration [1 of 180].
PTB-WARNING: Visual presentation timing is broken on your system and all followup tests and workarounds will likely fail.
PTB-WARNING: On this Apple macOS system you probably don't need to even bother asking anybody for help.
PTB-WARNING: Just upgrade to Linux if you care about trustworthy visual timing and stimulation.



PTB-INFO: OpenGL-Renderer is Intel Inc. :: Intel(R) Iris(TM) Pro Graphics 6200 :: 2.1 INTEL-16.5.2
PTB-INFO: Renderer has 1536 MB of VRAM and a maximum 3072 MB of texture memory.
PTB-INFO: VBL startline = 2304 , VBL Endline = 2369
PTB-INFO: Measured monitor refresh interval from beamposition = 16.672280 ms [59.979799 Hz].
PTB-INFO: Will use beamposition query for accurate Flip time stamping.
PTB-INFO: Measured monitor refresh interval from VBLsync = 16.591560 ms [60.271609 Hz]. (152 valid samples taken, stddev=1.613154 ms.)
PTB-INFO: Small deviations between reported values are normal and no reason to worry.
PTB-INFO: Psychtoolbox imaging pipeline starting up for window with requested imagingmode 3146753 ...
PTB-INFO: Will use 8 bits per color component framebuffer for stimulus drawing.
PTB-INFO: Will use 8 bits per color component framebuffer for stimulus post-processing (if any).
PTB-INFO: No image processing needed. Enabling zero-copy redirected output mode.
PTB-INFO: Using external textures as sinks for redirected output mode.
PsychVulkanCore-INFO: gpuIndex 1 [Intel(R) Iris(TM) Pro Graphics 6200] manually selected as gpu for presenting to the target surface.
PsychVulkanCore-INFO: For gpu [Intel(R) Iris(TM) Pro Graphics 6200] created a window Metal display surface [0x60000b3dc370] for display window 1
PsychVulkanCore-INFO: Probing if gpu 'Intel(R) Iris(TM) Pro Graphics 6200' supports presenting to the target surface: Yes
Surface minImageCount 2 - maxImageCount 3
Surface currentExtent 4096 x 2304 pixels with up to 1 view layers
Display native HDR properties as queried from monitor:
Display Supports control of HDR local dimming: No
Display Gamut  R: [0.000000, 0.000000]
Display Gamut  G: [0.000000, 0.000000]
Display Gamut  B: [0.000000, 0.000000]
Display Gamut WP: [0.000000, 0.000000]
Display minLuminance: 0.000000 nits
Display maxLuminance: 0.000000 nits
Content maxFrameAverageLightLevel: 0.000000 nits
Content maxContentLightLevel: 0.000000 nits
Surface number of supported surface colorspace + pixelformat combinations: 50
[0] For colorspace VK_COLOR_SPACE_SRGB_NONLINEAR_KHR       - [0] Swapchain format VK_FORMAT_B8G8R8A8_UNORM
[1] For colorspace VK_COLOR_SPACE_SRGB_NONLINEAR_KHR       - [1] Swapchain format VK_FORMAT_B8G8R8A8_SRGB
[2] For colorspace VK_COLOR_SPACE_SRGB_NONLINEAR_KHR       - [2] Swapchain format VK_FORMAT_R16G16B16A16_SFLOAT
[3] For colorspace VK_COLOR_SPACE_SRGB_NONLINEAR_KHR       - [3] Swapchain format VK_FORMAT_A2B10G10R10_UNORM_PACK32
[4] For colorspace VK_COLOR_SPACE_SRGB_NONLINEAR_KHR       - [4] Swapchain format VK_FORMAT_A2R10G10B10_UNORM_PACK32
[5] Swapchain format VK_FORMAT_B8G8R8A8_UNORM
[6] Swapchain format VK_FORMAT_B8G8R8A8_SRGB
[7] Swapchain format VK_FORMAT_R16G16B16A16_SFLOAT
[8] Swapchain format VK_FORMAT_A2B10G10R10_UNORM_PACK32
[9] Swapchain format VK_FORMAT_A2R10G10B10_UNORM_PACK32
[10] Swapchain format VK_FORMAT_B8G8R8A8_UNORM
[11] Swapchain format VK_FORMAT_B8G8R8A8_SRGB
[12] Swapchain format VK_FORMAT_R16G16B16A16_SFLOAT
[13] Swapchain format VK_FORMAT_A2B10G10R10_UNORM_PACK32
[14] Swapchain format VK_FORMAT_A2R10G10B10_UNORM_PACK32
[15] For colorspace VK_COLOR_SPACE_BT709_NONLINEAR_EXT      - [15] Swapchain format VK_FORMAT_B8G8R8A8_UNORM
[16] For colorspace VK_COLOR_SPACE_BT709_NONLINEAR_EXT      - [16] Swapchain format VK_FORMAT_B8G8R8A8_SRGB
[17] For colorspace VK_COLOR_SPACE_BT709_NONLINEAR_EXT      - [17] Swapchain format VK_FORMAT_R16G16B16A16_SFLOAT
[18] For colorspace VK_COLOR_SPACE_BT709_NONLINEAR_EXT      - [18] Swapchain format VK_FORMAT_A2B10G10R10_UNORM_PACK32
[19] For colorspace VK_COLOR_SPACE_BT709_NONLINEAR_EXT      - [19] Swapchain format VK_FORMAT_A2R10G10B10_UNORM_PACK32
[20] Swapchain format VK_FORMAT_B8G8R8A8_UNORM
[21] Swapchain format VK_FORMAT_B8G8R8A8_SRGB
[22] Swapchain format VK_FORMAT_R16G16B16A16_SFLOAT
[23] Swapchain format VK_FORMAT_A2B10G10R10_UNORM_PACK32
[24] Swapchain format VK_FORMAT_A2R10G10B10_UNORM_PACK32
[25] For colorspace VK_COLOR_SPACE_PASS_THROUGH_EXT         - [25] Swapchain format VK_FORMAT_B8G8R8A8_UNORM
[26] For colorspace VK_COLOR_SPACE_PASS_THROUGH_EXT         - [26] Swapchain format VK_FORMAT_B8G8R8A8_SRGB
[27] For colorspace VK_COLOR_SPACE_PASS_THROUGH_EXT         - [27] Swapchain format VK_FORMAT_R16G16B16A16_SFLOAT
[28] For colorspace VK_COLOR_SPACE_PASS_THROUGH_EXT         - [28] Swapchain format VK_FORMAT_A2B10G10R10_UNORM_PACK32
[29] For colorspace VK_COLOR_SPACE_PASS_THROUGH_EXT         - [29] Swapchain format VK_FORMAT_A2R10G10B10_UNORM_PACK32
[30] For colorspace VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT - [30] Swapchain format VK_FORMAT_B8G8R8A8_UNORM
[31] For colorspace VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT - [31] Swapchain format VK_FORMAT_B8G8R8A8_SRGB
[32] For colorspace VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT - [32] Swapchain format VK_FORMAT_R16G16B16A16_SFLOAT
[33] For colorspace VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT - [33] Swapchain format VK_FORMAT_A2B10G10R10_UNORM_PACK32
[34] For colorspace VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT - [34] Swapchain format VK_FORMAT_A2R10G10B10_UNORM_PACK32
[35] Swapchain format VK_FORMAT_B8G8R8A8_UNORM
[36] Swapchain format VK_FORMAT_B8G8R8A8_SRGB
[37] Swapchain format VK_FORMAT_R16G16B16A16_SFLOAT
[38] Swapchain format VK_FORMAT_A2B10G10R10_UNORM_PACK32
[39] Swapchain format VK_FORMAT_A2R10G10B10_UNORM_PACK32
[40] Swapchain format VK_FORMAT_B8G8R8A8_UNORM
[41] Swapchain format VK_FORMAT_B8G8R8A8_SRGB
[42] Swapchain format VK_FORMAT_R16G16B16A16_SFLOAT
[43] Swapchain format VK_FORMAT_A2B10G10R10_UNORM_PACK32
[44] Swapchain format VK_FORMAT_A2R10G10B10_UNORM_PACK32
[45] For colorspace VK_COLOR_SPACE_BT2020_LINEAR_EXT        - [45] Swapchain format VK_FORMAT_B8G8R8A8_UNORM
[46] For colorspace VK_COLOR_SPACE_BT2020_LINEAR_EXT        - [46] Swapchain format VK_FORMAT_B8G8R8A8_SRGB
[47] For colorspace VK_COLOR_SPACE_BT2020_LINEAR_EXT        - [47] Swapchain format VK_FORMAT_R16G16B16A16_SFLOAT
[48] For colorspace VK_COLOR_SPACE_BT2020_LINEAR_EXT        - [48] Swapchain format VK_FORMAT_A2B10G10R10_UNORM_PACK32
[49] For colorspace VK_COLOR_SPACE_BT2020_LINEAR_EXT        - [49] Swapchain format VK_FORMAT_A2R10G10B10_UNORM_PACK32
PsychVulkanCore-INFO: Using 10 bpc unorm [0; 1] range RGB10A2 framebuffer.
PsychVulkanCore-INFO: getMemoryTypeFromProperties(): Testing memoryType index 0 (1) against allowed 5 -  Properties 1 vs. required 1 - OK. Using memoryTypeIndex 0.
PsychVulkanCore-INFO: PsychCreateInteropTexture: Got OpenGL interop texture handle 2 [IOSurface 0x60000d79dbd0].
PsychVulkanCore-INFO: PsychCreateInteropTexture: Success for window 1.
PsychVulkanCore-INFO: PsychRecordCopyCommandBuffer(): Swapchainbuffer 0: Using vkCmdBlitImage() blit for interop -> swapchain transfer.
PsychVulkanCore-INFO: PsychRecordCopyCommandBuffer(): Swapchainbuffer 1: Using vkCmdBlitImage() blit for interop -> swapchain transfer.
PsychVulkanCore-DEBUG: PsychGetNextSwapChainTargetBuffer(1): frameIndex 0 - Next swapChain backBuffer image with index 0 acquired.
PsychVulkanCore-INFO: Vulkan reports nominal refresh rate 60.000002 Hz for display associated with window 1.
PsychVulkan-INFO: OpenGL implementation does not support OpenGL-Vulkan interop semaphores. Enabling operation without semaphores on gpu 1.
PsychVulkan-INFO: 8 bpc linear precision framebuffer will be used.
PsychVulkan-INFO: Using tiled rendering layout framebuffer for interop rendering.
PsychVulkanCore-DEBUG: PsychPresent(1): Queuing frame 0 with VkPresentTimesInfoGOOGLE for present at time >= tWhen 0.000000 secs.
PsychVulkanCore-DEBUG: PsychPresent(1): frameIndex 0 - swapChain image with index 0 queued for present at tWhen 0.000000 secs.
PsychVulkanCore-DEBUG: PsychGetNextSwapChainTargetBuffer(1): frameIndex 1 - Next swapChain backBuffer image with index 0 acquired.
PsychVulkanCore-DEBUG: PsychPresent(1): fpGetPastPresentationTimingGOOGLE failed to retrieve timestamp for frameIndex 0. Timed out. Carrying on with fallback.
PsychVulkanCore-DEBUG: PsychPresent(1): Present for frameIndex 0 completed: tComplete = 326101.369646 secs.
PsychVulkan-DEBUG: Delta between Vulkan and reference timestamps is 12302.171788 usecs.
PsychVulkanCore-DEBUG: PsychPresent(1): Queuing frame 1 with VkPresentTimesInfoGOOGLE for present at time >= tWhen 0.000000 secs.
PsychVulkanCore-DEBUG: PsychPresent(1): frameIndex 1 - swapChain image with index 0 queued for present at tWhen 0.000000 secs.
PsychVulkanCore-DEBUG: PsychGetNextSwapChainTargetBuffer(1): frameIndex 2 - Next swapChain backBuffer image with index 1 acquired.
PsychVulkanCore-ERROR: PsychPresent(1): fpGetPastPresentationTimingGOOGLE failed to retrieve timestamp! Timed out.
PsychVulkanCore-ERROR: 'Present' operation failed for some reason! Trying to keep going, brace for impact!

...

... 

PsychVulkanCore-INFO: Closing Vulkan window 1.
PsychVulkanCore-INFO: Vulkan window 1: swapChain is gone. Releasing display.
PsychVulkanCore-INFO: Vulkan window 1: Display or Window is gone. Releasing surface.
PsychVulkanCore-INFO: Vulkan window 1: Window successfully closed.
PTB missed 29 out of 30 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...

Time delta between successive flips:

If I comment out line 592:

>> clear all
PsychVulkanCore-INFO: Vulkan instance destruction and driver shutdown complete.
>> Screen('Preference', 'SkipSyncTests', 0)
PTB-INFO: Connection to Psychtoolbox kernel support driver instance #0 (Revision 1) established.

ans =

     0

>> PsychVulkan('Verbosity', 8)

ans =

     3

>> VBLSyncTest(30, [], [], [], [], [], [], [], true, 0)

ans =

     0

PsychVulkanCore-INFO: At startup there are 12 Vulkan instance extensions available.
PsychVulkanCore-INFO: Found and enabled 0. instance extension 'VK_KHR_surface'.
PsychVulkanCore-INFO: Found and enabled 1. instance extension 'VK_KHR_get_surface_capabilities2'.
PsychVulkanCore-INFO: Found and enabled 2. instance extension 'VK_KHR_external_memory_capabilities'.
PsychVulkanCore-INFO: Found and enabled 3. instance extension 'VK_KHR_external_semaphore_capabilities'.
PsychVulkanCore-INFO: Found and enabled 4. instance extension 'VK_KHR_get_physical_device_properties2'.
PsychVulkanCore-INFO: Found and enabled 5. instance extension 'VK_EXT_debug_utils'.
PsychVulkanCore-INFO: Found and enabled 6. instance extension 'VK_EXT_metal_surface'.
PsychVulkanCore-INFO: Found and enabled 7. instance extension 'VK_EXT_swapchain_colorspace'.
PsychVulkanCore-INFO: Vulkan instance (version 1.2.182) created.
PsychVulkanCore-INFO: At startup there are 1 Vulkan devices available.
PsychVulkanCore-INFO: GPU 0: 'Intel(R) Iris(TM) Pro Graphics 6200' : Vulkan 1.1.182 : VendorId 0x8086 : DeviceId 0x1622 : Integrated graphics chip.
PsychVulkanCore-INFO: GPU 0: Driver 'MoltenVK' [1.1.4] : Driver version 0x2778
PsychVulkanCore-INFO: GPU 0: Probing 53 device extensions against required set.
PsychVulkanCore-INFO: Found and enabled 0. device extension 'VK_KHR_swapchain'.
PsychVulkanCore-INFO: Found and enabled 1. device extension 'VK_KHR_external_memory'.
PsychVulkanCore-INFO: Found and enabled 2. device extension 'VK_KHR_external_semaphore'.
PsychVulkanCore-INFO: Found and enabled 3. device extension 'VK_KHR_maintenance1'.
PsychVulkanCore-INFO: Found and enabled 4. device extension 'VK_KHR_portability_subset'.
PsychVulkanCore-INFO: Found and enabled 5. device extension 'VK_EXT_hdr_metadata'.
PsychVulkanCore-INFO: Device extension 'VK_AMD_display_native_hdr' is not supported.
PsychVulkanCore-INFO: Found and enabled 6. device extension 'VK_GOOGLE_display_timing'.
PsychVulkanCore-INFO: GPU 0: ACCEPTED AND ACTIVATED! Count now 1
PsychVulkan-INFO: Onscreen window at rect [0, 0, 4096, 2304] is aligned with fullscreen exclusive output for screenId 0.


PTB-INFO: This is Psychtoolbox-3 for Apple OS X, under Matlab 64-Bit (Version 3.0.17 - Build date: Apr 18 2021).
PTB-INFO: OS support status: OSX version 11.0 is not yet tested or officially supported at all for this Psychtoolbox release.
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 priority support, community membership and commercial services, please type
PTB-INFO: 'PsychPaidSupportAndServices'.

PTB-INFO: External display method is in use for this window. Running short and lenient timing tests only.
PTB-WARNING: Pageflipping wasn't used consistently during refresh calibration [1 of 182].
PTB-WARNING: Visual presentation timing is broken on your system and all followup tests and workarounds will likely fail.
PTB-WARNING: On this Apple macOS system you probably don't need to even bother asking anybody for help.
PTB-WARNING: Just upgrade to Linux if you care about trustworthy visual timing and stimulation.

PTB-INFO: OpenGL-Renderer is Intel Inc. :: Intel(R) Iris(TM) Pro Graphics 6200 :: 2.1 INTEL-16.5.2
PTB-INFO: Renderer has 1536 MB of VRAM and a maximum 3072 MB of texture memory.
PTB-INFO: VBL startline = 2304 , VBL Endline = 2369
PTB-INFO: Measured monitor refresh interval from beamposition = 16.672244 ms [59.979929 Hz].
PTB-INFO: Will use beamposition query for accurate Flip time stamping.
PTB-INFO: Measured monitor refresh interval from VBLsync = 16.641101 ms [60.092179 Hz]. (173 valid samples taken, stddev=1.254470 ms.)
PTB-INFO: Small deviations between reported values are normal and no reason to worry.
PTB-INFO: Psychtoolbox imaging pipeline starting up for window with requested imagingmode 3146753 ...
PTB-INFO: Will use 8 bits per color component framebuffer for stimulus drawing.
PTB-INFO: Will use 8 bits per color component framebuffer for stimulus post-processing (if any).
PTB-INFO: No image processing needed. Enabling zero-copy redirected output mode.
PTB-INFO: Using external textures as sinks for redirected output mode.
PsychVulkanCore-INFO: gpuIndex 1 [Intel(R) Iris(TM) Pro Graphics 6200] manually selected as gpu for presenting to the target surface.
PsychVulkanCore-INFO: For gpu [Intel(R) Iris(TM) Pro Graphics 6200] created a window Metal display surface [0x60000b2f30c0] for display window 1
PsychVulkanCore-INFO: Probing if gpu 'Intel(R) Iris(TM) Pro Graphics 6200' supports presenting to the target surface: Yes
Surface minImageCount 2 - maxImageCount 3
Surface currentExtent 4096 x 2304 pixels with up to 1 view layers
Display native HDR properties as queried from monitor:
Display Supports control of HDR local dimming: No
Display Gamut  R: [0.000000, 0.000000]
Display Gamut  G: [0.000000, 0.000000]
Display Gamut  B: [0.000000, 0.000000]
Display Gamut WP: [0.000000, 0.000000]
Display minLuminance: 0.000000 nits
Display maxLuminance: 0.000000 nits
Content maxFrameAverageLightLevel: 0.000000 nits
Content maxContentLightLevel: 0.000000 nits
Surface number of supported surface colorspace + pixelformat combinations: 50
[0] For colorspace VK_COLOR_SPACE_SRGB_NONLINEAR_KHR       - [0] Swapchain format VK_FORMAT_B8G8R8A8_UNORM
[1] For colorspace VK_COLOR_SPACE_SRGB_NONLINEAR_KHR       - [1] Swapchain format VK_FORMAT_B8G8R8A8_SRGB
[2] For colorspace VK_COLOR_SPACE_SRGB_NONLINEAR_KHR       - [2] Swapchain format VK_FORMAT_R16G16B16A16_SFLOAT
[3] For colorspace VK_COLOR_SPACE_SRGB_NONLINEAR_KHR       - [3] Swapchain format VK_FORMAT_A2B10G10R10_UNORM_PACK32
[4] For colorspace VK_COLOR_SPACE_SRGB_NONLINEAR_KHR       - [4] Swapchain format VK_FORMAT_A2R10G10B10_UNORM_PACK32
[5] Swapchain format VK_FORMAT_B8G8R8A8_UNORM
[6] Swapchain format VK_FORMAT_B8G8R8A8_SRGB
[7] Swapchain format VK_FORMAT_R16G16B16A16_SFLOAT
[8] Swapchain format VK_FORMAT_A2B10G10R10_UNORM_PACK32
[9] Swapchain format VK_FORMAT_A2R10G10B10_UNORM_PACK32
[10] Swapchain format VK_FORMAT_B8G8R8A8_UNORM
[11] Swapchain format VK_FORMAT_B8G8R8A8_SRGB
[12] Swapchain format VK_FORMAT_R16G16B16A16_SFLOAT
[13] Swapchain format VK_FORMAT_A2B10G10R10_UNORM_PACK32
[14] Swapchain format VK_FORMAT_A2R10G10B10_UNORM_PACK32
[15] For colorspace VK_COLOR_SPACE_BT709_NONLINEAR_EXT      - [15] Swapchain format VK_FORMAT_B8G8R8A8_UNORM
[16] For colorspace VK_COLOR_SPACE_BT709_NONLINEAR_EXT      - [16] Swapchain format VK_FORMAT_B8G8R8A8_SRGB
[17] For colorspace VK_COLOR_SPACE_BT709_NONLINEAR_EXT      - [17] Swapchain format VK_FORMAT_R16G16B16A16_SFLOAT
[18] For colorspace VK_COLOR_SPACE_BT709_NONLINEAR_EXT      - [18] Swapchain format VK_FORMAT_A2B10G10R10_UNORM_PACK32
[19] For colorspace VK_COLOR_SPACE_BT709_NONLINEAR_EXT      - [19] Swapchain format VK_FORMAT_A2R10G10B10_UNORM_PACK32
[20] Swapchain format VK_FORMAT_B8G8R8A8_UNORM
[21] Swapchain format VK_FORMAT_B8G8R8A8_SRGB
[22] Swapchain format VK_FORMAT_R16G16B16A16_SFLOAT
[23] Swapchain format VK_FORMAT_A2B10G10R10_UNORM_PACK32
[24] Swapchain format VK_FORMAT_A2R10G10B10_UNORM_PACK32
[25] For colorspace VK_COLOR_SPACE_PASS_THROUGH_EXT         - [25] Swapchain format VK_FORMAT_B8G8R8A8_UNORM
[26] For colorspace VK_COLOR_SPACE_PASS_THROUGH_EXT         - [26] Swapchain format VK_FORMAT_B8G8R8A8_SRGB
[27] For colorspace VK_COLOR_SPACE_PASS_THROUGH_EXT         - [27] Swapchain format VK_FORMAT_R16G16B16A16_SFLOAT
[28] For colorspace VK_COLOR_SPACE_PASS_THROUGH_EXT         - [28] Swapchain format VK_FORMAT_A2B10G10R10_UNORM_PACK32
[29] For colorspace VK_COLOR_SPACE_PASS_THROUGH_EXT         - [29] Swapchain format VK_FORMAT_A2R10G10B10_UNORM_PACK32
[30] For colorspace VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT - [30] Swapchain format VK_FORMAT_B8G8R8A8_UNORM
[31] For colorspace VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT - [31] Swapchain format VK_FORMAT_B8G8R8A8_SRGB
[32] For colorspace VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT - [32] Swapchain format VK_FORMAT_R16G16B16A16_SFLOAT
[33] For colorspace VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT - [33] Swapchain format VK_FORMAT_A2B10G10R10_UNORM_PACK32
[34] For colorspace VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT - [34] Swapchain format VK_FORMAT_A2R10G10B10_UNORM_PACK32
[35] Swapchain format VK_FORMAT_B8G8R8A8_UNORM
[36] Swapchain format VK_FORMAT_B8G8R8A8_SRGB
[37] Swapchain format VK_FORMAT_R16G16B16A16_SFLOAT
[38] Swapchain format VK_FORMAT_A2B10G10R10_UNORM_PACK32
[39] Swapchain format VK_FORMAT_A2R10G10B10_UNORM_PACK32
[40] Swapchain format VK_FORMAT_B8G8R8A8_UNORM
[41] Swapchain format VK_FORMAT_B8G8R8A8_SRGB
[42] Swapchain format VK_FORMAT_R16G16B16A16_SFLOAT
[43] Swapchain format VK_FORMAT_A2B10G10R10_UNORM_PACK32
[44] Swapchain format VK_FORMAT_A2R10G10B10_UNORM_PACK32
[45] For colorspace VK_COLOR_SPACE_BT2020_LINEAR_EXT        - [45] Swapchain format VK_FORMAT_B8G8R8A8_UNORM
[46] For colorspace VK_COLOR_SPACE_BT2020_LINEAR_EXT        - [46] Swapchain format VK_FORMAT_B8G8R8A8_SRGB
[47] For colorspace VK_COLOR_SPACE_BT2020_LINEAR_EXT        - [47] Swapchain format VK_FORMAT_R16G16B16A16_SFLOAT
[48] For colorspace VK_COLOR_SPACE_BT2020_LINEAR_EXT        - [48] Swapchain format VK_FORMAT_A2B10G10R10_UNORM_PACK32
[49] For colorspace VK_COLOR_SPACE_BT2020_LINEAR_EXT        - [49] Swapchain format VK_FORMAT_A2R10G10B10_UNORM_PACK32
PsychVulkanCore-INFO: Using 8 bpc unorm [0; 1] range RGBA8 framebuffer.
PsychVulkanCore-INFO: getMemoryTypeFromProperties(): Testing memoryType index 0 (1) against allowed 5 -  Properties 1 vs. required 1 - OK. Using memoryTypeIndex 0.
PsychVulkanCore-INFO: PsychCreateInteropTexture: Got OpenGL interop texture handle 2 [IOSurface 0x60000d6ca510].
PsychVulkanCore-INFO: PsychCreateInteropTexture: Success for window 1.
PsychVulkanCore-INFO: PsychRecordCopyCommandBuffer(): Swapchainbuffer 0: Using vkCmdBlitImage() blit for interop -> swapchain transfer.
PsychVulkanCore-INFO: PsychRecordCopyCommandBuffer(): Swapchainbuffer 1: Using vkCmdBlitImage() blit for interop -> swapchain transfer.
PsychVulkanCore-DEBUG: PsychGetNextSwapChainTargetBuffer(1): frameIndex 0 - Next swapChain backBuffer image with index 0 acquired.
PsychVulkanCore-INFO: Vulkan reports nominal refresh rate 60.000002 Hz for display associated with window 1.
PsychVulkan-INFO: OpenGL implementation does not support OpenGL-Vulkan interop semaphores. Enabling operation without semaphores on gpu 1.
PsychVulkan-INFO: 8 bpc linear precision framebuffer will be used.
PsychVulkan-INFO: Using tiled rendering layout framebuffer for interop rendering.
PsychVulkanCore-DEBUG: PsychPresent(1): Queuing frame 0 with VkPresentTimesInfoGOOGLE for present at time >= tWhen 0.000000 secs.
PsychVulkanCore-DEBUG: PsychPresent(1): frameIndex 0 - swapChain image with index 0 queued for present at tWhen 0.000000 secs.
PsychVulkanCore-DEBUG: PsychGetNextSwapChainTargetBuffer(1): frameIndex 1 - Next swapChain backBuffer image with index 0 acquired.
PsychVulkanCore-DEBUG: PsychPresent(1): fpGetPastPresentationTimingGOOGLE failed to retrieve timestamp for frameIndex 0. Timed out. Carrying on with fallback.
PsychVulkanCore-DEBUG: PsychPresent(1): Present for frameIndex 0 completed: tComplete = 326318.504936 secs.
PsychVulkan-DEBUG: Delta between Vulkan and reference timestamps is 7744.126837 usecs.
PsychVulkanCore-DEBUG: PsychPresent(1): Queuing frame 1 with VkPresentTimesInfoGOOGLE for present at time >= tWhen 0.000000 secs.
PsychVulkanCore-DEBUG: PsychPresent(1): frameIndex 1 - swapChain image with index 0 queued for present at tWhen 0.000000 secs.
PsychVulkanCore-DEBUG: PsychGetNextSwapChainTargetBuffer(1): frameIndex 2 - Next swapChain backBuffer image with index 1 acquired.
PsychVulkanCore-ERROR: PsychPresent(1): fpGetPastPresentationTimingGOOGLE failed to retrieve timestamp! Timed out.
PsychVulkanCore-ERROR: 'Present' operation failed for some reason! Trying to keep going, brace for impact!
PsychVulkan-DEBUG: Delta between Vulkan and reference timestamps is 15492.744162 usecs.

...

PsychVulkanCore-INFO: Closing Vulkan window 1.
PsychVulkanCore-INFO: Vulkan window 1: swapChain is gone. Releasing display.
PsychVulkanCore-INFO: Vulkan window 1: Display or Window is gone. Releasing surface.
PsychVulkanCore-INFO: Vulkan window 1: Window successfully closed.
PTB missed 29 out of 30 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...

Thanks. I think i probably have a fix for the standard OpenGL path for your iMac. Apparently the iToys company broke iMac’s even harder with macOS 11 than on 10. They already needed special workarounds before, but this is a new low. We use the same switching logic as SwitchResX (utilizing non-public system private api’s which are not recommended by Apple, not guaranteed to work in the future, but the only api’s that still work properly now!) to work around all the regular mode setting api bugs, which make things like SetResolution() almost useless already. The workaround just wasn’t used on iMac as it wasn’t deemed neccessary.

My master branch has the commits and a Screen.mex file for Octave 6.2 for testing, if you want. With a bit of luck this will at least fix standard OpenGL display again – at least for macOS 11, i’m sure they already work hard on new bugs for macOS 12.

Wrt. Vulkan, this is even more broken than on my AMD with 10.15.7, very strong work by Apple. Even the line 592 workaround does not help anymore. I get this failure pattern on AMD with line 592 commented out, but with the line left intact, i only get those errors occassionally, it sometimes works for a while.

However, the most important use case for the Vulkan/Metal stuff are M1 systems with Apples proprietary gpu, where all our tricks and workarounds will fail completely and unfixable, so with Metal broken on the M1, it would be game over. If somebody wants to repeat Ian’s tests on a M1, that would be useful data.

-mario

This works great on my iMac. I installed Octave 6.2, and setup PTB (which worked really well, it warned about the security issues, and a restart allowed PTB to work with the keyboard). Then run VBLSyncTest, nice low sync variance:

>> VBLSyncTest
PTB-INFO: Connection to Psychtoolbox kernel support driver instance #0 (Revision 1) established.
ans = 0


PTB-INFO: This is Psychtoolbox-3 for Apple OS X, under GNU/Octave 64-Bit (Version 3.0.17 - Build date: Jul 28 2021).
PTB-INFO: OS support status: OSX version 11.0 is not yet tested or officially supported at all for this Psychtoolbox release.
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 priority support, community membership and commercial services, please type
PTB-INFO: 'PsychPaidSupportAndServices'.



PTB-INFO: OpenGL-Renderer is Intel Inc. :: Intel(R) Iris(TM) Pro Graphics 6200 :: 2.1 INTEL-16.5.2
PTB-INFO: Renderer has 1536 MB of VRAM and a maximum 3072 MB of texture memory.
PTB-INFO: VBL startline = 2304 , VBL Endline = 2369
PTB-INFO: Measured monitor refresh interval from beamposition = 16.672273 ms [59.979825 Hz].
PTB-INFO: Will use beamposition query for accurate Flip time stamping.
PTB-INFO: Measured monitor refresh interval from VBLsync = 16.672297 ms [59.979736 Hz]. (50 valid samples taken, stddev=0.009278 ms.)
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.
libptbdrawtext_ftgl: Thanks!

Measured refresh interval, as reported by "GetFlipInterval" is 16.67230 ms. (nsamples = 0, stddev = 0.00000 ms)
ans = 9.0000
Unable to revert mtime: /Library/Fonts
PTB missed 0 out of 600 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...
>>

For some reason PsychVulkan didn’t start:

>> VBLSyncTest(30, [], [], [], [], [], [], [], true, 0)
ans = 0
error: PsychImaging: Requested task 'UseVulkanDisplay', but this system does not support Vulkan at all.
error: called from
    PsychImaging>FinalizeConfiguration at line 3149 column 9
    PsychImaging at line 1809 column 41
    VBLSyncTest at line 295 column 7

But as you say, we need some M1 tests more than anything…

Good, so our builtin “SwitchResX”-style fixup works for the iMac.

Wrt. Vulkan failure: Peculiar, as i almost only use Octave for debugging and testing this atm., so it should work fine. What happens if you call PsychVulkanCore('GetCount') from the command line? Maybe some linking issue? Does a run of SetupPsychtoolbox help? The failing code is in PsychVulkan.m lines 275 - 285 and is straightforward.

I did run a SetupPsychtoolbox when setting up Octave, but I’ve rerun it again with no change. Here is the output:

PTB-INFO: Connection to Psychtoolbox kernel support driver instance #0 (Revision 1) established.
>> PsychVulkanCore('GetCount')
error: /Users/ian/Code/Psychtoolbox-3/Psychtoolbox/PsychBasic/Octave6OSXFiles64/PsychVulkanCore.mex: failed to load: dlopen(/Users/ian/Code/Psychtoolbox-3/Psychtoolbox/PsychBasic/Octave6OSXFiles64/PsychVulkanCore.mex, 10): Library not loaded: @rpath/libvulkan.1.dylib
  Referenced from: /Users/ian/Code/Psychtoolbox-3/Psychtoolbox/PsychBasic/Octave6OSXFiles64/PsychVulkanCore.mex
  Reason: image not found

the same command works OK in MATLAB:

>> PsychVulkanCore('GetCount')
PsychVulkanCore-INFO: Vulkan instance (version 1.2.182) created.

ans =

     1

Baffling. Maybe some new macOS linker bugs or incompatibilities introduced with the macOS 11 trainwreck. Works fine on my 10.15.7 and i don’t see anything unusual in my setup. The mex files specify @rpath/libvulkan.1.dylib as vulkan loader location, which is weird by itself, but works just fine on Matlab apparently, and on my Octave as well.

Normally this should search for libvulkan.1.dylib in the folder where the mex file is located, then fall back to $HOME/lib. On my machine i do not have a libvulkan in any of these locations and it works anyway on Matlab and Octave 6.2 from HomeBrew.

Maybe try copying libvulkan.1.dylib from wherever it is installed - in my case in /usr/local/lib into the Psychtoolbox/PsychBasic/Octave6OSXFiles64/ folder, or setting a symbolic link?

-mario

Added a symbolic link:

❯ ll ~/Code/Psychtoolbox-3/Psychtoolbox/PsychBasic/Octave6OSXFiles64/libV*
lrwxr-xr-x  1 ian  staff    32B  6 Aug 08:54 /Users/ian/Code/Psychtoolbox-3/Psychtoolbox/PsychBasic/Octave6OSXFiles64/libvulkan.1.dylib@ -> /usr/local/lib/libvulkan.1.dylib

Get a different error :face_with_thermometer:

>> VBLSyncTest(30, [], [], [], [], [], [], [], true, 0)
ans = 0
error: PsychImaging: Requested task 'UseVulkanDisplay', but this system does not support Vulkan at all.
error: called from
    PsychImaging>FinalizeConfiguration at line 3149 column 9
    PsychImaging at line 1809 column 41
    VBLSyncTest at line 295 column 7