Skip to main content

Crate drmkit_display

Crate drmkit_display 

Source
Expand description

Display characterization and color handling.

What a connected display can do, and what has to happen to pixels before they reach it. Two halves that mostly do not talk to each other.

§Finding the display

  • ScanoutTarget — the connected output and the CRTC and primary plane that drive it, which is the pair everything downstream needs and the one thing crtcs().first() reliably gets wrong on real hardware.
  • query_connector_modes — what each connector offers, with Probe deciding whether to ask the sink or trust the cache.
  • ConnectorCapabilities and CrtcCapabilities — the properties this pipe actually exposes, so a caller writes what the driver has rather than what the spec allows.
  • HotplugMonitor — the kernel’s own uevent stream, behind the hotplug feature.
  • DriverProfile — device capabilities, probed and never inferred from the driver’s name.

§Getting the pixels right

  • ToneMapper — SDR to HDR and back, over a ToneMapCurve. Color maths has too many plausible readings for a paper derivation to be worth much, so its answers are diffed against the reference’s own, vector by vector.
  • CrtcColorPipeline — the CRTC’s degamma, CTM and gamma stages. Each refuses on its own rather than the pipeline refusing whole, because partial pipelines are the common case: of 4,129 CRTCs surveyed, 848 have no color stage at all and three more shapes sit between that and the full three.
  • HdrSourceMetadata and HdrMetadataCache — the CTA-861.3 blob a sink needs to switch into HDR, and the cache that stops it being rewritten every frame. Its green/blue/red primary ordering and tail padding are both invisible on screen and both change the bytes, so this is diffed against the reference too, over twelve vectors.
  • edid — what the sink says about itself, behind the edid feature.

§Features

edid is off by default: libdisplay-info-sys links a system library, and the cross lanes have no sysroot for it. Everything else here — the tone mapper and color curves that downstream crates want — builds without it.

Re-exports§

pub use curves::ColorCtm;
pub use curves::ColorLut;
pub use hdr::HdrBlob;
pub use hdr::HdrMetadataBlob;
pub use hdr::HdrSourceMetadata;
pub use hdr::TransferFunction;
pub use hdr::hdr_metadata_hash;
pub use hdr::serialize_hdr_metadata;
pub use hdr_cache::HdrMetadataCache;
pub use scanout::CrtcChoice;
pub use scanout::ScanoutError;
pub use scanout::ScanoutTarget;
pub use scanout::crtc_for_connector;
pub use scanout::primary_plane_for_crtc;
pub use scanout::rank;
pub use scanout::rank_pick;

Modules§

color
Color primaries, independent of where they came from.
curves
Transfer functions.
edid
What a connected display says about itself.
hdr
Source-side HDR static metadata, and the property blob that carries it.
hdr_cache
Per-CRTC cache of the HDR_OUTPUT_METADATA blob.
scanout
Finding something to put a picture on.

Structs§

ConnectorCapabilities
What one connector’s color properties can be set to.
ConnectorModes
One connector and the modes it advertises.
CrtcCapabilities
What one CRTC’s color pipeline can be asked to do.
CrtcColorPipeline
The color pipeline of one CRTC.
DriverProfile
A device’s capabilities.
HotplugEvent
One connector changing.
HotplugMonitor
A pollable watch on DRM hotplug.
MaxBpc
The max bpc range, and where it currently sits.
PrimeCaps
What DRM_CAP_PRIME’s bitmask says.
ToneMapper
A configured tone-mapping transform.

Enums§

BroadcastRgb
A connector’s Broadcast RGB entries.
Colorspace
A connector’s Colorspace entries, by the kernel’s names.
Direction
Which transform a mapper performs.
PanelSelfRefresh
Whether a connected panel might hold its image without a flip.
PipelineError
What can go wrong programming the pipeline.
Probe
Whether to make the kernel ask the display again.
Source
Where the uevents are read from.
Stage
Which stage a call was about.
ToneMapCurve
The curve applied in linear light when compressing HDR into SDR.

Constants§

LUT_SIZE
Entries in each lookup table: 1024 buckets plus one sentinel.

Functions§

connector_type_self_refreshes
Whether a connector type can hold its image without a flip.
decode_prime_caps
Decode the DRM_CAP_PRIME bitmask.
query_connector_modes
Every connector on the device, with its modes.