pub trait Device: Device {
Show 35 methods
fn resource_handles(&self) -> Result<ResourceHandles, SystemError> { ... }
fn plane_handles(&self) -> Result<PlaneResourceHandles, SystemError> { ... }
fn get_connector(&self, handle: Handle) -> Result<Info, SystemError> { ... }
fn get_encoder(&self, handle: Handle) -> Result<Info, SystemError> { ... }
fn get_crtc(&self, handle: Handle) -> Result<Info, SystemError> { ... }
fn set_crtc(
&self,
handle: Handle,
framebuffer: Option<Handle>,
pos: (u32, u32),
conns: &[Handle],
mode: Option<Mode>
) -> Result<(), SystemError> { ... }
fn get_framebuffer(&self, handle: Handle) -> Result<Info, SystemError> { ... }
fn add_framebuffer<B>(
&self,
buffer: &B,
depth: u32,
bpp: u32
) -> Result<Handle, SystemError>
where
B: Buffer + ?Sized,
{ ... }
fn add_planar_framebuffer<B>(
&self,
planar_buffer: &B,
modifiers: &[Option<DrmModifier>; 4],
flags: u32
) -> Result<Handle, SystemError>
where
B: PlanarBuffer + ?Sized,
{ ... }
fn dirty_framebuffer(
&self,
handle: Handle,
clips: &[drm_clip_rect]
) -> Result<(), SystemError> { ... }
fn destroy_framebuffer(&self, handle: Handle) -> Result<(), SystemError> { ... }
fn get_plane(&self, handle: Handle) -> Result<Info, SystemError> { ... }
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> { ... }
fn get_property(&self, handle: Handle) -> Result<Info, SystemError> { ... }
fn set_property<T: ResourceHandle>(
&self,
handle: T,
prop: Handle,
value: RawValue
) -> Result<(), SystemError> { ... }
fn create_property_blob<T>(
&self,
data: &T
) -> Result<Value<'static>, SystemError> { ... }
fn get_property_blob(&self, blob: u64) -> Result<Vec<u8>, SystemError> { ... }
fn destroy_property_blob(&self, blob: u64) -> Result<(), SystemError> { ... }
fn get_modes(&self, handle: Handle) -> Result<Vec<Mode>, SystemError> { ... }
fn get_properties<T: ResourceHandle>(
&self,
handle: T
) -> Result<PropertyValueSet, SystemError> { ... }
fn get_gamma(
&self,
crtc: Handle,
red: &mut [u16],
green: &mut [u16],
blue: &mut [u16]
) -> Result<(), SystemError> { ... }
fn set_gamma(
&self,
crtc: Handle,
red: &[u16],
green: &[u16],
blue: &[u16]
) -> Result<(), SystemError> { ... }
fn open_buffer(&self, name: Name) -> Result<Handle, SystemError> { ... }
fn close_buffer(&self, handle: Handle) -> Result<(), SystemError> { ... }
fn create_dumb_buffer(
&self,
size: (u32, u32),
format: DrmFourcc,
bpp: u32
) -> Result<DumbBuffer, SystemError> { ... }
fn map_dumb_buffer<'a>(
&self,
buffer: &'a mut DumbBuffer
) -> Result<DumbMapping<'a>, SystemError> { ... }
fn destroy_dumb_buffer(&self, buffer: DumbBuffer) -> Result<(), SystemError> { ... }
fn set_cursor<B>(
&self,
crtc: Handle,
buffer: Option<&B>
) -> Result<(), SystemError>
where
B: Buffer + ?Sized,
{ ... }
fn set_cursor2<B>(
&self,
crtc: Handle,
buffer: Option<&B>,
hotspot: (i32, i32)
) -> Result<(), SystemError>
where
B: Buffer + ?Sized,
{ ... }
fn move_cursor(
&self,
crtc: Handle,
pos: (i32, i32)
) -> Result<(), SystemError> { ... }
fn atomic_commit(
&self,
flags: AtomicCommitFlags,
req: AtomicModeReq
) -> Result<(), SystemError> { ... }
fn prime_fd_to_buffer(&self, fd: RawFd) -> Result<Handle, SystemError> { ... }
fn buffer_to_prime_fd(
&self,
handle: Handle,
flags: u32
) -> Result<RawFd, SystemError> { ... }
fn page_flip(
&self,
handle: Handle,
framebuffer: Handle,
flags: PageFlipFlags,
target_sequence: Option<(PageFlipTarget, u32)>
) -> Result<(), SystemError> { ... }
fn receive_events(&self) -> Result<Events, SystemError>
where
Self: Sized,
{ ... }
}
Expand description
This trait should be implemented by any object that acts as a DRM device and provides modesetting functionality.
Like the parent super::Device
trait, this crate does not
provide a concrete object for this trait.
Example
use drm::control::Device as ControlDevice;
/// Assuming the [`Card`] wrapper already implements [`drm::Device`]
impl ControlDevice for Card {}
Provided methods
fn resource_handles(&self) -> Result<ResourceHandles, SystemError>
fn resource_handles(&self) -> Result<ResourceHandles, SystemError>
Gets the set of resource handles that this device currently controls
fn plane_handles(&self) -> Result<PlaneResourceHandles, SystemError>
fn plane_handles(&self) -> Result<PlaneResourceHandles, SystemError>
Gets the set of plane handles that this device currently has
fn get_connector(&self, handle: Handle) -> Result<Info, SystemError>
fn get_connector(&self, handle: Handle) -> Result<Info, SystemError>
Returns information about a specific connector
fn get_encoder(&self, handle: Handle) -> Result<Info, SystemError>
fn get_encoder(&self, handle: Handle) -> Result<Info, SystemError>
Returns information about a specific encoder
Returns information about a specific CRTC
Set CRTC state
fn get_framebuffer(&self, handle: Handle) -> Result<Info, SystemError>
fn get_framebuffer(&self, handle: Handle) -> Result<Info, SystemError>
Returns information about a specific framebuffer
fn add_framebuffer<B>(
&self,
buffer: &B,
depth: u32,
bpp: u32
) -> Result<Handle, SystemError> where
B: Buffer + ?Sized,
fn add_framebuffer<B>(
&self,
buffer: &B,
depth: u32,
bpp: u32
) -> Result<Handle, SystemError> where
B: Buffer + ?Sized,
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)
fn dirty_framebuffer(
&self,
handle: Handle,
clips: &[drm_clip_rect]
) -> Result<(), SystemError>
fn dirty_framebuffer(
&self,
handle: Handle,
clips: &[drm_clip_rect]
) -> Result<(), SystemError>
Mark parts of a framebuffer dirty
fn destroy_framebuffer(&self, handle: Handle) -> Result<(), SystemError>
fn destroy_framebuffer(&self, handle: Handle) -> Result<(), SystemError>
Destroy a framebuffer
Returns information about a specific plane
Set plane state.
Providing no framebuffer clears the plane.
fn get_property(&self, handle: Handle) -> Result<Info, SystemError>
fn get_property(&self, handle: Handle) -> Result<Info, SystemError>
Returns information about a specific property.
fn set_property<T: ResourceHandle>(
&self,
handle: T,
prop: Handle,
value: RawValue
) -> Result<(), SystemError>
fn set_property<T: ResourceHandle>(
&self,
handle: T,
prop: Handle,
value: RawValue
) -> Result<(), SystemError>
Sets a property for a specific resource.
fn create_property_blob<T>(
&self,
data: &T
) -> Result<Value<'static>, SystemError>
fn create_property_blob<T>(
&self,
data: &T
) -> Result<Value<'static>, SystemError>
Create a property blob value from a given data blob
fn get_property_blob(&self, blob: u64) -> Result<Vec<u8>, SystemError>
fn get_property_blob(&self, blob: u64) -> Result<Vec<u8>, SystemError>
Get a property blob’s data
fn destroy_property_blob(&self, blob: u64) -> Result<(), SystemError>
fn destroy_property_blob(&self, blob: u64) -> Result<(), SystemError>
Destroy a given property blob value
Returns the set of Mode
s that a particular connector supports.
fn get_properties<T: ResourceHandle>(
&self,
handle: T
) -> Result<PropertyValueSet, SystemError>
fn get_properties<T: ResourceHandle>(
&self,
handle: T
) -> Result<PropertyValueSet, SystemError>
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
fn open_buffer(&self, name: Name) -> Result<Handle, SystemError>
fn open_buffer(&self, name: Name) -> Result<Handle, SystemError>
Open a GEM buffer handle by name
fn close_buffer(&self, handle: Handle) -> Result<(), SystemError>
fn close_buffer(&self, handle: Handle) -> Result<(), SystemError>
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
fn map_dumb_buffer<'a>(
&self,
buffer: &'a mut DumbBuffer
) -> Result<DumbMapping<'a>, SystemError>
fn map_dumb_buffer<'a>(
&self,
buffer: &'a mut DumbBuffer
) -> Result<DumbMapping<'a>, SystemError>
Map the buffer for access
fn destroy_dumb_buffer(&self, buffer: DumbBuffer) -> Result<(), SystemError>
fn destroy_dumb_buffer(&self, buffer: DumbBuffer) -> Result<(), SystemError>
Free the memory resources of a dumb buffer
fn set_cursor<B>(
&self,
crtc: Handle,
buffer: Option<&B>
) -> Result<(), SystemError> where
B: Buffer + ?Sized,
fn set_cursor<B>(
&self,
crtc: Handle,
buffer: Option<&B>
) -> Result<(), SystemError> where
B: Buffer + ?Sized,
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
A buffer argument of None
will clear the cursor.
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.
A buffer argument of None
will clear the cursor.
fn move_cursor(&self, crtc: Handle, pos: (i32, i32)) -> Result<(), SystemError>
fn move_cursor(&self, crtc: Handle, pos: (i32, i32)) -> Result<(), SystemError>
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.
fn prime_fd_to_buffer(&self, fd: RawFd) -> Result<Handle, SystemError>
fn prime_fd_to_buffer(&self, fd: RawFd) -> Result<Handle, SystemError>
Convert a prime file descriptor to a GEM buffer handle
fn buffer_to_prime_fd(
&self,
handle: Handle,
flags: u32
) -> Result<RawFd, SystemError>
fn buffer_to_prime_fd(
&self,
handle: Handle,
flags: u32
) -> Result<RawFd, SystemError>
Convert a prime file descriptor to a GEM buffer handle
fn page_flip(
&self,
handle: Handle,
framebuffer: Handle,
flags: PageFlipFlags,
target_sequence: Option<(PageFlipTarget, u32)>
) -> Result<(), SystemError>
fn page_flip(
&self,
handle: Handle,
framebuffer: Handle,
flags: PageFlipFlags,
target_sequence: Option<(PageFlipTarget, u32)>
) -> Result<(), SystemError>
Queue a page flip on the given crtc
fn receive_events(&self) -> Result<Events, SystemError> where
Self: Sized,
fn receive_events(&self) -> Result<Events, SystemError> where
Self: Sized,
Receive pending events