Commit graph

176 commits

Author SHA1 Message Date
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
c83b3cc514 screenshot: Announce version property 2022-09-12 23:33:54 +02: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
Alias Gram
657b9edad5 chore(logging): change config file error to info 2022-04-18 18:44:47 +02:00
columbarius
6cec421f92 screencast: improve logging for pipewire events
We should log buffer add and remove events in the debug loglevel, since
they signal starts, stops and renegotiations of the buffer transfer.
Additionaly logging the negotiated pwr_format should help classify
issues from the DEBUG loglevel.
2022-04-10 13:38:01 +02:00
columbarius
852e1c95c7 screencast: HACK set an arbitrary chunk size for dmabufs
Clients have wrongly used the chunk size to detect if a buffer was valid
or not. Since dmabufs might not have a well defined buffer size we will
set an arbitrary value until clients are patched.
2022-04-10 13:38:01 +02:00
columbarius
0683f7ca7e screencast: add option to force implicit modifier to be linear
Linear buffer layouts are supported by most gpu vendors and as such
should be compatible in mixed mutli gpu setup where the implicit
modifier of one gpu is not supported by the other.

This option should make xdpw work in these environemnts.

The option is marked as experimental since it might be removed if
explicit modifiers provide a better solution.
2022-04-10 13:38:01 +02:00
columbarius
9085996111 screencast: announce implicit modifier via PipeWire 2022-04-10 13:38:01 +02:00
columbarius
d89631c792 screencast: allocate dmabuf with implicit modifier
This is using the older gbm api without support for explicit modifiers.
This is required to support AMD gpus using the GFX8 or older
architecture and older intel gpus.
2022-04-10 13:38:01 +02:00
columbarius
b2c5a94e8c screencast: add linux_dmabuf to registry 2022-04-10 13:38:01 +02:00
columbarius
9d620273e5 screencast: create gbm device
This is done by using the first device returned by getDRMDevices2
containing a render node (DRM_NODE_RENDER).
2022-04-10 13:38:01 +02:00
columbarius
bae393a684 screencast: support modifiers in build_format
When announcing support for dmabufs via PipeWire this is done by adding
the SPA_FORMAT_VIDEO_modifier property to an EnumFormat. Producers can
choose between two different ways [1]:

* Supporting only implicit modifiers by adding the property as a sigle
  value together with the SPA_POD_PROP_FLAG_MANDATORY flag
* Support for multiple modifiers. This is done by announcing a
  SPA_CHOICE_ENUM array together with the use of the
  SPA_POD_PROP_FLAG_MANDATORY and SPA_POD_PROP_FLAG_DONT_FIXATE flag

[1] https://docs.pipewire.org/page_dma_buf.html
2022-04-10 13:38:01 +02:00
columbarius
6630525b7a screencast: implement wlr_frame_linux_dmabuf 2022-04-10 13:38:01 +02:00