Commit graph

308 commits

Author SHA1 Message Date
Wim Taymans
3d2f5f2ab1 link: go to PAUSED when mixers have buffers 2019-07-29 17:09:19 +02:00
Wim Taymans
5aba40752d node: use activation to check for completed graph
The driver node is not scheduled on the server side and so we only
know if it finished by checking the activation.
2019-07-29 17:07:37 +02:00
Wim Taymans
e76a7abceb Add support for client fd memory
Remove the node buffers reply again. We don't need it. Instead add a
new method to the client-node to upload an array of buffer datas.
This method is called after the client has allocated buffer mem. It
will update the buffers on the server side with the client allocated
memory.

Wait for the async reply of use_buffers when doing alloc_buffers so
that we can get the updated buffer mem before we continue.

Let the link follow the states of the ports.

Add some error code to the port error states.

Add PW_STREAM_FLAG_ALLOC_BUFFERS flag to make the client alloc buffer
memory.
2019-07-26 16:17:39 +02:00
Wim Taymans
deb6c52f76 node: remove port_alloc_buffers
Remove the now obsolete port_alloc_buffer, rework to use the
port_use_buffers with the ALLOC flag.
2019-07-25 14:08:43 +02:00
Wim Taymans
8590ac158b node: add flags to port_use_buffer
Remove the CAN_USE_BUFFERS flag, it is redundant. We can know this
because of the IO params and buffer params.

Add flags to the port_use_buffer call. We also want this call to
replace port_alloc_buffer. Together with a new result event we can
ask the node to (a)synchronously fill up the buffer data for us. This
is part of a plan to let remote nodes provide buffer data.
2019-07-25 13:19:39 +02:00
Wim Taymans
2caf81c97c mem: improve memory handling
Add a memory pool to manage blocks of memory. Make it possible
to allocate and import blocks.

Add add_mem and remove_mem to the core events to signal a client
of a block of memory. Remove the client-node add_mem.

Make a global pool for memory and a per client pool where we
import and share the memory we need with the client.

Use the new memory pool to track and map memory in clients.
2019-07-23 17:46:43 +02:00
Wim Taymans
03eeb945f3 daemon: add support for properties in the config file
Make a set-prop command to set a property from the config file
into a pw_properties. Pass this to the pw_core_new() and the
main-loop to tweak some stuff.

Move some warns to errors
2019-06-20 15:19:28 +02:00
Wim Taymans
db88e9f954 System: More work on making system functions pluggable
Move the epoll functions to the system functions and make the loop
use those. Use simple mask for events instead of enum.
Add the used system api in pw_loop.
Add System API to spa_support and use it where possible.
Pass the system API used in the realtime loops in spa_support as
well and use this in the realtime paths.
Improve bootstrapping, load only the log and cpu interfaces because
those can/need to be shared between instances. Let the core load
the other interfaces.
Add keys to configure the System and Loop implementations used in
pw_loop.
2019-06-06 15:31:53 +02:00
Wim Taymans
b9d9042695 core: add method to add and find spa factory libraries
Make a method to add a mapping between a factory name regex
and the library it is in.
Add a method to find the library for a given factory name.
2019-05-31 14:58:59 +02:00
Wim Taymans
e9ecc47696 clean up proxy and resource api
Remove override for resources, it can't work in general.
Rename method to add_object_listener to add a listener for
events/methods from the remote object.
Rename some methods to _call to call the interface and _notify
to notify the listeners.
Remove unused client event to be notified of resource
implementations.
2019-05-29 10:39:24 +02:00
Wim Taymans
857b2a0cfb spa: add result type
We need this to know the type of result, especially when serializing.
2019-05-28 13:59:48 +02:00
Wim Taymans
973a92b49d device: add free signal 2019-05-27 15:58:50 +02:00
Wim Taymans
ff946e3d4b interface: add an interface struct
The interface struct has the type,version and methods of the
interface.
Make spa interfaces extend from spa_interface and make a
separate structure for the methods.
Pass a generic void* as the first argument of methods, like
we don in PipeWire.
Bundle the methods + implementation in a versioned inteface
and use that to invoke methods. This way we can do version
checks on the methods.
Make resource and proxy interfaces that we can can call. We
can then make the core interfaces independent on proxy/resource and
hide them in the lower layers.
Add add_listener method to methods of core interfaces, just
like SPA.
2019-05-23 12:59:24 +02:00
Wim Taymans
448c1937ad hook: separate spa_callbacks from the hook
Make a spa_callbacks with just the functions and data and use this
in the hook and objects.
2019-05-15 12:17:52 +02:00
Wim Taymans
903cbeb7c1 hook: handle port and factory implementation with hook
This way we can also handle the version number.
2019-05-14 18:08:02 +02:00
Wim Taymans
23d4ed62dd device: rename internal variable for consistency with node 2019-05-14 18:06:48 +02:00
Wim Taymans
d39d15b0d9 global: keep track of child globals
Keep track of the child globals and unregister when the parent
is unregistered.
2019-05-14 12:07:30 +02:00
Wim Taymans
04c153d410 global: add permissions_changed event 2019-05-13 17:24:33 +02:00
Wim Taymans
4e70cddf1d core: don't remove client resource in hello
Keep the client resource of a client around and make sure we don't
destroy it in hello.
2019-05-10 12:36:28 +02:00
Wim Taymans
a804b71267 core: destroy all resources on hello
Destroy all resources (except the core) for a client when it
does a hello. This typically needs to be done after passing the
connection fd from one client to another.
2019-05-10 11:56:30 +02:00
Wim Taymans
9ec3e3ab6d private: set min quantum to 32
Going as low as 32 is possible now with the better clock rate
estimation.
2019-04-25 13:04:44 +02:00
Wim Taymans
f8513029a1 node: cleanup, rename slave list 2019-04-24 16:56:18 +02:00
Wim Taymans
9b1da77bfc node: remove obsolete enabled state
We will create/destroy nodes instead of enabled/disable
2019-04-24 15:39:29 +02:00
Wim Taymans
092a0c660d make bitfields unsigned
Remove driver property from client-node of client-stream.
2019-04-10 17:52:42 +02:00
Wim Taymans
32f039e2e5 core: rework how nodes are added to a driver
Add a function to recalculate all nodes associated with a driver by
iterating the graph for each driver node. We used to do this in an
incremental way, which is easy to join graph but expensive to
split.

