Struct drm::Device
[−]
[src]
pub struct Device { /* fields omitted */ }
Open fd for a dri device. Such as /dev/dri/card0.
Methods
impl Device
[src]
fn cards() -> Result<Box<Iterator<Item=PathBuf>>>
List the cards found at the "Usual place" (/dev/dri).
This is mostly for convienience. It's simply iterating over: /dev/dri/card*
A more nuanced solution might need to be implemented. Such as support control and render nodes.
fn open<P>(path: P) -> Result<Device> where P: AsRef<Path>
Opens a card at a particular path.
fn first_card() -> Result<Device>
Grab the first card availble (by filename order), this is probably not what you want to do. Except when:
- You have a stupid demo application (like the ones in ../examples)
- Fallback for a configurable program that is not configured.
- You have a completely bespoke system and you know which card should be there. (eg embedded systems)
(i.e don't be asinine and force future users to use hacks to make your program work on multicard systems)
fn set_master<'a>(&'a mut self) -> Result<Master<'a>>
Set this process to be the current card master.
Returns a Guard that will unset master on drop. The card master can set the mode of the device and can update the frame buffer.
Returns a Invalid Arguement error (ErrorKind::InvalidInput
)
when another process already is already card master.
fn version(&self) -> Result<Version>
Get driver version information.
fn get_resources(&self) -> Result<Resources>
fn get<T: Resource>(&self, id: Id<T>) -> Result<T>
fn busid(&self) -> Result<String>
Fetches the busid of the card.
Dev notes: on my system this is an empty string. In xf86drm.h
there are functions that use this string to open the device.
I assume it might be realted to path names in /sys/
.
fn request_vblank(&self, data: usize, crtc_num: u32) -> Result<()>
Request a vblank event, that can be late read by an read_event.
crtc_num
is the index of the CRTC id returned by Resources::crtcs
.
fn read_event(&mut self) -> Result<Event>
Reads the next available event.
Errors
- If no events are availble an error with kind
ErrorKind::WouldBlock
is returned. - If a syscall is interrupted
ErrorKind::Interrupted
- If suprising data is returned
ErrorKind::InvalidData
. - Any other
io:Error
from the kernel.
Trait Implementations
impl Debug for Device
[src]
impl AsRawFd for Device
[src]
impl IntoRawFd for Device
[src]
fn into_raw_fd(self) -> RawFd
Consumes this object, returning the raw underlying file descriptor. Read more
impl FromRawFd for Device
[src]
unsafe fn from_raw_fd(fd: RawFd) -> Device
Constructs a new instances of Self
from the given raw file descriptor. Read more