cargo fmt
This commit is contained in:
parent
524057418e
commit
5d6fadcea8
|
@ -410,9 +410,7 @@ impl<A: AsRawFd + 'static> DrmDevice<A> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(1) =
|
if let Ok(1) = self.get_driver_capability(DriverCapability::AddFB2Modifiers) {
|
||||||
self.get_driver_capability(DriverCapability::AddFB2Modifiers)
|
|
||||||
{
|
|
||||||
let set = self.get_properties(plane).map_err(|source| Error::Access {
|
let set = self.get_properties(plane).map_err(|source| Error::Access {
|
||||||
errmsg: "Failed to query properties",
|
errmsg: "Failed to query properties",
|
||||||
dev: self.dev_path(),
|
dev: self.dev_path(),
|
||||||
|
@ -420,17 +418,20 @@ impl<A: AsRawFd + 'static> DrmDevice<A> {
|
||||||
})?;
|
})?;
|
||||||
let (handles, _) = set.as_props_and_values();
|
let (handles, _) = set.as_props_and_values();
|
||||||
// for every handle ...
|
// for every handle ...
|
||||||
let prop = handles.iter().find(|handle| {
|
let prop = handles
|
||||||
// get information of that property
|
.iter()
|
||||||
if let Some(info) = self.get_property(**handle).ok() {
|
.find(|handle| {
|
||||||
// to find out, if we got the handle of the "IN_FORMATS" property ...
|
// get information of that property
|
||||||
if info.name().to_str().map(|x| x == "IN_FORMATS").unwrap_or(false) {
|
if let Some(info) = self.get_property(**handle).ok() {
|
||||||
// so we can use that to get formats
|
// to find out, if we got the handle of the "IN_FORMATS" property ...
|
||||||
return true;
|
if info.name().to_str().map(|x| x == "IN_FORMATS").unwrap_or(false) {
|
||||||
|
// so we can use that to get formats
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
false
|
||||||
false
|
})
|
||||||
}).copied();
|
.copied();
|
||||||
if let Some(prop) = prop {
|
if let Some(prop) = prop {
|
||||||
let prop_info = self.get_property(prop).map_err(|source| Error::Access {
|
let prop_info = self.get_property(prop).map_err(|source| Error::Access {
|
||||||
errmsg: "Failed to query property",
|
errmsg: "Failed to query property",
|
||||||
|
@ -505,7 +506,9 @@ impl<A: AsRawFd + 'static> DrmDevice<A> {
|
||||||
|
|
||||||
trace!(
|
trace!(
|
||||||
self.logger,
|
self.logger,
|
||||||
"Supported scan-out formats for plane ({:?}): {:?}", plane, formats
|
"Supported scan-out formats for plane ({:?}): {:?}",
|
||||||
|
plane,
|
||||||
|
formats
|
||||||
);
|
);
|
||||||
|
|
||||||
Ok(DrmSurface {
|
Ok(DrmSurface {
|
||||||
|
|
|
@ -4,7 +4,10 @@ use std::sync::{
|
||||||
Arc, Weak,
|
Arc, Weak,
|
||||||
};
|
};
|
||||||
|
|
||||||
use drm::{Device as BasicDevice, control::{crtc, Device as ControlDevice}};
|
use drm::{
|
||||||
|
control::{crtc, Device as ControlDevice},
|
||||||
|
Device as BasicDevice,
|
||||||
|
};
|
||||||
use nix::libc::dev_t;
|
use nix::libc::dev_t;
|
||||||
use nix::sys::stat;
|
use nix::sys::stat;
|
||||||
|
|
||||||
|
@ -140,8 +143,8 @@ impl<A: AsRawFd + 'static> DrmSurfaceObserver<A> {
|
||||||
SessionSignal::ActivateSession => self.activate(None),
|
SessionSignal::ActivateSession => self.activate(None),
|
||||||
SessionSignal::ActivateDevice { major, minor, new_fd } => {
|
SessionSignal::ActivateDevice { major, minor, new_fd } => {
|
||||||
self.activate(Some((major, minor, new_fd)))
|
self.activate(Some((major, minor, new_fd)))
|
||||||
},
|
}
|
||||||
_ => {},
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,8 +165,11 @@ impl<A: AsRawFd + 'static> DrmSurfaceObserver<A> {
|
||||||
DrmSurfaceInternal::Atomic(surf) => surf.reset_state(fd.as_ref()),
|
DrmSurfaceInternal::Atomic(surf) => surf.reset_state(fd.as_ref()),
|
||||||
DrmSurfaceInternal::Legacy(surf) => surf.reset_state(fd.as_ref()),
|
DrmSurfaceInternal::Legacy(surf) => surf.reset_state(fd.as_ref()),
|
||||||
} {
|
} {
|
||||||
warn!(self.logger, "Failed to reset state of surface ({:?}/{:?}): {}", self.dev_id, self.crtc, err);
|
warn!(
|
||||||
|
self.logger,
|
||||||
|
"Failed to reset state of surface ({:?}/{:?}): {}", self.dev_id, self.crtc, err
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,11 @@ pub struct State {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl State {
|
impl State {
|
||||||
fn current_state<A: AsRawFd + ControlDevice>(fd: &A, crtc: crtc::Handle, prop_mapping: &Mapping) -> Result<Self, Error> {
|
fn current_state<A: AsRawFd + ControlDevice>(
|
||||||
|
fd: &A,
|
||||||
|
crtc: crtc::Handle,
|
||||||
|
prop_mapping: &Mapping,
|
||||||
|
) -> Result<Self, Error> {
|
||||||
let crtc_info = fd.get_crtc(crtc).map_err(|source| Error::Access {
|
let crtc_info = fd.get_crtc(crtc).map_err(|source| Error::Access {
|
||||||
errmsg: "Error loading crtc info",
|
errmsg: "Error loading crtc info",
|
||||||
dev: fd.dev_path(),
|
dev: fd.dev_path(),
|
||||||
|
@ -131,7 +135,7 @@ impl<A: AsRawFd + 'static> AtomicDrmSurface<A> {
|
||||||
errmsg: "Failed to create Property Blob for mode",
|
errmsg: "Failed to create Property Blob for mode",
|
||||||
dev: fd.dev_path(),
|
dev: fd.dev_path(),
|
||||||
source,
|
source,
|
||||||
})?;
|
})?;
|
||||||
let pending = State {
|
let pending = State {
|
||||||
mode,
|
mode,
|
||||||
blob,
|
blob,
|
||||||
|
@ -767,8 +771,10 @@ impl<A: AsRawFd + 'static> AtomicDrmSurface<A> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn reset_state<B: AsRawFd + ControlDevice + 'static>(
|
||||||
pub(crate) fn reset_state<B: AsRawFd + ControlDevice + 'static>(&self, fd: Option<&B>) -> Result<(), Error> {
|
&self,
|
||||||
|
fd: Option<&B>,
|
||||||
|
) -> Result<(), Error> {
|
||||||
*self.state.write().unwrap() = if let Some(fd) = fd {
|
*self.state.write().unwrap() = if let Some(fd) = fd {
|
||||||
State::current_state(fd, self.crtc, &self.prop_mapping)?
|
State::current_state(fd, self.crtc, &self.prop_mapping)?
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -92,7 +92,7 @@ impl<A: AsRawFd + 'static> LegacyDrmSurface<A> {
|
||||||
"Initializing drm surface with mode {:?} and connectors {:?}", mode, connectors
|
"Initializing drm surface with mode {:?} and connectors {:?}", mode, connectors
|
||||||
);
|
);
|
||||||
|
|
||||||
let state = State::current_state(&*fd, crtc)?;
|
let state = State::current_state(&*fd, crtc)?;
|
||||||
let pending = State {
|
let pending = State {
|
||||||
mode,
|
mode,
|
||||||
connectors: connectors.iter().copied().collect(),
|
connectors: connectors.iter().copied().collect(),
|
||||||
|
@ -402,8 +402,11 @@ impl<A: AsRawFd + 'static> LegacyDrmSurface<A> {
|
||||||
Ok(false)
|
Ok(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn reset_state<B: AsRawFd + ControlDevice + 'static>(&self, fd: Option<&B>) -> Result<(), Error> {
|
pub(crate) fn reset_state<B: AsRawFd + ControlDevice + 'static>(
|
||||||
|
&self,
|
||||||
|
fd: Option<&B>,
|
||||||
|
) -> Result<(), Error> {
|
||||||
*self.state.write().unwrap() = if let Some(fd) = fd {
|
*self.state.write().unwrap() = if let Some(fd) = fd {
|
||||||
State::current_state(fd, self.crtc)?
|
State::current_state(fd, self.crtc)?
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -217,7 +217,7 @@ impl<A: AsRawFd + 'static> DrmSurface<A> {
|
||||||
} // There is no test-commiting with the legacy interface
|
} // There is no test-commiting with the legacy interface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Re-evaluates the current state of the crtc.
|
/// Re-evaluates the current state of the crtc.
|
||||||
///
|
///
|
||||||
/// Usually you do not need to call this, but if the state of
|
/// Usually you do not need to call this, but if the state of
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
//! Implementation of the rendering traits using OpenGL ES 2
|
//! Implementation of the rendering traits using OpenGL ES 2
|
||||||
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
use std::convert::TryFrom;
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
@ -10,7 +11,6 @@ use std::sync::{
|
||||||
mpsc::{channel, Receiver, Sender},
|
mpsc::{channel, Receiver, Sender},
|
||||||
};
|
};
|
||||||
use std::{collections::HashSet, os::raw::c_char};
|
use std::{collections::HashSet, os::raw::c_char};
|
||||||
use std::convert::TryFrom;
|
|
||||||
|
|
||||||
use cgmath::{prelude::*, Matrix3};
|
use cgmath::{prelude::*, Matrix3};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue