Commit graph

862 commits

Author SHA1 Message Date
Trigg
610483bd23 steamcompmgr: Implement external overlay support 2022-01-11 00:09:33 +00:00
Joshua Ashton
9a26fa583a rendervulkan: Up layer count to 6 and document the layers we have 2022-01-11 00:09:33 +00:00
Joshua Ashton
89b145dbca rendervulkan: Replace flBorderAlpha with nBorderMask of layers
Allows us to fit more layers in push constants. We never use anything other than 0/1 anyway.
2022-01-11 00:09:33 +00:00
Joshua Ashton
68a68e6bb2 drm: Fix inverted CRTC_Y when rotated
This was doing 90deg logic here, not 270deg.
2022-01-07 17:15:43 +01:00
Georg Lehmann
7c94fc3437 rendervulkan: Compact descriptor set bindings. 2022-01-05 05:02:10 +00:00
Joshua Ashton
b8f66db496 steamcompmgr: Remove valid contents check
We hold onto base commits now -- no need to fhis logic when we can just test the layer count.
2022-01-05 05:00:59 +00:00
Joshua Ashton
2accc343f8 steamcompmgr: Fix returning valid contents 2022-01-05 05:00:59 +00:00
Georg Lehmann
7c5cc5e67e rendervulkan: Rework sampler cache.
Less awkward to use and also fixes a texture leak because the shared_ptr
to the texture is no longer stored in the sampler cache.
2022-01-05 05:00:46 +00:00
Joshua Ashton
95eba7e549 drm: Don't forget about modesetting + modesetting robustness
Makes it so that we don't forget about any required modesets we need to
undertake, and makes modesetting robust by trying again when compositing
(in case the error was not mode but plane related), and falling back to
the previous mode if that fails.

If we have no mode to fall back to then we abort, same if we fail our
mode fallback commit.

Co-authored-by: Simon Ser <contact@emersion.fr>
2021-12-21 22:11:33 +01:00
badsectoracula
bbfbf0dd8d
Update SDL window title from the focused window's title
* Update SDL window title from the focused window's title.

Instead of using the default "gamescope" title for the SDL window, this
makes the SDL window title be updated with the focused window's title
whenever a window is focused or whenever the focused window's title is
changed. "gamescope" is still used whenever a title cannot be obtained.

* Call SDL_SetWindowTitle from the sdlwindow thread.

This calls SDL_SetWindowTitle from the sdlwindow thread instead of from
wherever sdlwindow_title is called. sdlwindow_title stores the title
locally to be picked up by sdlwindow_update.

* Make SDL title update bool check atomic and use a mutex for title change.

* Ensure *all* accesses to g_SDLWindowTitle are behind the mutex lock.

* The atomic bool isn't really necessary with the mutex in place, so remove it.
2021-12-21 18:27:23 +01:00
Simon Ser
c1958be1d9 Drop leftover noop.h include 2021-12-20 14:09:39 +01:00
Simon Ser
11f89c1b15 Upgrade wlroots to 0.15.0 2021-12-20 10:22:17 +01:00
Georg Lehmann
0729954674 steamcompmgr: Fix undefined state of wayland_commit_queue after move. 2021-12-19 18:14:40 +01:00
Pierre-Loup A. Griffais
eba963b9fa drm: abort() on fatal flip failure
exit() would get stuck running exit handlers for global locks.
2021-12-18 00:49:20 -08:00
Joshua Ashton
d87fe5a00d steamcompmgr: Use std::move for tmp_queue
No point wasting cycles copying then freeing when we can just transfer ownership
2021-12-17 15:43:26 -08:00
Joshua Ashton
be1a784278 drm: Handle the same fb_id being held more than once
Ref this properly -- this can happen when a window is recreated sometimes
it seems.
2021-12-17 15:43:26 -08:00
Joshua Ashton
50ee712429 drm: Fix n_refs atomic check 2021-12-17 15:43:26 -08:00
Joshua Ashton
8ad367948f steamcompmgr: Always exit out if we don't have valid contents
This is solved by holding onto the base commit now so this isn't a problem.

