aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-01-01 09:54:45 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-01-01 09:54:45 +0400
commit84befb4e911245e7d28e939083004b512d34e8b2 (patch)
treef86e08642b8c6642fa5781193c83f6344fb6c456 /src
parentd39f7bebf35a3d05f8b0b5eef524549ce6d774d5 (diff)
downloadniri-84befb4e911245e7d28e939083004b512d34e8b2.tar.gz
niri-84befb4e911245e7d28e939083004b512d34e8b2.tar.bz2
niri-84befb4e911245e7d28e939083004b512d34e8b2.zip
tty: Move dmabuf_global up into Tty
Diffstat (limited to 'src')
-rw-r--r--src/backend/tty.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/backend/tty.rs b/src/backend/tty.rs
index 63c4c17b..81f56102 100644
--- a/src/backend/tty.rs
+++ b/src/backend/tty.rs
@@ -52,6 +52,9 @@ pub struct Tty {
udev_dispatcher: Dispatcher<'static, UdevBackend, State>,
libinput: Libinput,
primary_gpu_path: PathBuf,
+ // The dma-buf global corresponds to the output device (the primary GPU). It is only `Some()`
+ // if we have a device corresponding to the primary GPU.
+ dmabuf_global: Option<DmabufGlobal>,
output_device: Option<OutputDevice>,
connectors: Arc<Mutex<HashMap<String, Output>>>,
}
@@ -70,7 +73,6 @@ struct OutputDevice {
formats: HashSet<DrmFormat>,
drm_scanner: DrmScanner,
surfaces: HashMap<crtc::Handle, Surface>,
- dmabuf_global: DmabufGlobal,
// SAFETY: drop after all the objects used with them are dropped.
// See https://github.com/Smithay/smithay/issues/1102.
drm: DrmDevice,
@@ -136,6 +138,7 @@ impl Tty {
udev_dispatcher,
libinput,
primary_gpu_path,
+ dmabuf_global: None,
output_device: None,
connectors: Arc::new(Mutex::new(HashMap::new())),
}
@@ -344,8 +347,8 @@ impl Tty {
formats,
drm_scanner: DrmScanner::new(),
surfaces: HashMap::new(),
- dmabuf_global,
});
+ self.dmabuf_global = Some(dmabuf_global);
self.device_changed(device_id, niri);
@@ -400,7 +403,7 @@ impl Tty {
let mut device = self.output_device.take().unwrap();
niri.dmabuf_state
- .destroy_global::<State>(&niri.display_handle, device.dmabuf_global);
+ .destroy_global::<State>(&niri.display_handle, self.dmabuf_global.take().unwrap());
device.gles.unbind_wl_display();
niri.event_loop.remove(device.token);