Commit graph

281 commits

Author SHA1 Message Date
Simon Ser
c05fbc875b ci: generate coverage information
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-08 10:49:37 +02:00
Simon Ser
24b2ea134f ci: enable meson --fatal-meson-warnings
This allows us to catch issues such as unknown build options and
newer Meson features used without a bump in meson.build's project().

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-08 08:29:16 +00:00
Simon Ser
6ae12d067e ci: add junit report for tests
Allows GitLab to get structured test results.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-06 15:37:16 +02:00
Simon Ser
225ec04a54 di-edid-decode: print block checksum
While this isn't particularly interesting to print, this reduces
the diff between di-edid-decode and edid-decode.

This is not exposed via the low-level EDID library because callers
wouldn't have a use for it.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-06 11:01:55 +00:00
Simon Ser
6cbaf27c91 edid: switch to a statically allocated extension array
The spec defines an upper bound for the extension block count,
which means we don't need to dynamically allocate the array. This
simplifies our logic a bit by removing an allocation error codepath.

The array is NULL-terminated, so EDID_MAX_BLOCK_COUNT is suitable
since it's the max number of extension blocks including the base
block, and the array doesn't include the base block.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-02 10:24:28 +02:00
Simon Ser
6238439643 di-edid-decode: print extension block count
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-01 12:51:26 +00:00
Simon Ser
350e557c3f edid: check extension block count field
The ensures the EDID hasn't been truncated.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-01 12:51:26 +00:00
Simon Ser
64d148d2b2 edid: document where extension block tags are defined
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-25 11:33:00 +02:00
Simon Ser
ef4661147e edid: validate extension block tag
Skip any extension block with an unsupported tag to make sure we don't
return a bogus enum value to the user.

Signed-off-by: Simon Ser <contact@emersion.fr>
References: https://gitlab.freedesktop.org/emersion/libdisplay-info/-/merge_requests/16#note_1396993
2022-05-25 11:32:59 +02:00
Simon Ser
b479e68220 ci: always upload Meson logs as artifacts
Previously, the artifacts weren't uploaded on failure.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-25 11:26:55 +02:00
Simon Ser
3d7a9bb77c ci: fix tests with outdated edid-decode
It sounds like the CI container was shipping an outdated version
of edid-decode which doesn't match the commit recorded in
.gitlab-ci.yml.

Update the diffs in the test data, and bump the CI container tag
again to make sure it's up-to-date with the manifest.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-24 17:58:09 +02:00
Pekka Paalanen
9b86c06206 tests/data: add HP Pavilion 27 Quantum Dot
This is my HDR monitor. The EDID offers some fields that only HDR
monitors have.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-05-24 11:26:05 +03:00
Simon Ser
a20fda18dd edid: check that the blob size is divisible by the block size
This is something edid-decode does, and this ensures we don't miss
any byte when parsing the blob.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-24 06:14:20 +00:00
Simon Ser
ad8038fdec edid: use hex offsets
This is what the specification uses. Makes it easier to compare the
code to the spec.

No functional change, this is purely a cosmetic change.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-20 09:21:49 +00:00
Simon Ser
a8e78208a5 Add edid-decode testing infrastructure
Add two small shell utilities to generate and compare diffs between
edid-decode and di-edid-decode. Store the diffs in-tree and add tests
to ensure they don't regress. Run the tests in CI with a pinned
installation of edid-decode.

One EDID blob is added to the test collection: dell-2408wfp-dp. It's
extracted [1] from the edid-decode repository.

[1]: https://git.linuxtv.org/edid-decode.git/tree/data/dell-2408wfp-dp

Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/emersion/libdisplay-info/-/issues/5
2022-05-12 11:35:58 +02:00
Simon Ser
1c0f7497f5 edid: add low-level API to enumerate extension blocks
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-09 14:33:58 +02:00
Simon Ser
321d5dbcba Add di_info_get_product_name
This high-level function leverages the low-level
di_edid_get_vendor_product function to build a string describing
the display device product.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-09 14:33:58 +02:00
Simon Ser
c22e47162e build: enable POSIX.1-2008
Turns on functions like strdup.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-09 14:33:58 +02:00
Simon Ser
882d34cebb edid: add vendor and product identification data
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-09 14:33:58 +02:00
Simon Ser
8c017e37ac Add di-edid-decode utility
This utility displays low-level EDID information. It uses the same
format as the official edid-decode CLI tool from linuxtv.org. It
will be helpful for testing.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-09 14:33:49 +02:00
Simon Ser
40b7b46a5c Add di_info_get_edid
Returns a low-level struct di_edid from a high-level struct di_info.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-06 10:30:33 +02:00
Simon Ser
c01982bdb1 Add skeleton for high-level API
This exposes a new di_info opaque struct from which high-level
information will be able to be queried by the user. A new
di_info_parse_edid function creates a di_info from an EDID blob.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-06 10:26:28 +02:00
Simon Ser
ad1e3f4167 Add very basic EDID functions
Introduce an opaque struct di_edid to host EDID structures. Add
a function to create a di_edid (with basic size, header and
checksum validation). Add functions to fetch the EDID version and
revision.

This doesn't do much, but hopefully can be used as a fundation.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-05 16:42:10 +02:00
Simon Ser
73b763d6b4 ci: fix build stage not run in MRs
See https://docs.gitlab.com/ee/ci/yaml/#rules

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-04-04 21:57:50 +02:00
Simon Ser
74b0cbc41d build: turn on -Wconversion
This warns when implicit conversions may alter a value. It's easy
to miss implicit conversions from signed to unsigned, from real to
integer, or to smaller types. This warning forces such conversions
to be explicit.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-04-04 19:21:35 +00:00
Simon Ser
38a8028c69 readme: add goals
Explain our goals for the library.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-04-04 19:21:02 +00:00
Simon Ser
a47a411617 build: tweak C warning options
Enable a few extra warning options, including -Walloca because it's
error-prone. Enable -Wdeclaration-after-statement to enforce the code
style. Disable -Wunused-parameter and -Wmissing-field-initializers
because these are pointless and don't catch bugs.

Inspired from the Weston and wlroots options.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-03-25 12:21:59 +01:00
Simon Ser
79fbb1ec39 build: add Meson boilerplate
Add a minimal Meson build file, and wire it up to CI.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-03-24 02:32:58 +01:00
Simon Ser
7e5903d8b3 ci: add .gitlab-ci.yml
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-03-24 02:16:08 +01:00
Simon Ser
114fa16d44 Add .editorconfig
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-03-24 01:49:12 +01:00
Simon Ser
f4b94b9261 Initial commit
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-03-24 01:49:00 +01:00