anvil: Report errors of failed device initializations

This commit is contained in:
Victor Brekenfeld 2020-04-19 01:14:25 +02:00
parent 61fecb44cf
commit 8ba33f2473
1 changed files with 23 additions and 3 deletions

View File

@ -411,9 +411,29 @@ impl<S: SessionNotifier, Data: 'static> UdevHandler for UdevHandlerImpl<S, Data>
OFlag::O_RDWR | OFlag::O_CLOEXEC | OFlag::O_NOCTTY | OFlag::O_NONBLOCK,
)
.ok()
.and_then(|fd| LegacyDrmDevice::new(SessionFd(fd), self.logger.clone()).ok())
.and_then(|drm| GbmDevice::new(drm, self.logger.clone()).ok())
.and_then(|gbm| EglDevice::new(gbm, self.logger.clone()).ok())
.and_then(
|fd| match LegacyDrmDevice::new(SessionFd(fd), self.logger.clone()) {
Ok(drm) => Some(drm),
Err(err) => {
error!(self.logger, "Skipping drm device, because of error: {}", err);
None
}
},
)
.and_then(|drm| match GbmDevice::new(drm, self.logger.clone()) {
Ok(gbm) => Some(gbm),
Err(err) => {
error!(self.logger, "Skipping gbm device, because of error: {}", err);
None
}
})
.and_then(|gbm| match EglDevice::new(gbm, self.logger.clone()) {
Ok(egl) => Some(egl),
Err(err) => {
error!(self.logger, "Skipping egl device, because of error: {}", err);
None
}
})
{
// init hardware acceleration on the primary gpu.
#[cfg(feature = "egl")]