Commit graph

95 commits

Author SHA1 Message Date
Simon Ser
f1eb06d9b7 drm: add explicit needs_modeset flag 2021-07-28 18:17:07 +02:00
Simon Ser
24fe84c402 drm: reload our internal state on hotplug 2021-07-28 17:58:07 +02:00
Simon Ser
fae6bfc411 drm: refresh props after VT switch 2021-07-28 17:47:41 +02:00
Simon Ser
d67ce2865e wlserver: make global static
Let's prevent other threads from directly accessing it. Helper
functions can be introduced as needed.
2021-07-28 16:14:59 +02:00
Simon Ser
c33ad217e1 Handle session switch events
Pause/resume our frame submission on VT switch.

Closes: https://github.com/Plagman/gamescope/issues/6
2021-07-27 14:11:00 +02:00
Simon Ser
43ba33425b Open KMS device with wlr_session
This allows proper integration with logind/seatd. When switching
VTs, gamescope now dies with ENOPERM instead of making VT switching
freeze.

References: https://github.com/Plagman/gamescope/issues/6
2021-07-27 11:25:05 +02:00
Simon Ser
ba79953e4e wlserver: strip wl_ prefix from fields, remove event loop FD 2021-07-27 10:46:03 +02:00
Simon Ser
5f638dd780 wlserver: add missing newline to error log 2021-07-27 10:31:34 +02:00
Simon Ser
f33b040ba7 Move steamcompmgr init out of wlserver 2021-07-27 10:30:14 +02:00
Simon Ser
0f0489b455 wlserver: wait for Xwayland to be ready in wlserver_init
We''l be able to move some init bits out of wlserver with this.
2021-07-27 10:25:56 +02:00
Simon Ser
5fedd45d2f Switch to poll
epoll doesn't offer any benefit for our use-case. select is old.
Let's just make things consistent and use the portable poll
everywhere.
2021-07-25 20:42:16 +02:00
Simon Ser
52063b3858 wlserver: improve wlr_session_create error handling 2021-07-22 15:09:10 +02:00
Simon Ser
96346bd5f1 wlserver: remove unnecessary wlr_backend_is_headless check
A headless backend will always pass this check.
2021-07-22 15:01:09 +02:00
Simon Ser
3e17ea2e6f Add enum for g_nTouchClickMode
Makes it clearer what the values mean.
2021-06-18 10:44:13 +02:00
Simon Ser
2807bb27c1 Fix NULL g_XWLDpy
The previous commit stopped using the X11 server for nudging the
XWM. Thus g_XWLDpy has been dropped. However we still need it to
send XTest events.
2021-06-16 09:17:45 +02:00
Simon Ser
33f207d6a1 Replace nudge X11 events with pipe
Avoids the roundtrip through the X11 server. Avoids having to connect
to the X11 server from multiple threads.
2021-06-10 14:49:02 +02:00
Simon Ser
9d40b61645 wlserver: prevent list corruption on double wlserver_surface_set_wl_id 2021-05-20 17:40:20 +02:00
Pierre-Loup A. Griffais
e25f871d87 wlserver: avoid accessing mouse_focus_surface after destruction
We should also set the focus to something else that makes sense, which
means there's another bug in a higher-level layer somewhere, but at least
don't crash.
2021-05-05 16:37:51 -07:00
Pierre-Loup A. Griffais
496b5f58d2 wlserver: downgrade wlserver_surface_set_wl_id assert to spew 2021-04-30 18:45:00 -07:00
Pierre-Loup A. Griffais
2bb4907993 Also spew wayland display name through session pipe. 2021-04-27 21:17:36 -07:00
Simon Ser
be735e9360 Set GAMESCOPE_WAYLAND_DISPLAY
This allows gamescope-specific Wayland clients to connect to the
Wayland server, while preventing regular Wayland clients from doing
so.
2021-04-20 09:13:10 +02:00
Simon Ser
a05e5b0a39 Implement gamescope-xwayland protocol 2021-04-20 09:13:10 +02:00
Simon Ser
10816e6ed8 wlserver: adjust assertion in wlserver_surface_set_wlr
Make sure we don't overwrite an existing surf->wlr. We don't really
care about the Wayland surface ID here.
2021-04-20 09:13:10 +02:00
Simon Ser
ce0a3f7259 Rename wlserver_surface_set_id to wlserver_surface_set_wl_id
Make it clear the ID refers to a Wayland object.
2021-04-20 09:13:10 +02:00
Sefa Eyeoglu
ed44909813 Update wlroots to 0.13.0
Update usage of wlr_headless_backend_create,
wlr_renderer_get_shm_texture_formats,
wlr_texture_from_pixels and add missing include for render/egl.h.
2021-04-08 09:15:05 +02:00
Simon Ser
c834999a5f Introduce wlserver_surface 2021-04-02 08:37:53 +02:00
Simon Ser
df18c40815 Only advertise scanout capable modifiers 2021-04-01 17:41:06 +02:00
Simon Ser
29d00dbc68 tracing: use {begin,end}_ctx helpers, remove unnecessary newlines 2021-03-11 11:25:34 +01:00
Simon Ser
1b38faf9fd Fix double-unlock on wl_event_loop_dispatch error 2021-02-01 15:27:21 +01:00
Simon Ser
9b780b48db Use no-op backend for output
This avoids needlessly creating buffers for an headless output we won't
use, and will allow us to more easily replace the headless backend with
a custom renderer in the future.
2021-02-01 10:24:39 +01:00
Simon Ser
fbc6bd0c08
Update wlroots and libliftoff 2020-12-16 11:52:28 +01:00
Pierre-Loup A. Griffais
667d8afc54 wlserver: was wrong clickmode, we want 4, also fix some logic issues 2020-09-23 15:22:42 -07:00
Pierre-Loup A. Griffais
4f70525fc6 wlserver: add touch passthrough support, if clickmode == 0 2020-09-18 14:59:26 -07:00
Pierre-Loup A. Griffais
fd7a81547a vblankmanager: obey nested refresh rate if set 2020-09-15 14:46:12 -07:00
Simon Ser
c2d9b23d08 Hold buffers till steamcompmgr processes them 2020-09-01 12:36:35 -07:00
Pierre-Loup A. Griffais
2a98d2b85a wlserver: use gamescope-N wayland display name.
Letting wayland use the default makes random things connect to us, which we
don't want.

