Commit Graph

12535 Commits

Author SHA1 Message Date
Wim Taymans
6aa690fa8d pipewire: add a -P option to set context properties
Add a -P (--properties) option to create the context with custom
properties. This can be used to control the modules that are loaded, for
example when they have conditions.
2024-04-10 18:13:01 +02:00
Wim Taymans
18ce166735 protocol-native: cleanup when starting a server fails 2024-04-10 18:12:14 +02:00
Wim Taymans
d672e8fbf2 stream: use the pw_impl_node implementation details
We can use the position/clock and driving variables from the
pw_impl_node instead of keeping another copy around.
2024-04-10 17:33:30 +02:00
Wim Taymans
06905cd53b impl-node: improve set_io some more
Make sure we first set up our own state before calling into the
implementation. That way, the implementation can look at the new state.
2024-04-10 17:22:34 +02:00
Wim Taymans
a683049986 impl-node: only become driving when we are a driver
We don't just need to check the clock and position clock id, we also
need to be able to become a driver before we can be driving.
2024-04-10 16:45:18 +02:00
Wim Taymans
39ca1bb9ed mem: MAPPABLE -> UNMAPPABLE
Change the flag from MAPPABLE to UNMAPPABLE to ease compatibility.

Older servers with newer client will not set the flag and so memory is
mappable for the client.
Newer server will set the flag but the client will ignore it and act
like before.
2024-04-10 13:11:54 +02:00
Wim Taymans
8115bf3eeb protocol-native: send debug to right topic 2024-04-10 13:11:17 +02:00
Robert Rosengren
95127d8a18 gst/src: fix crash when current_caps is NULL
gst_pad_get_current_caps may return NULL and passing that into
gst_caps_is_equal may result in fatal critical log due to the
"g_return_val_if_fail (GST_IS_CAPS (caps1)" check. Fix by checking for
NULL to avoid this.
2024-04-10 09:17:14 +00:00
Wim Taymans
c534acac46 spa: handle empty values better
Make sure the properties are not empty before trying to access them.
2024-04-10 11:08:40 +02:00
Wim Taymans
61af61a4b3 v4l2: handle empty properties gracefully
When a property is not found or is empty, go on to the next format
instead of failing.

See #3959
2024-04-10 11:06:44 +02:00
Wim Taymans
51c2b02e9e client-node: pass the right object to functions
These functions are not really used so not currently a problem.
2024-04-10 10:44:03 +02:00
Wim Taymans
7007ffcae1 impl-node: keep some state consistent
The target.id might be needed to find existing targets.
Update the properties after setting the initial state for the node, it
is a driver for itself and the properties can make it a driving node
when the driver property is set.
2024-04-10 10:26:00 +02:00
columbarius
c223e02d9b vulkan: Complete vulkan_pass
vulkan_pass now contains everything required for a single blit pass.
2024-04-09 09:05:03 +00:00
columbarius
11ff1471e9 vulkan: Cache buffer_type
All buffers should have the same type.
2024-04-09 09:05:03 +00:00
columbarius
f935a191ad vulkan: Move vulkan_pass handling to filter
The current buffers are directly tracked by vulkan_pass.
2024-04-09 09:05:03 +00:00
columbarius
75daa140f3 vulkan: Split buffer import into CPU and GPU part 2024-04-09 09:05:03 +00:00
columbarius
3f47825082 vulkan: Introduce vulkan_pass for blit operations 2024-04-09 09:05:03 +00:00
columbarius
522546e8d3 vulkan: Sync buffers on in and export in blit 2024-04-09 09:05:03 +00:00
columbarius
f10e8d2717 vulkan: Export functions to handle implicit_fd 2024-04-09 09:05:03 +00:00
Martin Geier
5c8799a480 alsa-pcm: set threshold to final value before set_swparams is called
This patch fixes use case, when disable_tsched is set and
api.alsa.period-size is set to value different from default quantum size.

In a such configuration, threshold needs to be set to a final value
before snd_pcm_sw_params_set_avail_min is called to get IRQs with
right timing.

Avail minimum is calculated from a threshold set in the check_position_config.
The method returned different value for threshold right before playback
started and after the playback started. Therefore threshold used in
the snd_pcm_sw_params_set_avail_min was incorrect.

