Struct gbm::Device
[−]
[src]
pub struct Device<'a> { /* fields omitted */ }An open DRM device
Methods
impl<'a> Device<'a>[src]
fn new<I: IntoRawFd>(io: I) -> IoResult<Device<'static>>[src]
Open a GBM device from a given IO object taking ownership
fn new_from_drm<D: DrmDevice + AsRawFd + 'a>(
drm: &'a DrmDevice
) -> IoResult<Device<'a>>[src]
drm: &'a DrmDevice
) -> IoResult<Device<'a>>
Open a GBM device from a given DRM device
unsafe fn new_from_fd(fd: RawFd) -> IoResult<Device<'a>>[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.
Unsafety
The lifetime of the resulting device depends on the ownership of the file descriptor. If the fd will be controlled by the device a static lifetime is valid, if it does not own the fd the lifetime may not outlive the owning object.
fn backend_name(&self) -> &str[src]
Get the backend name
fn is_format_supported(
&self,
format: Format,
usage: &[BufferObjectFlags]
) -> bool[src]
&self,
format: Format,
usage: &[BufferObjectFlags]
) -> bool
Test if a format is supported for a given set of usage flags
fn create_surface<T: 'static>(
&'a self,
width: u32,
height: u32,
format: Format,
usage: &[BufferObjectFlags]
) -> IoResult<Surface<'a, T>>[src]
&'a self,
width: u32,
height: u32,
format: Format,
usage: &[BufferObjectFlags]
) -> IoResult<Surface<'a, T>>
Allocate a new surface object
fn create_buffer_object<T: 'static>(
&'a self,
width: u32,
height: u32,
format: Format,
usage: &[BufferObjectFlags]
) -> IoResult<BufferObject<'a, T>>[src]
&'a self,
width: u32,
height: u32,
format: Format,
usage: &[BufferObjectFlags]
) -> IoResult<BufferObject<'a, T>>
Allocate a buffer object for the given dimensions
fn import_buffer_object_from_wayland<T: 'static>(
&'a self,
buffer: &WlBuffer,
usage: &[BufferObjectFlags]
) -> IoResult<BufferObject<'a, T>>[src]
&'a self,
buffer: &WlBuffer,
usage: &[BufferObjectFlags]
) -> IoResult<BufferObject<'a, T>>
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 enabled 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.
fn import_buffer_object_from_egl<T: 'static>(
&'a self,
buffer: &EGLImage,
usage: &[BufferObjectFlags]
) -> IoResult<BufferObject<'a, T>>[src]
&'a self,
buffer: &EGLImage,
usage: &[BufferObjectFlags]
) -> IoResult<BufferObject<'a, T>>
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 enabled 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.
fn import_buffer_object_from_dma_buf<T: 'static>(
&'a self,
buffer: RawFd,
width: u32,
height: u32,
stride: u32,
format: Format,
usage: &[BufferObjectFlags]
) -> IoResult<BufferObject<'a, T>>[src]
&'a self,
buffer: RawFd,
width: u32,
height: u32,
stride: u32,
format: Format,
usage: &[BufferObjectFlags]
) -> IoResult<BufferObject<'a, T>>
Create a gbm buffer object from an dma buffer
This function imports a foreign dma buffer from an open file descriptor and creates a new gbm buffer object for it. This enabled 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<'a> AsRawFd for Device<'a>[src]
impl<'a> AsRaw<gbm_device> for Device<'a>[src]
fn as_raw(&self) -> *const gbm_device[src]
Receive a raw pointer representing this type.
impl<'a> FromRaw<gbm_device> for Device<'a>[src]
unsafe fn from_raw(ffi: *mut gbm_device) -> Self[src]
Create a new instance of this type from a raw pointer. Read more