2020-04-18 23:30:05 +00:00
|
|
|
//!
|
|
|
|
//! Module for common/shared types of the various [`Device`](::backend::drm::Device)
|
|
|
|
//! and [`Surface`](::backend::drm::Surface) implementations of the `backend::drm` module.
|
2020-04-19 20:29:10 +00:00
|
|
|
//!
|
2020-04-18 23:30:05 +00:00
|
|
|
|
|
|
|
use drm::control::{connector, crtc, Mode, RawResourceHandle};
|
|
|
|
|
|
|
|
use std::path::PathBuf;
|
|
|
|
|
2020-04-19 20:29:10 +00:00
|
|
|
pub mod fallback;
|
|
|
|
|
2020-04-18 23:30:05 +00:00
|
|
|
/// Errors thrown by the [`LegacyDrmDevice`](::backend::drm::legacy::LegacyDrmDevice),
|
|
|
|
/// [`AtomicDrmDevice`](::backend::drm::atomic::AtomicDrmDevice)
|
|
|
|
/// and their surfaces: [`LegacyDrmSurface`](::backend::drm::legacy::LegacyDrmSurface)
|
|
|
|
/// and [`AtomicDrmSurface`](::backend::drm::atomic::AtomicDrmSurface).
|
|
|
|
#[derive(thiserror::Error, Debug)]
|
|
|
|
pub enum Error {
|
|
|
|
/// Unable to acquire DRM master
|
|
|
|
#[error("Failed to aquire DRM master")]
|
|
|
|
DrmMasterFailed,
|
|
|
|
/// The `DrmDevice` encountered an access error
|
2020-04-26 22:42:33 +00:00
|
|
|
#[error("DRM access error: {errmsg} on device `{dev:?}` ({source:})")]
|
2020-04-18 23:30:05 +00:00
|
|
|
Access {
|
|
|
|
/// Error message associated to the access error
|
|
|
|
errmsg: &'static str,
|
|
|
|
/// Device on which the error was generated
|
|
|
|
dev: Option<PathBuf>,
|
|
|
|
/// Underlying device error
|
|
|
|
source: failure::Compat<drm::SystemError>,
|
|
|
|
},
|
|
|
|
/// Unable to determine device id of drm device
|
|
|
|
#[error("Unable to determine device id of drm device")]
|
|
|
|
UnableToGetDeviceId(#[source] nix::Error),
|
|
|
|
/// Device is currently paused
|
|
|
|
#[error("Device is currently paused, operation rejected")]
|
|
|
|
DeviceInactive,
|
|
|
|
/// Mode is not compatible with all given connectors
|
|
|
|
#[error("Mode `{0:?}` is not compatible with all given connectors")]
|
|
|
|
ModeNotSuitable(Mode),
|
|
|
|
/// The given crtc is already in use by another backend
|
|
|
|
#[error("Crtc `{0:?}` is already in use by another backend")]
|
|
|
|
CrtcAlreadyInUse(crtc::Handle),
|
2020-04-26 14:32:44 +00:00
|
|
|
/// This operation would result in a surface without connectors.
|
|
|
|
#[error("Surface of crtc `{0:?}` would have no connectors, which is not accepted")]
|
|
|
|
SurfaceWithoutConnectors(crtc::Handle),
|
2020-04-18 23:30:05 +00:00
|
|
|
/// No encoder was found for a given connector on the set crtc
|
|
|
|
#[error("No encoder found for the given connector '{connector:?}' on crtc `{crtc:?}`")]
|
|
|
|
NoSuitableEncoder {
|
|
|
|
/// Connector
|
|
|
|
connector: connector::Handle,
|
|
|
|
/// CRTC
|
|
|
|
crtc: crtc::Handle,
|
|
|
|
},
|
|
|
|
/// No matching primary and cursor plane could be found for the given crtc
|
|
|
|
#[error("No matching primary and cursor plane could be found for crtc {crtc:?} on {dev:?}")]
|
|
|
|
NoSuitablePlanes {
|
|
|
|
/// CRTC
|
|
|
|
crtc: crtc::Handle,
|
|
|
|
/// Device on which the error was generated
|
|
|
|
dev: Option<PathBuf>,
|
|
|
|
},
|
|
|
|
/// The DrmDevice is missing a required property
|
|
|
|
#[error("The DrmDevice is missing a required property '{name}' for handle ({handle:?})")]
|
|
|
|
UnknownProperty {
|
|
|
|
/// Property handle
|
|
|
|
handle: RawResourceHandle,
|
|
|
|
/// Property name
|
|
|
|
name: &'static str,
|
|
|
|
},
|
|
|
|
/// Atomic Test failed for new properties
|
|
|
|
#[error("Atomic Test failed for new properties on crtc ({0:?})")]
|
|
|
|
TestFailed(crtc::Handle),
|
|
|
|
}
|