Commit graph

928 commits

Author SHA1 Message Date
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
Bas Nieuwenhuizen
83eae082fa Warning fix 2021-09-14 17:29:51 -07:00
Bas Nieuwenhuizen
e510af1b7e Add a proper release barrier for modifier based images when not nested.
RADV does retiling in that barrier. Still hinky overall but this fixes
using compositing with DCC compressed images on RADV.
2021-09-14 17:22:07 -07:00
Joshua Ashton
143176acb1 Fix return value when SDL fails initialization 2021-09-14 17:01:42 -07:00
Joshua Ashton
ce87bf1b76 Init format info after initializing DRM
Otherwise all our modifiers/formats and stuff are garbage.

Fixes: #269
2021-09-14 17:01:42 -07:00
Pierre-Loup A. Griffais
8e75287454 steamcompmgr: more GAMESCOPECTRL work 2021-09-14 16:29:42 -07:00
Simon Ser
2eb520bc17 Fix BIsNested return type 2021-09-14 18:36:27 +02:00
Simon Ser
5a93c4ed13 Minor style fixup 2021-09-14 18:33:05 +02:00
Simon Ser
eed360ce09 sdlwindow: ignore key repeat events
Wayland clients (incl. Xwayland) handle this.
2021-09-14 18:25:56 +02:00
Simon Ser
0d43e3472a sdlwindow: get mod from key event
No need to call SDL_GetModState, the event already carries this
information.
2021-09-14 18:23:30 +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
1fca3896b1 wlserver: remove wlserver_init args
argc and argv are unused, bIsNested can be fetched from globals.
2021-09-14 17:03:52 +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
54e6614e2c wlserver: stop setting keyboard in wlserver_new_input
This avoids messing up with the current keyboard settings when a
new one is plugged in.
2021-09-14 13:56:33 +02:00
Simon Ser
f10e2248fd wlserver: set keyboard in wlserver_key
This ensures clients see the right keymap/modifiers/etc when
handling a keyboard event.
2021-09-14 13:47:55 +02:00
Simon Ser
1694e0c4f7 wlserver: handle null keyboard in wlserver_keyboardfocus 2021-09-14 13:44:35 +02:00
Simon Ser
16211ba7ca wlserver: expose nested refresh if set
Instead of faking an output with the KMS mode's refresh rate,
expose the nested refresh rate when -r is set.
2021-09-14 08:24:07 +02:00
Valentin David
5672737093 wlserver: Add support for mouse wheels 2021-09-13 23:17:34 +02:00
Simon Ser
90f3a13c13 Drop trailing spaces 2021-09-13 23:14:57 +02:00
Valentin David
a8ba73b8ae wlserver: Force reading XKB_DEFAULT_* variables
When gamescope has cap_sys_nice capability, then `secure_getenv` used
by libxkbcommon does not load the keymap configuration from
environment. So the environment variables have to be manually read from
gamescope.

Without `XKB_DEFAULT_LAYOUT` it is not possible to load other keymaps
than US.
2021-09-13 23:06:37 +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
3504fb2613 steamcompmgr: fix mouseMoved type 2021-09-13 10:01:28 +02:00
Simon Ser
af836736bf steamcompmgr: unify function call code style a bit 2021-09-13 09:25:57 +02:00
Simon Ser
d237cf387f steamcompmgr: switch to stdbool 2021-09-13 09:16:58 +02:00
Pierre-Loup A. Griffais
66064b23cf steamcompmgr: don't always warp cursor on mouse input focus change 2021-09-12 23:39:34 -07:00
Pierre-Loup A. Griffais
3db90edd75 steamcompmgr: don't allow giving an overlay layer keyboard focus
The main plane app rarely lets it go without making visible trouble.

We can reinstate this feature when we have a way to lie about it.
2021-09-12 23:30:51 -07:00
Pierre-Loup A. Griffais
ab72155ce0 steamcompmgr: some cursor hiding improvements
Absorb 5 moves for auto-hide purposes instead of 3. Our nudge is 2 moves,
and we can warp on top of that, so we weren't counting everything.

