#[non_exhaustive]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum DisplayTechnology {
Tft,
DstnStn,
TftIps,
TftMva,
Crt,
Pdp,
Oled,
El,
FedSed,
Lcos,
Unknown(u8),
}
impl DisplayTechnology {
pub fn from_nibble(nibble: u8) -> Self {
match nibble & 0x0F {
0 => Self::Tft,
1 => Self::DstnStn,
2 => Self::TftIps,
3 => Self::TftMva,
4 => Self::Crt,
5 => Self::Pdp,
6 => Self::Oled,
7 => Self::El,
8 => Self::FedSed,
9 => Self::Lcos,
v => Self::Unknown(v),
}
}
}
#[non_exhaustive]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum OperatingMode {
Continuous,
NonContinuous,
Unknown(u8),
}
impl OperatingMode {
pub fn from_nibble(nibble: u8) -> Self {
match nibble & 0x0F {
0 => Self::Continuous,
1 => Self::NonContinuous,
v => Self::Unknown(v),
}
}
}
#[non_exhaustive]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BacklightType {
None,
AcFluorescent,
Dc,
Unknown(u8),
}
impl BacklightType {
pub fn from_bits(bits: u8) -> Self {
match bits & 0x03 {
0 => Self::None,
1 => Self::AcFluorescent,
2 => Self::Dc,
v => Self::Unknown(v),
}
}
}
#[non_exhaustive]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum PhysicalOrientation {
Landscape,
Portrait,
NotDefined,
Undefined,
}
impl PhysicalOrientation {
pub fn from_bits(bits: u8) -> Self {
match bits & 0x03 {
0 => Self::Landscape,
1 => Self::Portrait,
2 => Self::NotDefined,
_ => Self::Undefined,
}
}
}
#[non_exhaustive]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum RotationCapability {
None,
Cw90,
Deg180,
Cw270,
}
impl RotationCapability {
pub fn from_bits(bits: u8) -> Self {
match bits & 0x03 {
0 => Self::None,
1 => Self::Cw90,
2 => Self::Deg180,
_ => Self::Cw270,
}
}
}
#[non_exhaustive]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ZeroPixelLocation {
UpperLeft,
UpperRight,
LowerLeft,
LowerRight,
}
impl ZeroPixelLocation {
pub fn from_bits(bits: u8) -> Self {
match bits & 0x03 {
0 => Self::UpperLeft,
1 => Self::UpperRight,
2 => Self::LowerLeft,
_ => Self::LowerRight,
}
}
}
#[non_exhaustive]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ScanDirection {
NotDefined,
Normal,
Reversed,
Reserved,
}
impl ScanDirection {
pub fn from_bits(bits: u8) -> Self {
match bits & 0x03 {
0 => Self::NotDefined,
1 => Self::Normal,
2 => Self::Reversed,
_ => Self::Reserved,
}
}
}
#[non_exhaustive]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SubpixelLayout {
NotDefined,
RgbVertical,
BgrVertical,
RgbHorizontal,
BgrHorizontal,
QuadRgbg,
QuadBgrg,
DeltaRgb,
DeltaBgr,
Unknown(u8),
}
impl SubpixelLayout {
pub fn from_byte(byte: u8) -> Self {
match byte {
0x00 => Self::NotDefined,
0x01 => Self::RgbVertical,
0x02 => Self::BgrVertical,
0x03 => Self::RgbHorizontal,
0x04 => Self::BgrHorizontal,
0x05 => Self::QuadRgbg,
0x06 => Self::QuadBgrg,
0x07 => Self::DeltaRgb,
0x08 => Self::DeltaBgr,
v => Self::Unknown(v),
}
}
}
#[non_exhaustive]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum DisplayInterfaceType {
Undefined,
Analog,
LvdsSingle,
LvdsDual,
TmdsSingle,
TmdsDual,
EmbeddedDisplayPort,
DisplayPort,
Proprietary,
Reserved(u8),
}
impl DisplayInterfaceType {
pub fn from_nibble(nibble: u8) -> Self {
match nibble & 0x0F {
0x0 => Self::Undefined,
0x1 => Self::Analog,
0x2 => Self::LvdsSingle,
0x3 => Self::LvdsDual,
0x4 => Self::TmdsSingle,
0x5 => Self::TmdsDual,
0x6 => Self::EmbeddedDisplayPort,
0x7 => Self::DisplayPort,
0x8 => Self::Proprietary,
v => Self::Reserved(v),
}
}
}
#[non_exhaustive]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum InterfaceContentProtection {
None,
Hdcp,
Dpcp,
Reserved(u8),
}
impl InterfaceContentProtection {
pub fn from_bits(bits: u8) -> Self {
match bits & 0x03 {
0 => Self::None,
1 => Self::Hdcp,
2 => Self::Dpcp,
v => Self::Reserved(v),
}
}
}
#[non_exhaustive]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct DisplayIdInterface {
pub interface_type: DisplayInterfaceType,
pub spread_spectrum: bool,
pub num_lanes: u8,
pub min_pixel_clock_10khz: u32,
pub max_pixel_clock_10khz: u32,
pub content_protection: InterfaceContentProtection,
}
impl DisplayIdInterface {
pub fn new(
interface_type: DisplayInterfaceType,
spread_spectrum: bool,
num_lanes: u8,
min_pixel_clock_10khz: u32,
max_pixel_clock_10khz: u32,
content_protection: InterfaceContentProtection,
) -> Self {
Self {
interface_type,
spread_spectrum,
num_lanes,
min_pixel_clock_10khz,
max_pixel_clock_10khz,
content_protection,
}
}
}
#[non_exhaustive]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum TileTopologyBehavior {
Undefined,
RequireAllTiles,
ScaleWhenMissing,
Reserved(u8),
}
impl TileTopologyBehavior {
pub fn from_bits(bits: u8) -> Self {
match bits & 0x03 {
0 => Self::Undefined,
1 => Self::RequireAllTiles,
2 => Self::ScaleWhenMissing,
v => Self::Reserved(v),
}
}
}
#[non_exhaustive]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct TileBezelInfo {
pub top_px: u8,
pub bottom_px: u8,
pub right_px: u8,
pub left_px: u8,
}
impl TileBezelInfo {
pub fn new(top_px: u8, bottom_px: u8, right_px: u8, left_px: u8) -> Self {
Self {
top_px,
bottom_px,
right_px,
left_px,
}
}
}
#[non_exhaustive]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct DisplayIdTiledTopology {
pub single_enclosure: bool,
pub topology_behavior: TileTopologyBehavior,
pub h_tile_count: u8,
pub v_tile_count: u8,
pub h_tile_location: u8,
pub v_tile_location: u8,
pub tile_width_px: u16,
pub tile_height_px: u16,
pub bezel: Option<TileBezelInfo>,
}
impl DisplayIdTiledTopology {
#[allow(clippy::too_many_arguments)]
pub fn new(
single_enclosure: bool,
topology_behavior: TileTopologyBehavior,
h_tile_count: u8,
v_tile_count: u8,
h_tile_location: u8,
v_tile_location: u8,
tile_width_px: u16,
tile_height_px: u16,
bezel: Option<TileBezelInfo>,
) -> Self {
Self {
single_enclosure,
topology_behavior,
h_tile_count,
v_tile_count,
h_tile_location,
v_tile_location,
tile_width_px,
tile_height_px,
bezel,
}
}
}
#[non_exhaustive]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum StereoViewingMode {
FieldSequential,
SideBySide,
TopAndBottom,
RowInterleaved,
ColumnInterleaved,
PixelInterleaved,
Reserved(u8),
}
impl StereoViewingMode {
pub fn from_nibble(nibble: u8) -> Self {
match nibble & 0x0F {
0 => Self::FieldSequential,
1 => Self::SideBySide,
2 => Self::TopAndBottom,
3 => Self::RowInterleaved,
4 => Self::ColumnInterleaved,
5 => Self::PixelInterleaved,
v => Self::Reserved(v),
}
}
}
#[non_exhaustive]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum StereoSyncInterface {
DisplayConnector,
VesaDin,
Infrared,
RadioFrequency,
Reserved(u8),
}
impl StereoSyncInterface {
pub fn from_byte(byte: u8) -> Self {
match byte {
0 => Self::DisplayConnector,
1 => Self::VesaDin,
2 => Self::Infrared,
3 => Self::RadioFrequency,
v => Self::Reserved(v),
}
}
}
#[non_exhaustive]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct DisplayIdStereoInterface {
pub viewing_mode: StereoViewingMode,
pub sync_polarity_positive: bool,
pub sync_interface: StereoSyncInterface,
}
impl DisplayIdStereoInterface {
pub fn new(
viewing_mode: StereoViewingMode,
sync_polarity_positive: bool,
sync_interface: StereoSyncInterface,
) -> Self {
Self {
viewing_mode,
sync_polarity_positive,
sync_interface,
}
}
}
#[non_exhaustive]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct PowerSequencing {
pub t1_power_to_signal: u8,
pub t2_signal_to_backlight: u8,
pub t3_backlight_to_signal_off: u8,
pub t4_signal_to_power_off: u8,
pub t5_power_off_min: u8,
pub t6_backlight_off_min: u8,
}
impl PowerSequencing {
pub fn new(
t1_power_to_signal: u8,
t2_signal_to_backlight: u8,
t3_backlight_to_signal_off: u8,
t4_signal_to_power_off: u8,
t5_power_off_min: u8,
t6_backlight_off_min: u8,
) -> Self {
Self {
t1_power_to_signal,
t2_signal_to_backlight,
t3_backlight_to_signal_off,
t4_signal_to_power_off,
t5_power_off_min,
t6_backlight_off_min,
}
}
}