Skip to main content

TmdsVideo

Struct TmdsVideo 

Source
#[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
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.
§pixel_clock_khz: u32

The 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: ColorBitDepth

Bits 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: ColorFormat

The colour format. YCbCr 4:2:0 halves the character rate (dw-hdmi and i915, as cited on TmdsVideo).

§pixel_repetition: u8

Pixel repetition: 0 for none, n for each pixel sent n + 1 times.

Implementations§

Source§

impl TmdsVideo

Source

pub const fn new( pixel_clock_khz: u32, color_depth: ColorBitDepth, color_format: ColorFormat, ) -> TmdsVideo

Constructs TmdsVideo with no pixel repetition.

Source

pub const fn with_pixel_repetition(self, pixel_repetition: u8) -> TmdsVideo

Sets the pixel repetition (0: none; n: each pixel sent n + 1 times).

Source

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.

Trait Implementations§

Source§

impl Clone for TmdsVideo

Source§

fn clone(&self) -> TmdsVideo

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 Copy for TmdsVideo

Source§

impl Debug for TmdsVideo

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for TmdsVideo

Source§

impl PartialEq for TmdsVideo

Source§

fn eq(&self, other: &TmdsVideo) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TmdsVideo

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, 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.