Commit graph

162 commits

Author SHA1 Message Date
vaxerski
c0e2339555 screencast: send transform to pw 2023-04-25 17:16:24 +01:00
Lucas Alber
f9f08c802e
Fix build after 7d3da7e968 (#54) 2023-04-24 15:04:59 +01:00
vaxerski
bf035bf3d5 pw: set type for all planes 2023-04-14 17:29:17 +01:00
vaxerski
a7b7880172 screencast: send damage via pw 2023-04-14 17:27:28 +01:00
vaxerski
7fc2e78581 screencast: use spa-pod-dynamic 2023-04-14 17:22:16 +01:00
vaxerski
78dee83d77 screencast: add fallback for linear modifier 2023-04-14 17:14:41 +01:00
vaxerski
2366b4d415 internal: remove metadata cursor mode 2023-04-13 21:14:13 +01:00
vaxerski
7ca51f935e screencast: make restore persistent 2023-04-10 00:03:24 +01:00
vaxerski
ab8d54f6f6 feat: add session restore 2023-04-09 23:30:19 +01:00
Vaxry
510257c0e9
[WIP] Global Shortcuts impl (#35)
Implements the `GlobalShortcuts` portal via `hyprland-global-shortcuts-v1`

---------

Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
2023-04-09 13:47:05 +01:00
vaxerski
803c00db11 screencast: crudely allow metadata and ignore it 2023-04-05 22:23:59 +01:00
vaxerski
74128d2a97 minor fix for region sharing 2023-03-16 15:11:27 +00:00
vaxerski
8707444cf5 fix shell tab behavior in headers 2023-02-03 18:41:28 +00:00
vaxerski
a0fa7909cd nuke toplevel_mgr_bind 2023-02-03 16:50:06 +00:00
vaxerski
f8cdd28cc8 sanitize input to the picker 2023-02-03 12:14:28 +00:00
vaxerski
13db7db849 fix returnlist on no manager 2023-02-01 19:48:49 +00:00
vaxerski
ee73fca9cc Bind toplevel protos once before first screencast
Also style.
2023-02-01 17:49:29 +00:00
vaxerski
101b58d9c5 add missing s 2022-12-13 18:55:32 +00:00
vaxerski
9fb4fae94b bring back qt wayland platform 2022-12-13 00:55:12 +00:00
Vaxry
3c4c9969cc
Toplevel sharing Rev2 impl (#3)
* toplevel sharing rev2

* nix: fix build

* updated protocols

Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
2022-12-12 14:51:37 +00:00
vaxerski
756789211e export HIS to the picker 2022-12-05 23:20:49 +00:00
vaxerski
2a634b0a60 log more about screencast 2022-12-05 23:11:13 +00:00
vaxerski
4ac6a9af82 export xcursor size to avoid odd-sized cursors 2022-12-05 18:53:51 +00:00
vaxerski
cea7c28bae force wayland platform for qt in invoking picker 2022-12-05 00:37:10 +00:00
vaxerski
bd91bd0d4e pass env to popen cmd picker 2022-12-05 00:13:36 +00:00
vaxerski
8a4e83da96 prevent segfaults on no toplevel proto available 2022-12-04 23:18:10 +00:00
Vaxry
3c850a0336
Window sharing (#2)
* added window sharing support

* nix: add hyprland-protocols and streamline build

Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
2022-12-04 21:12:57 +00:00
Leftas
607ce73671
Change from wlr to hyprland so dbus would recognize different implementation 2022-12-04 19:57:30 +02:00
vaxerski
e2cfaf3eee minor nix fixes 2022-12-03 23:42:56 +00:00
vaxerski
37c76fd7d8 start at pos 7 to avoid a warn 2022-12-03 23:40:08 +00:00
vaxerski
2dc95fe02f Allow region sharing 2022-12-03 22:42:21 +00:00
vaxerski
80775707ea Implement hyprland-share-picker 2022-12-03 21:27:49 +00:00
columbarius
723934d0b0 screencast: check if a valid format was received from wlr_screencopy
When a screencast is started we do a roundtrip on get the offered
formats from wlr_screencopy. This roundtrip can fail [1]. In this case
the formats won't be initialized and we will just error out of the
screencast session.

[1] https://github.com/emersion/xdg-desktop-portal-wlr/issues/214
2022-06-09 11:19:54 +02:00
columbarius
0bbd652c1c screencast: send pesentation timestamp via PipeWire 2022-06-01 21:12:46 +02:00
columbarius
b5491df0c0 screencast: destroy session if output is removed
We teardown all existing screencast_instances using the removed output
by destroying the frame, removing all timers and then marking the
instance as ready for teardown so we can destroy it after the last connected
session is closed.

Any wlr_screencopy_frame_v1 has to be destroyed before the connected
output can be removed. Otherwise wlr_screencopy_frame_v1_destroy
segfaults the whole program. To ensure this we will make all frame
callbacks safe to be triggered for a previous destroyed frame.
2022-05-31 01:23:34 +02:00
columbarius
ab0a07142d screencast: use wl_array for format-modifier-pairs
wl_array is a better fit than wl_list. It's less intensive on memory and
fits nicely with the flow of dmabuf_feedback announcing all format
modifier pairs at once and reseting them on change.
2022-05-31 01:22:48 +02:00
columbarius
2d54aeb36d screencast: fix handler logging for tranche_formats 2022-05-26 09:39:14 +02:00
columbarius
e70a1efa43 screencast: skip duplicated format-modifier pairs 2022-05-26 09:00:40 +02:00
columbarius
2219db7508 screencast: use dmabuf_feedback
The compositor can announce it's default rendering device via
linux_dmabuf_feedback as the main_device [1]. We should use this device
whenever possible. If aquiring this device fails we are adviced to use
force linear layout on buffers allocated with the implicit api.

With linux_dmabuf_v1 the modifier event is deprecated. Instead the
format_table event in combination with the tranches of
linux_dmabuf_feedback_v1 has to be used.

[1] https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/unstable/linux-dmabuf/feedback.rst
2022-05-26 09:00:40 +02:00
columbarius
14852efb05 screencast: Remove MESA hack from the old gbm api fallback
Calling gbm_bo_create_with_modifiers2(...) and setting the modifiers
pointer to NULL for the same result as gmb_bo_create(...) is a MESA hack,
which I missed to remove from 84282e9b5f.
2022-05-05 18:13:02 +02:00
columbarius
29f86168b6 screencast: announce supported explicit modifiers
We query the supported modifiers via a wrapper and announce them via
PipeWire.

This wrapper queries the supported formats from wlroots and returns them
as a simple array. The purpose of this wrapper is to ease the use of the
query functions which are kept in the style of the equivalent egl
queries.
2022-04-24 21:46:39 +02:00
columbarius
18efde6dde screencast: add function to query supported modifiers for a format
This function follows the structure of the equivalent function in egl
operating on basis of the announced format modifier pairs by wlroots.
2022-04-24 21:46:39 +02:00
columbarius
2ca2b7b603 screencast: get supported format modifier pairs from wlroots
Registering a zwp_linux_dmabuf_v1_listener gives access to the supported
format modifier pairs of the compositor.

This handler emits events for each format modifier pair. Those are stored
and will later be used to announce capabilities via PipeWire.
2022-04-24 21:46:39 +02:00
columbarius
b9c4472c50 screencast: stop assuming that allocation with implicit modifier works
It has shown that the assumption: "Allocation with implicit modifier will
always be available" doesn't hold true in all cases. Thus if allocation
of any dmabuf fails we mark the session to avoid dmabufs, thus falling
back to shm transport.
2022-04-24 21:46:39 +02:00
columbarius
84282e9b5f screencast: fixate modifier from PipeWire format negotiation result
This implements the modifier fixation procedure. The producer of a
stream has to ensure that it can create a buffer with the negotiated
properties. To do that we will take the result of the intersection of
supported modifiers by PipeWire and select the "best" modifier from that
list.

To do this we do the following allocations and fixate on the
modifier of the created buffer should the allocation suceed.
* Try to allocate a buffer with explicit modifiers using the list
  provided by PipeWire
* Walk the list of modifiers and do single allocations for implicit and
  linear modifiers using the old api.

If none of the allocations above succeed we fall back to shm buffers.
This is implemented in the next commit.

If an allocation was successfull we fixate the modifier with
fixate_format().
This function creates an EnumFormat like build_format, but will only
announce support for a single modifier.
It is used to finish the negotiation process by announcing it together
with EnumFormats of our full supported formats.
2022-04-24 21:46:39 +02:00
columbarius
a70a1195d4 screencast: check if pipewire returns a modifier list
Using SPA_POD_PROP_FLAG_DONT_FIXATE pipewire can return a list of
supported modifiers. In that case are we responsible to select one
modifier and fixate it.
2022-04-24 21:46:39 +02:00
columbarius
77bcd14ad2 screencast: support allocation of buffers with explicit modifiers 2022-04-24 21:46:39 +02:00
columbarius
1a7276068b screencast: support multiplane buffers with xdpw_buffer 2022-04-24 21:46:39 +02:00
columbarius
5799adeb57 screencast: enqueue pipewire when screencopy failed
Keeping a buffer when the copy failed has the risk of having this buffer
removed while we wait for the next buffer_done event. To prevent this we
just enqueue the buffer marking it as corrupt. A new buffer will be
dequeued at the buffer_done event.
2022-04-24 21:46:39 +02:00
columbarius
2f32d17448 screencast: remove swap_buffer function
Dequeuing a new buffer imidiately creates a problem when the buffer is
destroid while renegotiation of a valid modifier because we can end up using
a buffer which was freed while waiting for the buffer_done event. Then
xdpw will segfault when requesting a copy with a nonexisting buffer. To fix
this we can just dequeue a buffer right before we need it. This makes
the fallback via on_process obsolete since we dequeue the buffer at the
lates possible time.
2022-04-24 21:46:39 +02:00