A full scan simplifies some things and we can't avoid it when we
need to calculate latencies later. It will also simplifies assigning
master and slave roles to drivers when the graphs are joined/split.

When we link/unlink or add/remove nodes, recalc the graph.
2019-04-10 16:19:10 +02:00
Wim Taymans
b163dc9114 private: define max params 2019-03-18 16:10:36 +01:00
Wim Taymans
3049964031 stream: parse PropInfo and make controls
Parse the PropInfo params and make pw_stream_control elements.
Only emit control changes when something changed.
2019-03-18 11:19:08 +01:00
Wim Taymans
9245c81227 client-node: add get_node method
Make a get node method that binds to the server side node of the
client-node immediately. use this in the remote_export and always
return a node proxy.

Use the node proxy to get property updates and signal those in the
stream.
2019-03-15 20:29:34 +01:00
Wim Taymans
24117b33c7 control: make control links many to many
Output controls can be linked to many input controls and many input
controls can receive input from many output controls. Keep the control
link information inside the link.
2019-03-14 12:04:20 +01:00
Wim Taymans
7b3e7e2813 proxy: call core_proxy_delete in pw_proxy_destroy
Destroying a local proxy will also attempt to destroy the remote
resource unless the server already did that and told us to remove
the proxy.

Fix some cleanups.
2019-03-13 16:24:33 +01:00
Wim Taymans
3281737199 link: keep per link buffer negotiation state
Keep buffers cached on output ports.
Complete the link to PAUSED when we have negotiated buffers on
input and output.
2019-03-11 12:35:04 +01:00
Wim Taymans
7cdc13b281 node: improve driver changes
Reimplement driver changes without corrupting our lists.

Keep track of unfinished graph and dump state of nodes.
2019-03-08 11:37:52 +01:00
Wim Taymans
b357b7a7da scheduling: don't use the graph helpers.
Simplify the scheduling by using simple lists and removing the
subgraphs etc..

Make the driver node trigger all nodes it manages and when they
complete, trigger the driver node to finish the graph.
2019-03-06 20:33:55 +01:00
Wim Taymans
f0eb59bc75 port: allocate only from output ports
We don't need to use the mix_id to allocate, the allocation is
always shared between all output mixer ports
2019-03-06 10:30:27 +01:00
Wim Taymans
dcbe94c55a port: simplify states
Remove the mix states, we can get rid of them when:

The format is the same for all mixer ports. Set the existing
format on new mixer ports. When the first format is set, the port
becomes READY. When all mixer ports are cleared the port goes back
to CONFIGURE.

Only output ports allocate and manage buffers, input ports share
the buffers of the peer output port on the link.
2019-03-06 09:53:41 +01:00
Wim Taymans
ed988788fd client-node: pass spa_node_info along
Pass the complete spa_node_info to update node information. Remove
the redundant max/min port info.
Update the remote node based on port and node update events.
2019-03-04 12:30:45 +01:00
Wim Taymans
09c4683ef1 interfaces: make events return void
Events are dispatched with hooks and have no return value.

