diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2023-09-04 10:24:23 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-09-04 10:24:23 +0400 |
| commit | 786e0fa4f0a4faa5fd94a8270f9473e75e9f5b86 (patch) | |
| tree | 51b61d0b0cc9837451a835ebad56f0153e06ae5e | |
| parent | 8df48c05caacff207452e6317b0e9e2e31e54245 (diff) | |
| download | niri-786e0fa4f0a4faa5fd94a8270f9473e75e9f5b86.tar.gz niri-786e0fa4f0a4faa5fd94a8270f9473e75e9f5b86.tar.bz2 niri-786e0fa4f0a4faa5fd94a8270f9473e75e9f5b86.zip | |
Re-enable dmabufs but without overlay planes
| -rw-r--r-- | src/backend/tty.rs | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/src/backend/tty.rs b/src/backend/tty.rs index fb251d4a..194e49a0 100644 --- a/src/backend/tty.rs +++ b/src/backend/tty.rs @@ -12,7 +12,7 @@ use smithay::backend::drm::{DrmDevice, DrmDeviceFd, DrmEvent, DrmEventTime}; use smithay::backend::egl::{EGLContext, EGLDisplay}; use smithay::backend::libinput::{LibinputInputBackend, LibinputSessionInterface}; use smithay::backend::renderer::gles::{GlesRenderer, GlesTexture}; -use smithay::backend::renderer::{Bind, DebugFlags, ImportEgl}; +use smithay::backend::renderer::{Bind, DebugFlags, ImportDma, ImportEgl}; use smithay::backend::session::libseat::LibSeatSession; use smithay::backend::session::{Event as SessionEvent, Session}; use smithay::backend::udev::{self, UdevBackend, UdevEvent}; @@ -28,11 +28,11 @@ use smithay::reexports::nix::libc::dev_t; use smithay::reexports::wayland_protocols::wp::linux_dmabuf::zv1::server::zwp_linux_dmabuf_feedback_v1::TrancheFlags; use smithay::reexports::wayland_protocols::wp::presentation_time::server::wp_presentation_feedback; use smithay::utils::DeviceFd; -use smithay::wayland::dmabuf::{DmabufFeedbackBuilder, DmabufState, DmabufFeedback}; +use smithay::wayland::dmabuf::{DmabufFeedbackBuilder, DmabufGlobal, DmabufState, DmabufFeedback}; use smithay_drm_extras::drm_scanner::{DrmScanEvent, DrmScanner}; use smithay_drm_extras::edid::EdidInfo; -use crate::niri::OutputRenderElements; +use crate::niri::{OutputRenderElements, State}; use crate::utils::get_monotonic_time; use crate::{LoopData, Niri}; @@ -63,7 +63,7 @@ struct OutputDevice { drm_scanner: DrmScanner, surfaces: HashMap<crtc::Handle, Surface>, dmabuf_state: DmabufState, - // dmabuf_global: DmabufGlobal, + dmabuf_global: DmabufGlobal, } #[derive(Debug, Clone, Copy)] @@ -368,13 +368,12 @@ impl Tty { let formats = Bind::<Dmabuf>::supported_formats(&gles).unwrap_or_default(); - let dmabuf_state = DmabufState::new(); - // let default_feedback = DmabufFeedbackBuilder::new(device_id, gles.dmabuf_formats()) - // .build() - // .unwrap(); - // let dmabuf_global = dmabuf_state - // .create_global_with_default_feedback::<State>(&niri.display_handle, - // &default_feedback); + let mut dmabuf_state = DmabufState::new(); + let default_feedback = DmabufFeedbackBuilder::new(device_id, gles.dmabuf_formats()) + .build() + .unwrap(); + let dmabuf_global = dmabuf_state + .create_global_with_default_feedback::<State>(&niri.display_handle, &default_feedback); self.output_device = Some(OutputDevice { id: device_id, @@ -386,7 +385,7 @@ impl Tty { drm_scanner: DrmScanner::new(), surfaces: HashMap::new(), dmabuf_state, - // dmabuf_global, + dmabuf_global, }); self.device_changed(device_id, niri); @@ -441,9 +440,9 @@ impl Tty { } let mut device = self.output_device.take().unwrap(); - // device - // .dmabuf_state - // .destroy_global::<State>(&niri.display_handle, device.dmabuf_global); + device + .dmabuf_state + .destroy_global::<State>(&niri.display_handle, device.dmabuf_global); device.gles.unbind_wl_display(); niri.event_loop.remove(device.token); @@ -514,7 +513,9 @@ impl Tty { crtc, }); - let planes = surface.planes().unwrap(); + let mut planes = surface.planes().unwrap(); + // Disable overlay planes as they cause weird performance issues on my system. + planes.overlay.clear(); let scanout_formats = surface .supported_formats(planes.primary.handle) .unwrap() @@ -522,7 +523,7 @@ impl Tty { .chain( planes .overlay - .into_iter() + .iter() .flat_map(|p| surface.supported_formats(p.handle).unwrap()), ) .collect::<HashSet<_>>(); @@ -532,7 +533,7 @@ impl Tty { let compositor = DrmCompositor::new( OutputModeSource::Auto(output.clone()), surface, - None, + Some(planes), allocator, device.gbm.clone(), SUPPORTED_COLOR_FORMATS, |
