#[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
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.connector_id: u32The connector with a display on it.
crtc: CrtcChoiceThe CRTC that will drive it.
primary_plane_id: u32That CRTC’s primary plane.
mode: ModeThe mode to set.
primary_formats: FormatTableWhat 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
impl ScanoutTarget
Sourcepub fn discover(device: &Device) -> Result<Result<Self, ScanoutError>>
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.
Sourcepub fn discover_ranked(
device: &Device,
ranks: &[Interface],
) -> Result<Result<Self, ScanoutError>>
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
Sourcepub fn discover_connector(
device: &Device,
connector_id: u32,
) -> Result<Result<Self, ScanoutError>>
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.