Commit graph

263 commits

Author SHA1 Message Date
Pekka Paalanen
5d2af9a882 info: add di_info_get_default_gamma()
Wayland compositors may be interested in this.

DI-EXT is ignored, because libdisplay-info does not parse it yet.

EDID Color Point Descriptors are ignored, because they have not been
found in shipped products.

https://github.com/linuxhw/EDID.git database contains 373 samples for
which edid-decode complains:
  Basic Display Parameters & Features: sRGB is signaled, but the gamma != 2.2.

Therefore I assume that the sRGB flag is more correct when set.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-06-12 16:26:33 +03:00
Pekka Paalanen
0de6fd5f10 test: di_info_get_supported_signal_colorimetry()
Notifies us if the result ever changes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-06-12 16:26:33 +03:00
Pekka Paalanen
af7d091dc9 info: add di_info_get_supported_signal_colorimetry()
Add a high-level function to get the supported additional signal
colorimetries. This is only an interesting sub-set of the CTA-861-H
defined colorimetries, for driving WCG and HDR displays.

Wayland compositors will be interested in this.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-06-12 16:26:33 +03:00
Pekka Paalanen
6bc398e6db test: di_info_get_hdr_static_metadata()
Makes sure the results won't change unnoticed.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-06-12 16:26:33 +03:00
Pekka Paalanen
f2c1b01bd2 info: add di_info_get_hdr_static_metadata()
The low-level struct di_cta_hdr_static_metadata_block is essentially
duplicated in struct di_hdr_static_metadata to make the high-level API
independent of low-level API headers. It's also simpler in form, while
new fields can still be added in the end while maintaining ABI backward
compatibility.

If new sources for HDR static metadata appear, they can be parsed into
this same structure in the future when compatible.

Wayland compositors will be interested in this.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-06-12 16:26:33 +03:00
Pekka Paalanen
ef69f6276c test: di_info_get_default_color_primaries()
Notifies us if the result ever changes.

The 3 decimal precision is taken from E-EDID 1.4 spec which says that
the numbers have that precision.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-06-12 16:26:33 +03:00
Pekka Paalanen
85043a07d5 info: add di_info_get_default_color_primaries()
Add a high-level function to retrieve color primaries. Wayland
compositors will be interested in this.

A high-level function may later be extended to support stand-alone
DisplayID and other sources.

The high-level data is derived from low-level API calls in
di_info_parse_edid(). As we stash the results in struct di_info to avoid
requiring the callers to explicitly free the high-level structures, this
allows keeping struct di_info deeply const in high-level API
implementation. We also avoid some dynamic allocations.

https://github.com/linuxhw/EDID.git database contains 20399 samples for
which edid-decode complains:
  Basic Display Parameters & Features: sRGB is signaled, but the chromaticities do not match.