Force the check_position_config to use configured values when called
from spa_alsa_prepare as this method is called when starting new playback
and the state->period_frames and the state->rate are already known.

Signed-off-by: Martin Geier <martin.geier@streamunlimited.com>
2024-04-09 09:03:49 +00:00
Martin Geier
4c11a2aa9a alsa-pcm: start playback immediately if there is start delay set
Without this change, playback_ready or capture_ready was called
immediately after spa_alsa_start even tho start-delay was set.
Ready function was called with not precise "nsec" value, as "nsec"
plus latency should return time when the next buffer should be played
which wasn't true as start-delay was not included.

Now the playback is started immediately when the start_delay is set.
The alsa_do_wakeup_work is still called immediately but two things can
happened. Either start-delay is smaller then max_error and *_ready
function is called immediately, or start-delay is bigger then max_error
and state->next_time will be updated to correct value.

Signed-off-by: Martin Geier <martin.geier@streamunlimited.com>
2024-04-09 09:03:49 +00:00
Martin Geier
1e6dad14d3 alsa-pcm: use headroom to calculate minimum available frames for non time scheduling
Alsa needs to call handler soon enough to have headroom plus threshold
frames in the buffer and not only threshold left.

Signed-off-by: Martin Geier <martin.geier@streamunlimited.com>
2024-04-09 09:03:49 +00:00
Martin Geier
b4ed8dcf14 alsa-pcm: do not allow headroom plus threshold be bigger then the alsa buffer
Headroom are extra samples available in alsa buffer on top of a threshold.
Its use to prefill alsa buffer with silence before the playback starts
and later its use to calculate target number of a frames in the alsa buffer
when get_status is called. Target is calculated as headroom plus
threshold, which should be smaller then buffer size to make sense.

Signed-off-by: Martin Geier <martin.geier@streamunlimited.com>
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2024-04-09 09:03:49 +00:00
Carlos Rafael Giani
695f236f5f alsa-compress-offload-device: notify observers when profile changes
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2024-04-09 09:03:49 +00:00
Martin Geier
d6184bd9bb alsa-pcm-device: notify observers when profile changes
Signed-off-by: Martin Geier <martin.geier@streamunlimited.com>
2024-04-09 09:03:49 +00:00
columbarius
7206980023 vulkan: Sync renderer for blit filters
A spa_node has callback both on the main and data thread, which can
modify the internal state of vulkan_blit_state. Especially critical are
functions, which might drop buffers currently in use. To mitigate this
a read-write lock is used. The data thread shall try to aquire a read
lock before accessing the buffers, while the main thread has to aquire
exclusive access via a write lock before modifying the buffers.
2024-04-08 20:24:30 +00:00
columbarius
2010fa1349 vulkan: Name params 2024-04-08 20:24:30 +00:00
Wim Taymans
34c8322986 impl-node: count missed wakeups as xruns 2024-04-08 17:02:20 +02:00
Wim Taymans
8ce5211a64 impl-node: run recovery cycle immediately
There is no reason to use the fd to schedule process_node, we can call
it directly when we detect an underrun need to complete the cycle with
whatever data made it to the driver.

This avoids starting the graph while the process_node is running and
avoids some stuttering.

See #3937
2024-04-08 15:58:38 +02:00
Pauli Virtanen
47c080496f CI: fix pages build stage
build_on_fedora_html_docs needs to be on earlier stage than pages so
that it can find the artifacts.
2024-04-06 11:17:12 +03:00
Arun Raghavan
e4da3b95f5 alsa-pcm: Fix copy-pasto while listing ctls
Can cause a crash on startup under some circumstances.
2024-04-06 07:25:39 +00:00
Arun Raghavan
6c348e0600 ci: Avoid running pages build on merge requests 2024-04-05 11:49:41 -04:00
Arun Raghavan
ff95fcd901 ci: Switch only/except to rules
Only and except are deprecated, at least don't seem to be working for
the pages job.
2024-04-05 11:48:19 -04:00
Arun Raghavan
dedb086148 ci: Make syntax highlighting a bit happier
At least neovim's YAML parser doesn't like the ' ' without a leading
space.
2024-04-05 11:48:19 -04:00
Wim Taymans
cb716bcce7 impl-node: set_io on the port mixers 2024-04-05 15:55:12 +02:00
Wim Taymans
e9f4b55eb2 impl-node: set info.id as well
This is updated from the clock id a little later but we need it earlier
in the initialized event.
2024-04-05 15:53:13 +02:00
Wim Taymans
060052206f impl-node: add pw_impl_node_set_io()
Implement pw_impl_node_set_io() and do all the things that need to be
done in it, such as taking the clock.id, checking for driver etc.