Make it possible to get the last resource and proxy sender value
for where we need it.
2019-03-01 14:04:05 +01:00
Wim Taymans
0390969228 node: make add_listener method
Make struct spa_node_events for events emited from the main thread
and keep the spa_node_callbacks for the data thread callbacks.

The add_listener method installs the events and it's possible to
install multiple handles. Adding a listener first emits the info
and port_info events when installed, similar to how the PipeWire
proxy bind works.

This removes the need for the spa_pending_queue and makes it easier
to implement the _sync versions.

Add some helpers to make it easier for plugins to emit all the info
to new listeners.

Use the listeners for devices as well.
2019-03-01 12:00:42 +01:00
Wim Taymans
499dd3ff22 node: add port and node params
Add a new struct spa_param_info that lists the available params on
a node/port and if they are readable/writable/updated. We can use
this to replace and improve the PARAM_List and also to notify
property change and updates.

Update elements and code to deal with this new param stuff. Add
port and node info to most elements and signal changes.

Use async enum_params in -inspect and use the param info to know
which ones to enumerate.

Use the port info to know what parameters to update in the
remote-node.
2019-02-27 16:43:01 +01:00
Wim Taymans
245a0d5634 global: pass bind function to _new
Make the bind function a callback instead of an event. We can then
get a return value and use that to clean up the pending proxy and
generate an error.
2019-02-25 17:16:40 +01:00
Wim Taymans
f2ff6f393b more async improvements
Make the sequence number an int.

Keep track of the last received seq number and pass it in error
replies.

Pass seq in for_each methods.
2019-02-25 16:25:27 +01:00
Wim Taymans
d2c18c7b1a Improve async handling
Don't use special callback in node to receive the results. Instead,
use a generic result callback to receive the result. This makes things
a bit more symetric and generic again because then you can choose how
to match the result to the request and you have a generic way to handle
both the sync and async case. We can then also remove the wait method.
This also makes the remote interface and spa interface to objects very
similar.

Make a helper object to receive and dispatch results. Use this in the
helper for enum_params.

Make device use the same result callbacks.
2019-02-25 12:29:57 +01:00
Wim Taymans
eea062ee53 interfaces: improve remote API
Add return values to events and method callbacks. This makes it
possible to pass any error or async return value.
Add sync/done/error in both directions so that both proxy and resource
and perform/reply sync and produce errors.
Return a SPA_ASYNC from remote method calls (and events), keep the
sequence number in the connection.
With the core sync/done we can remove the client-node done method and
it's internal sequence number along with the seq number in method calls.
We can also use the method/event async return value to perform a sync
with as the unique sequence number for this method.
Add sync method and done/error event to proxy and resource.
2019-02-18 12:31:36 +01:00
Wim Taymans
21957e9e8d node: Add port_info event
Add a port_info event. With this, we get updates to ports pushed to
us, which is more convenient and also allows for better dynamic
add/remove of ports.
We don't need to the PortChanged event anymore
We can remove the get_port_ids/get_n_ports/port_get_info methods.
Update plugins
2019-02-14 17:08:46 +01:00
Wim Taymans
8ae5424359 resource: improve error handling
Make some more varargs error functions
Make pw_resource_error always just send the error to the resource id.
Make sure we send errors to the right destination.
Add proxy error event and emit it when the core finds an error for
the given proxy id.
The client error is supposed to be sent to all resources of a client
for the given global.
2019-02-14 16:53:42 +01:00
Wim Taymans
7a1bd163f7 node: remove port_send_command
We don't want to do this, we use a sequence to change things
at runtime.
2019-02-13 12:43:15 +01:00
Wim Taymans
5de7898808 node: implement activation
Make an eventfd for each node and listen for events when the node
is activated.
Reorganize some graphs links to make it possible to activiate nodes
by signaling the eventfd
Pass the peer node to each remote node and let the remote node
directly activate the peer when needed.
Let each node signal the driver node when finished.
With this we don't need to go through the daemon to schedule the
graph, nodes will simply activate eachother. We only go to the
server when there is a server node to schedule.
Keep stats about the state of each node and the time it was
triggered, running and finished.
2019-02-12 17:42:33 +01:00
Wim Taymans
f45e0b8966 reorganize some struct members to remove holes 2019-02-08 12:01:50 +01:00
Wim Taymans
658c1da52f node: allocate shared mem for activation
Allocate a per node a piece of shared memory where we place the
activation structure with the graph state and io_position.
We can then give this info to nodes so that they can get the position
in the graph directly but also later, activate the next node in
the graph.
2019-02-07 12:34:54 +01:00
Wim Taymans
31dacd9d6f remote: move node export code to client-node module
Make the code to export objects more generic. Make it possible for
modules to register a type to export.
Make the client-node also able to export plain spa_nodes.
Let the remote signal the global of the exported object if any. We can
then remote the (unused) remote_id from the proxy.
2019-01-31 11:02:13 +01:00