pub trait Device: Device {
Show 50 methods
// Provided methods
fn resource_handles(&self) -> Result<ResourceHandles> { ... }
fn plane_handles(&self) -> Result<Vec<Handle>> { ... }
fn get_connector(&self, handle: Handle, force_probe: bool) -> Result<Info> { ... }
fn get_encoder(&self, handle: Handle) -> Result<Info> { ... }
fn get_crtc(&self, handle: Handle) -> Result<Info> { ... }
fn set_crtc(
&self,
handle: Handle,
framebuffer: Option<Handle>,
pos: (u32, u32),
conns: &[Handle],
mode: Option<Mode>,
) -> Result<()> { ... }
fn get_framebuffer(&self, handle: Handle) -> Result<Info> { ... }
fn get_planar_framebuffer(
&self,
handle: Handle,
) -> Result<PlanarInfo, GetPlanarFramebufferError> { ... }
fn add_framebuffer<B>(
&self,
buffer: &B,
depth: u32,
bpp: u32,
) -> Result<Handle>
where B: Buffer + ?Sized { ... }
fn add_planar_framebuffer<B>(
&self,
planar_buffer: &B,
flags: FbCmd2Flags,
) -> Result<Handle>
where B: PlanarBuffer + ?Sized { ... }
fn dirty_framebuffer(
&self,
handle: Handle,
clips: &[ClipRect],
) -> Result<()> { ... }
fn destroy_framebuffer(&self, handle: Handle) -> Result<()> { ... }
fn get_plane(&self, handle: Handle) -> Result<Info> { ... }
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<()> { ... }
fn get_property(&self, handle: Handle) -> Result<Info> { ... }
fn set_property<T: ResourceHandle>(
&self,
handle: T,
prop: Handle,
value: RawValue,
) -> Result<()> { ... }
fn create_property_blob<T>(&self, data: &T) -> Result<Value<'static>> { ... }
fn get_property_blob(&self, blob: u64) -> Result<Vec<u8>> { ... }
fn destroy_property_blob(&self, blob: u64) -> Result<()> { ... }
fn get_modes(&self, handle: Handle) -> Result<Vec<Mode>> { ... }
fn get_properties<T: ResourceHandle>(
&self,
handle: T,
) -> Result<PropertyValueSet> { ... }
fn get_gamma(
&self,
crtc: Handle,
red: &mut [u16],
green: &mut [u16],
blue: &mut [u16],
) -> Result<()> { ... }
fn set_gamma(
&self,
crtc: Handle,
red: &[u16],
green: &[u16],
blue: &[u16],
) -> Result<()> { ... }
fn open_buffer(&self, name: Name) -> Result<Handle> { ... }
fn close_buffer(&self, handle: Handle) -> Result<()> { ... }
fn create_dumb_buffer(
&self,
size: (u32, u32),
format: DrmFourcc,
bpp: u32,
) -> Result<DumbBuffer> { ... }
fn map_dumb_buffer<'a>(
&self,
buffer: &'a mut DumbBuffer,
) -> Result<DumbMapping<'a>> { ... }
fn destroy_dumb_buffer(&self, buffer: DumbBuffer) -> Result<()> { ... }
fn set_cursor<B>(&self, crtc: Handle, buffer: Option<&B>) -> Result<()>
where B: Buffer + ?Sized { ... }
fn set_cursor2<B>(
&self,
crtc: Handle,
buffer: Option<&B>,
hotspot: (i32, i32),
) -> Result<()>
where B: Buffer + ?Sized { ... }
fn move_cursor(&self, crtc: Handle, pos: (i32, i32)) -> Result<()> { ... }
fn atomic_commit(
&self,
flags: AtomicCommitFlags,
req: AtomicModeReq,
) -> Result<()> { ... }
fn prime_fd_to_buffer(&self, fd: BorrowedFd<'_>) -> Result<Handle> { ... }
fn buffer_to_prime_fd(&self, handle: Handle, flags: u32) -> Result<OwnedFd> { ... }
fn page_flip(
&self,
handle: Handle,
framebuffer: Handle,
flags: PageFlipFlags,
target_sequence: Option<PageFlipTarget>,
) -> Result<()> { ... }
fn create_syncobj(&self, signalled: bool) -> Result<Handle> { ... }
fn destroy_syncobj(&self, handle: Handle) -> Result<()> { ... }
fn syncobj_to_fd(
&self,
handle: Handle,
export_sync_file: bool,
) -> Result<OwnedFd> { ... }
fn fd_to_syncobj(
&self,
fd: BorrowedFd<'_>,
import_sync_file: bool,
) -> Result<Handle> { ... }
fn syncobj_wait(
&self,
handles: &[Handle],
timeout_nsec: i64,
wait_all: bool,
wait_for_submit: bool,
) -> Result<u32> { ... }
fn syncobj_reset(&self, handles: &[Handle]) -> Result<()> { ... }
fn syncobj_signal(&self, handles: &[Handle]) -> Result<()> { ... }
fn syncobj_timeline_wait(
&self,
handles: &[Handle],
points: &[u64],
timeout_nsec: i64,
wait_all: bool,
wait_for_submit: bool,
wait_available: bool,
) -> Result<u32> { ... }
fn syncobj_timeline_query(
&self,
handles: &[Handle],
points: &mut [u64],
last_submitted: bool,
) -> Result<()> { ... }
fn syncobj_timeline_transfer(
&self,
src_handle: Handle,
dst_handle: Handle,
src_point: u64,
dst_point: u64,
) -> Result<()> { ... }
fn syncobj_timeline_signal(
&self,
handles: &[Handle],
points: &[u64],
) -> Result<()> { ... }
fn create_lease(
&self,
objects: &[RawResourceHandle],
flags: u32,
) -> Result<(LeaseId, OwnedFd)> { ... }
fn list_lessees(&self) -> Result<Vec<LeaseId>> { ... }
fn revoke_lease(&self, lessee_id: LeaseId) -> Result<()> { ... }
fn receive_events(&self) -> Result<Events>
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§
sourcefn resource_handles(&self) -> Result<ResourceHandles>
fn resource_handles(&self) -> Result<ResourceHandles>
Gets the set of resource handles that this device currently controls
sourcefn plane_handles(&self) -> Result<Vec<Handle>>
fn plane_handles(&self) -> Result<Vec<Handle>>
Gets the set of plane handles that this device currently has
sourcefn get_connector(&self, handle: Handle, force_probe: bool) -> Result<Info>
fn get_connector(&self, handle: Handle, force_probe: bool) -> Result<Info>
Returns information about a specific connector
§Force-probing
If force_probe
is set to true
and the DRM client is the current DRM master,
the kernel will perform a forced probe on the connector to refresh the connector status, modes and EDID.
A forced-probe can be slow, might cause flickering and the ioctl will block.
- User needs to force-probe connectors to ensure their metadata is up-to-date at startup and after receiving a hot-plug event.
- User may perform a forced-probe when the user explicitly requests it.
- User shouldn’t perform a forced-probe in other situations.
sourcefn get_encoder(&self, handle: Handle) -> Result<Info>
fn get_encoder(&self, handle: Handle) -> Result<Info>
Returns information about a specific encoder
sourcefn set_crtc(
&self,
handle: Handle,
framebuffer: Option<Handle>,
pos: (u32, u32),
conns: &[Handle],
mode: Option<Mode>,
) -> Result<()>
fn set_crtc( &self, handle: Handle, framebuffer: Option<Handle>, pos: (u32, u32), conns: &[Handle], mode: Option<Mode>, ) -> Result<()>
Set CRTC state
sourcefn get_framebuffer(&self, handle: Handle) -> Result<Info>
fn get_framebuffer(&self, handle: Handle) -> Result<Info>
Returns information about a specific framebuffer
sourcefn get_planar_framebuffer(
&self,
handle: Handle,
) -> Result<PlanarInfo, GetPlanarFramebufferError>
fn get_planar_framebuffer( &self, handle: Handle, ) -> Result<PlanarInfo, GetPlanarFramebufferError>
Returns information about a specific framebuffer (with modifiers)
sourcefn add_framebuffer<B>(&self, buffer: &B, depth: u32, bpp: u32) -> Result<Handle>
fn add_framebuffer<B>(&self, buffer: &B, depth: u32, bpp: u32) -> Result<Handle>
Add a new framebuffer
sourcefn add_planar_framebuffer<B>(
&self,
planar_buffer: &B,
flags: FbCmd2Flags,
) -> Result<Handle>where
B: PlanarBuffer + ?Sized,
fn add_planar_framebuffer<B>(
&self,
planar_buffer: &B,
flags: FbCmd2Flags,
) -> Result<Handle>where
B: PlanarBuffer + ?Sized,
Add framebuffer (with modifiers)
sourcefn dirty_framebuffer(&self, handle: Handle, clips: &[ClipRect]) -> Result<()>
fn dirty_framebuffer(&self, handle: Handle, clips: &[ClipRect]) -> Result<()>
Mark parts of a framebuffer dirty
sourcefn destroy_framebuffer(&self, handle: Handle) -> Result<()>
fn destroy_framebuffer(&self, handle: Handle) -> Result<()>
Destroy a framebuffer
sourcefn 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<()>
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<()>
Set plane state.
Providing no framebuffer clears the plane.
sourcefn get_property(&self, handle: Handle) -> Result<Info>
fn get_property(&self, handle: Handle) -> Result<Info>
Returns information about a specific property.
sourcefn set_property<T: ResourceHandle>(
&self,
handle: T,
prop: Handle,
value: RawValue,
) -> Result<()>
fn set_property<T: ResourceHandle>( &self, handle: T, prop: Handle, value: RawValue, ) -> Result<()>
Sets a property for a specific resource.
sourcefn create_property_blob<T>(&self, data: &T) -> Result<Value<'static>>
fn create_property_blob<T>(&self, data: &T) -> Result<Value<'static>>
Create a property blob value from a given data blob
sourcefn destroy_property_blob(&self, blob: u64) -> Result<()>
fn destroy_property_blob(&self, blob: u64) -> Result<()>
Destroy a given property blob value
sourcefn get_modes(&self, handle: Handle) -> Result<Vec<Mode>>
fn get_modes(&self, handle: Handle) -> Result<Vec<Mode>>
Returns the set of Mode
s that a particular connector supports.
sourcefn get_properties<T: ResourceHandle>(
&self,
handle: T,
) -> Result<PropertyValueSet>
fn get_properties<T: ResourceHandle>( &self, handle: T, ) -> Result<PropertyValueSet>
Gets a list of property handles and values for this resource.
sourcefn get_gamma(
&self,
crtc: Handle,
red: &mut [u16],
green: &mut [u16],
blue: &mut [u16],
) -> Result<()>
fn get_gamma( &self, crtc: Handle, red: &mut [u16], green: &mut [u16], blue: &mut [u16], ) -> Result<()>
Receive the currently set gamma ramp of a crtc
sourcefn set_gamma(
&self,
crtc: Handle,
red: &[u16],
green: &[u16],
blue: &[u16],
) -> Result<()>
fn set_gamma( &self, crtc: Handle, red: &[u16], green: &[u16], blue: &[u16], ) -> Result<()>
Set a gamma ramp for the given crtc
sourcefn open_buffer(&self, name: Name) -> Result<Handle>
fn open_buffer(&self, name: Name) -> Result<Handle>
Open a GEM buffer handle by name
sourcefn close_buffer(&self, handle: Handle) -> Result<()>
fn close_buffer(&self, handle: Handle) -> Result<()>
Close a GEM buffer handle
sourcefn create_dumb_buffer(
&self,
size: (u32, u32),
format: DrmFourcc,
bpp: u32,
) -> Result<DumbBuffer>
fn create_dumb_buffer( &self, size: (u32, u32), format: DrmFourcc, bpp: u32, ) -> Result<DumbBuffer>
Create a new dumb buffer with a given size and pixel format
sourcefn map_dumb_buffer<'a>(
&self,
buffer: &'a mut DumbBuffer,
) -> Result<DumbMapping<'a>>
fn map_dumb_buffer<'a>( &self, buffer: &'a mut DumbBuffer, ) -> Result<DumbMapping<'a>>
Map the buffer for access
sourcefn destroy_dumb_buffer(&self, buffer: DumbBuffer) -> Result<()>
fn destroy_dumb_buffer(&self, buffer: DumbBuffer) -> Result<()>
Free the memory resources of a dumb buffer
sourcefn set_cursor<B>(&self, crtc: Handle, buffer: Option<&B>) -> Result<()>
👎Deprecated: Usage of deprecated ioctl set_cursor: use a cursor plane instead
fn set_cursor<B>(&self, crtc: Handle, buffer: Option<&B>) -> Result<()>
Sets a hardware-cursor on the given crtc with the image of a given buffer
A buffer argument of None
will clear the cursor.
sourcefn set_cursor2<B>(
&self,
crtc: Handle,
buffer: Option<&B>,
hotspot: (i32, i32),
) -> Result<()>
👎Deprecated: Usage of deprecated ioctl set_cursor2: use a cursor plane instead
fn set_cursor2<B>( &self, crtc: Handle, buffer: Option<&B>, hotspot: (i32, i32), ) -> Result<()>
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.
sourcefn move_cursor(&self, crtc: Handle, pos: (i32, i32)) -> Result<()>
👎Deprecated: Usage of deprecated ioctl move_cursor: use a cursor plane instead
fn move_cursor(&self, crtc: Handle, pos: (i32, i32)) -> Result<()>
Moves a set cursor on a given crtc
sourcefn atomic_commit(
&self,
flags: AtomicCommitFlags,
req: AtomicModeReq,
) -> Result<()>
fn atomic_commit( &self, flags: AtomicCommitFlags, req: AtomicModeReq, ) -> Result<()>
Request an atomic commit with given flags and property-value pair for a list of objects.
sourcefn prime_fd_to_buffer(&self, fd: BorrowedFd<'_>) -> Result<Handle>
fn prime_fd_to_buffer(&self, fd: BorrowedFd<'_>) -> Result<Handle>
Convert a prime file descriptor to a GEM buffer handle
sourcefn buffer_to_prime_fd(&self, handle: Handle, flags: u32) -> Result<OwnedFd>
fn buffer_to_prime_fd(&self, handle: Handle, flags: u32) -> Result<OwnedFd>
Convert a GEM buffer handle to a prime file descriptor
sourcefn page_flip(
&self,
handle: Handle,
framebuffer: Handle,
flags: PageFlipFlags,
target_sequence: Option<PageFlipTarget>,
) -> Result<()>
fn page_flip( &self, handle: Handle, framebuffer: Handle, flags: PageFlipFlags, target_sequence: Option<PageFlipTarget>, ) -> Result<()>
Queue a page flip on the given crtc
sourcefn create_syncobj(&self, signalled: bool) -> Result<Handle>
fn create_syncobj(&self, signalled: bool) -> Result<Handle>
Creates a syncobj.
sourcefn destroy_syncobj(&self, handle: Handle) -> Result<()>
fn destroy_syncobj(&self, handle: Handle) -> Result<()>
Destroys a syncobj.
sourcefn syncobj_to_fd(
&self,
handle: Handle,
export_sync_file: bool,
) -> Result<OwnedFd>
fn syncobj_to_fd( &self, handle: Handle, export_sync_file: bool, ) -> Result<OwnedFd>
Exports a syncobj as an inter-process file descriptor or as a poll()-able sync file.
sourcefn fd_to_syncobj(
&self,
fd: BorrowedFd<'_>,
import_sync_file: bool,
) -> Result<Handle>
fn fd_to_syncobj( &self, fd: BorrowedFd<'_>, import_sync_file: bool, ) -> Result<Handle>
Imports a file descriptor exported by Self::syncobj_to_fd
back into a process-local handle.
sourcefn syncobj_wait(
&self,
handles: &[Handle],
timeout_nsec: i64,
wait_all: bool,
wait_for_submit: bool,
) -> Result<u32>
fn syncobj_wait( &self, handles: &[Handle], timeout_nsec: i64, wait_all: bool, wait_for_submit: bool, ) -> Result<u32>
Waits for one or more syncobjs to become signalled.
sourcefn syncobj_reset(&self, handles: &[Handle]) -> Result<()>
fn syncobj_reset(&self, handles: &[Handle]) -> Result<()>
Resets (un-signals) one or more syncobjs.
sourcefn syncobj_signal(&self, handles: &[Handle]) -> Result<()>
fn syncobj_signal(&self, handles: &[Handle]) -> Result<()>
Signals one or more syncobjs.
sourcefn syncobj_timeline_wait(
&self,
handles: &[Handle],
points: &[u64],
timeout_nsec: i64,
wait_all: bool,
wait_for_submit: bool,
wait_available: bool,
) -> Result<u32>
fn syncobj_timeline_wait( &self, handles: &[Handle], points: &[u64], timeout_nsec: i64, wait_all: bool, wait_for_submit: bool, wait_available: bool, ) -> Result<u32>
Waits for one or more specific timeline syncobj points.
sourcefn syncobj_timeline_query(
&self,
handles: &[Handle],
points: &mut [u64],
last_submitted: bool,
) -> Result<()>
fn syncobj_timeline_query( &self, handles: &[Handle], points: &mut [u64], last_submitted: bool, ) -> Result<()>
Queries for state of one or more timeline syncobjs.
sourcefn syncobj_timeline_transfer(
&self,
src_handle: Handle,
dst_handle: Handle,
src_point: u64,
dst_point: u64,
) -> Result<()>
fn syncobj_timeline_transfer( &self, src_handle: Handle, dst_handle: Handle, src_point: u64, dst_point: u64, ) -> Result<()>
Transfers one timeline syncobj point to another.
sourcefn syncobj_timeline_signal(
&self,
handles: &[Handle],
points: &[u64],
) -> Result<()>
fn syncobj_timeline_signal( &self, handles: &[Handle], points: &[u64], ) -> Result<()>
Signals one or more specific timeline syncobj points.
sourcefn create_lease(
&self,
objects: &[RawResourceHandle],
flags: u32,
) -> Result<(LeaseId, OwnedFd)>
fn create_lease( &self, objects: &[RawResourceHandle], flags: u32, ) -> Result<(LeaseId, OwnedFd)>
Create a drm lease
sourcefn list_lessees(&self) -> Result<Vec<LeaseId>>
fn list_lessees(&self) -> Result<Vec<LeaseId>>
List active lessees
sourcefn revoke_lease(&self, lessee_id: LeaseId) -> Result<()>
fn revoke_lease(&self, lessee_id: LeaseId) -> Result<()>
Revoke a previously issued drm lease
sourcefn receive_events(&self) -> Result<Events>where
Self: Sized,
fn receive_events(&self) -> Result<Events>where
Self: Sized,
Receive pending events