Commit graph

18 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
Pekka Paalanen
7b4d87b2d2 info: drop unused includes
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-06-11 15:33:38 +03: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
Joshua Ashton
c995305a69 info: Use memory_stream_cleanup in di_info_get_serial
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2022-11-25 12:15:14 +00:00
Joshua Ashton
12923cc3bc info: Use memory-stream API for di_info_parse_edid
Avoids a bunch of duplicated code here.

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
Pekka Paalanen
ac857e8985 info: use PNP ID database for manufacturer names
The three character PNP ID is a key to manufacturer name database. It
may be desirable to report the manufacturer's real name than just PNP ID
which can be misleading, e.g. MSI refers to Microstep and not MSI GmbH.

This builds the PNP ID database into libdisplay-info to avoid having to
find and parse files at runtime.

tool/gen-search-table.py started as a copy of Wayland 1.21.0's
src/embed.py and took influence from
10945c4ed8/conv.py
However, our script parses the text file shipped in hwdata package in
Debian (and presumably other distributions) rather than the original
CSV.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-11-11 13:09:18 +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
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
Simon Ser
7834b6ba22 info: introduce di_logger
This can be used by parsers (EDID, CTA, DisplayID, etc) to report
errors.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-08-04 08:40:36 +02:00
Simon Ser
a1f97e89fe Add failure message reporting functions
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-29 12:25:48 +02:00
Simon Ser
c383417629 edid: prefix private functions with "_di_"
The extra underscore indicates that it's not a function which is
part of our public API. This will allow the next commit to setup the
linker to export functions based on their name.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-14 11:40:07 +00: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
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