2022-06-06 20:53:10 +02:00
|
|
|
#include <assert.h>
|
2022-03-24 13:23:07 +01:00
|
|
|
#include <errno.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "edid.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The size of an EDID block, defined in section 2.2.
|
|
|
|
*/
|
|
|
|
#define EDID_BLOCK_SIZE 128
|
2022-05-24 09:05:14 +02:00
|
|
|
/**
|
|
|
|
* The size of an EDID byte descriptor, defined in section 3.10.
|
|
|
|
*/
|
|
|
|
#define EDID_BYTE_DESCRIPTOR_SIZE 18
|
2022-03-24 13:23:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Fixed EDID header, defined in section 3.1.
|
|
|
|
*/
|
|
|
|
static const uint8_t header[] = { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 };
|
|
|
|
|
2022-06-09 14:27:11 +02:00
|
|
|
/**
|
|
|
|
* Check whether a byte has a bit set.
|
|
|
|
*/
|
|
|
|
static bool
|
|
|
|
has_bit(uint8_t val, size_t index)
|
|
|
|
{
|
|
|
|
return val & (1 << index);
|
|
|
|
}
|
|
|
|
|
2022-06-06 20:53:10 +02:00
|
|
|
/**
|
|
|
|
* Extract a bit range from a byte.
|
|
|
|
*
|
|
|
|
* Both offsets are inclusive, start from zero, and high must be greater than low.
|
|
|
|
*/
|
|
|
|
static uint8_t
|
|
|
|
get_bit_range(uint8_t val, size_t high, size_t low)
|
|
|
|
{
|
|
|
|
size_t n;
|
|
|
|
uint8_t bitmask;
|
|
|
|
|
|
|
|
assert(high <= 7 && high >= low);
|
|
|
|
|
|
|
|
n = high - low + 1;
|
|
|
|
bitmask = (uint8_t) ((1 << n) - 1);
|
|
|
|
return (uint8_t) (val >> low) & bitmask;
|
|
|
|
}
|
|
|
|
|
2022-03-24 13:23:07 +01:00
|
|
|
static void
|
|
|
|
parse_version_revision(const uint8_t data[static EDID_BLOCK_SIZE],
|
|
|
|
int *version, int *revision)
|
|
|
|
{
|
2022-05-12 10:59:33 +02:00
|
|
|
*version = (int) data[0x12];
|
|
|
|
*revision = (int) data[0x13];
|
2022-03-24 13:23:07 +01:00
|
|
|
}
|
|
|
|
|
2022-05-25 17:32:25 +02:00
|
|
|
static size_t
|
|
|
|
parse_ext_count(const uint8_t data[static EDID_BLOCK_SIZE])
|
|
|
|
{
|
|
|
|
return data[0x7E];
|
|
|
|
}
|
|
|
|
|
2022-03-24 13:23:07 +01:00
|
|
|
static bool
|
|
|
|
validate_block_checksum(const uint8_t data[static EDID_BLOCK_SIZE])
|
|
|
|
{
|
|
|
|
uint8_t sum = 0;
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
for (i = 0; i < EDID_BLOCK_SIZE; i++) {
|
|
|
|
sum += data[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
return sum == 0;
|
|
|
|
}
|
|
|
|
|
2022-03-24 17:54:29 +01:00
|
|
|
static void
|
|
|
|
parse_vendor_product(const uint8_t data[static EDID_BLOCK_SIZE],
|
|
|
|
struct di_edid_vendor_product *out)
|
|
|
|
{
|
|
|
|
uint16_t man;
|
|
|
|
int year = 0;
|
|
|
|
|
|
|
|
/* The ASCII 3-letter manufacturer code is encoded in 5-bit codes. */
|
2022-05-12 10:59:33 +02:00
|
|
|
man = (uint16_t) ((data[0x08] << 8) | data[0x09]);
|
2022-03-24 17:54:29 +01:00
|
|
|
out->manufacturer[0] = ((man >> 10) & 0x1F) + '@';
|
|
|
|
out->manufacturer[1] = ((man >> 5) & 0x1F) + '@';
|
|
|
|
out->manufacturer[2] = ((man >> 0) & 0x1F) + '@';
|
|
|
|
|
2022-05-12 10:59:33 +02:00
|
|
|
out->product = (uint16_t) (data[0x0A] | (data[0x0B] << 8));
|
|
|
|
out->serial = (uint32_t) (data[0x0C] |
|
|
|
|
(data[0x0D] << 8) |
|
|
|
|
(data[0x0E] << 16) |
|
|
|
|
(data[0x0F] << 24));
|
2022-03-24 17:54:29 +01:00
|
|
|
|
2022-05-12 10:59:33 +02:00
|
|
|
if (data[0x11] >= 0x10) {
|
|
|
|
year = data[0x11] + 1990;
|
2022-03-24 17:54:29 +01:00
|
|
|
}
|
|
|
|
|
2022-05-12 10:59:33 +02:00
|
|
|
if (data[0x10] == 0xFF) {
|
2022-03-24 17:54:29 +01:00
|
|
|
/* Special flag for model year */
|
|
|
|
out->model_year = year;
|
|
|
|
} else {
|
|
|
|
out->manufacture_year = year;
|
2022-05-12 10:59:33 +02:00
|
|
|
if (data[0x10] > 0 && data[0x10] <= 54) {
|
|
|
|
out->manufacture_week = data[0x10];
|
2022-03-24 17:54:29 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-10 12:20:55 +02:00
|
|
|
static bool
|
2022-05-10 12:53:52 +02:00
|
|
|
parse_video_input_digital(struct di_edid *edid, uint8_t video_input)
|
2022-05-10 12:20:55 +02:00
|
|
|
{
|
2022-05-10 12:53:52 +02:00
|
|
|
uint8_t color_bit_depth, interface;
|
2022-05-10 12:20:55 +02:00
|
|
|
struct di_edid_video_input_digital *digital = &edid->video_input_digital;
|
|
|
|
|
2022-05-10 12:53:52 +02:00
|
|
|
if (edid->revision < 4) {
|
2022-05-10 12:20:55 +02:00
|
|
|
/* TODO: parse EDID 1.3- fields */
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
color_bit_depth = get_bit_range(video_input, 6, 4);
|
|
|
|
if (color_bit_depth == 0x07) {
|
|
|
|
/* Reserved */
|
|
|
|
if (edid->revision <= 4) {
|
|
|
|
errno = EINVAL;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} else if (color_bit_depth != 0) {
|
|
|
|
digital->color_bit_depth = 2 * color_bit_depth + 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface = get_bit_range(video_input, 3, 0);
|
|
|
|
switch (interface) {
|
|
|
|
case DI_EDID_VIDEO_INPUT_DIGITAL_UNDEFINED:
|
|
|
|
case DI_EDID_VIDEO_INPUT_DIGITAL_DVI:
|
|
|
|
case DI_EDID_VIDEO_INPUT_DIGITAL_HDMI_A:
|
|
|
|
case DI_EDID_VIDEO_INPUT_DIGITAL_HDMI_B:
|
|
|
|
case DI_EDID_VIDEO_INPUT_DIGITAL_MDDI:
|
|
|
|
case DI_EDID_VIDEO_INPUT_DIGITAL_DISPLAYPORT:
|
|
|
|
digital->interface = interface;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* Reserved */
|
|
|
|
if (edid->revision <= 4) {
|
|
|
|
errno = EINVAL;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
digital->interface = DI_EDID_VIDEO_INPUT_DIGITAL_UNDEFINED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2022-05-10 12:53:52 +02:00
|
|
|
static bool
|
|
|
|
parse_basic_params_features(struct di_edid *edid,
|
|
|
|
const uint8_t data[static EDID_BLOCK_SIZE])
|
|
|
|
{
|
2022-05-12 11:30:54 +02:00
|
|
|
uint8_t video_input, width, height, features;
|
2022-05-10 12:53:52 +02:00
|
|
|
struct di_edid_screen_size *screen_size = &edid->screen_size;
|
|
|
|
|
|
|
|
video_input = data[0x14];
|
|
|
|
edid->is_digital = has_bit(video_input, 7);
|
|
|
|
|
|
|
|
/* TODO: parse analog fields */
|
|
|
|
if (edid->is_digital) {
|
|
|
|
if (!parse_video_input_digital(edid, video_input)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* v1.3 says screen size is undefined if either byte is zero, v1.4 says
|
|
|
|
* screen size and aspect ratio are undefined if both bytes are zero and
|
|
|
|
* encodes the aspect ratio if either byte is zero. */
|
|
|
|
width = data[0x15];
|
|
|
|
height = data[0x16];
|
|
|
|
if (width > 0 && height > 0) {
|
|
|
|
screen_size->width_cm = width;
|
|
|
|
screen_size->height_cm = height;
|
|
|
|
} else if (edid->revision >= 4) {
|
|
|
|
if (width > 0) {
|
|
|
|
screen_size->landscape_aspect_ratio = ((float) width + 99) / 100;
|
|
|
|
} else if (height > 0) {
|
|
|
|
screen_size->portait_aspect_ratio = ((float) height + 99) / 100;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-12 11:15:26 +02:00
|
|
|
if (data[0x17] != 0xFF) {
|
|
|
|
edid->gamma = ((float) data[0x17] + 100) / 100;
|
|
|
|
} else {
|
|
|
|
edid->gamma = 0;
|
|
|
|
}
|
|
|
|
|
2022-05-12 11:30:54 +02:00
|
|
|
features = data[0x18];
|
|
|
|
|
|
|
|
edid->dpms.standby = has_bit(features, 7);
|
|
|
|
edid->dpms.suspend = has_bit(features, 6);
|
|
|
|
edid->dpms.off = has_bit(features, 5);
|
|
|
|
|
2022-05-13 10:07:13 +02:00
|
|
|
if (edid->is_digital && edid->revision >= 4) {
|
|
|
|
edid->color_encoding_formats.rgb444 = true;
|
|
|
|
edid->color_encoding_formats.ycrcb444 = has_bit(features, 3);
|
|
|
|
edid->color_encoding_formats.ycrcb422 = has_bit(features, 4);
|
|
|
|
}
|
|
|
|
|
2022-05-13 10:42:59 +02:00
|
|
|
if (edid->revision >= 4) {
|
|
|
|
edid->misc_features.has_preferred_timing = true;
|
|
|
|
edid->misc_features.continuous_freq = has_bit(features, 0);
|
|
|
|
edid->misc_features.preferred_timing_is_native = has_bit(features, 1);
|
|
|
|
} else {
|
|
|
|
edid->misc_features.default_gtf = has_bit(features, 0);
|
|
|
|
edid->misc_features.has_preferred_timing = has_bit(features, 1);
|
|
|
|
}
|
|
|
|
edid->misc_features.srgb_is_primary = has_bit(features, 2);
|
|
|
|
|
2022-05-10 12:53:52 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2022-05-24 09:05:14 +02:00
|
|
|
static bool
|
|
|
|
parse_byte_descriptor(struct di_edid *edid,
|
|
|
|
const uint8_t data[static EDID_BYTE_DESCRIPTOR_SIZE])
|
|
|
|
{
|
|
|
|
struct di_edid_display_descriptor *desc;
|
|
|
|
uint8_t tag;
|
2022-05-24 09:38:40 +02:00
|
|
|
char *newline;
|
2022-05-24 09:05:14 +02:00
|
|
|
|
|
|
|
if (data[0] || data[1]) {
|
|
|
|
if (edid->display_descriptors_len > 0) {
|
|
|
|
/* A detailed timing descriptor is not allowed after a
|
|
|
|
* display descriptor per note 3 of table 3.20. */
|
|
|
|
errno = EINVAL;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* TODO: parse detailed timing descriptor */
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* TODO: check we got at least one detailed timing descriptor, per note
|
|
|
|
* 4 of table 3.20. */
|
|
|
|
|
|
|
|
desc = calloc(1, sizeof(*desc));
|
|
|
|
if (!desc) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
tag = data[3];
|
|
|
|
switch (tag) {
|
|
|
|
case DI_EDID_DISPLAY_DESCRIPTOR_PRODUCT_SERIAL:
|
|
|
|
case DI_EDID_DISPLAY_DESCRIPTOR_DATA_STRING:
|
|
|
|
case DI_EDID_DISPLAY_DESCRIPTOR_PRODUCT_NAME:
|
2022-05-24 09:38:40 +02:00
|
|
|
memcpy(desc->str, &data[5], 13);
|
|
|
|
|
|
|
|
/* A newline (if any) indicates the end of the string. */
|
|
|
|
newline = strchr(desc->str, '\n');
|
|
|
|
if (newline) {
|
|
|
|
newline[0] = '\0';
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DI_EDID_DISPLAY_DESCRIPTOR_RANGE_LIMITS:
|
2022-05-24 09:05:14 +02:00
|
|
|
case DI_EDID_DISPLAY_DESCRIPTOR_COLOR_POINT:
|
|
|
|
case DI_EDID_DISPLAY_DESCRIPTOR_STD_TIMING_IDS:
|
|
|
|
case DI_EDID_DISPLAY_DESCRIPTOR_DCM_DATA:
|
|
|
|
case DI_EDID_DISPLAY_DESCRIPTOR_CVT_TIMING_CODES:
|
|
|
|
case DI_EDID_DISPLAY_DESCRIPTOR_ESTABLISHED_TIMINGS_III:
|
|
|
|
case DI_EDID_DISPLAY_DESCRIPTOR_DUMMY:
|
|
|
|
break; /* Ignore */
|
|
|
|
default:
|
|
|
|
free(desc);
|
|
|
|
if (tag <= 0x0F) {
|
|
|
|
/* Manufacturer-specific */
|
|
|
|
errno = ENOTSUP;
|
|
|
|
} else {
|
|
|
|
/* Reserved */
|
|
|
|
if (edid->revision > 4) {
|
|
|
|
errno = ENOTSUP;
|
|
|
|
} else {
|
|
|
|
errno = EINVAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
desc->tag = tag;
|
|
|
|
edid->display_descriptors[edid->display_descriptors_len++] = desc;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2022-05-24 18:09:43 +02:00
|
|
|
static bool
|
|
|
|
parse_ext(struct di_edid *edid, const uint8_t data[static EDID_BLOCK_SIZE])
|
2022-05-03 10:35:25 +02:00
|
|
|
{
|
|
|
|
struct di_edid_ext *ext;
|
2022-05-24 18:09:43 +02:00
|
|
|
uint8_t tag;
|
2022-05-03 10:35:25 +02:00
|
|
|
|
|
|
|
if (!validate_block_checksum(data)) {
|
|
|
|
errno = EINVAL;
|
2022-05-24 18:09:43 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
tag = data[0x00];
|
|
|
|
switch (tag) {
|
|
|
|
case DI_EDID_EXT_CEA:
|
|
|
|
case DI_EDID_EXT_VTB:
|
|
|
|
case DI_EDID_EXT_DI:
|
|
|
|
case DI_EDID_EXT_LS:
|
|
|
|
case DI_EDID_EXT_DPVL:
|
|
|
|
case DI_EDID_EXT_BLOCK_MAP:
|
|
|
|
case DI_EDID_EXT_VENDOR:
|
|
|
|
/* Supported */
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* Unsupported */
|
|
|
|
errno = ENOTSUP;
|
|
|
|
return false;
|
2022-05-03 10:35:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ext = calloc(1, sizeof(*ext));
|
|
|
|
if (!ext) {
|
2022-05-24 18:09:43 +02:00
|
|
|
return false;
|
2022-05-03 10:35:25 +02:00
|
|
|
}
|
2022-05-24 18:09:43 +02:00
|
|
|
ext->tag = tag;
|
|
|
|
edid->exts[edid->exts_len++] = ext;
|
2022-05-03 10:35:25 +02:00
|
|
|
|
2022-05-24 18:09:43 +02:00
|
|
|
return true;
|
2022-05-03 10:35:25 +02:00
|
|
|
}
|
|
|
|
|
2022-03-24 13:23:07 +01:00
|
|
|
struct di_edid *
|
|
|
|
di_edid_parse(const void *data, size_t size)
|
|
|
|
{
|
|
|
|
struct di_edid *edid;
|
|
|
|
int version, revision;
|
2022-05-03 10:35:25 +02:00
|
|
|
size_t exts_len, i;
|
2022-05-24 09:05:14 +02:00
|
|
|
const uint8_t *byte_desc_data, *ext_data;
|
2022-03-24 13:23:07 +01:00
|
|
|
|
|
|
|
if (size < EDID_BLOCK_SIZE ||
|
2022-05-13 09:43:08 +02:00
|
|
|
size > EDID_MAX_BLOCK_COUNT * EDID_BLOCK_SIZE ||
|
|
|
|
size % EDID_BLOCK_SIZE != 0) {
|
2022-03-24 13:23:07 +01:00
|
|
|
errno = EINVAL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (memcmp(data, header, sizeof(header)) != 0) {
|
|
|
|
errno = EINVAL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
parse_version_revision(data, &version, &revision);
|
|
|
|
if (version != 1) {
|
|
|
|
/* Only EDID version 1 is supported -- as per section 2.1.7
|
|
|
|
* subsequent versions break the structure */
|
|
|
|
errno = ENOTSUP;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!validate_block_checksum(data)) {
|
|
|
|
errno = EINVAL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2022-05-25 17:32:25 +02:00
|
|
|
exts_len = size / EDID_BLOCK_SIZE - 1;
|
|
|
|
if (exts_len != parse_ext_count(data)) {
|
|
|
|
errno = -EINVAL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2022-03-24 13:23:07 +01:00
|
|
|
edid = calloc(1, sizeof(*edid));
|
|
|
|
if (!edid) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
edid->version = version;
|
|
|
|
edid->revision = revision;
|
|
|
|
|
2022-03-24 17:54:29 +01:00
|
|
|
parse_vendor_product(data, &edid->vendor_product);
|
|
|
|
|
2022-05-10 12:20:55 +02:00
|
|
|
if (!parse_basic_params_features(edid, data)) {
|
|
|
|
di_edid_destroy(edid);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2022-05-24 09:05:14 +02:00
|
|
|
for (i = 0; i < EDID_BYTE_DESCRIPTOR_COUNT; i++) {
|
|
|
|
byte_desc_data = (const uint8_t *) data
|
|
|
|
+ 0x36 + i * EDID_BYTE_DESCRIPTOR_SIZE;
|
|
|
|
if (!parse_byte_descriptor(edid, byte_desc_data)
|
|
|
|
&& errno != ENOTSUP) {
|
|
|
|
di_edid_destroy(edid);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-03 10:35:25 +02:00
|
|
|
for (i = 0; i < exts_len; i++) {
|
|
|
|
ext_data = (const uint8_t *) data + (i + 1) * EDID_BLOCK_SIZE;
|
2022-05-24 18:09:43 +02:00
|
|
|
if (!parse_ext(edid, ext_data) && errno != ENOTSUP) {
|
2022-05-03 10:35:25 +02:00
|
|
|
di_edid_destroy(edid);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-24 13:23:07 +01:00
|
|
|
return edid;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
di_edid_destroy(struct di_edid *edid)
|
|
|
|
{
|
2022-05-03 10:35:25 +02:00
|
|
|
size_t i;
|
|
|
|
|
2022-05-24 09:05:14 +02:00
|
|
|
for (i = 0; i < edid->display_descriptors_len; i++) {
|
|
|
|
free(edid->display_descriptors[i]);
|
|
|
|
}
|
|
|
|
|
2022-05-03 10:35:25 +02:00
|
|
|
for (i = 0; edid->exts[i] != NULL; i++) {
|
|
|
|
free(edid->exts[i]);
|
|
|
|
}
|
|
|
|
|
2022-03-24 13:23:07 +01:00
|
|
|
free(edid);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
di_edid_get_version(const struct di_edid *edid)
|
|
|
|
{
|
|
|
|
return edid->version;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
di_edid_get_revision(const struct di_edid *edid)
|
|
|
|
{
|
|
|
|
return edid->revision;
|
|
|
|
}
|
2022-03-24 17:54:29 +01:00
|
|
|
|
|
|
|
const struct di_edid_vendor_product *
|
|
|
|
di_edid_get_vendor_product(const struct di_edid *edid)
|
|
|
|
{
|
|
|
|
return &edid->vendor_product;
|
|
|
|
}
|
2022-05-03 10:35:25 +02:00
|
|
|
|
2022-05-10 12:20:55 +02:00
|
|
|
const struct di_edid_video_input_digital *
|
|
|
|
di_edid_get_video_input_digital(const struct di_edid *edid)
|
|
|
|
{
|
|
|
|
return edid->is_digital ? &edid->video_input_digital : NULL;
|
|
|
|
}
|
|
|
|
|
2022-05-10 12:53:52 +02:00
|
|
|
const struct di_edid_screen_size *
|
|
|
|
di_edid_get_screen_size(const struct di_edid *edid)
|
|
|
|
{
|
|
|
|
return &edid->screen_size;
|
|
|
|
}
|
|
|
|
|
2022-05-12 11:15:26 +02:00
|
|
|
float
|
|
|
|
di_edid_get_basic_gamma(const struct di_edid *edid)
|
|
|
|
{
|
|
|
|
return edid->gamma;
|
|
|
|
}
|
|
|
|
|
2022-05-12 11:30:54 +02:00
|
|
|
const struct di_edid_dpms *
|
|
|
|
di_edid_get_dpms(const struct di_edid *edid)
|
|
|
|
{
|
|
|
|
return &edid->dpms;
|
|
|
|
}
|
|
|
|
|
2022-05-13 10:07:13 +02:00
|
|
|
const struct di_edid_color_encoding_formats *
|
|
|
|
di_edid_get_color_encoding_formats(const struct di_edid *edid)
|
|
|
|
{
|
|
|
|
/* If color encoding formats are specified, RGB 4:4:4 is always
|
|
|
|
* supported. */
|
|
|
|
return edid->color_encoding_formats.rgb444 ? &edid->color_encoding_formats : NULL;
|
|
|
|
}
|
|
|
|
|
2022-05-13 10:42:59 +02:00
|
|
|
const struct di_edid_misc_features *
|
|
|
|
di_edid_get_misc_features(const struct di_edid *edid)
|
|
|
|
{
|
|
|
|
return &edid->misc_features;
|
|
|
|
}
|
|
|
|
|
2022-05-24 09:05:14 +02:00
|
|
|
const struct di_edid_display_descriptor *const *
|
|
|
|
di_edid_get_display_descriptors(const struct di_edid *edid)
|
|
|
|
{
|
|
|
|
return (const struct di_edid_display_descriptor *const *) &edid->display_descriptors;
|
|
|
|
}
|
|
|
|
|
|
|
|
enum di_edid_display_descriptor_tag
|
|
|
|
di_edid_display_descriptor_get_tag(const struct di_edid_display_descriptor *desc)
|
|
|
|
{
|
|
|
|
return desc->tag;
|
|
|
|
}
|
|
|
|
|
2022-05-24 09:38:40 +02:00
|
|
|
const char *
|
|
|
|
di_edid_display_descriptor_get_string(const struct di_edid_display_descriptor *desc)
|
|
|
|
{
|
|
|
|
switch (desc->tag) {
|
|
|
|
case DI_EDID_DISPLAY_DESCRIPTOR_PRODUCT_SERIAL:
|
|
|
|
case DI_EDID_DISPLAY_DESCRIPTOR_DATA_STRING:
|
|
|
|
case DI_EDID_DISPLAY_DESCRIPTOR_PRODUCT_NAME:
|
|
|
|
return desc->str;
|
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-03 10:35:25 +02:00
|
|
|
const struct di_edid_ext *const *
|
|
|
|
di_edid_get_extensions(const struct di_edid *edid)
|
|
|
|
{
|
|
|
|
return (const struct di_edid_ext *const *) edid->exts;
|
|
|
|
}
|
|
|
|
|
|
|
|
enum di_edid_ext_tag
|
|
|
|
di_edid_ext_get_tag(const struct di_edid_ext *ext)
|
|
|
|
{
|
|
|
|
return ext->tag;
|
|
|
|
}
|