#[non_exhaustive]pub struct TmdsVideo {
pub pixel_clock_khz: u32,
pub color_depth: ColorBitDepth,
pub color_format: ColorFormat,
pub pixel_repetition: u8,
}Expand description
The PHY value types, at the paths hdmi-hal gives them (hdmi_hal::phy::*). They are
re-exported at the crate root as well.
The video a TMDS link carries, as far as a PHY may need it.
Some PHYs are set up from the pixel clock and colour depth rather than from the character
rate, and one character rate comes from several pixel clocks: for RGB and YCbCr 4:4:4 the
rate is the pixel clock times the bits per component over 8, and for YCbCr 4:2:0 half
that (dw-hdmi,
torvalds/linux e774d5f1b drivers/gpu/drm/bridge/synopsys/dw-hdmi.c:2008–2026; i915,
drivers/gpu/drm/i915/display/intel_hdmi.c:1925–1937). A PHY keyed by the character rate
ignores this.
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.pixel_clock_khz: u32The clock at which pixels reach the TMDS encoder, in kHz: pixel repetition included,
the deep-colour factor not. For a repeated mode it is the mode’s own clock times
pixel_repetition + 1.
Linux lists 720(1440)x480i (VIC 6) at 13 500 kHz with a double-clock flag
(torvalds/linux e774d5f1b, drivers/gpu/drm/drm_edid.c:791–794); this field is
27 000 for it, with pixel_repetition 1. Drivers read such a mode either way: i915
doubles the clock for the port (i915/display/intel_hdmi.c:2049–2052, 2175–2176),
while dw-hdmi takes the mode’s clock as its pixel clock (bridge/synopsys/dw-hdmi.c:2004)
and refuses double-clocked modes (:2940–2941). The convention here is chosen, so
that a PHY keyed by the pixel clock needs no other field to find its rate.
color_depth: ColorBitDepthBits per colour component.
The type is display-types’ depth vocabulary, decoded from the EDID, so it names
depths (6 or 14 bits, for example) a PHY may not carry. TmdsPhy::configure
returns an error for a depth or a format the PHY cannot carry.
color_format: ColorFormatThe colour format. YCbCr 4:2:0 halves the character rate (dw-hdmi and i915, as cited
on TmdsVideo).
pixel_repetition: u8Pixel repetition: 0 for none, n for each pixel sent n + 1 times.
Implementations§
Source§impl TmdsVideo
impl TmdsVideo
Sourcepub const fn new(
pixel_clock_khz: u32,
color_depth: ColorBitDepth,
color_format: ColorFormat,
) -> TmdsVideo
pub const fn new( pixel_clock_khz: u32, color_depth: ColorBitDepth, color_format: ColorFormat, ) -> TmdsVideo
Constructs TmdsVideo with no pixel repetition.
Sourcepub const fn with_pixel_repetition(self, pixel_repetition: u8) -> TmdsVideo
pub const fn with_pixel_repetition(self, pixel_repetition: u8) -> TmdsVideo
Sets the pixel repetition (0: none; n: each pixel sent n + 1 times).
Sourcepub const fn character_rate_khz(&self) -> Option<u32>
pub const fn character_rate_khz(&self) -> Option<u32>
The TMDS character rate this video gives, in kHz, rounded up: the
character_rate_khz a TmdsPhyConfig for it
carries.
pixel_clock_khz times the deep-colour factor (×5/4 at 10
bits, ×3/2 at 12, ×2 at 16), except for YCbCr 4:2:2, which runs at the pixel clock at
any depth up to 12 bits, and halved for YCbCr 4:2:0. Pixel repetition is already in
the pixel clock. The DRM helper and dw-hdmi compute it so, and i915 agrees for the
formats it carries (torvalds/linux e774d5f1b:
display/drm_hdmi_helper.c:225–257, bridge/synopsys/dw-hdmi.c:2008–2026,
i915/display/intel_hdmi.c:1925–1938). They round to the nearest Hz; this rounds up to
the next kHz, so a rate just above a threshold, such as 340 000.5 kHz, is never taken
for one at or below it.
None for a depth TMDS does not carry (6 or 14 bits, or one added to
ColorBitDepth later), YCbCr 4:2:2 above 12 bits (the helper refuses it), a format
added to ColorFormat later, or a rate above u32::MAX kHz.