Struct gbm::Device [−][src]
pub struct Device<T: AsRawFd + 'static> { /* fields omitted */ }
An open GBM device
Implementations
impl Device<FdWrapper>
[src]
impl Device<FdWrapper>
[src]pub unsafe fn new_from_fd(fd: RawFd) -> IoResult<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]
impl<T: AsRawFd + 'static> Device<T>
[src]pub fn new(fd: T) -> IoResult<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]
pub fn backend_name(&self) -> &str
[src]Get the backend name
pub fn is_format_supported(
&self,
format: Format,
usage: BufferObjectFlags
) -> bool
[src]
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]
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]
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]
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]
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]
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]
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]
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]
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]
impl<T: AsRawFd + 'static> AsRaw<gbm_device> for Device<T>
[src]fn as_raw(&self) -> *const gbm_device
[src]
fn as_raw(&self) -> *const gbm_device
[src]Receive a raw pointer representing this type.
impl<T: DrmControlDevice + AsRawFd + 'static> Device for Device<T>
[src]
impl<T: DrmControlDevice + AsRawFd + 'static> Device for Device<T>
[src]fn resource_handles(&self) -> Result<ResourceHandles, SystemError>
[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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
fn destroy_framebuffer(&self, handle: Handle) -> Result<(), SystemError>
[src]Destroy a framebuffer
fn get_plane(&self, handle: Handle) -> Result<Info, SystemError>
[src]
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]
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]
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]
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]
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]
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]
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]
fn get_modes(&self, handle: Handle) -> Result<Vec<Mode, Global>, SystemError>
[src]Returns the set of Mode
s that a particular connector supports.
fn get_properties<T>(&self, handle: T) -> Result<PropertyValueSet, SystemError> where
T: ResourceHandle,
[src]
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]
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]
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]
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]
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]
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]
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]
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]
fn set_cursor<B>(
&self,
crtc: Handle,
buffer: Option<&B>
) -> Result<(), SystemError> where
B: Buffer + ?Sized,
[src]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]
fn set_cursor2<B>(
&self,
crtc: Handle,
buffer: Option<&B>,
hotspot: (i32, i32)
) -> Result<(), SystemError> where
B: Buffer + ?Sized,
[src]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]
fn move_cursor(&self, crtc: Handle, pos: (i32, i32)) -> Result<(), SystemError>
[src]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]
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]
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]
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]
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]
fn receive_events(&self) -> Result<Events, SystemError>
[src]Receive pending events
impl<T: DrmDevice + AsRawFd + 'static> Device for Device<T>
[src]
impl<T: DrmDevice + AsRawFd + 'static> Device for Device<T>
[src]fn acquire_master_lock(&self) -> Result<(), SystemError>
[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]
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]
fn generate_auth_token(&self) -> Result<AuthToken, SystemError>
[src]Consider opening a render node instead.
Generates an AuthToken
for this process.
fn authenticate_auth_token(&self, token: AuthToken) -> Result<(), SystemError>
[src]
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]
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]
fn get_bus_id(&self) -> Result<BusID, SystemError>
[src]Gets the BusID
of this device.
fn authenticated(&self) -> Result<bool, SystemError>
[src]
fn authenticated(&self) -> Result<bool, SystemError>
[src]fn get_driver_capability(
&self,
cap: DriverCapability
) -> Result<u64, SystemError>
[src]
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]
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,
T: Send,
impl<T> !Sync for Device<T>
impl<T> Unpin for Device<T> where
T: Unpin,
T: Unpin,
impl<T> !UnwindSafe for Device<T>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[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,
impl<T> Downcast for T where
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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>
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)
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)
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> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
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]
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