Hide before changing mouse input focus and the warp that ensues.

Re-arm warp count when changing mouse input focus, so doing it repeatedly
with the same window doesn't eventually unhide despite no input.
2021-09-12 23:21:35 -07:00
Joshua Ashton
805e3c5801 rendervulkan: Set addressModeW for samplers
Technically, YCbCr has a hard requirement of everything being CLAMP_TO_EDGE here and validation moans about it. Better just to set it.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-09-12 18:21:44 -07:00
Joshua Ashton
249708fedd rendervulkan: Enable VK_KHR_image_format_list if we use modifiers
This extension is required for whatever reason. Validation complains about it.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-09-12 18:21:44 -07:00
Joshua Ashton
5a1f28d8bc rendervulkan: Use push constants for composite data
We can just bung this in here and avoid needing to deal with a buffer.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-09-12 18:21:44 -07:00
Joshua Ashton
3e1ebd7241 rendervulkan: Replace border color with CLAMP_TO_EDGE + bounds check
We can't use normal border colors if we are doing linear filtering as we will sample slightly outside on the edges and blend to the border color.

Replace this with a way to push an arbitrary layer alpha and return that in the OOB case, and when sampling, clamp to edge.

This also may be more efficient to avoid sampling OOB a lot of the time in some cases.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-09-12 18:21:44 -07:00
Simon Ser
1e707d7947 Fix typo in usage message 2021-09-11 20:51:51 +02:00
Simon Ser
b5001aa00c Simplify build_optstring for long-only options 2021-09-11 02:59:48 +02:00
Joshua Ashton
2cea675db0 meta: Use wrap file for STB rather than submodule
Allows us to use this as a Meson subproject which means that recursive cloning doesn't matter (Meson resolves it for subprojects).

Given this subproject doesn't have a meson file, doing subproject() on it would fail, so:
Make a wrap file with an overlay that declares a proper dependency.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-09-11 02:55:21 +02:00
Pierre-Loup A. Griffais
21d631590a Fix build_optstring bug with long-only options requiring argument. 2021-09-10 17:46:00 -07:00
Simon Ser
97b73a8c9a readme: mention --help 2021-09-10 14:26:42 +02:00
Simon Ser
fb4ec7cb4e Drop short option for --cursor 2021-09-10 14:25:19 +02:00
Simon Ser
f8e251962c Add --help 2021-09-10 14:21:59 +02:00
Simon Ser
94f78d1b3c steamcompmgr: use log scope 2021-09-10 12:04:20 +02:00
Simon Ser
d926ea0b33 steamcompmgr: init g_nudgePipe to invalid FDs
Make sure we don't wrongly read from stdin or something.
2021-09-10 11:49:14 +02:00
Simon Ser
97746c609f steamcompmgr: remove unused environ 2021-09-10 11:48:10 +02:00
Simon Ser
ba9c46cea2 drm: disable all KMS resources at exit 2021-09-10 11:42:43 +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
Simon Ser
fc748ebd78 wlserver: remove wlserver_run return value
It always returns 0.
2021-09-10 11:01:54 +02:00
Simon Ser
cd0e12d050 Wait for steamcompmgr when exiting
This allows steamcompmgr to perform cleanup actions without being
hard-terminated.
2021-09-10 11:00:18 +02:00
Simon Ser
6557cdce18 build: specify explicit C++ edition 2021-09-10 10:50:41 +02:00
Simon Ser
1e163fa358 steamcompmgr: check for XNextEvent errors 2021-09-09 19:56:50 +02:00
Simon Ser
597fc8fa48 Move signal handler to main 2021-09-09 19:49:31 +02:00
Simon Ser
1989c291ee Avoid double-closing GEM handles 2021-09-04 17:30:13 +02:00