Commit graph

66 commits

Author SHA1 Message Date
Sebastian Wick
d299c4716a edid: Sync On Green Signal only is set if the bit is 0 and not 1
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-01-30 17:10:40 +01:00
Sebastian Wick
4a8684d1b0 edid: add support for CVT timing code descriptors
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-01-04 02:12:22 +01:00
Pekka Paalanen
56be915e27 edid: fix uint16_t conversion warning
../../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>
2022-10-13 13:03:16 +03:00
Sebastian Wick
78b4f0eb68 edid: use the correct definition for maximum standard timings
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2022-09-28 02:44:35 +02:00
Simon Ser
40d8018a7e displayid: parse data blocks
Just parse the tag for now.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-27 07:56:09 +00:00
Sebastian Wick
ef67125056 edid: add support for Color Management Data descriptors
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2022-09-26 21:51:58 +02:00
Simon Ser
28beee232c edid: parse established timings III
This display descriptor contains a bitfield indicating support for
DMT timings.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-26 09:18:59 +02:00
Simon Ser
047e8bb305 edid: expose struct di_dmt_timing
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>
2022-09-17 06:53:39 +00:00
Sebastian Wick
cc7597d9cc edid: add support for color point descriptors
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2022-09-15 16:26:03 +02:00
Simon Ser
6f7dc0bcf7 Add safety assertions when inserting into array
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>
2022-09-12 06:21:12 +00:00
Simon Ser
c637a9daf8 edid: parse timing data from CVT range limit descriptor
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-06 09:27:32 +02:00
Simon Ser
7c8bcb09eb edid: parse timing data from secondary GTF range limit descriptor
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-06 09:26:32 +02:00
Simon Ser
df9e7eedaa edid: check padding in range limits descriptor
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-06 09:26:00 +02:00
Simon Ser
7a6d694b1a Add basic support for DisplayID in EDID extension blocks
Establish the new headers and structs, and just parse the
version/revision for now.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-02 06:42:06 +00:00
Sebastian Wick
44e1810f2b edid: split the detailed timing signal union into separate structs
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>
2022-08-30 12:24:46 +02:00
Simon Ser
93b0fd18de edid: add support for standard timings descriptor
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-08-29 11:54:48 +00:00
Simon Ser
1911c0be81 edid: refactor parse_standard_timing() with an output param
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>
2022-08-29 11:54:48 +00:00
Simon Ser
f5f8371965 edid: add prefix to range limits failure messages
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>
2022-08-29 10:19:48 +00:00
Simon Ser
92c0933b44 edid: parse analog video input params
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-08-09 09:07:17 +00:00
Simon Ser
febb8b56f9 edid: parse digital video input flags for EDID 1.3-
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-08-09 09:05:44 +00:00
Simon Ser
7275f65131 edid: expose _di_edid_parse_detailed_timing_def
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>
2022-08-08 18:37:52 +02:00
Simon Ser
501c20f854 edid: parse established timings I and II
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-08-08 16:33:14 +00:00
Simon Ser
0e271c53f5 edid: check first byte descriptor is a DTD
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>
2022-08-08 16:32:12 +00:00
Simon Ser
06a05c83c0 cta: log failures
Use the newly-introduced di_logger to report CTA failures.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-08-04 08:40:36 +02:00
Simon Ser
7834b6ba22 info: introduce di_logger
This can be used by parsers (EDID, CTA, DisplayID, etc) to report
errors.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-08-04 08:40:36 +02:00
Simon Ser
8e7308358e edid: parse analog and digital flags in DTDs
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-08-03 18:49:00 +00:00
Simon Ser
f11ec2b9ab edid: parse DTD signal type
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-08-03 18:49:00 +00:00
Simon Ser
0e3f4cedbf edid: fix product year < 2006 in EDID 1.3
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>
2022-08-03 18:49:00 +00:00
Simon Ser
fc10923200 edid: drop unnecessary ENOTSUP checks
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>
2022-08-03 09:32:12 +02:00
Simon Ser
051d25a406 edid: drop return value for parse_chromaticity_coords()
We always return true now that we report non-fatal failures.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-08-03 06:57:46 +00:00
Simon Ser
ad15d6ac6d edid: drop return value for parse_basic_params_features()
We always return true now that we report non-fatal failures.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-08-03 06:57:46 +00:00
Simon Ser
1a1a025de8 edid: fix negative errno
errno holds positive values.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-08-02 19:51:23 +00:00
Simon Ser
4f4aa025cf edid: add display range limits type
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>
2022-08-02 20:07:08 +02:00
Simon Ser
cf66667ac3 edid: stop setting errno in parse_display_range_limits
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>
2022-08-02 20:05:41 +02:00
Simon Ser
e047d89f94 cta: add support for enumerating data blocks
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-08-01 16:41:59 +02:00
Simon Ser
a29c533b66 Extract bit helpers into shared header
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>
2022-08-01 16:41:58 +02:00
Simon Ser
afdacff9f8 cta: introduce new API for CTA-861
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-08-01 16:41:33 +02:00
Simon Ser
b22dcc8af8 edid: add di_edid_standard_timing_get_dmt_id
This returns the DMT ID of an EDID standard timing, if any.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-08-01 14:35:33 +00:00
Simon Ser
676984a737 edid: report parsing errors with new helpers
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-07-27 17:15:00 +02:00
Simon Ser
a1f97e89fe Add failure message reporting functions
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-29 12:25:48 +02:00
Simon Ser
fed3a18b64 edid: add support for chromaticity coordinates
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-21 16:14:52 +02:00
Simon Ser
2b6f3804a0 edid: parse standard timings
The edid-decode output uses data from the DMT, so we're not able
to replicate it yet.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-21 16:07:52 +02:00
Simon Ser
669bdac3c8 edid: parse display color type
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-21 12:48:49 +00:00
Simon Ser
197c5f5ee1 edid: parse interlaced/stereo flags from DTDs
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>
2022-06-17 11:22:09 +02:00
Simon Ser
9da7803e4a edid: ignore aspect ratio stored in DTD mm size
The spec allows manufacturers to store the aspect ratio in these
fields. Instead of exposing bogus values to the user, mark the
size in mm as undefined.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-17 10:12:10 +02:00
Simon Ser
c8b9b8f42d edid: parse display range limits descriptor
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-15 17:29:33 +02:00
Simon Ser
13a9287e40 edid: add support for detailed timing definitions
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-14 16:37:57 +02:00
Simon Ser
c383417629 edid: prefix private functions with "_di_"
The extra underscore indicates that it's not a function which is
part of our public API. This will allow the next commit to setup the
linker to export functions based on their name.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-14 11:40:07 +00:00
Simon Ser
10435a83e8 edid: parse other feature support flags
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-10 11:49:20 +00:00
Simon Ser
0473e12c54 edid: parse supported color encoding formats
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-10 11:49:20 +00:00