Struct gbm_rs::Device [] [src]

pub struct Device { /* fields omitted */ }

Analogous to gbm_device.

Used to perform memory allocations for a DRM device.

Methods

impl Device
[src]

Creates a Device for allocating Buffers

The file descriptor passed in is used by the backend to communicate with platform for allocating the memory. For allocations using DRI this would be the file descriptor returned when opening a device such as /dev/dri/card0

Arguments

fd: The file descriptor for a backend specific device

Returns

The newly created struct gbm_device. If the creation of the device failed None will be returned.

Example

extern crate gbm_rs as gbm;

use std::fs::OpenOptions;
use std::os::unix::prelude::*;

let file = OpenOptions::new().read(true).write(true).open("/dev/dri/card0").unwrap();

let device = gbm::Device::from_fd(file.as_raw_fd()).unwrap();

Test if a format is supported for a given set of usage flags

Arguments

format: The fourcc code to test

usage: A bitmask of the usages to test the format against

Returns

true if the format is supported otherwise false

Returns the file descriptor for the Device

Returns

The Fd that the Device was created with

Example

let fd = device.fd();

assert_eq!(fd, file.as_raw_fd());

Returns the gbm_device for the Device

Returns

A pointer to the gbm_device used to create the Device.

Trait Implementations

impl Drop for Device
[src]

A method called when the value goes out of scope. Read more