Commit graph

94 commits

Author SHA1 Message Date
Joshua Ashton
dc498638c3 drm: Hook up "content type" property 2023-01-16 21:49:05 +00:00
Joshua Ashton
5054054768 drm, steamcompmgr: Implement 3DLUT + SHAPERLUT support 2023-01-06 15:54:31 +00:00
Joshua Ashton
06c7c3efff drm: Respect connector HDR capabilities 2022-12-30 03:21:55 +00:00
Joshua Ashton
0d86168480 drm: Respect app's HDR metadata 2022-12-30 03:21:55 +00:00
Joshua Ashton
70b74e73be drm: Hook up Colorspace and HDR_OUTPUT_METADATA 2022-12-30 03:21:55 +00:00
Joshua Ashton
b5bb169889 drm, rendervulkan: Hook up composite ST2084 output 2022-12-30 03:21:55 +00:00
Joshua Ashton
22806541e2 drm: Parse out HDR/colorimetry metadata from EDID 2022-12-30 03:21:55 +00:00
Joshua Ashton
c0cb4c336c steamcompmgr, drm: Add GAMESCOPE_DISPLAY_EDID_PATH atom 2022-12-06 01:25:38 +00:00
Simon Ser
5a9bf10c81 drm: make g_drmEffectiveOrientation atomic
It's accessed from multiple threads.
2022-11-29 11:19:05 +01:00
Joshua Ashton
989806791f main: Add --adaptive-sync commandline arg
Enables VRR if the display is capable if this flag is set.

