Fixes an issue where we would use an invalid connector because
the MST connector object got destroyed from our last CRTC set.
This avoids just using it again.
Reworks some logic re. frame pacing and presentation to flip directly when an app asks when this is enabled.
The next step for us would be to make this respect whether the app has vsync enabled or not using the tearing protocol too.
This is a good starting point though.
When adding/removing from a normal map, the iterators become undefined, which means drm->connector can change randomly to the wrong connector or garbage memory.
There is no way to tel a NV12 buffer in Wayland's color space. Why?
What a glaring omission.
Even then, the color management protocol that has supposedly been in
development for 2 years is missing basic features like setting the
color range. Great!
For now we are just setting an env var both us and Remote Play Together
are going to listen to and call it a day until the situation is
properly resolved.
On hardware and drivers that don't support a gamma
LUT property, don't attempt to generate or set
one. Log the lack of gamma LUT support at the
informational level.
Makes it so that we don't forget about any required modesets we need to
undertake, and makes modesetting robust by trying again when compositing
(in case the error was not mode but plane related), and falling back to
the previous mode if that fails.
If we have no mode to fall back to then we abort, same if we fail our
mode fallback commit.
Co-authored-by: Simon Ser <contact@emersion.fr>
Initialize Vulkan first to pick a physical device, then initialize
DRM or SDL. That way, DRM can open its own device depending on what
Vulkan is using. This avoids picking the wrong GPU on multi-GPU
setups.
This required rejiggering how initialization happens. In particular,
we need to get the SDL Vulkan instance extension list early. This is
supported since SDL 2.0.9 (by omitting the window in
SDL_Vulkan_GetInstanceExtensions).
g_nOutput* stored two different values: preferred values taken from
the CLI at init-time, then current values after init. This results
in some tricky logic because depending on when code is executed it'd
access one or the other.
Introduce two separate sets of variables instead. DRM reads from the
preferred values, decides which DRM mode to enable, then writes to
the current values. SDL reads from the preferred values and makes
them current immediately.
This changes gamescope's behaviour so that native DRM modes are
picked when -w/-h isn't specified on the command line. When -w/-h are
specified, the DRM logic will try to pick a mode which matches.
When nested, the default output size still defaults to 720p, but
changes when the user resizes the window.
Closes: https://github.com/Plagman/gamescope/issues/258
Refresh connector status and mode list on hotplug event. Then
execute the connector selection logic again to see if the
preferred connector has changed.
References: https://github.com/Plagman/gamescope/issues/211