Some EDIDs have DisplayID 2 extension blocks which we don't support
at the moment. Skip the extension block in that case. While at it,
also skip malformed DisplayID blocks.
Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/emersion/libdisplay-info/-/issues/42
../../git/weston/subprojects/display-info/edid.c: In function ‘decode_chromaticity_coord’:
../../git/weston/subprojects/display-info/edid.c:250:8: warning: conversion from ‘int’ to ‘uint16_t’ {aka ‘short unsigned int’} may change value [-Wconversion]
250 | raw = (uint16_t) (hi << 2) | lo;
| ^
Apparently the cast applies to (hi << 2), then bitwise-or implicitly
promotes to signed int, and that gets assigned to uint16_t raw. At least
gcc 10.2.1 from Debian seems to think so.
Fix it by forcing the cast on the complete result.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This allows callers to access the detailed DMT data.
di-edid-decode is updated to print the missing fields.
Signed-off-by: Simon Ser <contact@emersion.fr>
Make sure we didn't mess up the array size. Abort instead of
corrupting memory.
Found the array insert operations via:
git grep '++]'
Signed-off-by: Simon Ser <contact@emersion.fr>
Nested structs makes it impossible to extend the nested struct after
extending the base struct. The union acts as a single struct in this
case but the nesting is still an issue. Use pointers to those structs instead
to keep all of them extensible. Only the struct which is applicable for the
signal type is not a null pointer to make sure only valid data is accessed.
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
To parse standard timing descriptors, we'll need to re-use that
function and store the result elsewhere.
Signed-off-by: Simon Ser <contact@emersion.fr>
Upstream edid-decode uses a global variable to store the current
EDID section name and prefix failure messages.
Signed-off-by: Simon Ser <contact@emersion.fr>
This is a private function which parses DTDs. This will be useful
in the next commit to parse DTDs from the CTA extension.
Signed-off-by: Simon Ser <contact@emersion.fr>
EDID 1.2- allow the first byte descriptor to contain a display
descriptor. EDID 1.3+ require the first byte descriptor to contain
a detailed timing definition describing the display's preferred
(ie, optimal) mode.
Signed-off-by: Simon Ser <contact@emersion.fr>
EDID 1.4 forbids years < 2006, but EDID 1.3 allows them.
Error out when an EDID uses a reserved value. Correctly parse the
year on older EDID revisions.
Signed-off-by: Simon Ser <contact@emersion.fr>
These functions now only return false on fatal failures
(e.g. out of memory). They no longer return false for unsupported
block types.
Signed-off-by: Simon Ser <contact@emersion.fr>
This is a bit messy because the values depend on various misc flags
defined earlier in the spec, and the meaning changes between EDID 1.3
and 1.4. On top of that edid-decode prints something confusing in the
EDID 1.3 case.
Signed-off-by: Simon Ser <contact@emersion.fr>
The only caller skips any descriptor with errors, it doesn't surface
back the errno to the library user.
Signed-off-by: Simon Ser <contact@emersion.fr>
This will allow us to use the helpers from cta.c.
The functions are marked "static inline" to avoid warnings about
unused functions.
Signed-off-by: Simon Ser <contact@emersion.fr>
The analog/digital flags are left for a future patch.
A join_str() function is introduced in di-edid-decode: upstream
edid-decode uses a comma-separated list with a handful of other
flags.
Signed-off-by: Simon Ser <contact@emersion.fr>