Type Alias libdrm_amdgpu_sys::drmModeModeInfo

source ·
pub type drmModeModeInfo = _drmModeModeInfo;

Aliased Type§

struct drmModeModeInfo {
Show 15 fields pub clock: u32, pub hdisplay: u16, pub hsync_start: u16, pub hsync_end: u16, pub htotal: u16, pub hskew: u16, pub vdisplay: u16, pub vsync_start: u16, pub vsync_end: u16, pub vtotal: u16, pub vscan: u16, pub vrefresh: u32, pub flags: u32, pub type_: u32, pub name: [i8; 32],
}

Fields§

§clock: u32§hdisplay: u16§hsync_start: u16§hsync_end: u16§htotal: u16§hskew: u16§vdisplay: u16§vsync_start: u16§vsync_end: u16§vtotal: u16§vscan: u16§vrefresh: u32§flags: u32§type_: u32§name: [i8; 32]

Implementations§

source§

impl drmModeModeInfo

source

pub fn name(&self) -> String

source

pub fn refresh_rate(&self) -> f32

Examples found in repository?
examples/drm_mode.rs (line 34)
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
fn main() {
    let fd = {
        use std::os::fd::IntoRawFd;

        let f = File::open("/dev/dri/card0").unwrap();

        f.into_raw_fd()
    };

    let drm_mode_res = drmModeRes::get(fd).unwrap();
    let current_connectors = drm_mode_res.get_all_connector_current(fd);

    for connector in current_connectors.iter() {
        println!(
            "Connector {} ({}-{}), {}",
            connector.connector_id(),
            connector.connector_type(),
            connector.connector_type_id(),
            connector.connection(),
        );

        let modes = connector.get_modes();

        if !modes.is_empty() {
            println!("    Modes");
            for mode in connector.get_modes() {
                println!(
                    "        {}x{}@{:.2}{}{}",
                    mode.vdisplay,
                    mode.hdisplay,
                    mode.refresh_rate(),
                    if mode.type_is_preferred() { " preferred" } else { "" },
                    if mode.type_is_driver() { " driver" } else { "" },
                );
            }
        }

        if let Some(conn_prop) = connector.get_connector_props(fd) {
            let mode_props = conn_prop.get_mode_property(fd);

            for (prop, value) in mode_props {
                let type_ = prop.property_type();

                println!(
                    "    {:?}, id: {}, value: {}, type: {}",
                    prop.name(),
                    prop.prop_id(),
                    value,
                    type_,
                );

                match type_ {
                    drmModePropType::RANGE =>
                        println!("        values: {:?}", prop.values()),
                    drmModePropType::ENUM => {
                        print!("        enums: [");
                        for enum_ in prop.enums().iter() {
                            print!("{:?}={}, ", enum_.name(), enum_.value);
                        }
                        println!("] ");
                    },
                    drmModePropType::BLOB => {
                        if let Some(b) = drmModePropertyBlob::get(fd, value as u32) {
                            print!("        blob:");

                            for (i, byte) in b.data().iter().enumerate() {
                                if (i % 16) == 0 { print!("\n            "); }
                                print!("{byte:02x}");
                            }

                            println!();
                        }
                    },
                    _ => {},
                }
            }
        }
        println!();
    }
}
source

pub fn type_is_preferred(&self) -> bool

