kms: Allow updating the primary node

Add more sophisticated code to handle the primary node disappearing.

Also overhaul the selection logic to respect our allow/deny-list and
prefer devices with built-in connectors before using the boot gpu.

This will also allow triggering a primary node switch at runtime
for debugging purposes in the future.
This commit is contained in:
Victoria Brekenfeld 2025-05-21 22:07:46 +02:00 committed by Victoria Brekenfeld
parent 4c0c61e94b
commit 8194be30c6
8 changed files with 153 additions and 93 deletions

View file

@ -12,7 +12,7 @@ impl BufferHandler for State {
if let BackendData::Kms(kms_state) = &mut self.backend {
for device in kms_state.drm_devices.values_mut() {
if device.active_buffers.remove(&buffer.downgrade()) {
if !device.in_use(kms_state.primary_node.as_ref()) {
if !device.in_use(kms_state.primary_node.read().unwrap().as_ref()) {
if let Err(err) = kms_state.refresh_used_devices() {
warn!(?err, "Failed to init devices.");
};