Skip to main content

ferroui_linuxframebuffer/
drm_output_options.rs

1//! The options of the DRM output (the port of `DrmOutputOptions.cs`).
2
3use crate::DrmConnectorType;
4use ferroui_base::media::Color;
5use ferroui_base::platform::SurfaceOrientation;
6use ferroui_base::PixelSize;
7
8/// DRM Output Options
9#[derive(Clone, Debug, PartialEq)]
10pub struct DrmOutputOptions {
11    /// Scaling factor.
12    /// Default: 1.0
13    pub scaling: f64,
14
15    /// The orientation of the screen relative to the frame buffer memory orientation
16    /// Default: Normal
17    pub orientation: SurfaceOrientation,
18
19    /// If true an two cycle buffer swapping is processed at init.
20    /// Default: True
21    pub enable_initial_buffer_swapping: bool,
22
23    /// Color for [`enable_initial_buffer_swapping`](Self::enable_initial_buffer_swapping)
24    /// Default: R0 G0 B0 A0
25    pub initial_buffer_swapping_color: Color,
26
27    /// Specifies the video mode with which the DrmOutput should be created, if it is not found it will fallback to the preferred mode.
28    /// If null, the preferred mode will be used.
29    pub video_mode: Option<PixelSize>,
30
31    /// Specifies whether our connector is HDMI-A, DVI, DisplayPort, etc.
32    /// If null, the preferred connector will be used.
33    pub connector_type: Option<DrmConnectorType>,
34
35    /// Specifies the connector type ID used with [`connector_type`](Self::connector_type).
36    /// If null, the preferred connector type ID will be used.
37    pub connector_type_id: Option<u32>,
38}
39
40impl Default for DrmOutputOptions {
41    fn default() -> Self {
42        Self {
43            scaling: 1.0,
44            orientation: SurfaceOrientation::Rotation0,
45            enable_initial_buffer_swapping: true,
46            initial_buffer_swapping_color: Color::new(0, 0, 0, 0),
47            video_mode: None,
48            connector_type: None,
49            connector_type_id: None,
50        }
51    }
52}