Compare commits

...

2 Commits

Author SHA1 Message Date
Ivan Molodetskikh
c3327d36da tty: Generalize DRM property helpers 2024-03-19 09:00:00 +04:00
Ivan Molodetskikh
e0da101c73 Disable screencast when PipeWire is missing
This can cause a panic.
2024-03-19 08:59:28 +04:00
3 changed files with 15 additions and 8 deletions

View File

@ -38,6 +38,7 @@ use smithay::reexports::calloop::timer::{TimeoutAction, Timer};
use smithay::reexports::calloop::{Dispatcher, LoopHandle, RegistrationToken};
use smithay::reexports::drm::control::{
self, connector, crtc, property, Device, Mode as DrmMode, ModeFlags, ModeTypeFlags,
ResourceHandle,
};
use smithay::reexports::gbm::Modifier;
use smithay::reexports::input::Libinput;
@ -1812,13 +1813,13 @@ fn surface_dmabuf_feedback(
fn find_drm_property(
drm: &DrmDevice,
crtc: crtc::Handle,
resource: impl ResourceHandle,
name: &str,
) -> Option<(property::Handle, property::RawValue)> {
let props = match drm.get_properties(crtc) {
let props = match drm.get_properties(resource) {
Ok(props) => props,
Err(err) => {
warn!("error getting CRTC properties: {err:?}");
warn!("error getting properties: {err:?}");
return None;
}
};
@ -1833,13 +1834,13 @@ fn find_drm_property(
fn get_drm_property(
drm: &DrmDevice,
crtc: crtc::Handle,
resource: impl ResourceHandle,
prop: property::Handle,
) -> Option<property::RawValue> {
let props = match drm.get_properties(crtc) {
let props = match drm.get_properties(resource) {
Ok(props) => props,
Err(err) => {
warn!("error getting CRTC properties: {err:?}");
warn!("error getting properties: {err:?}");
return None;
}
};

View File

@ -67,7 +67,7 @@ impl DBusServers {
dbus.conn_screen_shot = try_start(screenshot);
#[cfg(feature = "xdp-gnome-screencast")]
{
if niri.pipewire.is_some() {
let (to_niri, from_screen_cast) = calloop::channel::channel();
niri.event_loop
.insert_source(from_screen_cast, {
@ -82,6 +82,8 @@ impl DBusServers {
.unwrap();
let screen_cast = ScreenCast::new(backend.enabled_outputs(), to_niri);
dbus.conn_screen_cast = try_start(screen_cast);
} else {
warn!("disabling screencast support because we couldn't start PipeWire");
}
}

View File

@ -898,7 +898,11 @@ impl State {
}
};
let pw = self.niri.pipewire.as_ref().unwrap();
let Some(pw) = &self.niri.pipewire else {
error!("screencasting must be disabled if PipeWire is missing");
return;
};
match pw.start_cast(
to_niri.clone(),
gbm,