Avoid situations where we try to paint with 0 layers.
2021-12-17 15:43:26 -08:00
Joshua Ashton
6f284f2cce steamcompmgr: Treat video underlay as a base plane if we have it -- otherwise treat the focus window as one when streaming
Fixes a case where we can get 0 layers.
2021-12-17 15:43:26 -08:00
Joshua Ashton
589fd61d58 rendervulkan: Refactor to use shared_ptr for VulkanTexture_t 2021-12-17 15:43:26 -08:00
Joshua Ashton
ee91053acc steamcompmgr: Use video underlay as base held commit if available 2021-12-17 15:43:26 -08:00
Joshua Ashton
0e7ef385d5 steamcompmgr: Move commit refs to shared_ptr
This is the right thing to do given a vulkanTexture could refer to muliple commits.
2021-12-17 15:43:26 -08:00
Joshua Ashton
ec92dc75e5 rendervulkan: Fix release barrier
Need to use our queueFamilyIndex as the src.
2021-12-17 11:58:06 +01:00
Pierre-Loup A. Griffais
a7b484135d steamcompmgr: acknowledge screenshot request once it's actually done 2021-12-16 17:18:36 -08:00
Pierre-Loup A. Griffais
0a8346384b steamcompmgr: fix touch scaling bugs
We want to scale to remote play main UI plane even when we skip it, since
that's the one that properly sized to be a fullscreen  proxy for game input.
2021-12-16 01:46:13 -08:00
Joshua Ashton
8f67acdeb3 sdlwindow: Only process mouse motion when we're focused
Annoying to have the cursor moving around or the game view having a moment when we're not focused on the window.
2021-12-16 08:49:13 +01:00
Joshua Ashton
4b48c80ed3 steamcompmgr: Fix transient override focus crash
Only should try to find overrides if we have a focus (ie. focusing the right appid) and only of the appid we want.
2021-12-15 22:38:00 -08:00
Joshua Ashton
ced63bf255 rendervulkan: Clean up some stuff dependent on k_nMaxSamplers 2021-12-15 22:37:50 -08:00
Joshua Ashton
c102e49c2f steamcompmgr: Only release commits when window is gone 2021-12-15 21:29:16 -08:00
Joshua Ashton
023948e22d rendervulkan: Fix dangling YCbCr descriptors 2021-12-15 21:29:16 -08:00
Pierre-Loup A. Griffais
11a3bfb199 rendervulkan: change default YUV mode to limited color range
That's what Remote Play uses, we can add metadata to pick eventually but that'll
work for now.
2021-12-15 16:45:03 -08:00
Pierre-Loup A. Griffais
99e7ccf74d steamcompmgr: add programmatic way to take screenshots. 2021-12-15 00:57:53 -08:00
Joshua Ashton
ec58813268 steamcompmgr: Flush XSelectInput before reading properties 2021-12-14 15:51:50 -08:00
Joshua Ashton
ad244097db steamcompmgr: Set set_ignore before XDamageSubtract
Seems to be common across X compositors to do this from what I have seen.
2021-12-14 15:51:50 -08:00
Joshua Ashton
966439e84b steamcompmgr: Defer focus setting in X event loop
Otherwise we can get BadWindow errors as the window may have been destroyed later in the event list.
2021-12-14 15:51:50 -08:00
Joshua Ashton
bb3fd430eb sdlwindow: Don't hide window in Steam mode
Enables testing held commits, etc better.
2021-12-14 15:51:50 -08:00
Joshua Ashton
e6726ccc3a steamcompmgr: Clean up dangling commits on shutdown 2021-12-14 15:51:50 -08:00
Joshua Ashton
2019359448 steamcompmgr: Release commits on Window destruction
We could still have these hanging out in the commit queue after import doing nothing.
2021-12-14 15:51:50 -08:00
Joshua Ashton
c85de4a59c steamcompmgr: Add debugging for commit refs 2021-12-14 15:51:50 -08:00
Simon Ser
5eec694ac0 Upgrade libliftoff
Fixes a bug with zpos ordering.
2021-12-14 19:11:40 +01:00
Jan Beich
9553362865 steamcompmgr: add missing header for libc++ after 296a3d498d
src/steamcompmgr.cpp:270:41: error: implicit instantiation of undefined template 'std::array<commit_t, 2>'
std::array<commit_t, HELD_COMMIT_COUNT> g_HeldCommits;
                                        ^
/usr/include/c++/v1/__tuple:219:64: note: template is declared here
template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array;
                                                               ^
src/steamcompmgr.cpp:1160:50: error: implicit instantiation of undefined template 'std::array<BaseLayerInfo_t, 2>'
std::array< BaseLayerInfo_t, HELD_COMMIT_COUNT > g_CachedPlanes = {};
                                                 ^
/usr/include/c++/v1/__tuple:219:64: note: template is declared here
template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array;
                                                               ^
2021-12-14 18:12:19 +01:00
Joshua Ashton
dd22f8db76 steamcompmgr: Fix validContents nullptr deref
We check for this below, we should check it here too otherwise it's pointless
2021-12-13 23:47:29 -08:00
Joshua Ashton
cf20a692d8 steamcompmgr: Add --fade-out-duration option
Allows controling the fade out duration without recompiling the whole compositor.
2021-12-13 23:47:29 -08:00
Joshua Ashton
95baa301c7 steamcompmgr: Implement fades 2021-12-13 23:47:29 -08:00
Joshua Ashton
8a84b4d7e6 drm: Remove assertion about base layer opacity
We want this for fades.
2021-12-13 23:47:29 -08:00
Joshua Ashton
0252f44ffe rendervulkan: Handle base layer opacity 2021-12-13 23:47:29 -08:00
Joshua Ashton
06cb10683a steamcompmgr: Cache and preserve base commit until we get a new one
Fixes black frames when focusing new windows without commits yet.
2021-12-13 23:47:29 -08:00
Joshua Ashton
296a3d498d steamcompmgr: Add framework for held commits 2021-12-13 23:47:29 -08:00
Joshua Ashton
a5af1a78c1 steamcompmgr: Avoid deadlock between import_commit and destroy_buffer
Very rarely we can see a deadlock between import_commit and destroy_buffer where:

- destroy_buffer is waiting on `wlr_buffer_map_lock` and has `wlserver_lock` (from up the chain)

- import_commit has `wlr_buffer_map_lock` and is waiting on `wlserver_lock`

To avoid this, we simply replace the lock_guard in import_commit with a unique_lock and manually unlock this before going into the section where we need to lock the wl_server.

This is safe for a few reasons:
- 1: All accesses to wlr_buffer_map are done before this lock.
- 2: destroy_buffer cannot be called from this buffer before now
     as it only happens because of the signal added below.
- 3: "References to elements in the unordered_map container remain
	  valid in all cases, even after a rehash."
2021-12-13 23:46:39 -08:00
Joshua Ashton
952949f1a1 steamcompmgr: Fix crusty cursor in some scenarios
The PNG spec says that alpha is not premultiplied, so we need to do that.

(Although there are some things that do use PNG with premultiplied alpha... but let's just ignore that for now and go with the PNG spec and what we are getting exported to us to use on Deck.)

Cursor in X must have premultiplied alpha, our blending setup breaks a lot if this is not true.
2021-11-26 21:55:40 +01:00