I found a workaround for this issue:
Each time I run this command (and also some other applications like fillets-ng or mednafen) under X11, the entire screen freezes for several seconds (audio still working fine), then unfreezes and command or application continues normally. This happens under X11 only, no delay under wayland. At first I thought that maybe its the adapter that powers on, but it does not matter if its in D3Cold or D0. It only seems to affect some applications, most OpenGL/Vulkan applications run just fine without an…
I couldn’t respond again because I’m a “new user” and can’t reply more than 3 times. Continuing the discussion:
I cloned xrandr and launched a debug session. The delay (for me) is occuring during the call to XRRGetScreenResources()
.
This led me to discover this issue:
opened 05:35PM - 02 Sep 14 UTC
closed 11:06AM - 10 Sep 14 UTC
enhancement
X11
verified
Since calls to XRRGetScreenResources can be very long (due to hardware polling),… maybe would be better to use XRRGetScreenResourcesCurrent when this performance penalty can be noticeable, ie:
_glfwPlatformGetVideoModes
_glfwPlatformGetVideoMode
_glfwPlatformGetMonitorPos (also?)
(always in X11 platform)
I measured in my system an improvement of 3 orders of magnitude between XRRGetScreenResources and XRRGetScreenResourcesCurrent, and of 2 orders of magnitude in the execution time of the function glfwGetVideoMode between the two alternatives.
Maybe the rest of "setters" functions in x11_monitor.c can be left with XRRGetScreenResources, and also the one in initExtensions (x11_init.c), since I think, although I'm not sure, that these functions are not prone to be called very often, like in every render frame.
(Also, I've to say that I don't have much experience in Github...I think I did well but I was not sure if what I've to do is open an issue like I did or send a patch via pull request, so...I wait for your comments!)
I think a workaround could be to call xrandr with the --current
switch, which uses the current screen configuration and avoids polling for hardware. I’m not sure if this covers all use-cases though, particularly if you’re trying to detect hardware changes.
2 Likes