We can then remove some code that tries to reimplement this, most
notably in the remote-node (where it was missing updates to the
target_rate and target_quantum and maybe related to #3845.
2024-04-05 13:16:46 +02:00
Wim Taymans
74de723ecc impl-node: improve node activation
Only activate the nodes when it was not-triggered, do this check with an
atomic compare-and-swap so that we only activate a node once.

We might be able to use this later to make sure that we resume the
untriggered peer nodes when we remove a node from the graph.
2024-04-04 22:01:44 +02:00
Wim Taymans
9cb4d820d5 impl-node: don't report xrun when pending <= 0
We might decrement too much but that would mean the driver was triggered
at some point and we don't really have an error.

Improve some debug
2024-04-04 22:01:01 +02:00
Wim Taymans
4db96d2197 impl-node: fix debug of do_move_nodes
Pass the old driver around so we can use it in debug. The new driver is
the one set in node->driver_node.
2024-04-04 21:00:50 +02:00
Wim Taymans
0633be3c12 node: add a cycle counter to the position
So that we can count the number of times the graph is scheduled.
2024-04-04 20:47:43 +02:00
Wim Taymans
f366167278 settings: remove link.min-buffers option again
The min should always be 1. We have other ways of bumping the number of
buffers to 2, like the ASYNC allocation flag which we can set if we are
also doing some async scheduling. We could make this an option later.

Otherwise, we would also allocate 2 buffers by default between the mixer
and the node, which is unnecessary.
2024-04-03 15:27:05 +02:00
Wim Taymans
dbedd09d42 settings: add link.min-buffers option
Add link.min-buffers option to set the minimum amount of buffers to
create for links. Set this by default to 2 because we really need two
now in case the sink xruns and does async mixing.

Make this an option because in low-memory cases and when xruns are not
expected, we can set this to 1.
2024-04-03 15:02:30 +02:00
Wim Taymans
5829276dbb client-node: fix array length debug 2024-04-03 13:29:27 +02:00
Wim Taymans
a01a33aa75 impl-node: improve xrun handling
To check if the driver was not completed, check the pending state
instead of the status. This is more correct and we can do this a little
smarter by swapping the current state with 0 atomically.

When we detect a non-zero pending state, wake up the driver node.
Because we atomically swapped 0, we are the only ones doing this and it
will make the node process whatever was in the input ports instead of
underrunning.

Running 2 apps outputting to a sink and pausing one will still play the
output of the other one, this way.

See #3509
Fixes #3937
2024-04-03 11:18:46 +02:00
Wim Taymans
208a343d9f module-ffado: add ffado.rtprio and ffado.realtime
Add two properties to control the realtime ffado thread and its
priority.

See #3558
2024-04-03 09:30:38 +02:00
Wim Taymans
986de92521 buffers: add support for mandatory metadata
Add a SPA_PARAM_BUFFERS_metaType in the Buffers object. This contains a
bitmask of the mandatory metadata items that should be included on a
buffer when using this Buffers param.

Make the buffer allocation logic skip over the Buffers params that
require unavailable metadata.

This can be used to, for example, enforce specific metadata to describe
extra buffer memory (such as the meaning of generic file descriptors).

One such use is the explicit sync, where an extra buffer data is needed
for the sync fd along with metadata that contains the sync_point.
2024-04-02 12:28:21 +02:00
Wim Taymans
a5c8100666 buffers: do some cleanups
Parse the metas right after we fixate the params and collec them in the
metas array. We don't have to loop twice and then we can simply pass the
prepared metas to alloc_buffers.

In case there are multiple Buffers params, take the first valid one and
ignore invalid ones.
2024-04-02 12:28:16 +02:00
Wim Taymans
f3fe20bdde buffer: add GenericFd memory type
Add a Generic fd type. These could be eventfd or timerfd, the meaning
can depend on extra metadata.
2024-04-02 12:28:09 +02:00
Wim Taymans
77f3b7f6e4 examples: set the MAPPABLE flag for MemFd 2024-04-02 12:28:01 +02:00