Only works when switching to fbcon for now. We need to stop
page-flipping when the DRM FD is paused to support switching to another
compositor.
References: https://github.com/Plagman/gamescope/issues/6
win objects are allocated with `new`, so they need to be de-allocated
with `delete` instead of `free`.
==589398==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new vs free) on 0x61200017f140
(EE) failed to read Wayland events: Broken pipe
X connection to :1 broken (explicit kill or server shutdown).
#0 0x7f5468ae4720 in __interceptor_free /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:122
#1 0x559820f5c9a0 in finish_destroy_win ../src/steamcompmgr.cpp:1743
#2 0x559820f5ca6d in destroy_win ../src/steamcompmgr.cpp:1759
#3 0x559820f6163e in steamcompmgr_main ../src/steamcompmgr.cpp:2288
#4 0x559820f8e977 in steamCompMgrThreadRun() ../src/main.cpp:121
#5 0x559820f8e3e9 in void std::__invoke_impl<void, void (*)()>(std::__invoke_other, void (*&&)()) /usr/include/c++/9.3.0/bits/invoke.h:60
#6 0x559820f8e24f in std::__invoke_result<void (*)()>::type std::__invoke<void (*)()>(void (*&&)()) /usr/include/c++/9.3.0/bits/invoke.h:95
#7 0x559820f8e0b3 in void std:🧵:_Invoker<std::tuple<void (*)()> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) /usr/include/c++/9.3.0/thread:244
#8 0x559820f8dfae in std:🧵:_Invoker<std::tuple<void (*)()> >::operator()() /usr/include/c++/9.3.0/thread:251
#9 0x559820f8d7ba in std:🧵:_State_impl<std:🧵:_Invoker<std::tuple<void (*)()> > >::_M_run() /usr/include/c++/9.3.0/thread:195
#10 0x7f5468006b23 in execute_native_thread_routine /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:80
#11 0x7f546745346e in start_thread (/usr/lib/libpthread.so.0+0x946e)
#12 0x7f54673833d2 in clone (/usr/lib/libc.so.6+0xff3d2)
0x61200017f140 is located 0 bytes inside of 296-byte region [0x61200017f140,0x61200017f268)
allocated by thread T40 here:
#0 0x7f5468ae6968 in operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cc:104
#1 0x559820f595fe in add_win ../src/steamcompmgr.cpp:1548
#2 0x559820f614e8 in steamcompmgr_main ../src/steamcompmgr.cpp:2278
#3 0x559820f8e977 in steamCompMgrThreadRun() ../src/main.cpp:121
#4 0x559820f8e3e9 in void std::__invoke_impl<void, void (*)()>(std::__invoke_other, void (*&&)()) /usr/include/c++/9.3.0/bits/invoke.h:60
#5 0x559820f8e24f in std::__invoke_result<void (*)()>::type std::__invoke<void (*)()>(void (*&&)()) /usr/include/c++/9.3.0/bits/invoke.h:95
#6 0x559820f8e0b3 in void std:🧵:_Invoker<std::tuple<void (*)()> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) /usr/include/c++/9.3.0/thread:244
#7 0x559820f8dfae in std:🧵:_Invoker<std::tuple<void (*)()> >::operator()() /usr/include/c++/9.3.0/thread:251
#8 0x559820f8d7ba in std:🧵:_State_impl<std:🧵:_Invoker<std::tuple<void (*)()> > >::_M_run() /usr/include/c++/9.3.0/thread:195
#9 0x7f5468006b23 in execute_native_thread_routine /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:80
Thread T40 created by T0 here:
#0 0x7f5468a0e377 in __interceptor_pthread_create /build/gcc/src/gcc/libsanitizer/asan/asan_interceptors.cc:208
#1 0x7f5468006df9 in __gthread_create /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:663
#2 0x7f5468006df9 in std:🧵:_M_start_thread(std::unique_ptr<std:🧵:_State, std::default_delete<std:🧵:_State> >, void (*)()) /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:135
#3 0x559820f8ea10 in startSteamCompMgr ../src/main.cpp:126
#4 0x559820f95cfb in xwayland_ready ../src/wlserver.c:119
#5 0x5598210de191 in wlr_signal_emit_safe ../subprojects/wlroots/util/signal.c:29
#6 0x559820ff596b in xserver_handle_ready ../subprojects/wlroots/xwayland/xwayland.c:251
#7 0x7f5468744434 (/usr/lib/libwayland-server.so.0+0xa434)
#8 0x7ffc9796869f ([stack]+0x1f69f)
Activate libliftoff's internal log when layers are enabled and the parameter
'd' is provided.
Note: this needs some patches to libliftoff to make the debug readable that I
have proposed upstream.
Trying to layer onto planes should be continued when fb ids are set and
not the other way around. Here the assert also failed when only having
one layer.
It is enough to get the global cursor location when repainting it. So we do not
need to query the relative position. If later on we find this is not right we
should be still able to get the relative position from the surface position
instead of calling into XWayland.
Also it is not expected and apparently unnecessary to move the cursor in the
paint function. Therefore remove this call too.
With cursor position going through global variables we do not need to query the
global position anymore. Remove the MouseCursor function for that.
Furtheron the relative position getter is also not necessary, but let's remove
this one in a separate commit.
This commit also adds a debug line for debugging flaky focus changing.
Many code editiors remove trailing whitespace automatically making patches
difficult since often unrelated lines get changed with the same commit.
So remove the whitespace in the steamcompmgr file all at once in this separate
commit.
For now just mark one repaint per refresh interval without any particular
alignment, as that can be hard to get in nested. We'll use the display
timing extensions for that later.
We'll have it align properly in embedded mode soon.
- Add a commit wait thread that just waits for the work associated with
an in-bound dma-buff is done. We'd like to be getting a fence directly
from Wayland, but in the absence of that we'll make our own by tapping
into implicit-sync, DX11-style. gpuvis logging of the outcome of the
waits in the thread are consistent with the end of GPU work.
- Rework wayland commit handoff between wlserver and steamcompmgr to let
steamcompmgr have full access to the commit queue, letting it remove
elements in the middle and still keep going, compared to the previous
interface. This lets steamcompmgr get one commit per window per loop,
for now. We should be able to kick off waits and ref/unref resources
for all pending commits soon, with some work on the accounting first.
This should also fix an issue introduced recently where the overlay
could get really starved in embedded mode, as we were just getting
the first commit in the queue for a single frame.