Closes: #199
2022-11-08 03:14:24 +00:00
Joshua Ashton
ec6bd30bb6 drm, steamcompmgr: Support for VRR
Exposes GAMESCOPE_VRR_ENABLED, GAMESCOPE_VRR_CAPABLE and GAMESCOPE_VRR_FEEDBACK
2022-10-19 18:57:14 +01:00
ruineka
cf89b2fbae
drm: add support for the panel orientation property 2022-10-11 18:20:14 +02:00
ruineka
647e1d96d0
Add --force-orientation option
Co-authored-by: Joaquín Ignacio Aramendía <samsagax@gmail.com>
Co-authored-by: alphonsez1 <alphonsez743@gmail.com>
Co-authored-by: Ruineka <ruineka@pop-os.localdomain>
2022-10-07 15:29:52 +02:00
Joshua Ashton
b87660561f drm: Fix respecting custom mode refresh rates
This was being overwritten by some dynamic refresh code.
2022-10-01 21:10:34 -02:30
Joshua Ashton
b305a97e9d drm: Don't re-zero connector CRTCs we already have zero-ed.
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.
2022-09-16 06:06:50 +01:00
Joshua Ashton
5ec3b7cffb drm, steamcompmgr: Add GAMESCOPE_DISPLAY_MODE_NUDGE 2022-09-07 11:36:44 +00:00
Joshua Ashton
0d171a7346 drm: Add support for a mode set file 2022-09-07 11:31:40 +00:00
Joshua Ashton
1c7a2db86d steamcompmgr: Implement GAMESCOPE_DISPLAY_FORCE_INTERNAL 2022-09-07 11:11:09 +00:00
Joshua Ashton
a4ab1b0459 drm, steamcompmgr: Allow async flips if supported with GAMESCOPE_ALLOW_TEARING
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.
2022-09-06 17:01:22 +01:00
Joshua Ashton
9aada10be3 drm: Split GAMESCOPE_COLOR_GAMMA_EXPONENT for EXTERNAL displays 2022-08-19 22:10:21 +00:00
Joshua Ashton
bbc240390c drm: Split GAMESCOPE_COLOR_MATRIX for EXTERNAL displays 2022-08-19 22:01:36 +00:00
Joshua Ashton
7adbdd3f80 drm: Use unordered_map for connectors
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.
2022-07-27 15:50:17 +00:00
Joshua Ashton
81cd2bbc6d drm: Add method to get screen type
Either internal or external
2022-07-27 15:43:50 +00:00
Simon Ser
4dbcd068ed drm: de-duplicate EDID parsing 2022-07-27 09:35:25 +02:00
Simon Ser
5fca0702ab drm: parse make/model from EDID 2022-07-27 09:30:45 +02:00
Joshua Ashton
1b34a570a5 drm: Implement COLOR_ENCODING + COLOR_RANGE and hook up to env var for now
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.
2022-06-16 01:31:47 +00:00
Joshua Ashton
549d22094b drm: Implement gamma and degamma exponent 2022-05-26 23:08:34 +00:00
Joshua Ashton
3c59167b67 steamcompmgr, drm: Add GAMESCOPE_COLOR_MATRIX to control CTM matrix 2022-05-18 01:20:49 +00:00
Georg Lehmann
d29d83f792 Remove those two terrible structs 2022-05-12 11:32:05 +00:00
James Jones
22660ce088 drm: Skip gamma LUT on CRTCs that don't support it
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.
2022-05-06 22:45:44 +02:00
Simon Ser
483e2729ec drm: store connectors in map
We'll need to create/destroy connectors for DP-MST. A vector
invalidates pointers/references when new elements are inserted.
2022-02-23 23:07:21 +00:00
Joshua Ashton
6d2cb3073c steamcompmgr: Implement dynamic refresh rate based on FPS limit
Adds a mode to dynamically change the refresh rate based on the existing FPS limit.
2022-02-09 00:34:58 +00:00
Joshua Ashton
02e0086856 steamcompmgr: New night mode color toys 2022-02-09 00:20:35 +00:00
Joshua Ashton
c5ccd71ff6 drm: Implement linear color gain control via atoms
Adds GAMESCOPE_COLOR_LINEARGAIN to control the linear color gain.
2022-02-03 05:29:33 +00:00
Joshua Ashton
95eba7e549 drm: Don't forget about modesetting + modesetting robustness
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>
2021-12-21 22:11:33 +01:00
Joshua Ashton
be1a784278 drm: Handle the same fb_id being held more than once
Ref this properly -- this can happen when a window is recreated sometimes
it seems.
2021-12-17 15:43:26 -08:00
Bas Nieuwenhuizen
7e93200e08 Dedupe and memoize fb_id and vulkan texture per buffer.
Also split lock/unlock from import/drop in drm, because we still
need the lock/unlock semantics to signal to the app when ti can
reuse the buffer.
2021-11-22 21:45:52 -08:00
Bas Nieuwenhuizen
5f6940f7d6 Make the drm fb map threadsafe.
It could be accessed both in the pageflip handler and in the main
thread.
2021-11-22 21:45:52 -08:00
Simon Ser
8be45451d9 Introduce --generate-drm-mode 2021-11-20 16:01:39 -08:00
Simon Ser
332f261c35 drm: generalize find_drm_node_by_devid for render nodes
We'll use this to open the DRM render node from a VkPhysicalDevice.
2021-09-15 12:12:06 +02:00
Simon Ser
e5faeaed68 Open DRM device from Vulkan physical device
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).
2021-09-14 18:16:53 +02:00
Simon Ser
7198851e98 Unify init functions return types a bit
We had both int and bool, let's try to end up with only bools.
2021-09-14 16:59:46 +02:00
Simon Ser
1d528be605 Untangle preferred mode and current mode
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
2021-09-14 16:45:23 +02:00
Simon Ser
5ac5a1ea29 drm: don't use globals as inputs for find_mode
These globals are overwritten by drm_set_mode. Save the globals at
init time to remember what the user preference is.
2021-09-13 18:34:27 +02:00
Simon Ser
ff8c0b183b Introduce finish_drm
For now it just closes the DRM FD, but will do more soon.
2021-09-10 11:05:09 +02:00
Pierre-Loup A. Griffais
5d3a0eb078 Repaint on possible connector hotplug 2021-09-02 17:18:13 -07:00
Simon Ser
f18723d489 drm: compute per-connector CRTC mask 2021-09-01 13:23:12 +02:00
Simon Ser
51cfc0df06 Implement priority list for -O
e.g. `-O DP-1,VGA-1` will use DP-1 if possible, then fallback to
VGA-1, then to any other connector.
2021-08-25 16:22:14 +02:00
Simon Ser
6e1d4c2a7e drm: switch connector on hotplug
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
2021-08-02 12:35:49 +02:00
Simon Ser
a314c3f0ba drm: plane -> primary 2021-07-28 19:27:51 +02:00