Merge pull request #83 from pop-os/qxl_jammy

kms: Use primary node if no render node is found
This commit is contained in:
Victoria Brekenfeld 2023-03-06 12:50:32 +01:00 committed by GitHub
commit 094bd0df38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -157,10 +157,11 @@ pub fn init_backend(
{
path
} else {
primary_gpu(session.seat())
let primary_node = primary_gpu(session.seat())
.ok()
.flatten()
.and_then(|x| DrmNode::from_path(x).ok())
.and_then(|x| DrmNode::from_path(x).ok());
primary_node
.and_then(|x| x.node_with_type(NodeType::Render).and_then(Result::ok))
.unwrap_or_else(|| {
for dev in all_gpus(session.seat()).expect("No GPU found") {
@ -171,7 +172,12 @@ pub fn init_backend(
return node;
}
}
panic!("Failed to initialize any GPU");
// If we find no render nodes, use primary node
if let Some(primary_node) = primary_node {
return primary_node;
} else {
panic!("Failed to initialize any GPU");
}
})
};
info!("Using {} as primary gpu for rendering.", primary);