aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-05-15 08:13:56 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-05-15 08:13:56 +0400
commit3d63f5e644604a6d749c8c3405fac481b7a34cdd (patch)
treec268629c796e4aaabb8c2e69b862053c8e55a015 /src
parent1096f0cf0e6f3e332994256729efbe9ba2a5685c (diff)
downloadniri-3d63f5e644604a6d749c8c3405fac481b7a34cdd.tar.gz
niri-3d63f5e644604a6d749c8c3405fac481b7a34cdd.tar.bz2
niri-3d63f5e644604a6d749c8c3405fac481b7a34cdd.zip
tty: Try harder to find a GBM device
Diffstat (limited to 'src')
-rw-r--r--src/backend/tty.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/backend/tty.rs b/src/backend/tty.rs
index 392a038a..a96eb064 100644
--- a/src/backend/tty.rs
+++ b/src/backend/tty.rs
@@ -1537,7 +1537,15 @@ impl Tty {
#[cfg(feature = "xdp-gnome-screencast")]
pub fn primary_gbm_device(&self) -> Option<GbmDevice<DrmDeviceFd>> {
- self.devices.get(&self.primary_node).map(|d| d.gbm.clone())
+ // Try to find a device corresponding to the primary render node.
+ let device = self
+ .devices
+ .values()
+ .find(|d| d.render_node == self.primary_render_node);
+ // Otherwise, try to get the device corresponding to the primary node.
+ let device = device.or_else(|| self.devices.get(&self.primary_node));
+
+ Some(device?.gbm.clone())
}
pub fn set_monitors_active(&mut self, active: bool) {