Commit graph

124 commits

Author SHA1 Message Date
Simon Ser
119a95844d edid: switch to sized integers for DTD
This makes it clearer what the range of the value can be: we no
longer need to deal with 16-bit integers.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-17 10:12:10 +02:00
Simon Ser
d40a89262d edid: document that DTD size in mm can be unset
According to table 3.21 note 17, these fields should be set to zero
for some sinks, e.g. front projectors.

edid-decode hides the size from its output if both fields are zero.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-17 10:11:20 +02:00
Simon Ser
c8b9b8f42d edid: parse display range limits descriptor
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-15 17:29:33 +02:00
Simon Ser
13a9287e40 edid: add support for detailed timing definitions
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-14 16:37:57 +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
c7a2edb74c edid: re-order display descriptor declarations in public header
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>
2022-06-10 16:42:29 +02:00
Simon Ser
742697cb98 di-edid-decode: only print serial number if non-zero
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>
2022-06-10 14:04:48 +02:00
Simon Ser
10435a83e8 edid: parse other feature support flags
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-10 11:49:20 +00:00
Simon Ser
0473e12c54 edid: parse supported color encoding formats
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-10 11:49:20 +00:00
Simon Ser
039a2a15f7 edid: parse supported DPMS states
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-10 11:49:20 +00:00
Simon Ser
83396e28e3 edid: parse basic gamma
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-10 11:49:20 +00:00
Simon Ser
5b156d8370 edid: parse screen size
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-10 11:49:20 +00:00
Simon Ser
b1bce19f03 edid: parse digital video input definition
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-10 11:49:20 +00:00
Simon Ser
7a31791343 edid: add support for product serial, name and data strings
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-09 07:28:16 +00:00
Simon Ser
2f8f41ea48 edid: add basic support for display descriptors
Expose an API to list display descriptors. Detailed timing
descriptors are not parsed.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-09 07:28:16 +00:00
Simon Ser
6cbaf27c91 edid: switch to a statically allocated extension array
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>
2022-06-02 10:24:28 +02:00
Simon Ser
64d148d2b2 edid: document where extension block tags are defined
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-25 11:33:00 +02:00
Simon Ser
ef4661147e edid: validate extension block tag
Skip any extension block with an unsupported tag to make sure we don't
return a bogus enum value to the user.

Signed-off-by: Simon Ser <contact@emersion.fr>
References: https://gitlab.freedesktop.org/emersion/libdisplay-info/-/merge_requests/16#note_1396993
2022-05-25 11:32:59 +02:00
Simon Ser
1c0f7497f5 edid: add low-level API to enumerate extension blocks
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-09 14:33:58 +02: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
882d34cebb edid: add vendor and product identification data
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
Simon Ser
ad1e3f4167 Add very basic EDID functions
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>
2022-05-05 16:42:10 +02:00