backend/kms: Check all connectors for primary gpu

This commit is contained in:
Victoria Brekenfeld 2026-07-24 14:14:15 +02:00 • committed by Jeremy Soller
parent b407ed560a
commit a7d31a75d2

View file

@ -32,7 +32,11 @@ use smithay::{
calloop::{Dispatcher, EventLoop, LoopHandle}, calloop::{Dispatcher, EventLoop, LoopHandle},
drm::{ drm::{
Device as _, Device as _,
control::{Device as _, connector::Interface, crtc}, control::{
Device as _,
connector::{Interface, State as ConnectorState},
crtc,
},
}, },
input::{self, Libinput}, input::{self, Libinput},
wayland_protocols::wp::linux_dmabuf::zv1::server::zwp_linux_dmabuf_feedback_v1::TrancheFlags, wayland_protocols::wp::linux_dmabuf::zv1::server::zwp_linux_dmabuf_feedback_v1::TrancheFlags,
@ -250,13 +254,18 @@ fn determine_primary_gpu(
// try to find builtin display // try to find builtin display
for dev in drm_devices.values() { for dev in drm_devices.values() {
if dev.inner.surfaces.values().any(|s| { let drm = dev.drm.device();
if let Ok(conn_info) = dev.drm.device().get_connector(s.connector, false) { let res_handles = drm.resource_handles()?;
let i = conn_info.interface(); let connectors = res_handles.connectors();
i == Interface::EmbeddedDisplayPort || i == Interface::LVDS || i == Interface::DSI if connectors.iter().any(|conn| {
} else { let Ok(conn_info) = drm.get_connector(*conn, false) else {
false return false;
} };
let i = conn_info.interface();
conn_info.state() == ConnectorState::Connected
&& (i == Interface::EmbeddedDisplayPort
|| i == Interface::LVDS
|| i == Interface::DSI)
}) { }) {
return Ok(Some(dev.inner.render_node)); return Ok(Some(dev.inner.render_node));
} }