Examples found in repository?
examples/drm_mode.rs (line 35)
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
fn main() {
    let fd = {
        use std::os::fd::IntoRawFd;

        let f = File::open("/dev/dri/card0").unwrap();

        f.into_raw_fd()
    };

    let drm_mode_res = drmModeRes::get(fd).unwrap();
    let current_connectors = drm_mode_res.get_all_connector_current(fd);

    for connector in current_connectors.iter() {
        println!(
            "Connector {} ({}-{}), {}",
            connector.connector_id(),
            connector.connector_type(),
            connector.connector_type_id(),
            connector.connection(),
        );

        let modes = connector.get_modes();

        if !modes.is_empty() {
            println!("    Modes");
            for mode in connector.get_modes() {
                println!(
                    "        {}x{}@{:.2}{}{}",
                    mode.vdisplay,
                    mode.hdisplay,
                    mode.refresh_rate(),
                    if mode.type_is_preferred() { " preferred" } else { "" },
                    if mode.type_is_driver() { " driver" } else { "" },
                );
            }
        }

        if let Some(conn_prop) = connector.get_connector_props(fd) {
            let mode_props = conn_prop.get_mode_property(fd);

            for (prop, value) in mode_props {
                let type_ = prop.property_type();

                println!(
                    "    {:?}, id: {}, value: {}, type: {}",
                    prop.name(),
                    prop.prop_id(),
                    value,
                    type_,
                );

                match type_ {
                    drmModePropType::RANGE =>
                        println!("        values: {:?}", prop.values()),
                    drmModePropType::ENUM => {
                        print!("        enums: [");
                        for enum_ in prop.enums().iter() {
                            print!("{:?}={}, ", enum_.name(), enum_.value);
                        }
                        println!("] ");
                    },
                    drmModePropType::BLOB => {
                        if let Some(b) = drmModePropertyBlob::get(fd, value as u32) {
                            print!("        blob:");

                            for (i, byte) in b.data().iter().enumerate() {
                                if (i % 16) == 0 { print!("\n            "); }
                                print!("{byte:02x}");
                            }

                            println!();
                        }
                    },
                    _ => {},
                }
            }
        }
        println!();
    }
}
source

pub fn type_is_userdef(&self) -> bool

source

pub fn type_is_driver(&self) -> bool

Examples found in repository?
examples/drm_mode.rs (line 36)
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
fn main() {
    let fd = {
        use std::os::fd::IntoRawFd;

        let f = File::open("/dev/dri/card0").unwrap();

        f.into_raw_fd()
    };

    let drm_mode_res = drmModeRes::get(fd).unwrap();
    let current_connectors = drm_mode_res.get_all_connector_current(fd);

    for connector in current_connectors.iter() {
        println!(
            "Connector {} ({}-{}), {}",
            connector.connector_id(),
            connector.connector_type(),
            connector.connector_type_id(),
            connector.connection(),
        );

        let modes = connector.get_modes();

        if !modes.is_empty() {
            println!("    Modes");
            for mode in connector.get_modes() {
                println!(
                    "        {}x{}@{:.2}{}{}",
                    mode.vdisplay,
                    mode.hdisplay,
                    mode.refresh_rate(),
                    if mode.type_is_preferred() { " preferred" } else { "" },
                    if mode.type_is_driver() { " driver" } else { "" },
                );
            }
        }

        if let Some(conn_prop) = connector.get_connector_props(fd) {
            let mode_props = conn_prop.get_mode_property(fd);

            for (prop, value) in mode_props {
                let type_ = prop.property_type();

                println!(
                    "    {:?}, id: {}, value: {}, type: {}",
                    prop.name(),
                    prop.prop_id(),
                    value,
                    type_,
                );

                match type_ {
                    drmModePropType::RANGE =>
                        println!("        values: {:?}", prop.values()),
                    drmModePropType::ENUM => {
                        print!("        enums: [");
                        for enum_ in prop.enums().iter() {
                            print!("{:?}={}, ", enum_.name(), enum_.value);
                        }
                        println!("] ");
                    },
                    drmModePropType::BLOB => {
                        if let Some(b) = drmModePropertyBlob::get(fd, value as u32) {
                            print!("        blob:");

                            for (i, byte) in b.data().iter().enumerate() {
                                if (i % 16) == 0 { print!("\n            "); }
                                print!("{byte:02x}");
                            }

                            println!();
                        }
                    },
                    _ => {},
                }
            }
        }
        println!();
    }
}
source

pub fn is_phsync(&self) -> bool

source

pub fn is_nhsync(&self) -> bool

source

pub fn is_pvsync(&self) -> bool

source

pub fn is_nvsync(&self) -> bool

source

pub fn is_interlace(&self) -> bool

source

pub fn is_dblscan(&self) -> bool

source

pub fn is_csync(&self) -> bool

source

pub fn is_pcsync(&self) -> bool

source

pub fn is_ncsync(&self) -> bool

source

pub fn is_hskew(&self) -> bool

source

pub fn is_dblclk(&self) -> bool

source

pub fn is_clkdiv2(&self) -> bool