atomic: honor dev.active
This commit is contained in:
parent
33149b17e2
commit
da18c3a5f3
|
@ -236,6 +236,10 @@ impl<A: AsRawFd + 'static> Surface for AtomicDrmSurfaceInternal<A> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_connector(&self, conn: connector::Handle) -> Result<(), Error> {
|
fn add_connector(&self, conn: connector::Handle) -> Result<(), Error> {
|
||||||
|
if !self.dev.active.load(Ordering::SeqCst) {
|
||||||
|
return Err(Error::DeviceInactive);
|
||||||
|
}
|
||||||
|
|
||||||
let info = self
|
let info = self
|
||||||
.get_connector(conn)
|
.get_connector(conn)
|
||||||
.compat()
|
.compat()
|
||||||
|
@ -275,6 +279,10 @@ impl<A: AsRawFd + 'static> Surface for AtomicDrmSurfaceInternal<A> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn remove_connector(&self, conn: connector::Handle) -> Result<(), Error> {
|
fn remove_connector(&self, conn: connector::Handle) -> Result<(), Error> {
|
||||||
|
if !self.dev.active.load(Ordering::SeqCst) {
|
||||||
|
return Err(Error::DeviceInactive);
|
||||||
|
}
|
||||||
|
|
||||||
let mut pending = self.pending.write().unwrap();
|
let mut pending = self.pending.write().unwrap();
|
||||||
|
|
||||||
// check if new config is supported (should be)
|
// check if new config is supported (should be)
|
||||||
|
@ -300,6 +308,10 @@ impl<A: AsRawFd + 'static> Surface for AtomicDrmSurfaceInternal<A> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_connectors(&self, connectors: &[connector::Handle]) -> Result<(), Error> {
|
fn set_connectors(&self, connectors: &[connector::Handle]) -> Result<(), Error> {
|
||||||
|
if !self.dev.active.load(Ordering::SeqCst) {
|
||||||
|
return Err(Error::DeviceInactive);
|
||||||
|
}
|
||||||
|
|
||||||
let current = self.state.write().unwrap();
|
let current = self.state.write().unwrap();
|
||||||
let mut pending = self.pending.write().unwrap();
|
let mut pending = self.pending.write().unwrap();
|
||||||
|
|
||||||
|
@ -328,6 +340,10 @@ impl<A: AsRawFd + 'static> Surface for AtomicDrmSurfaceInternal<A> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn use_mode(&self, mode: Mode) -> Result<(), Error> {
|
fn use_mode(&self, mode: Mode) -> Result<(), Error> {
|
||||||
|
if !self.dev.active.load(Ordering::SeqCst) {
|
||||||
|
return Err(Error::DeviceInactive);
|
||||||
|
}
|
||||||
|
|
||||||
let mut pending = self.pending.write().unwrap();
|
let mut pending = self.pending.write().unwrap();
|
||||||
|
|
||||||
// check if new config is supported
|
// check if new config is supported
|
||||||
|
@ -374,6 +390,10 @@ impl<A: AsRawFd + 'static> RawSurface for AtomicDrmSurfaceInternal<A> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn commit(&self, framebuffer: framebuffer::Handle) -> Result<(), Error> {
|
fn commit(&self, framebuffer: framebuffer::Handle) -> Result<(), Error> {
|
||||||
|
if !self.dev.active.load(Ordering::SeqCst) {
|
||||||
|
return Err(Error::DeviceInactive);
|
||||||
|
}
|
||||||
|
|
||||||
let mut current = self.state.write().unwrap();
|
let mut current = self.state.write().unwrap();
|
||||||
let mut pending = self.pending.write().unwrap();
|
let mut pending = self.pending.write().unwrap();
|
||||||
|
|
||||||
|
@ -480,6 +500,10 @@ impl<A: AsRawFd + 'static> RawSurface for AtomicDrmSurfaceInternal<A> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn page_flip(&self, framebuffer: framebuffer::Handle) -> Result<(), SwapBuffersError> {
|
fn page_flip(&self, framebuffer: framebuffer::Handle) -> Result<(), SwapBuffersError> {
|
||||||
|
if !self.dev.active.load(Ordering::SeqCst) {
|
||||||
|
return Err(SwapBuffersError::AlreadySwapped);
|
||||||
|
}
|
||||||
|
|
||||||
let req = self
|
let req = self
|
||||||
.build_request(
|
.build_request(
|
||||||
&mut [].iter(),
|
&mut [].iter(),
|
||||||
|
@ -506,6 +530,10 @@ impl<A: AsRawFd + 'static> CursorBackend for AtomicDrmSurfaceInternal<A> {
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
|
|
||||||
fn set_cursor_position(&self, x: u32, y: u32) -> Result<(), Error> {
|
fn set_cursor_position(&self, x: u32, y: u32) -> Result<(), Error> {
|
||||||
|
if !self.dev.active.load(Ordering::SeqCst) {
|
||||||
|
return Err(Error::DeviceInactive);
|
||||||
|
}
|
||||||
|
|
||||||
trace!(self.logger, "New cursor position ({},{}) pending", x, y);
|
trace!(self.logger, "New cursor position ({},{}) pending", x, y);
|
||||||
self.cursor.position.set(Some((x, y)));
|
self.cursor.position.set(Some((x, y)));
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -516,6 +544,10 @@ impl<A: AsRawFd + 'static> CursorBackend for AtomicDrmSurfaceInternal<A> {
|
||||||
buffer: &Self::CursorFormat,
|
buffer: &Self::CursorFormat,
|
||||||
hotspot: (u32, u32),
|
hotspot: (u32, u32),
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
|
if !self.dev.active.load(Ordering::SeqCst) {
|
||||||
|
return Err(Error::DeviceInactive);
|
||||||
|
}
|
||||||
|
|
||||||
trace!(self.logger, "Setting the new imported cursor");
|
trace!(self.logger, "Setting the new imported cursor");
|
||||||
|
|
||||||
if let Some(fb) = self.cursor.framebuffer.get().take() {
|
if let Some(fb) = self.cursor.framebuffer.get().take() {
|
||||||
|
|
Loading…
Reference in New Issue