Commit graph

111 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
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
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
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
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
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
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
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
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
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
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
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
Sebastian Wick
506925a66b cta: add support for InfoFrame Data Block
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-01-31 14:58:50 +01:00
Sebastian Wick
4698004913 cta: Add new data blocks from CTA-861.6
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-01-30 16:53:47 +01:00
Simon Ser
b439985324 cta: add VIC table
Add a small Python tool to extract VIC information from the spec.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-01-13 02:37:01 +01:00
Sebastian Wick
5c2255047b cta: add support for YCbCr 4:2:0 Capability Map
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-01-11 22:02:20 +00:00
Sebastian Wick
f7bd527557 cta: add support for YCbCr 4:2:0 Video
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-01-11 21:21:27 +01:00
Simon Ser
2ebc104594 cta: add support for speaker allocation data block
Signed-off-by: Simon Ser <contact@emersion.fr>
2023-01-11 21:04:48 +01:00
Sebastian Wick
a55e759f7c cta: parse HDR Dynamic Metadata Data Block
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-01-11 19:11:37 +00:00
Sebastian Wick
c32df33fe7 cta: include stddef.h for size_t
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-01-10 15:12:09 +01:00
Simon Ser
67b5d67a64 cta: add support for VESA DDDB
Signed-off-by: Simon Ser <contact@emersion.fr>
2023-01-10 12:23:38 +00:00
Simon Ser
fc13fb4d53 displayid: add support for tiled display topology data block
Signed-off-by: Simon Ser <contact@emersion.fr>
2023-01-09 22:49:01 +00:00
Sebastian Wick
4a8684d1b0 edid: add support for CVT timing code descriptors
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-01-04 02:12:22 +01:00
Simon Ser
f7160730cc Introduce di_cvt_compute()
Same as di_gtf_compute(), but for CVT.

Code imported from edid-decode, fixed up [1] [2], edited for
code style and extended to return all output parameters.

Will help with CVT timing code descriptors in EDID [3].

[1]: https://lore.kernel.org/linux-media/20221005121221.14882-1-contact@emersion.fr/T/#u
[2]: https://lore.kernel.org/linux-media/20221028142405.81894-1-contact@emersion.fr/T/#u
[3]: https://gitlab.freedesktop.org/emersion/libdisplay-info/-/merge_requests/93

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-12-16 15:37:38 +01:00
Sebastian Wick
8fbc366c7c cta: parse short audio descriptors
Co-authored-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2022-12-14 15:19:27 +01:00
Joshua Ashton
c63ca40ef7 memory-stream: Add memory_stream_cleanup helper
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2022-11-25 12:15:14 +00:00
Joshua Ashton
a10c478558 memory-stream: Factor out memory-stream related code to a new file
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2022-11-25 12:15:14 +00:00
Simon Ser
7d5003c5ac dmt: add reduced_blanking field
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-11-23 15:30:33 +01: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
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
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
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
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
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
ceabc884fd displayid: parse product type
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
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