Merge pull request #626 from mahkoh/jorth/log-udmabuf
udmabuf: log device status
This commit is contained in:
commit
987bc5ee25
1 changed files with 10 additions and 5 deletions
|
|
@ -3,8 +3,8 @@ use {
|
||||||
allocator::{Allocator, AllocatorError, BufferObject, BufferUsage, MappedBuffer},
|
allocator::{Allocator, AllocatorError, BufferObject, BufferUsage, MappedBuffer},
|
||||||
format::Format,
|
format::Format,
|
||||||
utils::{
|
utils::{
|
||||||
clonecell::CloneCell, compat::IoctlNumber, errorfmt::ErrorFmt, oserror::OsError,
|
clonecell::CloneCell, compat::IoctlNumber, errorfmt::ErrorFmt, once::Once,
|
||||||
page_size::page_size,
|
oserror::OsError, page_size::page_size,
|
||||||
},
|
},
|
||||||
video::{
|
video::{
|
||||||
LINEAR_MODIFIER, Modifier,
|
LINEAR_MODIFIER, Modifier,
|
||||||
|
|
@ -54,6 +54,7 @@ pub enum UdmabufError {
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct UdmabufHolder {
|
pub struct UdmabufHolder {
|
||||||
|
logged: Once,
|
||||||
udmabuf: CloneCell<Option<Option<Rc<Udmabuf>>>>,
|
udmabuf: CloneCell<Option<Option<Rc<Udmabuf>>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,14 +65,18 @@ impl UdmabufHolder {
|
||||||
}
|
}
|
||||||
match Udmabuf::new() {
|
match Udmabuf::new() {
|
||||||
Ok(u) => {
|
Ok(u) => {
|
||||||
|
log::info!("Opened /dev/udmabuf");
|
||||||
let u = Rc::new(u);
|
let u = Rc::new(u);
|
||||||
self.udmabuf.set(Some(Some(u.clone())));
|
self.udmabuf.set(Some(Some(u.clone())));
|
||||||
Some(u)
|
Some(u)
|
||||||
}
|
}
|
||||||
Err(UdmabufError::Open(OsError(c::EPERM))) => None,
|
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
log::error!("Could not create udmabuf device: {}", ErrorFmt(e));
|
self.logged.exec(|| {
|
||||||
self.udmabuf.set(Some(None));
|
log::warn!("Unable to open /dev/udmabuf: {}", ErrorFmt(&e));
|
||||||
|
});
|
||||||
|
if !matches!(e, UdmabufError::Open(OsError(c::EPERM))) {
|
||||||
|
self.udmabuf.set(Some(None));
|
||||||
|
}
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue