Commit graph

465 commits

Author SHA1 Message Date
Pierre-Loup A. Griffais
22f20882b9 rendervulkan: use realtime priority async compute if CAP_SYS_NICE is set.
Fixes: https://github.com/Plagman/gamescope/issues/20.
2020-09-01 23:25:53 -07:00
Pierre-Loup A. Griffais
79cb130dcc sdlwindow: put all the SDL I/O code in the same spot. 2020-09-01 23:00:06 -07:00
Pierre-Loup A. Griffais
81b8e8c33c steamcompmgr: ignore vblank messages if we get them too late. 2020-09-01 22:59:44 -07:00
Pierre-Loup A. Griffais
b196cd063b steamcompmgr: show which window we're pushing commit waits for. 2020-09-01 18:03:09 -07:00
Pierre-Loup A. Griffais
8854cd8bd6 steamcompmgr: add 100ms timeout for commit wait thread.
poll() inexplicably blocks forever for some commits right now, this helps
a bit while we understand why.
2020-09-01 17:51:11 -07:00
Pierre-Loup A. Griffais
9f183ae76c drm: add gpuvis error spew when failing a legacy flip. 2020-09-01 16:16:45 -07:00
Pierre-Loup A. Griffais
11dd8014ad main: set R600_DEBUG=nodcc ourselves if we have a sub-command.
We know it's strictly better than not having it in the current state,
so might as well, if we know it'll apply to clients as well.
2020-09-01 16:01:20 -07:00
Simon Ser
aac57e7c75 Hold client buffers till KMS stops using them 2020-09-01 12:36:35 -07:00
Simon Ser
31a0713455 Copy commit queue in check_new_wayland_res
This will allow us to call wlr_buffer_lock/unlock in import_commit without
causing a deadlock.
2020-09-01 12:36:35 -07:00
Simon Ser
d88cfec0c2 Add wlr_buffer to commit queue
This lets us keep the buffers for pending commits locked.
2020-09-01 12:36:35 -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
Simon Ser
d36a11d39f
Remove whitespace at the end of rendervulkan.cpp 2020-08-31 19:23:45 +02:00
Simon Ser
9a78452a41
Read window title
Prefer _NET_WM_NAME since it's UTF-8. Fallback to WM_NAME if the client
doesn't support it.

Closes: https://github.com/Plagman/gamescope/issues/89
2020-08-31 14:59:51 +02:00
Simon Ser
5076ec1586
Fix buffer overflow when reading WM_NAME
XTextProperty doesn't guarantee the string will be null-terminated.
2020-08-31 14:33:25 +02:00
Simon Ser
6eb108d3bc
Extract client message event handling in function
No logic changes, just shuffling code around.
2020-08-31 13:53:41 +02:00
Simon Ser
0a1bf2e81f
Extract PropertyNotify event handling in function
No logic changes, just shuffling code around for better readability.
2020-08-31 13:48:21 +02:00
Simon Ser
3096c1e9cf
Fix alloc-dealloc-mismatch in vecNewEnviron
==2654441==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs operator delete) on 0x6020000c0330
        #0 0x7f264e95e009 in operator delete(void*, unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:172
        #1 0x5645ddfcef1e in steamcompmgr_main(int, char**) ../src/steamcompmgr.cpp:2602
    Running Steam on arch rolling 64-bit
        #2 0x5645de0020e6 in steamCompMgrThreadRun() ../src/main.cpp:126
        #3 0x5645de001a2f in void std::__invoke_impl<void, void (*)()>(std::__invoke_other, void (*&&)()) /usr/include/c++/10.2.0/bits/invoke.h:60
        #4 0x5645de001899 in std::__invoke_result<void (*)()>::type std::__invoke<void (*)()>(void (*&&)()) /usr/include/c++/10.2.0/bits/invoke.h:95
        #5 0x5645de001757 in void std:🧵:_Invoker<std::tuple<void (*)()> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) /usr/include/c++/10.2.0/thread:264
        #6 0x5645de00161a in std:🧵:_Invoker<std::tuple<void (*)()> >::operator()() /usr/include/c++/10.2.0/thread:271
        #7 0x5645de000d98 in std:🧵:_State_impl<std:🧵:_Invoker<std::tuple<void (*)()> > >::_M_run() /usr/include/c++/10.2.0/thread:215
    STEAM_RUNTIME is enabled automatically
        #8 0x7f264e143c23 in execute_native_thread_routine /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:80
        #9 0x7f264d58b3e8 in start_thread (/usr/lib/libpthread.so.0+0x93e8)
        #10 0x7f264d4b9292 in __GI___clone (/usr/lib/libc.so.6+0x100292)

