Commit graph

851 commits

Author SHA1 Message Date
Simon Ser
3b2c8995a0 ci: fix meson invocation 2021-09-15 19:07:06 +02:00
Simon Ser
0d8afd8e51 ci: turn on werror 2021-09-15 19:03:37 +02:00
Simon Ser
1cf749c43b build: ensure wlroots has been built with libinput support 2021-09-15 18:57:44 +02:00
Simon Ser
0687d241a1 build: simplify have_xwayland check 2021-09-15 18:55:39 +02:00
Simon Ser
033695da64 build: disable unused wlroots backends and renderers 2021-09-15 18:44:36 +02:00
Jan Beich
12bff15700 wlserver: hide remaining pipewire stuff with -Dpipewire=disabled
src/wlserver.cpp:511:13: warning: unused function 'create_gamescope_pipewire' [-Wunused-function]
static void create_gamescope_pipewire( void )
            ^
2021-09-15 18:42:12 +02:00
Jan Beich
5548b29521 wlserver: compare using larger type on 32-bit architectures
src/wlserver.cpp:430:16: warning: comparison of integers of different signs: 'long' and 'uint32_t' (aka 'unsigned int') [-Wsign-compare]
                if (s->wl_id == id && s->wlr == nullptr)
                    ~~~~~~~~ ^  ~~
2021-09-15 18:42:12 +02:00
Jan Beich
04fd7ed5b7 drm: adjust printf format modifiers for 32-bit architectures
src/drm.cpp:187:50: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
        drm_verbose_log.debugf("page_flip_handler %lu", flipcount);
                                                  ~~~   ^~~~~~~~~
                                                  %llu
src/drm.cpp:777:44: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
        drm_verbose_log.debugf("flip commit %lu", (uint64_t)g_DRM.flipcount);
                                            ~~~   ^~~~~~~~~~~~~~~~~~~~~~~~~
                                            %llu
2021-09-15 18:42:12 +02:00
Simon Ser
7d108448b1 Improve unknown option error message
The stdlib will already print an error message. Let's just mention
--help.
2021-09-15 13:40:59 +02:00
Simon Ser
5849b6c14e Forbid duplicate short options
Just make sure we don't define two flags with the same letter.
2021-09-15 13:38:38 +02:00
Simon Ser
27cff4e41b wlserver: drop headless backend
Saves us the GLES2 renderer init.
2021-09-15 13:35:42 +02:00
Simon Ser
a480fe81fe Drop VulkanRenderer_t.parent
We don't need the wlroots parent GLES2 renderer anymore.
2021-09-15 13:35:42 +02:00
Simon Ser
2772a17f22 Implement wlr_renderer_impl.get_drm_fd
This depends on VK_EXT_physical_device_drm.
2021-09-15 13:35:42 +02:00
Simon Ser
92c6823897 wlserver: let wlr_renderer init the DMA-BUF Wayland protocols
wlr_renderer_init_wl_display will automatically init the suitable
Wayland protocols.
2021-09-15 13:35:42 +02:00
Simon Ser
9593ef0bfe build: bump wlroots version requirement 2021-09-15 13:35:42 +02:00
Simon Ser
ae7fcc5ba7 wlserver: get wlr_buffer from VulkanWlrTexture_t
This side-steps wlr_client_buffer and ensures we get access to the
underlying buffer. This allows us to call
wlr_buffer_begin_data_ptr_access to upload shm textures.
2021-09-15 13:35:42 +02:00
Simon Ser
0bbecd7e90 Extract fence from Vulkan texture if buffer is shm 2021-09-15 13:35:42 +02:00
Simon Ser
118d8213e4 rendervulkan: implement wlr_renderer_impl.texture_from_buffer 2021-09-15 13:35:42 +02:00
Simon Ser
db1ffbe2e4 rendervulkan: remove wlr_renderer_impl.init_wl_display
We don't need EGL_bind_wayland_display anymore.
2021-09-15 13:35:42 +02:00
Simon Ser
6fbabb94b3 rendervulkan: build list of supported wl_shm formats 2021-09-15 13:35:42 +02:00
Simon Ser
a325cf193b Use wlroots' wl_drm implementation
wl_drm is not available on Vulkan.

References: https://github.com/swaywm/wlroots/pull/2708
2021-09-15 13:35:42 +02:00
Simon Ser
123df9006f rendervulkan: implement wlr_renderer_impl.get_render_buffer_caps 2021-09-15 13:35:42 +02:00
Simon Ser
d13d19981b rendervulkan: drop wlr_renderer_impl.render_ellipse_with_matrix stub
This has been removed from wlroots upstream.
2021-09-15 13:35:42 +02: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
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