2022-03-24 13:23:07 +01:00
|
|
|
#ifndef EDID_H
|
|
|
|
#define EDID_H
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Private header for the low-level EDID API.
|
|
|
|
*/
|
|
|
|
|
2022-05-10 12:20:55 +02:00
|
|
|
#include <stdbool.h>
|
2022-03-24 13:23:07 +01:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include <libdisplay-info/edid.h>
|
|
|
|
|
2022-05-25 18:47:02 +02:00
|
|
|
/**
|
|
|
|
* The maximum number of EDID blocks (including the base block), defined in
|
|
|
|
* section 2.2.1.
|
|
|
|
*/
|
|
|
|
#define EDID_MAX_BLOCK_COUNT 256
|
2022-05-24 09:05:14 +02:00
|
|
|
/**
|
|
|
|
* The number of EDID byte descriptors, defined in section 3.10.
|
|
|
|
*/
|
|
|
|
#define EDID_BYTE_DESCRIPTOR_COUNT 4
|
2022-05-25 18:47:02 +02:00
|
|
|
|
2022-03-24 13:23:07 +01:00
|
|
|
struct di_edid {
|
2022-03-24 17:54:29 +01:00
|
|
|
struct di_edid_vendor_product vendor_product;
|
2022-03-24 13:23:07 +01:00
|
|
|
int version, revision;
|
2022-05-10 12:20:55 +02:00
|
|
|
|
|
|
|
bool is_digital;
|
|
|
|
struct di_edid_video_input_digital video_input_digital;
|
|
|
|
|
2022-05-24 09:05:14 +02:00
|
|
|
/* NULL-terminated */
|
|
|
|
struct di_edid_display_descriptor *display_descriptors[EDID_BYTE_DESCRIPTOR_COUNT + 1];
|
|
|
|
size_t display_descriptors_len;
|
2022-05-10 12:20:55 +02:00
|
|
|
|
2022-05-03 10:35:25 +02:00
|
|
|
/* NULL-terminated, doesn't include the base block */
|
2022-05-25 18:47:02 +02:00
|
|
|
struct di_edid_ext *exts[EDID_MAX_BLOCK_COUNT];
|
2022-05-24 18:09:43 +02:00
|
|
|
size_t exts_len;
|
2022-05-03 10:35:25 +02:00
|
|
|
};
|
|
|
|
|
2022-05-24 09:05:14 +02:00
|
|
|
struct di_edid_display_descriptor {
|
|
|
|
enum di_edid_display_descriptor_tag tag;
|
2022-05-24 09:38:40 +02:00
|
|
|
/* Used for PRODUCT_SERIAL, DATA_STRING and PRODUCT_NAME,
|
|
|
|
* zero-terminated */
|
|
|
|
char str[14];
|
2022-05-24 09:05:14 +02:00
|
|
|
};
|
|
|
|
|
2022-05-03 10:35:25 +02:00
|
|
|
struct di_edid_ext {
|
|
|
|
enum di_edid_ext_tag tag;
|
2022-03-24 13:23:07 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create an EDID data structure.
|
|
|
|
*
|
|
|
|
* Callers do not need to keep the provided data pointer valid after calling
|
|
|
|
* this function. Callers should destroy the returned pointer via
|
|
|
|
* di_edid_destroy().
|
|
|
|
*/
|
|
|
|
struct di_edid *
|
|
|
|
di_edid_parse(const void *data, size_t size);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Destroy an EDID data structure.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
di_edid_destroy(struct di_edid *edid);
|
|
|
|
|
|
|
|
#endif
|