Struct gbm::Device[][src]

pub struct Device<T: AsRawFd + 'static> { /* fields omitted */ }

An open GBM device

Implementations

impl Device<FdWrapper>[src]

pub unsafe fn new_from_fd(fd: RawFd) -> IoResult<Device<FdWrapper>>[src]

Open a GBM device from a given unix file descriptor.

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.

Safety

The lifetime of the resulting device depends on the ownership of the file descriptor. Closing the file descriptor before dropping the Device will lead to undefined behavior.

impl<T: AsRawFd + 'static> Device<T>[src]

pub fn new(fd: T) -> IoResult<Device<T>>[src]

Open a GBM device from a given open DRM device.

The underlying 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.

pub fn backend_name(&self) -> &str[src]

Get the backend name

pub fn is_format_supported(
    &self,
    format: Format,
    usage: BufferObjectFlags
) -> bool
[src]

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

pub fn create_surface<U: 'static>(
    &self,
    width: u32,
    height: u32,
    format: Format,
    usage: BufferObjectFlags
) -> IoResult<Surface<U>>
[src]

Allocate a new surface object

pub fn create_surface_with_modifiers<U: 'static>(
    &self,
    width: u32,
    height: u32,
    format: Format,
    modifiers: impl Iterator<Item = Modifier>
) -> IoResult<Surface<U>>
[src]

Allocate a new surface object with explicit modifiers

pub fn create_buffer_object<U: 'static>(
    &self,
    width: u32,
    height: u32,
    format: Format,
    usage: BufferObjectFlags
) -> IoResult<BufferObject<U>>
[src]

Allocate a buffer object for the given dimensions

pub fn create_buffer_object_with_modifiers<U: 'static>(
    &self,
    width: u32,
    height: u32,
    format: Format,
    modifiers: impl Iterator<Item = Modifier>
) -> IoResult<BufferObject<U>>
[src]

Allocate a buffer object for the given dimensions with explicit modifiers

pub fn import_buffer_object_from_wayland<U: 'static>(
    &self,
    buffer: &WlBuffer,
    usage: BufferObjectFlags
) -> IoResult<BufferObject<U>>
[src]

Create a GBM buffer object from a wayland buffer

This function imports a foreign WlBuffer object and creates a new GBM buffer object for it. This enables using the foreign object with a display API such as KMS.

The GBM bo shares the underlying pixels but its life-time is independent of the foreign object.

pub unsafe fn import_buffer_object_from_egl<U: 'static>(
    &self,
    buffer: EGLImage,
    usage: BufferObjectFlags
) -> IoResult<BufferObject<U>>
[src]

Create a GBM buffer object from an egl buffer

This function imports a foreign EGLImage object and creates a new GBM buffer object for it. This enables using the foreign object with a display API such as KMS.

The GBM bo shares the underlying pixels but its life-time is independent of the foreign object.

Safety

The given EGLImage is a raw pointer. Passing null or an invalid EGLImage will cause undefined behavior.

pub fn import_buffer_object_from_dma_buf<U: 'static>(
    &self,
    buffer: RawFd,
    width: u32,
    height: u32,
    stride: u32,
    format: Format,
    usage: BufferObjectFlags
) -> IoResult<BufferObject<U>>
[src]

Create a GBM buffer object from a dma buffer

This function imports a foreign dma buffer from an open file descriptor and creates a new GBM buffer object for it. This enables using the foreign object with a display API such as KMS.

The GBM bo shares the underlying pixels but its life-time is independent of the foreign object.

pub fn import_buffer_object_from_dma_buf_with_modifiers<U: 'static>(
    &self,
    len: u32,
    buffers: [RawFd; 4],
    width: u32,
    height: u32,
    format: Format,
    usage: BufferObjectFlags,
    strides: [i32; 4],
    offsets: [i32; 4],
    modifier: Modifier
) -> IoResult<BufferObject<U>>
[src]

Create a GBM buffer object from a dma buffer with explicit modifiers

This function imports a foreign dma buffer from an open file descriptor and creates a new GBM buffer object for it. This enables using the foreign object with a display API such as KMS.

The GBM bo shares the underlying pixels but its life-time is independent of the foreign object.

Trait Implementations

impl<T: AsRawFd + 'static> AsRaw<gbm_device> for Device<T>[src]

fn as_raw(&self) -> *const gbm_device[src]

Receive a raw pointer representing this type.

impl<T: AsRawFd + 'static> AsRawFd for Device<T>[src]