Therefore I assume that the sRGB flag is more correct when set.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-06-12 16:25:44 +03:00
Pekka Paalanen
7b4d87b2d2 info: drop unused includes
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-06-11 15:33:38 +03:00
Sebastian Wick
fbd0022272 build: build edid-decode as subproject
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-06-07 17:05:47 +02:00
Sebastian Wick
c0c0c8acc5 cta: HDMI Audio: Add a failure when NonMixed is supported without MS
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-06-06 10:58:48 +02:00
Sebastian Wick
08a4d543c8 cta: Add support for the HDMI Audio Data Block
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-05-29 11:29:37 +02:00
Sebastian Wick
5741163901 edid: Record failures instead of aborting parsing
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-05-08 12:43:20 +02:00
Simon Ser
f48cc61166 edid: ignore malformed CTA extension blocks
Same as previous commit, but for CTA instead of DisplayID.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-05-08 09:10:58 +02:00
Simon Ser
204576ecff edid: ignore unsupported/malformed DisplayID extension blocks
Some EDIDs have DisplayID 2 extension blocks which we don't support
at the moment. Skip the extension block in that case. While at it,
also skip malformed DisplayID blocks.

Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/emersion/libdisplay-info/-/issues/42
2024-04-29 11:12:44 +02:00
Simon Ser
7067ab6ad1 displayid: add support for type III timings
Signed-off-by: Simon Ser <contact@emersion.fr>
2024-03-21 17:15:27 +01:00
Simon Ser
245207e5ef displayid: extract timing_aspect_ratio_is_valid()
This will be used by the type III timing parsing logic in the next
commit.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-03-21 17:12:08 +01:00
Simon Ser
179f481c8f displayid: rename enum di_displayid_type_i_ii_vii_timing_aspect_ratio
This is also used by type III timings, and there is no other
competing aspect ratio enum in the DisplayID standard.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-03-21 17:09:18 +01:00
Sebastian Wick
8f4b0f768f edid: Change error messages and di-edid-decode printing
Following the changes in edid-decode.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-03-21 15:47:34 +01:00
Sebastian Wick
dda7c12642 test: Bump edid-decode to newer version
It has updated the calculation of the PQ level for Dolby Video.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-03-21 15:44:53 +01:00
Sebastian Wick
2d48bf1d54 di-edid-decode/displayid: Print Type II Detailed Timings
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-03-20 14:00:59 +01:00
Sebastian Wick
4f1a7ca5a0 displayid: Add support for Type II Detailed Timing Data Block
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-03-20 14:00:59 +01:00
Sebastian Wick
bedd81f1b6 displayid: Handle Type II timings in di_displayid_type_i_ii_vii_timing
Type II timings are exactly the same as Type I except more tightly
packed and no information on the aspect ratio. As such, they fit neatly
into the Type I and Type VII structure.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-03-19 18:02:47 +01:00
Sebastian Wick
0eb10bda9e cta: Parse DisplayID Type VII Video Timing Data Block
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-03-19 17:13:30 +01:00
Sebastian Wick
f36771f732 di-edid-decode/displayid: Make print_displayid_type_i_vii_timing generic
Instead of hardcoding the type of timing to DTD let the caller decide.
Also lets the caller set the level of indentation.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-03-19 17:11:50 +01:00
Sebastian Wick
f96aa28c9b displayid: Make parsing type I & VII timings available for CTA
The CTA block contains a single type VII descriptor.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-03-19 17:11:47 +01:00
Sebastian Wick
adc25656c2 displayid: Use a single struct for Type I and Type VII timings
They only have a different resolution for the pixel clock which we can
represent by just using a type in the struct which fits the higher
resolution.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-03-19 16:52:28 +01:00
Simon Ser
8d221c1d3d di-edid-decode: don't print manufacture week if unspecified
Fixes philips-ftv-2017.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-02-15 14:12:18 +01:00
Sebastian Wick
1388f16e71 cta: add support for Video Format Preference
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-02-15 11:02:47 +01:00
Sebastian Wick
75b21671d0 cta: add support for Speaker Location data blocks
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-02-14 20:56:17 +01:00
Sebastian Wick
3edb81e68d cta: add support for Room Configuration data blocks
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-02-14 20:56:17 +01:00
Sebastian Wick
63b483cd46 cta: Pull out speaker allocation struct
The speaker allocation format is reused in multiple CTA data blocks.
This commit pulls it into its own struct so it can be embedded into
other data block structs.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-02-14 17:27:28 +01:00
Christian Meissl
ebee35935d di-edid-decode: fix rgb quantization output
the output accidentally used the ycc range for
testing support of rgb quantization

Signed-off-by: Christian Meissl <meissl.christian@gmail.com>
2023-12-03 16:23:10 +01:00
Simon Ser
ae6cb5242e ci: upgrade to Alpine 3.18
Signed-off-by: Simon Ser <contact@emersion.fr>
2023-11-05 11:31:18 +01:00
Simon Ser
0e1235a908 ci: halt on UBSan error
By default, UBSan prints the error to stderr and does nothing else.
Halt the program so that CI fails and we notice the mistake.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-11-05 10:12:47 +00:00
Simon Ser
8aa57fbed9 edid: turn range limits max pixel clock into an int64_t
An int32_t is not large enough:
MAX_UINT8 * 10 * 1000 * 1000 > MAX_INT32.

We already use int64_t for di_cta_video_format.pixel_clock.

Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/emersion/libdisplay-info/-/issues/38
2023-11-05 10:12:47 +00:00
Simon Ser
924f59f6dc test: add QEMU EDID
Signed-off-by: Simon Ser <contact@emersion.fr>
References: https://gitlab.freedesktop.org/emersion/libdisplay-info/-/issues/38
2023-11-05 10:12:47 +00:00
Simon Ser
303484081d test: add ayaneo-wxga
Signed-off-by: Simon Ser <contact@emersion.fr>
References: https://gitlab.freedesktop.org/emersion/libdisplay-info/-/issues/36
2023-10-31 12:43:55 +01:00
Sebastian Wick
5142866ee7 cta: be more lenient about data block parsing
If the data block sizes start overlapping the DTD we cannot continue
parsing this or further data blocks but the ones we parsed already
should be valid.

