Documentation
¶
Overview ¶
Package edid reads what a display's EDID says about it: its make, model and serial, as outputs are described and matched by, its colour and its variable refresh range.
Index ¶
Constants ¶
const PNPEnv = "LYS_PNP_IDS"
PNPEnv is the environment variable that points PNPPath at a PNP ID database.
Variables ¶
var ErrInvalid = errors.New("edid: invalid")
ErrInvalid is a blob that is not an EDID: too short, without the header, or with a bad base block checksum.
var ErrNoVRRRange = errors.New("edid: no variable refresh range")
ErrNoVRRRange is an EDID that states no variable refresh range.
Functions ¶
Types ¶
type Chromaticity ¶
type Chromaticity struct {
X, Y float64
}
Chromaticity is a CIE 1931 xy coordinate.
type HDR ¶
type HDR struct {
Red, Green, Blue, White Chromaticity
ST2084, HLG bool
BT2020 bool
StaticMetadata bool
MaxLuminance float64
MaxAverageLuminance float64
MinLuminance float64
}
HDR is what an EDID says about a display's colour: the primaries of its base block, and the transfer functions, gamut and luminance of its CTA-861 extension's Colorimetry and HDR Static Metadata data blocks. Luminances are in cd/m², and zero where the display leaves them out.
func ParseHDR ¶
ParseHDR reads b's colour characteristics. A display with no CTA-861 extension, or none with the data blocks, has an HDR with only its primaries. It fails with ErrInvalid on a bad base block or a data block that overruns. An extension with a bad checksum fails too, not to promise a signal the display may not take.
type Info ¶
Info is a display's identity: its PNP manufacturer ID, its make (the manufacturer's name, or the PNP ID when unknown), its model and its serial.
func Parse ¶
Parse reads the identity from EDID b's base block. The model and serial come from the name and serial descriptors, falling back to the product code and the numeric serial in hex; a zero numeric serial leaves Serial empty. It fails with ErrInvalid.
func (Info) Description ¶
Description is make, model and serial joined by spaces, empty ones left out.
type VRRRange ¶
VRRRange is the vertical refresh range a display can vary its rate within, in millihertz, and where the EDID says so.
func ParseVRR ¶
ParseVRR reads b's variable refresh range from the most specific source it lists: DisplayID 2.x's Adaptive Sync data block, then the CTA-861 AMD vendor-specific data block, then the base block's range limits descriptor with EDID 1.4's 255 Hz offsets. A range whose minimum equals its maximum is a fixed rate and is no range. It fails with ErrNoVRRRange when no source states a range, and with ErrInvalid on a bad base block, an extension with a bad checksum, a data block that overruns or a range whose minimum is zero or above its maximum.
func (VRRRange) MaxFrameDuration ¶
MaxFrameDuration is the longest the display holds one frame: the period of its minimum refresh rate.
type VRRSource ¶
type VRRSource uint8
VRRSource is the part of an EDID a VRRRange was read from. A larger value is a more specific source.
const ( // VRRRangeLimits is the base block's display range limits descriptor. VRRRangeLimits VRRSource = iota + 1 // VRRAMDVendorBlock is the CTA-861 AMD FreeSync vendor-specific data block. VRRAMDVendorBlock // VRRDisplayIDAdaptiveSync is DisplayID 2.x's Adaptive Sync data block. VRRDisplayIDAdaptiveSync )