fn as_raw_fd(&self) -> RawFd[src]

Extracts the raw file descriptor. Read more

impl<T: AsRawFd + Clone + 'static> Clone for Device<T>[src]

fn clone(&self) -> Device<T>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T: AsRawFd + 'static> Deref for Device<T>[src]

type Target = T

The resulting type after dereferencing.

fn deref(&self) -> &T[src]

Dereferences the value.

impl<T: AsRawFd + 'static> DerefMut for Device<T>[src]

fn deref_mut(&mut self) -> &mut T[src]

Mutably dereferences the value.

impl<T: DrmControlDevice + AsRawFd + 'static> Device for Device<T>[src]

fn resource_handles(&self) -> Result<ResourceHandles, SystemError>[src]

Gets the set of resource handles that this device currently controls

fn plane_handles(&self) -> Result<PlaneResourceHandles, SystemError>[src]

Gets the set of plane handles that this device currently has

fn get_connector(&self, handle: Handle) -> Result<Info, SystemError>[src]

Returns information about a specific connector

fn get_encoder(&self, handle: Handle) -> Result<Info, SystemError>[src]

Returns information about a specific encoder

fn get_crtc(&self, handle: Handle) -> Result<Info, SystemError>[src]

Returns information about a specific CRTC

fn set_crtc(
    &self,
    handle: Handle,
    framebuffer: Option<Handle>,
    pos: (u32, u32),
    conns: &[Handle],
    mode: Option<Mode>
) -> Result<(), SystemError>
[src]

Set CRTC state

fn get_framebuffer(&self, handle: Handle) -> Result<Info, SystemError>[src]

Returns information about a specific framebuffer

fn add_framebuffer<B>(
    &self,
    buffer: &B,
    depth: u32,
    bpp: u32
) -> Result<Handle, SystemError> where
    B: Buffer + ?Sized
[src]

Add a new framebuffer

fn add_planar_framebuffer<B>(
    &self,
    planar_buffer: &B,
    modifiers: &[Option<DrmModifier>; 4],
    flags: u32
) -> Result<Handle, SystemError> where
    B: PlanarBuffer + ?Sized
[src]

Add framebuffer (with modifiers)

fn dirty_framebuffer(
    &self,
    handle: Handle,
    clips: &[drm_clip_rect]
) -> Result<(), SystemError>
[src]

Mark parts of a framebuffer dirty

fn destroy_framebuffer(&self, handle: Handle) -> Result<(), SystemError>[src]

Destroy a framebuffer

fn get_plane(&self, handle: Handle) -> Result<Info, SystemError>[src]

Returns information about a specific plane

fn set_plane(
    &self,
    handle: Handle,
    crtc: Handle,
    framebuffer: Option<Handle>,
    flags: u32,
    crtc_rect: (i32, i32, u32, u32),
    src_rect: (u32, u32, u32, u32)
) -> Result<(), SystemError>
[src]

Set plane state. Read more

fn get_property(&self, handle: Handle) -> Result<Info, SystemError>[src]

Returns information about a specific property.

fn set_property<T>(
    &self,
    handle: T,
    prop: Handle,
    value: u64
) -> Result<(), SystemError> where
    T: ResourceHandle
[src]

Sets a property for a specific resource.

fn create_property_blob<T>(
    &self,
    data: &T
) -> Result<Value<'static>, SystemError>
[src]

Create a property blob value from a given data blob

fn get_property_blob(&self, blob: u64) -> Result<Vec<u8, Global>, SystemError>[src]

Get a property blob’s data

fn destroy_property_blob(&self, blob: u64) -> Result<(), SystemError>[src]

Destroy a given property blob value

fn get_modes(&self, handle: Handle) -> Result<Vec<Mode, Global>, SystemError>[src]

Returns the set of Modes that a particular connector supports.

fn get_properties<T>(&self, handle: T) -> Result<PropertyValueSet, SystemError> where
    T: ResourceHandle
[src]

Gets a list of property handles and values for this resource.

fn get_gamma(
    &self,
    crtc: Handle,
    red: &mut [u16],
    green: &mut [u16],
    blue: &mut [u16]
) -> Result<(), SystemError>
[src]

Receive the currently set gamma ramp of a crtc

fn set_gamma(
    &self,
    crtc: Handle,
    red: &[u16],
    green: &[u16],
    blue: &[u16]
) -> Result<(), SystemError>
[src]

Set a gamma ramp for the given crtc

