diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-11-20 11:56:04 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-11-21 07:14:27 +0300 |
| commit | 5555e5578c14b6ce847ca8e54bfb2081dfd5b490 (patch) | |
| tree | 6c29b587ca1a67b583da08f9fa5bcf548da481bb /src | |
| parent | a21aac949c42f98735237b0b63c7fae1d592580c (diff) | |
| download | niri-5555e5578c14b6ce847ca8e54bfb2081dfd5b490.tar.gz niri-5555e5578c14b6ce847ca8e54bfb2081dfd5b490.tar.bz2 niri-5555e5578c14b6ce847ca8e54bfb2081dfd5b490.zip | |
tty: Create allocator at device creation
Co-authored-by: Christian Meissl <meissl.christian@gmail.com>
Co-authored-by: Scott McKendry <39483124+scottmckendry@users.noreply.github.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/backend/tty.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/backend/tty.rs b/src/backend/tty.rs index 368f5119..fd47aa52 100644 --- a/src/backend/tty.rs +++ b/src/backend/tty.rs @@ -140,6 +140,7 @@ pub struct OutputDevice { // See https://github.com/Smithay/smithay/issues/1102. drm: DrmDevice, gbm: GbmDevice<DrmDeviceFd>, + allocator: GbmAllocator<DrmDeviceFd>, pub drm_lease_state: Option<DrmLeaseState>, non_desktop_connectors: HashSet<(connector::Handle, crtc::Handle)>, @@ -825,6 +826,9 @@ impl Tty { } } + let gbm_flags = GbmBufferFlags::RENDERING | GbmBufferFlags::SCANOUT; + let allocator = GbmAllocator::new(gbm.clone(), gbm_flags); + let token = niri .event_loop .insert_source(drm_notifier, move |event, meta, state| { @@ -848,6 +852,7 @@ impl Tty { render_node, drm, gbm, + allocator, drm_scanner: DrmScanner::new(), surfaces: HashMap::new(), known_crtcs: HashMap::new(), @@ -1261,10 +1266,6 @@ impl Tty { } } - // Create GBM allocator. - let gbm_flags = GbmBufferFlags::RENDERING | GbmBufferFlags::SCANOUT; - let allocator = GbmAllocator::new(device.gbm.clone(), gbm_flags); - // Update the output mode. let (physical_width, physical_height) = connector.size().unwrap_or((0, 0)); @@ -1334,7 +1335,7 @@ impl Tty { OutputModeSource::Auto(output.clone()), surface, None, - allocator.clone(), + device.allocator.clone(), GbmFramebufferExporter::new(device.gbm.clone(), device.render_node.into()), SUPPORTED_COLOR_FORMATS, // This is only used to pick a good internal format, so it can use the surface's render @@ -1364,7 +1365,7 @@ impl Tty { OutputModeSource::Auto(output.clone()), surface, None, - allocator, + device.allocator.clone(), GbmFramebufferExporter::new(device.gbm.clone(), device.render_node.into()), SUPPORTED_COLOR_FORMATS, render_formats, |
