Commit graph

211 commits

Author SHA1 Message Date
Pekka Paalanen
89f8eecc11 editorconfig: add python rules
This seems to be what the existing python file uses, and trying to write
python when your editor is constantly resetting its settings according
to the previous "incorrect" editorconfig was infuriating.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-11-09 14:18:24 +02:00
Pekka Paalanen
00b446d5db test: make edid-decode-diff.sh easier to run
Having to define just DI_EDID_DECODE was tolerable when REF_EDID_DECODE
does not need setting, but now that there are two built tools, it is
getting inconvenient.

Change the defaults to match the build directory structure and add a new
overridable for the build directory.

Now I only need to set BUILDDIR for this to work. My build dirs are
completely elsewhere, but if someone uses the usual 'meson build'
incantation, the default value for BUILDDIR should be fine.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-11-09 14:18:04 +02:00
Pekka Paalanen
f70fa58441 test: add high-level API test
This new test exercises all existing high-level API to make sure the
output does not change unexpectedly.

Unlike with edid-decode tests, these new print tests do not have an
externally defined groundtruth. They are only to detect changes and
exercise code paths.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-11-09 14:18:04 +02:00
Pekka Paalanen
b3231b85dd info: add getters for make, model and serial
The functionality of these new high-level functions as implemented here
follows what Weston 11.0's ad hoc EDID parser extracted. There are
differences to Weston though:
- get_model() falls back to the numeric model field
- unusual characters are escaped as hex rather than replaced with dash

The documentation of the new functions allows to change the behavior of
get_model and get_make to e.g. convert PNP ID to a company name. The
notes about UTF-8 allow us to make use of UTF-8 fields if such appear
useful in the future.

Weston's ad hoc parser shall be replaced with this. After another API
addition, the high-level API semantics will match what Weston expects.

The memory_stream stuff is for convenience and will see more complex
use in the future.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-11-09 14:14:27 +02:00
Simon Ser
4af5b96140 di-edid-decode/cta: round VESA transfer characteristics
Fixes the differences with edid-decode.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-10-20 08:07:22 +00:00
Simon Ser
b7d0793a03 edid-decode/cta: align data block names with edid-decode
We were diverging here.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-10-20 08:07:22 +00:00
Simon Ser
c930f13457 test: add custom-uncommon-cta-vesa
This is a hand-crafted EDID taken from edid-decode (test/cta-vesa.test).
It contains uncommon blocks: VESA Display Transfer Characteristics Data
Block and VESA Video Display Device Data Block in the CTA-861 extension.

While it's not as good as a real-world EDID, it can still improve our
test coverage and ensure we behave like edid-decode.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-10-20 08:07:22 +00:00
Simon Ser
add5d0bd76 info: drop di_info_get_product_name()
This was used as an example of what a high-level API function would
look like, but is too opinionated to be useful across many
compositors.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-10-15 19:01:08 +02:00
Pekka Paalanen
cda99a0913 readme: add Using section
I believe this is what we intended, and it is what I want.

It could lead to duplicating low-level API in high-level API at first,
but once we start seeing DisplayID in the wild, the high-level functions
need to start looking into both EDID and DisplayID APIs to deliver the
desired information.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-10-14 13:26:40 +03:00
Pekka Paalanen
6d7ce6dbd8 readme: mention edid-decode version
I was scratching my head for a good while, why does the test suite fail
straight out of upstream on one EDID file. Turns out I was using a
different version of edid-decode than CI, which caused the recorded diff
patch to fail to apply. I was missing

41507c0b5f "ci: update edid-decode"

Make an explicit note about this dependency.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-10-14 13:26:37 +03:00
Pekka Paalanen
50ce9c73f5 Get size_t definition for info.h
VScode told me that this header wasn't self-contained. Fix it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-10-14 13:26:30 +03: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
Simon Ser
619fc30c7b ci: update edid-decode
Contains a fix for DsiplayID tiled display topology and for CVT
RBv3.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-10-11 11:48:29 +00:00
Simon Ser
41d3278807 readme: link to latest code coverage report
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-10-07 07:20:18 +02:00
Simon Ser
97a8f16d1f di-edid-decode: split into multiple files
di-edid-decode.c is getting bit and messy.

Use one file per spec.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-10-07 05:05:27 +00:00
Simon Ser
f2d6819f04 displayid: add missing includes in public header
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-10-07 05:05:27 +00:00
Simon Ser
2ec42b3bd2 readme: add link to website
The website hosts the documentation.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-10-05 10:47:44 +00:00
Simon Ser
ec2521e4e0 Generate HTML documentation
Leverages gyosu [1] to generate HTML documentation from the header
files.

[1]: https://sr.ht/~emersion/gyosu/

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-10-04 16:21:46 +00:00
Simon Ser
eea7215002 di-edid-decode: print preferred flag for type I timing
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-10-03 14:14:45 +02:00
Simon Ser
cad7de92c7 displayid: add support for display parameters data block
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-10-03 08:56:03 +02:00
Simon Ser
d7144ad9b9 displayid: parse type I timings
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-10-03 06:32:38 +00:00
Simon Ser
87e264f7fb Introduce di_gtf_compute()
This is a function to compute a timing according to GTF.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-29 11:50:09 +00:00
Sebastian Wick
11f48480d8 cta: add support for VESA Display Transfer Characteristic data block
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2022-09-28 23:56:46 +02: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
Simon Ser
3b8816ba3f displayid: add logging helpers
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-27 07:56:09 +00:00
Simon Ser
186e78c128 displayid: validate checksum
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-27 07:56:09 +00:00
Simon Ser
ceabc884fd displayid: parse product type
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-27 07:56:09 +00:00
Simon Ser
106947ac1f displayid: parse section size
The section size might be smaller than the provided buffer size,
because the buffer might have padding at the end.

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
b89910ef4e test/data: add goldstar-ite6604-hdmi
It contains established timings III.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-17 09:09:59 +02:00
Simon Ser
df676bef3a di-edid-decode: fix inverted text for analog video setup
The texts and cases are inverted here.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-17 09:07:20 +02:00
Simon Ser
29dd7c1e17 test/data: add acer-p1276
We don't have any analog display EDID in our tests. Increase our
test coverage by including one.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-17 09:07:05 +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
Simon Ser
ad4c9b467c dmt: add public header
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-17 06:53:39 +00:00
Simon Ser
4ead11c64b dmt: add more timing info
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
a382b96645 cta: add missing <stdint.h> include in public header
cta.h:246 uses uint8_t but we never include <stdint.h>.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-14 12:03:36 +00: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
fbec9839fa cta: add EDID_CTA_MAX_DATA_BLOCKS
Use a constant for the max number of data blocks, with a comment
explaining the reasoning.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-12 06:21:12 +00:00
Simon Ser
2fc4aedee7 ci: simplify ci-templates include
Turns out we can include multiple files with an array instead of
repeating ourselves.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-08 12:19:50 +02: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
7e0b8c1af9 test/data: add viewsonic-vp2768-dp
It contains a CVT range limits descriptor.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-06 09:25:57 +02:00
Simon Ser
da89d95268 test/data: add msi-mag321curv-dp
It contains a GTF secondary range limit descriptor.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-06 09:25:12 +02:00
Simon Ser
407b309904 cta: add support for video capability data block
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-05 18:11:56 +00:00
Simon Ser
edb952756d cta: rename di_edid_cta_flags.underscan to it_underscan
Make it clear this is only about IT video formats.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-05 18:11:56 +00: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