Fixes: 4a5cd5d2bd ("steamcompmgr: disable Steam overlay for sub-command")
2020-08-31 12:18:47 +02:00
Pierre-Loup A. Griffais
6dd7f60540 Switch commit waiting over to polling the DMA-BUF fd.
Remove the implicit sync Vulkan fence hack, it took us 0.2ms of GPU time
to prepare the 1x1 copy to wait on.
2020-08-30 13:26:46 -07:00
Pierre-Loup A. Griffais
165946fad9 rendervulkan: fix typo and some easy validation errors.
Needs more correctness around layout transitions still.
2020-08-29 21:44:47 -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
4a5cd5d2bd steamcompmgr: disable Steam overlay for sub-command
If running through Steam, we want the overlay hooked into gamescope and
not the underlying game, or we'll get double overlay, and one with wrong
scaling.

This strips any token containing gameoverlayrenderer.so from LD_PRELOAD.
2020-08-28 18:16:13 -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
74f831f290 steamcompmgr: fix valgrind warning in size hints code. 2020-08-28 00:40:05 -07:00
Pierre-Loup A. Griffais
7fedd8251b steamcompmgr: zero-initialize some cursor stuff that used to be global. 2020-08-28 00:39:54 -07:00
Simon Ser
d3f3acde74 steamcompmgr: check message_type in NET_WM_STATE handler 2020-08-26 11:50:26 +02:00
Simon Ser
c6d7ef0be2 steamcompmgr: set WM_STATE
Closes: https://github.com/Plagman/gamescope/issues/79
Closes: https://github.com/Plagman/gamescope/issues/42
2020-08-26 11:50:26 +02:00
Simon Ser
535fa8c7e5 steamcompmgr: add _NET_WM_STATE to supported atoms 2020-08-26 11:50:26 +02:00
Simon Ser
9889d4f521 steamcompmgr: set _NET_WM_STATE_FOCUSED 2020-08-26 11:50:26 +02:00
Simon Ser
79ab59c05d
Update Mesa requirement
Building a Mesa branch is no longer needed. Instead, a recent enough
Mesa will do.
2020-08-14 12:43:39 +02:00
Simon Ser
3b9f8a6d85
Rename NET_WM_STATE_* Atom globals
Give them a less misleading name, because WM_STATE is a separate thing.
2020-08-12 12:04:45 +02:00
Simon Ser
aa853dbb76
steamcompmgr: use initializer for supported atoms
Makes it less error-prone to add atoms to the list.
2020-08-12 11:41:07 +02:00
Pierre-Loup A. Griffais
695fc4eb17 steamcompmgr: flip opacity default and ignore transparent windows for focus
Origin has a bunch of sub-windows that are fully translucent until remapped.
2020-08-04 18:25:39 -07:00
Pierre-Loup A. Griffais
272699656f steamcompmgr: also allow override redirect windows out-of-game
Only if there's no alternative. Useful for Steam updater screen.
2020-08-04 18:25:39 -07:00
Pierre-Loup A. Griffais
a24b3ba008 steamcompmgr: add focus debug optional spew 2020-08-04 18:25:39 -07:00
Simon Ser
d7132a2397
Remove unused CVulkanTexture::m_DMA 2020-07-30 13:38:05 +02:00
Simon Ser
dd4d035808
Fix DMA-BUF leak in CVulkanTexture with bFlippable
We were storing the DMA-BUF in a CVulkanTexture field, without using it
after BInit, and without cleaning it up on destroy.
2020-07-30 13:34:59 +02: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
Pierre-Loup A. Griffais
da81b37d07 Revert "Add wlr_buffer to commit queue"
This reverts commit 789f009a53.
2020-07-24 15:01:32 -07:00
Pierre-Loup A. Griffais
0757f2676b Revert "Copy commit queue in check_new_wayland_res"
This reverts commit 9c9a8093ee.
2020-07-24 15:01:31 -07:00
Pierre-Loup A. Griffais
fb2fd1127a Revert "Hold client buffers till KMS stops using them"
This reverts commit c9e11ebdbf.
2020-07-24 15:01:28 -07:00
Pierre-Loup A. Griffais
a39fddf909
Update README.md 2020-07-23 14:06:54 -07:00
Simon Ser
77722293f3 Don't use VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO_MESA for imported DMA-BUFs
We don't know whether clients create scanout-able DMA-BUFs.
2020-07-23 22:41:56 +02:00
Simon Ser
c9e11ebdbf Hold client buffers till KMS stops using them 2020-07-23 22:26:06 +02:00
Simon Ser
9c9a8093ee Copy commit queue in check_new_wayland_res
This will allow us to call wlr_buffer_lock/unlock in import_commit without
causing a deadlock.
2020-07-23 22:26:06 +02:00
Simon Ser
789f009a53 Add wlr_buffer to commit queue
This lets us keep the buffers for pending commits locked.
2020-07-23 22:26:06 +02: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
Simon Ser
7785ed9cdb
Upgrade to wlroots 0.11.0 2020-07-23 13:37:33 +02:00