Skip to content

Commit

Permalink
PsychVulkan/Windows: Reenable fullscreen exclusive mode for AMD gpus.
Browse files Browse the repository at this point in the history
Fullscreen exclusive mode for Vulkan direct display mode, bypassing the DWM
compositor and fixing the broken (one frame too early) stimulus onset now works
again on AMD gpu's with the latest AMD display drivers, version 23.11.1 from
November 2023, as tested successfully in both SDR mode and HDR-10 mode on
Windows 10 22H2 with AMD Raven Ridge iGPU of AMD Ryzen 5 2400G APU, aka
DCN-1 display engine and Vega 11 graphics. Hurray!

Some earlier driver versions might work as well, but this is the only confirmed one
by testing, so reenable fullscreen exclusive starting with the 23.11.1 release.
  • Loading branch information
kleinerm committed Nov 18, 2023
1 parent c5404f4 commit e123808
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Psychtoolbox/PsychGLImageProcessing/PsychVulkan.m
Original file line number Diff line number Diff line change
Expand Up @@ -558,16 +558,19 @@
% e.g., the Radeon RX 460 (Polaris, pci device id 0x67EF).
% Check gpu against badFSEIds list and enable a workaround if it is
% one of the bad gpu's.
% Additionally driver version raw >= 8388767 aka 20.11.2+ seems to have
% generally broken fullscreen-exclusive mode, as verified by Dale Stolizka,
% and by kleinerm with version 21.11.2 from one year later - November 2021!
% This on the Windows 10 21H1 edition. So we fall back to non-fs-exclusive
% mode and accept broken timing and potentially impaired HDR - what choice do
% we have?!
% Additionally driver version raw >= 8388767 aka 20.11.2+ to
% somewhere before 23.11.1 seems to have generally broken
% fullscreen-exclusive mode, as verified by Dale Stolizka, and by
% kleinerm with version 21.11.2 from one year later - November
% 2021! This on the Windows 10 21H1 edition. So we fall back to
% non-fs-exclusive mode and accept broken timing and potentially
% impaired HDR - what choice do we have?! The bug seems to be gone
% as of version 23.11.1, aka raw 8388887, so we can enable
% fs-exclusive again for these recent driver from November 2023.
badFSEIds = hex2dec({'67EF'});
for i=1:length(devs)
if (devs(i).VendorId == 4098) && strcmp(winfo.GLRenderer, devs(i).GpuName) && ...
(ismember(devs(i).DeviceId, badFSEIds) || (devs(i).DriverVersionRaw >= 8388767))
(ismember(devs(i).DeviceId, badFSEIds) || (devs(i).DriverVersionRaw >= 8388767 && devs(i).DriverVersionRaw < 8388887))
% Got a bad one! Disable fullscreen-exclusive mode for fullscreen windows:
flags = mor(flags, 2);
fprintf('PsychVulkan-INFO: AMD gpu [%s] with buggy Vulkan driver for fullscreen mode detected! Enabling workaround, timing reliability may suffer.\n', devs(i).GpuName);
Expand Down

0 comments on commit e123808

Please sign in to comment.