Struct libdrm_amdgpu_sys::drmModeConnector
source · pub struct drmModeConnector(/* private fields */);
Implementations§
source§impl drmModeConnector
impl drmModeConnector
pub fn get(fd: i32, connector_id: u32) -> Option<Self>
pub fn get_current(fd: i32, connector_id: u32) -> Option<Self>
pub fn set( fd: i32, connector_id: u32, property_id: u32, value: u64 ) -> Result<(), i32>
sourcepub fn connection(&self) -> drmModeConnection
pub fn connection(&self) -> drmModeConnection
Examples found in repository?
examples/drm_mode.rs (line 22)
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!();
}
}
sourcepub fn connector_type(&self) -> drmModeConnectorType
pub fn connector_type(&self) -> drmModeConnectorType
Examples found in repository?
examples/drm_mode.rs (line 20)
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!();
}
}
sourcepub fn connector_id(&self) -> u32
pub fn connector_id(&self) -> u32
Examples found in repository?
examples/drm_mode.rs (line 19)
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!();
}
}
sourcepub fn connector_type_id(&self) -> u32
pub fn connector_type_id(&self) -> u32
Examples found in repository?
examples/drm_mode.rs (line 21)
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!();
}
}
pub fn encoder_id(&self) -> u32
pub fn mmWidth(&self) -> u32
pub fn mmHeight(&self) -> u32
sourcepub fn get_connector_props(&self, fd: i32) -> Option<drmModeObjectProperties>
pub fn get_connector_props(&self, fd: i32) -> Option<drmModeObjectProperties>
Examples found in repository?
examples/drm_mode.rs (line 41)
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!();
}
}
sourcepub fn get_modes(&self) -> Vec<drmModeModeInfo>
pub fn get_modes(&self) -> Vec<drmModeModeInfo>
Examples found in repository?
examples/drm_mode.rs (line 25)
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!();
}
}
Trait Implementations§
source§impl Clone for drmModeConnector
impl Clone for drmModeConnector
source§fn clone(&self) -> drmModeConnector
fn clone(&self) -> drmModeConnector
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for drmModeConnector
impl Debug for drmModeConnector
Auto Trait Implementations§
impl Freeze for drmModeConnector
impl RefUnwindSafe for drmModeConnector
impl !Send for drmModeConnector
impl !Sync for drmModeConnector
impl Unpin for drmModeConnector
impl UnwindSafe for drmModeConnector
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more