Fix merge with latest logind bug fixes

This commit is contained in:
Drakulix 2018-02-21 14:52:31 +01:00
parent 4a2658090b
commit 85bac997e0
1 changed files with 18 additions and 14 deletions

View File

@ -591,7 +591,7 @@ where
Err(err) => handler.error(evlh, device, err), Err(err) => handler.error(evlh, device, err),
}; };
}, },
error: |_evlh, &mut (ref mut device, ref mut handler), _, error| { error: |evlh, &mut (ref mut device, ref mut handler), _, error| {
warn!(device.logger, "DrmDevice errored: {}", error); warn!(device.logger, "DrmDevice errored: {}", error);
handler.error(evlh, device, error.into()); handler.error(evlh, device, error.into());
}, },
@ -603,6 +603,7 @@ pub struct DrmDeviceObserver<A: ControlDevice + 'static> {
context: Weak<EGLContext<Gbm<framebuffer::Info>, GbmDevice<A>>>, context: Weak<EGLContext<Gbm<framebuffer::Info>, GbmDevice<A>>>,
device_id: dev_t, device_id: dev_t,
backends: Rc<RefCell<HashMap<crtc::Handle, Weak<DrmBackendInternal<A>>>>>, backends: Rc<RefCell<HashMap<crtc::Handle, Weak<DrmBackendInternal<A>>>>>,
old_state: HashMap<crtc::Handle, (crtc::Info, Vec<connector::Handle>)>,
active: Arc<AtomicBool>, active: Arc<AtomicBool>,
priviledged: bool, priviledged: bool,
logger: ::slog::Logger, logger: ::slog::Logger,
@ -614,6 +615,7 @@ impl<A: ControlDevice + 'static> AsSessionObserver<DrmDeviceObserver<A>> for Drm
context: Rc::downgrade(&self.context), context: Rc::downgrade(&self.context),
device_id: self.device_id.clone(), device_id: self.device_id.clone(),
backends: self.backends.clone(), backends: self.backends.clone(),
old_state: self.old_state.clone(),
active: self.active.clone(), active: self.active.clone(),
priviledged: self.priviledged, priviledged: self.priviledged,
logger: self.logger.clone(), logger: self.logger.clone(),
@ -629,19 +631,21 @@ impl<A: ControlDevice + 'static> SessionObserver for DrmDeviceObserver<A> {
return; return;
} }
} }
for (handle, &(ref info, ref connectors)) in self.old_state.iter() { if let Some(device) = self.context.upgrade() {
if let Err(err) = crtc::set( for (handle, &(ref info, ref connectors)) in self.old_state.iter() {
&*self.context, if let Err(err) = crtc::set(
*handle, &*device,
info.fb(), *handle,
connectors, info.fb(),
info.position(), connectors,
info.mode(), info.position(),
) { info.mode(),
error!( ) {
self.logger, error!(
"Failed to reset crtc ({:?}). Error: {}", handle, err self.logger,
); "Failed to reset crtc ({:?}). Error: {}", handle, err
);
}
} }
} }
self.active.store(false, Ordering::SeqCst); self.active.store(false, Ordering::SeqCst);