Skip to main content

ScanoutTarget

Struct ScanoutTarget 

Source
#[non_exhaustive]
pub struct ScanoutTarget { pub connector_id: u32, pub crtc: CrtcChoice, pub primary_plane_id: u32, pub mode: Mode, pub primary_formats: FormatTable, }
Expand description

Somewhere to scan out.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§connector_id: u32

The connector with a display on it.

§crtc: CrtcChoice

The CRTC that will drive it.

§primary_plane_id: u32

That CRTC’s primary plane.

§mode: Mode

The mode to set.

§primary_formats: FormatTable

What the primary plane will scan out.

Synthesized as LINEAR-only when the driver exposes no IN_FORMATS, so this is never empty on a plane that works – see PlaneRegistry::from_capabilities.

Implementations§

Source§

impl ScanoutTarget

Source

pub fn discover(device: &Device) -> Result<Result<Self, ScanoutError>>

Find an output with a display on it, preferring connector types in rank::MAIN order.

Enables universal planes, without which the kernel hides primary and cursor planes and this could only ever fail. Most callers will have set it already without meaning to: measured on amdgpu, a client with neither capability sees 2 planes and one that has gone atomic sees all 10, because the kernel turns universal planes on with atomic. It is asked for here anyway, so a caller that has not gone atomic yet gets an answer rather than a confusing NoPrimaryPlane.

§Errors

ScanoutError for each way there is nothing to drive, or CoreError if the device cannot be read.

Source

pub fn discover_ranked( device: &Device, ranks: &[Interface], ) -> Result<Result<Self, ScanoutError>>

As ScanoutTarget::discover, preferring displays in ranks order.

The rank is a preference, not a filter. When nothing connected matches it, the first eligible connector is used anyway – it is a display, and refusing to drive it leaves a machine looking headless with a picture on it. So rank::INTERNAL on a machine with only external outputs still returns one of them.

A caller that wants the strict reading – an instrument cluster that must show nothing rather than appear on the docking monitor – ranks the connectors itself with rank_pick, which returns None when none match.

§Errors

As ScanoutTarget::discover.

Source

pub fn discover_connector( device: &Device, connector_id: u32, ) -> Result<Result<Self, ScanoutError>>

As ScanoutTarget::discover, for one connector; 0 is ScanoutTarget::discover itself.

For shared-display controllers, which publish one connected connector per display consumer and light only the one actually presenting: the first connected connector can be an unlit output that reports perfect flips (drm-cxx 882dbf8). Never falls back to another output.

§Errors

As ScanoutTarget::discover, with ScanoutError::ConnectorUnavailable when that connector is not connected or has no mode.

Trait Implementations§

Source§

impl Clone for ScanoutTarget

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ScanoutTarget

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.