fn open_buffer(&self, name: Name) -> Result<Handle, SystemError>[src]

Open a GEM buffer handle by name

fn close_buffer(&self, handle: Handle) -> Result<(), SystemError>[src]

Close a GEM buffer handle

fn create_dumb_buffer(
    &self,
    size: (u32, u32),
    format: DrmFourcc,
    bpp: u32
) -> Result<DumbBuffer, SystemError>
[src]

Create a new dumb buffer with a given size and pixel format

fn map_dumb_buffer(
    &self,
    buffer: &'a mut DumbBuffer
) -> Result<DumbMapping<'a>, SystemError>
[src]

Map the buffer for access

fn destroy_dumb_buffer(&self, buffer: DumbBuffer) -> Result<(), SystemError>[src]

Free the memory resources of a dumb buffer

fn set_cursor<B>(
    &self,
    crtc: Handle,
    buffer: Option<&B>
) -> Result<(), SystemError> where
    B: Buffer + ?Sized
[src]

👎 Deprecated:

Usage of deprecated ioctl set_cursor: use a cursor plane instead

Sets a hardware-cursor on the given crtc with the image of a given buffer Read more

fn set_cursor2<B>(
    &self,
    crtc: Handle,
    buffer: Option<&B>,
    hotspot: (i32, i32)
) -> Result<(), SystemError> where
    B: Buffer + ?Sized
[src]

👎 Deprecated:

Usage of deprecated ioctl set_cursor2: use a cursor plane instead

Sets a hardware-cursor on the given crtc with the image of a given buffer and a hotspot marking the click point of the cursor. Read more

fn move_cursor(&self, crtc: Handle, pos: (i32, i32)) -> Result<(), SystemError>[src]

👎 Deprecated:

Usage of deprecated ioctl move_cursor: use a cursor plane instead

Moves a set cursor on a given crtc

fn atomic_commit(
    &self,
    flags: &[AtomicCommitFlags],
    req: AtomicModeReq
) -> Result<(), SystemError>
[src]

Request an atomic commit with given flags and property-value pair for a list of objects.

fn prime_fd_to_buffer(&self, fd: i32) -> Result<Handle, SystemError>[src]

Convert a prime file descriptor to a GEM buffer handle

fn buffer_to_prime_fd(
    &self,
    handle: Handle,
    flags: u32
) -> Result<i32, SystemError>
[src]

Convert a prime file descriptor to a GEM buffer handle

fn page_flip(
    &self,
    handle: Handle,
    framebuffer: Handle,
    flags: &[PageFlipFlags],
    target: Option<PageFlipTarget>
) -> Result<(), SystemError>
[src]

Queue a page flip on the given crtc

fn receive_events(&self) -> Result<Events, SystemError>[src]

Receive pending events

impl<T: DrmDevice + AsRawFd + 'static> Device for Device<T>[src]

fn acquire_master_lock(&self) -> Result<(), SystemError>[src]

Acquires the DRM Master lock for this process. Read more

fn release_master_lock(&self) -> Result<(), SystemError>[src]

Releases the DRM Master lock for another process to use.

fn generate_auth_token(&self) -> Result<AuthToken, SystemError>[src]

👎 Deprecated:

Consider opening a render node instead.

Generates an AuthToken for this process.

fn authenticate_auth_token(&self, token: AuthToken) -> Result<(), SystemError>[src]

Authenticates an AuthToken from another process.

fn set_client_capability(
    &self,
    cap: ClientCapability,
    enable: bool
) -> Result<(), SystemError>
[src]

Requests the driver to expose or hide certain capabilities. See ClientCapability for more information. Read more

fn get_bus_id(&self) -> Result<BusID, SystemError>[src]

Gets the BusID of this device.

fn authenticated(&self) -> Result<bool, SystemError>[src]

Check to see if our AuthToken has been authenticated by the DRM Master Read more

fn get_driver_capability(
    &self,
    cap: DriverCapability
) -> Result<u64, SystemError>
[src]

Gets the value of a capability.

fn get_driver(&self) -> Result<Driver, SystemError>[src]

Possible errors: Read more

Auto Trait Implementations

impl<T> !RefUnwindSafe for Device<T>

impl<T> Send for Device<T> where
    T: Send

impl<T> !Sync for Device<T>

impl<T> Unpin for Device<T> where
    T: Unpin

impl<T> !UnwindSafe for Device<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> Downcast for T where
    T: Any

pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more

pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

pub fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.