pub struct DrmDevice<A: AsRawFd + 'static> { /* private fields */ }
Expand description
An open drm device
Implementations§
Source§impl<A: AsRawFd + 'static> DrmDevice<A>
impl<A: AsRawFd + 'static> DrmDevice<A>
Sourcepub fn new<L>(fd: A, disable_connectors: bool, logger: L) -> Result<Self, Error>
pub fn new<L>(fd: A, disable_connectors: bool, logger: L) -> Result<Self, Error>
Create a new DrmDevice
from an open drm node
§Arguments
fd
- Open drm nodedisable_connectors
- Setting this to true will initialize all connectors
as disabled on device creation. smithay enables connectors, when attached
to a surface, and disables them, when detached. Setting this tofalse
requires usage ofdrm-rs
to disable unused connectors to prevent them
showing garbage, but will also prevent flickering of already turned on
connectors (assuming you won’t change the resolution).logger
- Optionalslog::Logger
to be used by this device.
§Return
Returns an error if the file is no valid drm node or the device is not accessible.
Sourcepub fn is_atomic(&self) -> bool
pub fn is_atomic(&self) -> bool
Returns if the underlying implementation uses atomic-modesetting or not.
Sourcepub fn planes(&self, crtc: &Handle) -> Result<Planes, Error>
pub fn planes(&self, crtc: &Handle) -> Result<Planes, Error>
Returns a set of available planes for a given crtc
Sourcepub fn create_surface(
&self,
crtc: Handle,
mode: Mode,
connectors: &[Handle],
) -> Result<DrmSurface<A>, Error>
pub fn create_surface( &self, crtc: Handle, mode: Mode, connectors: &[Handle], ) -> Result<DrmSurface<A>, Error>
Creates a new rendering surface.
§Arguments
Initialization of surfaces happens through the types provided by
drm-rs
.
crtcs
represent scanout engines of the device pointing to one framebuffer.
Their responsibility is to read the data of the framebuffer and export it into an “Encoder”.
The number of crtc’s represent the number of independent output devices the hardware may handle.mode
describes the resolution and rate of images produced by the crtc and
has to be compatible with the providedconnectors
.connectors
- List of connectors driven by the crtc. At least one(!) connector needs to be
attached to a crtc in smithay.
Trait Implementations§
Source§impl<A: AsRawFd + 'static> Allocator<DumbBuffer<A>> for DrmDevice<A>
impl<A: AsRawFd + 'static> Allocator<DumbBuffer<A>> for DrmDevice<A>
Source§type Error = SystemError
type Error = SystemError
Error type thrown if allocations fail
Source§fn create_buffer(
&mut self,
width: u32,
height: u32,
fourcc: Fourcc,
modifiers: &[Modifier],
) -> Result<DumbBuffer<A>, Self::Error>
fn create_buffer( &mut self, width: u32, height: u32, fourcc: Fourcc, modifiers: &[Modifier], ) -> Result<DumbBuffer<A>, Self::Error>
Try to create a buffer with the given dimensions and pixel format
Source§impl<A: AsRawFd + 'static> Device for DrmDevice<A>
impl<A: AsRawFd + 'static> Device for DrmDevice<A>
Source§fn acquire_master_lock(&self) -> Result<(), SystemError>
fn acquire_master_lock(&self) -> Result<(), SystemError>
Acquires the DRM Master lock for this process. Read more
Source§fn release_master_lock(&self) -> Result<(), SystemError>
fn release_master_lock(&self) -> Result<(), SystemError>
Releases the DRM Master lock for another process to use.
Source§fn generate_auth_token(&self) -> Result<AuthToken, SystemError>
fn generate_auth_token(&self) -> Result<AuthToken, SystemError>
👎Deprecated: Consider opening a render node instead.
Generates an
AuthToken
for this process.Source§fn authenticate_auth_token(&self, token: AuthToken) -> Result<(), SystemError>
fn authenticate_auth_token(&self, token: AuthToken) -> Result<(), SystemError>
Authenticates an
AuthToken
from another process.Source§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.Source§fn get_bus_id(&self) -> Result<BusID, SystemError>
fn get_bus_id(&self) -> Result<BusID, SystemError>
Gets the
BusID
of this device.Source§fn authenticated(&self) -> Result<bool, SystemError>
fn authenticated(&self) -> Result<bool, SystemError>
Check to see if our
AuthToken
has been authenticated
by the DRM MasterSource§fn get_driver_capability(
&self,
cap: DriverCapability,
) -> Result<u64, SystemError>
fn get_driver_capability( &self, cap: DriverCapability, ) -> Result<u64, SystemError>
Gets the value of a capability.
Source§fn get_driver(&self) -> Result<Driver, SystemError>
fn get_driver(&self) -> Result<Driver, SystemError>
Possible errors: Read more
Source§impl<A: AsRawFd + 'static> Device for DrmDevice<A>
impl<A: AsRawFd + 'static> Device for DrmDevice<A>
Source§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
Source§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
Source§fn get_connector(&self, handle: Handle) -> Result<Info, SystemError>
fn get_connector(&self, handle: Handle) -> Result<Info, SystemError>
Returns information about a specific connector
Source§fn get_encoder(&self, handle: Handle) -> Result<Info, SystemError>
fn get_encoder(&self, handle: Handle) -> Result<Info, SystemError>
Returns information about a specific encoder
Source§fn get_crtc(&self, handle: Handle) -> Result<Info, SystemError>
fn get_crtc(&self, handle: Handle) -> Result<Info, SystemError>
Returns information about a specific CRTC
Source§fn set_crtc(
&self,
handle: Handle,
framebuffer: Option<Handle>,
pos: (u32, u32),
conns: &[Handle],
mode: Option<Mode>,
) -> Result<(), SystemError>
fn set_crtc( &self, handle: Handle, framebuffer: Option<Handle>, pos: (u32, u32), conns: &[Handle], mode: Option<Mode>, ) -> Result<(), SystemError>
Set CRTC state
Source§fn get_framebuffer(&self, handle: Handle) -> Result<Info, SystemError>
fn get_framebuffer(&self, handle: Handle) -> Result<Info, SystemError>
Returns information about a specific framebuffer
Source§fn add_framebuffer<B>(
&self,
buffer: &B,
depth: u32,
bpp: u32,
) -> Result<Handle, SystemError>
fn add_framebuffer<B>( &self, buffer: &B, depth: u32, bpp: u32, ) -> Result<Handle, SystemError>
Add a new framebuffer
Source§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)
Source§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
Source§fn destroy_framebuffer(&self, handle: Handle) -> Result<(), SystemError>
fn destroy_framebuffer(&self, handle: Handle) -> Result<(), SystemError>
Destroy a framebuffer
Source§fn get_plane(&self, handle: Handle) -> Result<Info, SystemError>
fn get_plane(&self, handle: Handle) -> Result<Info, SystemError>
Returns information about a specific plane
Source§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 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>
Set plane state. Read more
Source§fn get_property(&self, handle: Handle) -> Result<Info, SystemError>
fn get_property(&self, handle: Handle) -> Result<Info, SystemError>
Returns information about a specific property.
Source§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.
Source§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
Source§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
Source§fn destroy_property_blob(&self, blob: u64) -> Result<(), SystemError>
fn destroy_property_blob(&self, blob: u64) -> Result<(), SystemError>
Destroy a given property blob value
Source§fn get_modes(&self, handle: Handle) -> Result<Vec<Mode>, SystemError>
fn get_modes(&self, handle: Handle) -> Result<Vec<Mode>, SystemError>
Returns the set of
Mode
s that a particular connector supports.Source§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.
Source§fn get_gamma(
&self,
crtc: Handle,
red: &mut [u16],
green: &mut [u16],
blue: &mut [u16],
) -> Result<(), SystemError>
fn get_gamma( &self, crtc: Handle, red: &mut [u16], green: &mut [u16], blue: &mut [u16], ) -> Result<(), SystemError>
Receive the currently set gamma ramp of a crtc
Source§fn set_gamma(
&self,
crtc: Handle,
red: &[u16],
green: &[u16],
blue: &[u16],
) -> Result<(), SystemError>
fn set_gamma( &self, crtc: Handle, red: &[u16], green: &[u16], blue: &[u16], ) -> Result<(), SystemError>
Set a gamma ramp for the given crtc
Source§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
Source§fn close_buffer(&self, handle: Handle) -> Result<(), SystemError>
fn close_buffer(&self, handle: Handle) -> Result<(), SystemError>
Close a GEM buffer handle
Source§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
Source§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
Source§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
Source§fn set_cursor<B>(
&self,
crtc: Handle,
buffer: Option<&B>,
) -> Result<(), SystemError>
fn set_cursor<B>( &self, crtc: Handle, buffer: Option<&B>, ) -> Result<(), SystemError>
👎Deprecated: 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
Source§fn set_cursor2<B>(
&self,
crtc: Handle,
buffer: Option<&B>,
hotspot: (i32, i32),
) -> Result<(), SystemError>
fn set_cursor2<B>( &self, crtc: Handle, buffer: Option<&B>, hotspot: (i32, i32), ) -> Result<(), SystemError>
👎Deprecated: 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
Source§fn move_cursor(&self, crtc: Handle, pos: (i32, i32)) -> Result<(), SystemError>
fn move_cursor(&self, crtc: Handle, pos: (i32, i32)) -> Result<(), SystemError>
👎Deprecated: Usage of deprecated ioctl move_cursor: use a cursor plane instead
Moves a set cursor on a given crtc
Source§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.
Source§fn prime_fd_to_buffer(&self, fd: i32) -> Result<Handle, SystemError>
fn prime_fd_to_buffer(&self, fd: i32) -> Result<Handle, SystemError>
Convert a prime file descriptor to a GEM buffer handle
Source§fn buffer_to_prime_fd(
&self,
handle: Handle,
flags: u32,
) -> Result<i32, SystemError>
fn buffer_to_prime_fd( &self, handle: Handle, flags: u32, ) -> Result<i32, SystemError>
Convert a prime file descriptor to a GEM buffer handle
Source§fn page_flip(
&self,
handle: Handle,
framebuffer: Handle,
flags: &[PageFlipFlags],
target: Option<PageFlipTarget>,
) -> Result<(), SystemError>
fn page_flip( &self, handle: Handle, framebuffer: Handle, flags: &[PageFlipFlags], target: Option<PageFlipTarget>, ) -> Result<(), SystemError>
Queue a page flip on the given crtc
Source§fn receive_events(&self) -> Result<Events, SystemError>where
Self: Sized,
fn receive_events(&self) -> Result<Events, SystemError>where
Self: Sized,
Receive pending events
Source§impl<A> EventSource for DrmDevice<A>where
A: AsRawFd + 'static,
impl<A> EventSource for DrmDevice<A>where
A: AsRawFd + 'static,
Source§fn process_events<F>(
&mut self,
_: Readiness,
token: Token,
callback: F,
) -> Result<PostAction>
fn process_events<F>( &mut self, _: Readiness, token: Token, callback: F, ) -> Result<PostAction>
Process any relevant events Read more
Source§fn register(
&mut self,
poll: &mut Poll,
factory: &mut TokenFactory,
) -> Result<()>
fn register( &mut self, poll: &mut Poll, factory: &mut TokenFactory, ) -> Result<()>
Register yourself to this poll instance Read more
Source§fn reregister(
&mut self,
poll: &mut Poll,
factory: &mut TokenFactory,
) -> Result<()>
fn reregister( &mut self, poll: &mut Poll, factory: &mut TokenFactory, ) -> Result<()>
Re-register your file descriptors Read more
Auto Trait Implementations§
impl<A> !Freeze for DrmDevice<A>
impl<A> !RefUnwindSafe for DrmDevice<A>
impl<A> !Send for DrmDevice<A>
impl<A> !Sync for DrmDevice<A>
impl<A> Unpin for DrmDevice<A>
impl<A> !UnwindSafe for DrmDevice<A>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn 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
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
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.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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.