kms: Use primary node if no render node is found
It seems this is all that's needed to make cosmic-comp run in a VM without graphics acceleration. Fixes https://github.com/pop-os/cosmic-comp/issues/62.
This commit is contained in:
parent
b1c7f68b6e
commit
5b950a9be7
1 changed files with 9 additions and 3 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue