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,9 +631,10 @@ impl<A: ControlDevice + 'static> SessionObserver for DrmDeviceObserver<A> {
return; return;
} }
} }
if let Some(device) = self.context.upgrade() {
for (handle, &(ref info, ref connectors)) in self.old_state.iter() { for (handle, &(ref info, ref connectors)) in self.old_state.iter() {
if let Err(err) = crtc::set( if let Err(err) = crtc::set(
&*self.context, &*device,
*handle, *handle,
info.fb(), info.fb(),
connectors, connectors,
@ -644,6 +647,7 @@ impl<A: ControlDevice + 'static> SessionObserver for DrmDeviceObserver<A> {
); );
} }
} }
}
self.active.store(false, Ordering::SeqCst); self.active.store(false, Ordering::SeqCst);
if self.priviledged { if self.priviledged {
if let Some(device) = self.context.upgrade() { if let Some(device) = self.context.upgrade() {