Fixes https://github.com/Plagman/gamescope/issues/96.

Related to the va-api problem, but most likely not the only fix:

https://github.com/Plagman/gamescope/issues/23
2020-09-01 11:52:55 -07:00
Pierre-Loup A. Griffais
df38bea747 Implement screenshot support.
Mostly in rendervulkan. Super+S or SIGUSR2.
2020-08-29 21:33:14 -07:00
Pierre-Loup A. Griffais
669183c1e2 wlserver: fix use-after-free in surface destroy path.
The new-ish code to listen for destroy on surfaces on the wlserver side
installs a dynamic listener. We need to remove it from the list before
freeing it, or wayland will try to do it when the signal gets destroyed,
which involves updating the link member in the freed memory.

Some xcb protocol allocations would often get allocated there in that
short time window and get scribbled on.

https://github.com/Plagman/gamescope/issues/7

Ironic. 064d132c could save others from use-after-free, but not itself.
2020-08-28 00:49:04 -07:00
Pierre-Loup A. Griffais
69bcb1b339 Revert "Hold buffers till steamcompmgr processes them"
This reverts commit 98e263c37d.
2020-07-24 15:01:33 -07:00
Simon Ser
98e263c37d Hold buffers till steamcompmgr processes them 2020-07-23 22:26:06 +02:00
Simon Ser
b7505b23cf Get DMA-BUF from wlr_buffer if possible
wlr_texture_to_dmabuf involves issuing EGL commands to get a DMA-BUF out
of an EGLImage.

When the client submits a DMA-BUF via the linux-dmabuf protocol, there's
no need to go through EGL. We can directly import the client's DMA-BUF
into Vulkan.

The old code is still retained as a fallback in case the client uses
wl_drm (old Xwayland) or wl_shm. Removing it would involve creating a
Vulkan-based wlr_renderer.

References: https://github.com/Plagman/gamescope/issues/16
2020-07-23 22:14:17 +02:00
Simon Ser
4ddb892d4f
wlserver: listen for new_input on the multi backend
The multi backend aggregates all input devices. No need to have a
different listener for headless and libinput.
2020-07-23 13:52:07 +02:00
Pierre-Loup A. Griffais
064d132c93 wlserver: Fix use-after-free of wlr_surface in steamcompmgr. 2020-07-03 15:05:00 -07:00
Pierre-Loup A. Griffais
575171360b wlserver: properly handle touch for scaled windows.
Gets scale from steamcompmgr in an extremely safe and elegant way.
2020-07-02 17:40:31 -07:00
Simon Ser
bae255ee1a
Get rid of C_SIDE
wlroots headers can mostly be included with extern "C" blocks. Two
exceptions are the use of `static` for array args and `class` as a
struct field. These can be #define'ed to avoid C++ build errors.

This allows the whole project to be built as a single C++ codebase,
without having to maintain hybrid header files.
2020-06-11 12:44:36 +02:00
Renamed from src/wlserver.c (Browse further)