Commit graph

1433 commits

Author SHA1 Message Date
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
Joshua Ashton
93e4d94a78 steamcompmgr: Add --cursor-hotspot
Allow setting the hotspot for the custom cursor.
2021-11-26 21:45:39 +01:00
Joshua Ashton
4ee56a1e75 rendervulkan: Do not premultiply color
The surface should already have premultiplied alpha.

Gets us to how we look with planes.
2021-11-22 21:48:58 -08:00
Joshua Ashton
23430084e2 rendervulkan: Blend in linear space
We must blend in linear space, not SRGB space or we get these horrible browns.

Gets us closer to how this looks with planes.
2021-11-22 21:48:58 -08:00
Bas Nieuwenhuizen
7e93200e08 Dedupe and memoize fb_id and vulkan texture per buffer.
Also split lock/unlock from import/drop in drm, because we still
need the lock/unlock semantics to signal to the app when ti can
reuse the buffer.
2021-11-22 21:45:52 -08:00
Bas Nieuwenhuizen
5fc9df512c Add wlr_buffer destroy callback.
Couldn't find a wlr_buffer creation callback, so doing some
work on commit.
2021-11-22 21:45:52 -08:00
Bas Nieuwenhuizen
c0d745baac Use atomics for CVulkanTexture refcounts.
Otherwise the double access on destruction could be very messy. The
default for all these operations is the cst memory order which is
certainly good enough though technically not the most optimal.
(Could do acq_rel for all of them).
2021-11-22 21:45:52 -08:00
Bas Nieuwenhuizen
3a1776f0f8 Properly lock the id->CVulkanTexture map.
Only locks the map itself, the lifetime of the texture itself has
still to be known to be valid.
2021-11-22 21:45:52 -08:00
Bas Nieuwenhuizen
5f6940f7d6 Make the drm fb map threadsafe.
It could be accessed both in the pageflip handler and in the main
thread.
2021-11-22 21:45:52 -08:00
Joshua Ashton
df781455cf steamcompmgr: Cleanup focusable loops
Use for-each to make things much easier to follow here.
2021-11-22 21:43:32 -08:00
Joshua Ashton
584215dc47 steamcompmgr: Take into account appids for override redirect resolution 2021-11-22 21:43:32 -08:00
Joshua Ashton
d4c8880bdf steamcompmgr: Workaround zpos bug
Super rarely we see bugs when the zposes differ from these values.

For now, let's workaround that and have a define to enable the behaviour so we can fix this in kernel later.
2021-11-22 21:43:32 -08:00
Joshua Ashton
5d9ace2b00 steamcompmgr: Resolve transient override redirects
Fixes dropdowns in Origin.
2021-11-22 21:43:32 -08:00
Joshua Ashton
72bc8ec56f steamcompmgr: Bail presentation if no windows have valid commits
Fixes some black frames in some seamless boot on Deck as of 39574a86b6d54d786f057a7a1951e690ca49b370
2021-11-22 21:43:32 -08:00
Joshua Ashton
623c457721 steamcompmgr: Make sure to repaint on focus window change 2021-11-22 21:43:32 -08:00
Joshua Ashton
6697abc766 steamcompmgr: Position cursor and override windows accordingly 2021-11-22 21:43:32 -08:00
Joshua Ashton
6402b5cd40 steamcompmgr: Fix child window cursor barrier
If our input focus is ever a child window, we need to account for its X/Y offset in the check for warping it.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-11-22 21:43:32 -08:00
Joshua Ashton
7fd1f3c930 steamcompmgr: Implement support for override redirect windows 2021-11-22 21:43:32 -08:00
Joshua Ashton
dbdf1095f8 rendervulkan: Add --composite-debug
Adds a --composite-debug flag for displaying frame markers on alternating corners of the screen or rotating in a localized square when compositing.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-11-22 21:40:10 -08:00
Simon Ser
8be45451d9 Introduce --generate-drm-mode 2021-11-20 16:01:39 -08:00
Joshua Ashton
10dd0322d4 steamcompmgr: Resolve transient links before determining input focus
Helps with launchers like FO:NV and other games where we end up having the visuals disjoint from what we actually want to input to.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-11-20 16:00:21 -08:00
Simon Ser
e8dab4efe0 Drop unnecessary typedef 2021-11-10 18:30:47 +01:00
Simon Ser
1a2fbd5fea Switch libliftoff submodule URL to gitlab.fdo 2021-11-09 11:27:32 +01:00
Pierre-Loup A. Griffais
6831e6df2c steamcompmgr: don't repaint on focus change
This'll repaint an empty texture we don't want in a lot of cases.

Reverts part of 7796ffc130.
2021-11-07 22:46:26 -08:00
Pierre-Loup A. Griffais
5e7dcd30f8 steamcompmgr: don't focus random windows
If we don't have -e, everything will have a fake gameID to get focus.
2021-11-07 21:01:56 -08:00
Simon Ser
b3b8d60c00 Disable Xwayland touch pointer emulation
Depends on https://github.com/swaywm/wlroots/pull/3289
2021-11-02 12:21:12 +01:00
Simon Ser
78a2496386 pipewire: set CORRUPTED flag when buffer params mismatch 2021-11-01 14:51:03 +01:00
Simon Ser
6be82ccabb Copy Vulkan textures in PipeWire thread 2021-11-01 10:01:32 +01:00
Simon Ser
e80e4393de Add CVulkanTexture::{m_width,m_height} 2021-11-01 09:56:08 +01:00
Simon Ser
49fb59ac56 Don't use std::unique_ptr for screenshot textures
We need to keep the screneshot textures around if they are still
ref'ed when we re-make the swapchain. std::unique_ptr makes this
impossible. Switch to std::shared_ptr, and get rid of the nLockRefs
field.
2021-11-01 09:44:51 +01:00