Similarily if we fail parsing a specific data block the previous ones
should still be valid and the next ones might be as well.

Closes: https://gitlab.freedesktop.org/emersion/libdisplay-info/-/issues/36
Closes: https://gitlab.freedesktop.org/emersion/libdisplay-info/-/issues/37
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-10-31 12:43:37 +01:00
Jani Nikula
8829bab67a tool: fix redirect bashism in dump-i2c.sh
In POSIX sh, &> is undefined, and will lead to confusing errors on
e.g. dash.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2023-06-28 12:12:04 +03:00
Simon Ser
41027f9cc6 ci: use detached CI pipelines
See [1], required to allow contributors to trigger CI pipelines
for MRs. Example failure can be found at [2].

[1]: https://gitlab.freedesktop.org/freedesktop/freedesktop/-/issues/540#what-it-means-for-me-a-maintainer-of-a-project-part-of-gitlabfreedesktoporg
[2]: https://gitlab.freedesktop.org/emersion/libdisplay-info/-/jobs/44443608

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-06-26 16:23:15 +02:00
Simon Ser
49af17a3e6 editorconfig: bump max line length to 100 chars
Increase the maximum line length to 100 characters, following the
kernel policy change [1]. It's still a good idea to split long
lines, but not if that degrades readability and is only a few
characters over the limit.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bdc48fa11e46f867ea4d75fa59ee87a7f48be144

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-05-11 08:58:10 +00:00
Sebastian Wick
8781d1d7a9 tool: add a tool for dumping EDID/DisplayID from I2C
Dumps the content of every I2C address which might contain an EDID or
DisplayID blob for every connector which has an I2C bus.

This can be useful to discover DisplayID blobs which are not nested
inside an EDID blob.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-05-08 19:49:45 +00:00
Bernd Kuhls
5c9801a75f displayid.c: Include sys/types.h
Fixes build error
../displayid.c:377:10: error: ‘ssize_t’ undeclared (first use in this function); did you mean ‘size_t’?

seen with:
arc-linux-gcc.br_real (Buildroot 2021.11-4428-g6b6741b) 10.2.0

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
2023-05-07 14:23:26 +02:00
Simon Ser
598bde5846 edid: fix missing color point descriptor cleanup
This wasn't caught by ASan in CI because we don't have a blob with
color point descriptors.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-04-14 13:00:50 +02:00
Consolatis
480f72510a displayid.c: prevent int promotion warning
Fixes following warning

```
../displayid.c: In function ‘parse_tiled_topo_block’:
../displayid.c:298:29: error: conversion from ‘int’ to ‘uint16_t’ {aka ‘short unsigned int’} may change value [-Werror=conversion]
  298 |  tiled_topo->product_code = data[0x13] | (uint16_t)(data[0x14] << 8);
      |                             ^~~~
```

Signed-off-by: Consolatis <40171-Consolatis@users.noreply.gitlab.freedesktop.org>
2023-03-26 10:26:53 +02:00
Simon Ser
147d6611a6 readme: update test suite instructions
Since eed3e1e0f8 ("test: remove edid-decode as a test
dependency"), edid-decode is no longer required to run the test
suite. It's only required to re-generate the test data.

Expand a bit on how to setup edid-decode to re-generate the test
data.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-03-02 19:43:44 +01:00
Simon Ser
83ae3f5515 ci: remove unnecessary "Testing checks" stage
Merge the stage into "Build and test". The next stages don't depend
on this stage, so we can parallelize, no need to block the next
stages because of the testing-check step.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-02-27 11:56:27 +00:00
Simon Ser
af7af6090a info: ignore empty model/serial descriptors
Some EDIDs (e.g. goldstar-e2441) contain string descriptors for
model/serial which happen to be empty. Skip them.

Signed-off-by: Simon Ser <contact@emersion.fr>
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3599
2023-02-27 10:32:12 +01:00
Simon Ser
5e7bb09937 test/data: add goldstar-e2441
Signed-off-by: Simon Ser <contact@emersion.fr>
2023-02-27 10:31:58 +01:00
Sebastian Wick
eed3e1e0f8 test: remove edid-decode as a test dependency
by storing the reference edid-decode output in the repository. It is now
only a dependency for the gen-test-data target. The CI checks that the
reference output in the repository matches the one generated from a
specific checkout of edid-decode.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-02-23 20:50:13 +01:00