Fatal error in new Screen.mex when opening window on 27" iMac at full res

Dear Mario and friends,

macOS 10.14.6
latest psychtoolbox
'3.0.16 - Flavor: beta - Corresponds to SVN Revision 10420 but is locally modified !
27" iMac
GratingDemo runs fine at default screen resoltuion. However, if I use System Preferences:Display to set it to max resolution, then GratingDemo fails:

GratingDemo
Error using Screen
See error message printed above.

Error in GratingDemo (line 74)
window = Screen(‘OpenWindow’, whichScreen);

It says there is a error message above, but there isn’t. I tried enabling warnings and setting debug level to 20, but there is still no explantion of the Screen error.
oldVisualDebugLevel = Screen(‘Preference’, ‘VisualDebugLevel’, 20);
oldSupressAllWarnings = Screen(‘Preference’, ‘SuppressAllWarnings’, 0);

I originally encountered this in my own program, and replicated the fault with GratingDemo.

At normal resolution everything seems normal.
Best
Denis

“Max resolution” in System Preferences (aka “More space”) is actually not maximum, it is a fractionally scaled resolution (compositor renders are 2X stated resolution, but then has to scale to physical screen, which isn’t an integer multiple). These non-integer scaled resolutions are very inefficient (try testing performance in other types of OpenGL software). You’d need 3rd party software to set the desktop resolution to “native” maximum resolution.

As these resolutions are not simple integer scalings but fractional ones, I’m not so surprised they will fail. I do love them for normal desktop use (macOS still handles high DPI monitors better than Windows and way better than Gnome), but they come with drawing costs…

What happens when you use PsychImaging('AddTask', 'General', 'UseRetinaResolution')?

As I also prefer to work in “More space” mode for other software, I run a script to switch me into standard resolution before running MATLAB on my iMac, I run this via an Alfred workflow:

-- Launch "System Preferences", open the "Displays" options and change to the "Display" tab
tell application "System Preferences"
	activate
	set the current pane to pane id "com.apple.preference.displays"
	reveal anchor "displaysDisplayTab" of pane id "com.apple.preference.displays"
end tell

local index1, index2, index3, indexToUse

set index1 to 3
set index2 to 4
set index3 to 5

-- Now lets make the necessary changes
tell application "System Events"
	delay 0.2
	tell window "Built-in Retina Display" of application process "System Preferences" of application "System Events"
		delay 0.2
		tell radio group 1 of tab group 1
			click radio button "Scaled"
		end tell
		delay 0.2
		tell radio group 1 of group 1 of tab group 1
			if (value of radio button index1) is true then
				set indexToUse to index2
			else if (value of radio button index2) is true then
				set indexToUse to index3
			else if (value of radio button index3) is true then
				set indexToUse to index1
			else
				set indexToUse to index1
			end if
			click radio button indexToUse
		end tell
		--get entire contents
	end tell
end tell

tell application "System Preferences"
	quit
end tell

What is the complete output you get?

On any digital display it really doesn’t make sense to ever choose any other resolution than the native one, as that will just provide blurriness or various timing problems. If you need a resolution other than the native one, use PTB’s PanelFitter functionality, e.g., PanelFitterDemo.m.

Also, as part of the hacks to work around all of macOS timing brokenness, PTB will always try to switch the display into native resolution anyway if it can determine it. Because iMac’s are especially broken at the OS level, PTB needs to use a lookup table of all known iMac models of the last decade or so. All to say it’s pointless to switch resolution manually in the GUI or via Screen(‘Resolution’), especially on a Retina panel.

Ideally doing so should only be futile, but not cause extra problems, but that’s also not possible due to yet another set of bugs in macOS, e.g., SetMouse/GetMouse can get quite confused on Retina panels with such special modes where the OS pretends the display has a higher resolution than it has, and then upscales and then fractionally downscales again. Safest and most efficient is to use the ‘UseRetinaResolution’ switch.

Seeing the full output to see how it goes wrong would be still interesting, although i doubt anything can be done about it.

Hi Mario

Thx. It fails at native resolution. It’s ok at lower resolution. I’m out now. Will send full output tomorrow.

Could it be that full res demands too much memory somewhere?

Thx

Denis

How are you activating “native” resolution? macOS does not allow you to activate the actual native resolution through system preferences as far as I can tell; for example, my 21" iMac has a native panel resolution of 4096 x 2304 – but the options in System Preferences are:

Screen Shot 2020-03-06 at 12.25.12_SMALL

The default “looks like” 2048 x 1152 so not “native” but an integer scaling 2X that is faster to compute. The highest resolution available in System Preferences “looks like” 2560 x 1440, but that isn’t native either. macOS renders the virtual 2560 x 1440 desktop at 5120 x 2880, then scales it by 0.8 to fit the native 4096 x 2304 panel. Still looks better than a normal DPI monitor by far, but the OS is doing a lot of extra work. These non-integer modes have never worked well with PTB in my experience. SwitchResX does allow you to set any resolution, including native, easily: https://www.madrau.com