Struct gbm::Device [−][src]
pub struct Device<T: AsRawFd + 'static> { /* fields omitted */ }
Expand description
An open GBM device
Implementations
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.
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.
Get the backend name
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>>
pub fn create_surface<U: 'static>(
&self,
width: u32,
height: u32,
format: Format,
usage: BufferObjectFlags
) -> IoResult<Surface<U>>Allocate a new surface object
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>>
pub fn create_buffer_object<U: 'static>(
&self,
width: u32,
height: u32,
format: Format,
usage: BufferObjectFlags
) -> IoResult<BufferObject<U>>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>>
pub fn create_buffer_object_with_modifiers<U: 'static>(
&self,
width: u32,
height: u32,
format: Format,
modifiers: impl Iterator<Item = Modifier>
) -> IoResult<BufferObject<U>>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>>
pub fn import_buffer_object_from_wayland<U: 'static>(
&self,
buffer: &WlBuffer,
usage: BufferObjectFlags
) -> IoResult<BufferObject<U>>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>>
pub unsafe fn import_buffer_object_from_egl<U: 'static>(
&self,
buffer: EGLImage,
usage: BufferObjectFlags
) -> IoResult<BufferObject<U>>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>>
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>>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.
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
Receive a raw pointer representing this type.
Gets the set of resource handles that this device currently controls
Gets the set of plane handles that this device currently has
Returns information about a specific connector
Returns information about a specific encoder
Returns information about a specific CRTC
Set CRTC state
Returns information about a specific framebuffer
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,
fn add_planar_framebuffer<B>(
&self,
planar_buffer: &B,
modifiers: &[Option<DrmModifier>; 4],
flags: u32
) -> Result<Handle, SystemError> where
B: PlanarBuffer + ?Sized, Add framebuffer (with modifiers)
Mark parts of a framebuffer dirty
Destroy a framebuffer
Returns information about a specific plane
Set plane state. Read more
Returns information about a specific property.
fn set_property<T>(
&self,
handle: T,
prop: Handle,
value: u64
) -> Result<(), SystemError> where
T: ResourceHandle,
fn set_property<T>(
&self,
handle: T,
prop: Handle,
value: u64
) -> Result<(), SystemError> where
T: ResourceHandle, Sets a property for a specific resource.
Create a property blob value from a given data blob
Get a property blob’s data
Destroy a given property blob value
Returns the set of Modes that a particular connector supports.
fn get_properties<T>(&self, handle: T) -> Result<PropertyValueSet, SystemError> where
T: ResourceHandle,
fn get_properties<T>(&self, handle: T) -> Result<PropertyValueSet, SystemError> where
T: ResourceHandle, Gets a list of property handles and values for this resource.
Receive the currently set gamma ramp of a crtc
Set a gamma ramp for the given crtc
Open a GEM buffer handle by name
Close a GEM buffer handle
fn create_dumb_buffer(
&self,
size: (u32, u32),
format: DrmFourcc,
bpp: u32
) -> Result<DumbBuffer, SystemError>
fn create_dumb_buffer(
&self,
size: (u32, u32),
format: DrmFourcc,
bpp: u32
) -> Result<DumbBuffer, SystemError>Create a new dumb buffer with a given size and pixel format
Map the buffer for access
Free the memory resources of a dumb buffer
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
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
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>
fn atomic_commit(
&self,
flags: &[AtomicCommitFlags],
req: AtomicModeReq
) -> Result<(), SystemError>Request an atomic commit with given flags and property-value pair for a list of objects.
Convert a prime file descriptor to a GEM buffer handle
Convert a prime file descriptor to a GEM buffer handle
Queue a page flip on the given crtc
Receive pending events
Acquires the DRM Master lock for this process. Read more
Releases the DRM Master lock for another process to use.
Authenticates an AuthToken from another process.
fn set_client_capability(
&self,
cap: ClientCapability,
enable: bool
) -> Result<(), SystemError>
fn set_client_capability(
&self,
cap: ClientCapability,
enable: bool
) -> Result<(), SystemError>Requests the driver to expose or hide certain capabilities. See
ClientCapability for more information. Read more
Gets the BusID of this device.
Gets the value of a capability.
Possible errors: Read more
Auto Trait Implementations
impl<T> !RefUnwindSafe for Device<T>impl<T> !UnwindSafe for Device<T>Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any, 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>
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
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)
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