Commit graph

146 commits

Author SHA1 Message Date
Simon Ser
c784d978fb cta: parse detailed timing definitions
After the data blocks, the CTA extension contains a list of DTDs.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-08-08 18:41:18 +02: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
9198ef48a3 edid: fix typo in di_edid_get_standard_timings() doc comment
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-08-08 16:29:43 +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
21f7fe66a0 test/data: add sun-gh19ps-dvi
It contains unusual DTD flags, a manufacture year we don't parse
correctly yet, and GTF support.

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
44963edc4c cta: parse colorimetry data blocks
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-08-02 22:21:19 +02: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
1ce9128701 di-edid-decode: exit with non-zero code on conformance failure
Upstream edid-decode does the same.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-08-02 21:48:52 +02:00
Simon Ser
3b64049622 di-edid-decode: print failure message
Mirror upstream edid-decode.

samsung-s27a950d-dp and hp-5dq99aa-hdmi are missing some failures
about features we haven't implemented yet. panasonic-mei96a2-dp
has a bogus "Missing Display Product Name" failure, see [1].

[1]: https://lore.kernel.org/linux-media/20220802093219.30599-1-contact@emersion.fr/T/#u

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-08-02 21:48:01 +02:00
Simon Ser
79e0ac2dd4 test: include edid-decode failure messages in diffs
This will allow us to check that we find the same failures as
upstream edid-decode.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-08-02 21:47:35 +02: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
67af3033ee cta: add support for misc flags
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
0cc784971b dmt: introduce generated table for DMT data
The Display Monitor Timing specification is a PDF with data tables.
A small Python script can be used to extract its contents in a
machine-readable form.

For now only extract a few fields. This can be extended later.

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
3d0f36c528 test/data: add samsung-s27a950d-dp
This EDID contains DTDs with the stereo flag set, and audio blocks
in the CTA extension.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-17 11:17:48 +02:00
Simon Ser
119a95844d edid: switch to sized integers for DTD
This makes it clearer what the range of the value can be: we no
longer need to deal with 16-bit integers.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-17 10:12:10 +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
d40a89262d edid: document that DTD size in mm can be unset
According to table 3.21 note 17, these fields should be set to zero
for some sinks, e.g. front projectors.

edid-decode hides the size from its output if both fields are zero.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-17 10:11:20 +02:00
Simon Ser
4a4ee90888 ci: disable parallel jobs for coverage reports
Running in parallel results in spurious failures:
https://gitlab.freedesktop.org/emersion/libdisplay-info/-/jobs/24101687

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-16 11:12:06 +00:00
Simon Ser
999a4d4c57 ci: build with both GCC and Clang
These two compilers may have different warnings. Make sure we
don't miss any.

The Clang build also supports ASan + UBSan.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-16 11:12:06 +00:00
Simon Ser
adddd56680 di-edid-decode: remove default cases for enum switches
The motivation is two-fold:

- These were added back when we exposed values outside of the enum
  entries. We no longer do that, so these can't be hit.
- The compiler now warns when we are missing an entry from the switch.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-16 11:12:06 +00:00
Simon Ser
37711a44ed di-edid-decode: add missing DI_EDID_EXT_DPVL name
This is missing from the switch.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-16 11:12:06 +00: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
58b10d9048 di-edid-decode: compute DTD aspect ratio
Upstream edid-decode computes the aspect ratio for detailed
timing definitions.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-15 11:43:23 +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
ffb81c9bef ci: mention how to force a container rebuild when pushing
This should remove the risk to merge a patch with the
FDO_FORCE_REBUILD line uncommented. Mentionning the command in the
manifest makes it easier to remember.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-14 12:03:10 +00:00
Simon Ser
a4d2bbf95f build: set symbol visibility
A simple version script is used because it allows us to consistently
expose all symbols starting with "di_", removing the risk to forget
to mark a symbol as public.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-14 11:40:07 +00: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
c7a2edb74c edid: re-order display descriptor declarations in public header
These appear after the basic display parameters and features in
the EDID structure, so it makes sense to put them below in the
header.

I got confused while during a rebase.

While at it, move the declaration for struct di_edid_display_descriptor
before the one for di_edid_get_display_descriptors(), because the
latter uses the former.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-10 16:42:29 +02:00
Simon Ser
c14569af01 di-edid-decode: add optional arg to specify input filename
This makes it easier to e.g. run the tool inside gdb, and is
consistent with upstream edid-decode.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-10 14:12:02 +00:00
Simon Ser
0b6970ed70 readme: document fuzzing setup
These are just the standard AFL instructions, adapted to Meson.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-10 14:08:57 +00:00