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>
The first fread call fills our 32 KiB buffer, and then we enter a busy
loop calling fread with zero.
Found via fuzzing with AFL.
Signed-off-by: Simon Ser <contact@emersion.fr>
This adds coverage for two untested code-paths:
- Unset "Serial Number"
- "Model year" instead of "Made in"
This EDID blob comes from Digital/Panasonic/MEI96A2/7CA47BE65E1E [1]
in the linuxhw EDID repository.
[1]: https://github.com/linuxhw/EDID/blob/master/Digital/Panasonic/MEI96A2/7CA47BE65E1E
Signed-off-by: Simon Ser <contact@emersion.fr>
Upstream edid-decode hides the serial number in this case.
The spec says that it's optional, and set to zero when unused.
Signed-off-by: Simon Ser <contact@emersion.fr>
These warnings are easy to miss during development:
../edid.c: In function ‘_di_edid_parse’:
../edid.c:254:25: warning: implicit declaration of function ‘di_edid_destroy’? [-Wimplicit-function-declaration]
254 | di_edid_destroy(edid);
| ^~~~~~~~~~~~~~~
And when missed, the code still compiles. Which means one needs to clean-build
to show them again.
Signed-off-by: Simon Ser <contact@emersion.fr>
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>
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>
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>
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>
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>
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
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>
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>
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>
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>
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>
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>