mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-09 13:30:06 -05:00
context: also reconfigure when quantum was forced
This makes the clock.force-quantum setting and node.force-quantum suspend all drivers and resume them in the new quantum. This is essential in order to change the quantum on an IRQ based driver because it will otherwise refuse to change the graph quantum.
This commit is contained in:
parent
03840a2a9a
commit
9bfe24d62f
2 changed files with 16 additions and 10 deletions
|
|
@ -1309,6 +1309,7 @@ again:
|
||||||
uint32_t quantum, target_rate, current_rate;
|
uint32_t quantum, target_rate, current_rate;
|
||||||
uint64_t quantum_stamp = 0, rate_stamp = 0;
|
uint64_t quantum_stamp = 0, rate_stamp = 0;
|
||||||
bool force_rate, force_quantum, restore_rate = false;
|
bool force_rate, force_quantum, restore_rate = false;
|
||||||
|
bool do_reconfigure = false, was_target_pending;
|
||||||
const uint32_t *node_rates;
|
const uint32_t *node_rates;
|
||||||
uint32_t node_n_rates, node_def_rate;
|
uint32_t node_n_rates, node_def_rate;
|
||||||
uint32_t node_max_quantum, node_min_quantum, node_def_quantum, node_rate_quantum;
|
uint32_t node_max_quantum, node_min_quantum, node_def_quantum, node_rate_quantum;
|
||||||
|
|
@ -1416,8 +1417,9 @@ again:
|
||||||
rate.denom, target_rate);
|
rate.denom, target_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
was_target_pending = n->target_pending;
|
||||||
|
|
||||||
if (target_rate != current_rate) {
|
if (target_rate != current_rate) {
|
||||||
bool do_reconfigure = false;
|
|
||||||
/* we doing a rate switch */
|
/* we doing a rate switch */
|
||||||
pw_log_info("(%s-%u) state:%s new rate:%u/(%u)->%u",
|
pw_log_info("(%s-%u) state:%s new rate:%u/(%u)->%u",
|
||||||
n->name, n->info.id,
|
n->name, n->info.id,
|
||||||
|
|
@ -1427,23 +1429,17 @@ again:
|
||||||
|
|
||||||
if (force_rate) {
|
if (force_rate) {
|
||||||
if (settings->clock_rate_update_mode == CLOCK_RATE_UPDATE_MODE_HARD)
|
if (settings->clock_rate_update_mode == CLOCK_RATE_UPDATE_MODE_HARD)
|
||||||
do_reconfigure = !n->target_pending;
|
do_reconfigure |= !was_target_pending;
|
||||||
} else {
|
} else {
|
||||||
if (n->info.state >= PW_NODE_STATE_SUSPENDED)
|
if (n->info.state >= PW_NODE_STATE_SUSPENDED)
|
||||||
do_reconfigure = !n->target_pending;
|
do_reconfigure |= !was_target_pending;
|
||||||
}
|
}
|
||||||
if (do_reconfigure)
|
|
||||||
reconfigure_driver(context, n);
|
|
||||||
|
|
||||||
/* we're setting the pending rate. This will become the new
|
/* we're setting the pending rate. This will become the new
|
||||||
* current rate in the next iteration of the graph. */
|
* current rate in the next iteration of the graph. */
|
||||||
n->target_rate = SPA_FRACTION(1, target_rate);
|
n->target_rate = SPA_FRACTION(1, target_rate);
|
||||||
n->target_pending = true;
|
|
||||||
n->forced_rate = force_rate;
|
n->forced_rate = force_rate;
|
||||||
|
n->target_pending = true;
|
||||||
current_rate = target_rate;
|
current_rate = target_rate;
|
||||||
/* we might be suspended now and the links need to be prepared again */
|
|
||||||
if (do_reconfigure)
|
|
||||||
goto again;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node_rate_quantum != 0 && current_rate != node_rate_quantum) {
|
if (node_rate_quantum != 0 && current_rate != node_rate_quantum) {
|
||||||
|
|
@ -1476,10 +1472,19 @@ again:
|
||||||
quantum);
|
quantum);
|
||||||
/* this is the new pending quantum */
|
/* this is the new pending quantum */
|
||||||
n->target_quantum = quantum;
|
n->target_quantum = quantum;
|
||||||
|
n->forced_quantum = force_quantum;
|
||||||
n->target_pending = true;
|
n->target_pending = true;
|
||||||
|
|
||||||
|
if (force_quantum)
|
||||||
|
do_reconfigure |= !was_target_pending;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n->target_pending) {
|
if (n->target_pending) {
|
||||||
|
if (do_reconfigure) {
|
||||||
|
reconfigure_driver(context, n);
|
||||||
|
/* we might be suspended now and the links need to be prepared again */
|
||||||
|
goto again;
|
||||||
|
}
|
||||||
/* we have a pending change. We place the new values in the
|
/* we have a pending change. We place the new values in the
|
||||||
* pending fields so that they are picked up by the driver in
|
* pending fields so that they are picked up by the driver in
|
||||||
* the next cycle */
|
* the next cycle */
|
||||||
|
|
|
||||||
|
|
@ -673,6 +673,7 @@ struct pw_impl_node {
|
||||||
unsigned int suspend_on_idle:1;
|
unsigned int suspend_on_idle:1;
|
||||||
unsigned int reconfigure:1;
|
unsigned int reconfigure:1;
|
||||||
unsigned int forced_rate:1;
|
unsigned int forced_rate:1;
|
||||||
|
unsigned int forced_quantum:1;
|
||||||
unsigned int trigger:1; /**< has the TRIGGER property and needs an extra
|
unsigned int trigger:1; /**< has the TRIGGER property and needs an extra
|
||||||
* trigger to start processing. */
|
* trigger to start processing. */
|
||||||
unsigned int can_suspend:1;
|
unsigned int can_suspend:1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue