forge
Explore
Log in

Don't you dare go Hollow

Re-enable dmabufs but without overlay planes

Browse files at this commit

786e0fa4f0a4faa5fd94a8270f9473e75e9f5b86Ivan MolodetskikhParent: 8df48c0
src/backend/tty.rsmodified+19 -18
@@ -12,7 +12,7 @@ use smithay::backend::drm::{DrmDevice, DrmDeviceFd, DrmEvent, DrmEventTime};
12 use smithay::backend::egl::{EGLContext, EGLDisplay};12 use smithay::backend::egl::{EGLContext, EGLDisplay};
13 use smithay::backend::libinput::{LibinputInputBackend, LibinputSessionInterface};13 use smithay::backend::libinput::{LibinputInputBackend, LibinputSessionInterface};
14 use smithay::backend::renderer::gles::{GlesRenderer, GlesTexture};14 use smithay::backend::renderer::gles::{GlesRenderer, GlesTexture};
15-use smithay::backend::renderer::{Bind, DebugFlags, ImportEgl};15+use smithay::backend::renderer::{Bind, DebugFlags, ImportDma, ImportEgl};
16 use smithay::backend::session::libseat::LibSeatSession;16 use smithay::backend::session::libseat::LibSeatSession;
17 use smithay::backend::session::{Event as SessionEvent, Session};17 use smithay::backend::session::{Event as SessionEvent, Session};
18 use smithay::backend::udev::{self, UdevBackend, UdevEvent};18 use smithay::backend::udev::{self, UdevBackend, UdevEvent};
@@ -28,11 +28,11 @@ use smithay::reexports::nix::libc::dev_t;
28 use smithay::reexports::wayland_protocols::wp::linux_dmabuf::zv1::server::zwp_linux_dmabuf_feedback_v1::TrancheFlags;28 use smithay::reexports::wayland_protocols::wp::linux_dmabuf::zv1::server::zwp_linux_dmabuf_feedback_v1::TrancheFlags;
29 use smithay::reexports::wayland_protocols::wp::presentation_time::server::wp_presentation_feedback;29 use smithay::reexports::wayland_protocols::wp::presentation_time::server::wp_presentation_feedback;
30 use smithay::utils::DeviceFd;30 use smithay::utils::DeviceFd;
31-use smithay::wayland::dmabuf::{DmabufFeedbackBuilder, DmabufState, DmabufFeedback};31+use smithay::wayland::dmabuf::{DmabufFeedbackBuilder, DmabufGlobal, DmabufState, DmabufFeedback};
32 use smithay_drm_extras::drm_scanner::{DrmScanEvent, DrmScanner};32 use smithay_drm_extras::drm_scanner::{DrmScanEvent, DrmScanner};
33 use smithay_drm_extras::edid::EdidInfo;33 use smithay_drm_extras::edid::EdidInfo;
34 34
35-use crate::niri::OutputRenderElements;35+use crate::niri::{OutputRenderElements, State};
36 use crate::utils::get_monotonic_time;36 use crate::utils::get_monotonic_time;
37 use crate::{LoopData, Niri};37 use crate::{LoopData, Niri};
38 38
@@ -63,7 +63,7 @@ struct OutputDevice {
63 drm_scanner: DrmScanner,63 drm_scanner: DrmScanner,
64 surfaces: HashMap<crtc::Handle, Surface>,64 surfaces: HashMap<crtc::Handle, Surface>,
65 dmabuf_state: DmabufState,65 dmabuf_state: DmabufState,
66- // dmabuf_global: DmabufGlobal,66+ dmabuf_global: DmabufGlobal,
67 }67 }
68 68
69 #[derive(Debug, Clone, Copy)]69 #[derive(Debug, Clone, Copy)]
@@ -368,13 +368,12 @@ impl Tty {
368 368
369 let formats = Bind::<Dmabuf>::supported_formats(&gles).unwrap_or_default();369 let formats = Bind::<Dmabuf>::supported_formats(&gles).unwrap_or_default();
370 370
371- let dmabuf_state = DmabufState::new();371+ let mut dmabuf_state = DmabufState::new();
372- // let default_feedback = DmabufFeedbackBuilder::new(device_id, gles.dmabuf_formats())372+ let default_feedback = DmabufFeedbackBuilder::new(device_id, gles.dmabuf_formats())
373- // .build()373+ .build()
374- // .unwrap();374+ .unwrap();
375- // let dmabuf_global = dmabuf_state375+ let dmabuf_global = dmabuf_state
376- // .create_global_with_default_feedback::<State>(&niri.display_handle,376+ .create_global_with_default_feedback::<State>(&niri.display_handle, &default_feedback);
377- // &default_feedback);
378 377
379 self.output_device = Some(OutputDevice {378 self.output_device = Some(OutputDevice {
380 id: device_id,379 id: device_id,
@@ -386,7 +385,7 @@ impl Tty {
386 drm_scanner: DrmScanner::new(),385 drm_scanner: DrmScanner::new(),
387 surfaces: HashMap::new(),386 surfaces: HashMap::new(),
388 dmabuf_state,387 dmabuf_state,
389- // dmabuf_global,388+ dmabuf_global,
390 });389 });
391 390
392 self.device_changed(device_id, niri);391 self.device_changed(device_id, niri);
@@ -441,9 +440,9 @@ impl Tty {
441 }440 }
442 441
443 let mut device = self.output_device.take().unwrap();442 let mut device = self.output_device.take().unwrap();
444- // device443+ device
445- // .dmabuf_state444+ .dmabuf_state
446- // .destroy_global::<State>(&niri.display_handle, device.dmabuf_global);445+ .destroy_global::<State>(&niri.display_handle, device.dmabuf_global);
447 device.gles.unbind_wl_display();446 device.gles.unbind_wl_display();
448 447
449 niri.event_loop.remove(device.token);448 niri.event_loop.remove(device.token);
@@ -514,7 +513,9 @@ impl Tty {
514 crtc,513 crtc,
515 });514 });
516 515
517- let planes = surface.planes().unwrap();516+ let mut planes = surface.planes().unwrap();
517+ // Disable overlay planes as they cause weird performance issues on my system.
518+ planes.overlay.clear();
518 let scanout_formats = surface519 let scanout_formats = surface
519 .supported_formats(planes.primary.handle)520 .supported_formats(planes.primary.handle)
520 .unwrap()521 .unwrap()
@@ -522,7 +523,7 @@ impl Tty {
522 .chain(523 .chain(
523 planes524 planes
524 .overlay525 .overlay
525- .into_iter()526+ .iter()
526 .flat_map(|p| surface.supported_formats(p.handle).unwrap()),527 .flat_map(|p| surface.supported_formats(p.handle).unwrap()),
527 )528 )
528 .collect::<HashSet<_>>();529 .collect::<HashSet<_>>();
@@ -532,7 +533,7 @@ impl Tty {
532 let compositor = DrmCompositor::new(533 let compositor = DrmCompositor::new(
533 OutputModeSource::Auto(output.clone()),534 OutputModeSource::Auto(output.clone()),
534 surface,535 surface,
535- None,536+ Some(planes),
536 allocator,537 allocator,
537 device.gbm.clone(),538 device.gbm.clone(),
538 SUPPORTED_COLOR_FORMATS,539 SUPPORTED_COLOR_FORMATS,