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>
|
2022-06-22 15:29:53 +02:00
|
|
|
#include <stdio.h>
|
2022-03-24 13:23:07 +01:00
|
|
|
|
|
|
|
#include <libdisplay-info/edid.h>
|
|
|
|
|
2022-06-11 11:38:49 +02:00
|
|
|
#include "cta.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-06-20 16:41:09 +02:00
|
|
|
/**
|
|
|
|
* The maximum number of EDID standard timings, defined in section 3.9.
|
|
|
|
*/
|
|
|
|
#define EDID_MAX_STANDARD_TIMING_COUNT 8
|
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-08-02 18:56:02 +02:00
|
|
|
/**
|
|
|
|
* The size of an EDID byte descriptor, defined in section 3.10.
|
|
|
|
*/
|
|
|
|
#define EDID_BYTE_DESCRIPTOR_SIZE 18
|
2022-08-15 18:54:22 +02:00
|
|
|
/**
|
|
|
|
* The maximum number of standard timings in an EDID display descriptor, defined
|
|
|
|
* in section 3.10.3.6.
|
|
|
|
*/
|
|
|
|
#define EDID_MAX_DESCRIPTOR_STANDARD_TIMING_COUNT 6
|
2022-05-25 18:47:02 +02:00
|
|
|
|
2022-08-17 00:47:08 +02:00
|
|
|
struct di_edid_detailed_timing_def_priv {
|
|
|
|
struct di_edid_detailed_timing_def base;
|
|
|
|
struct di_edid_detailed_timing_analog_composite analog_composite;
|
|
|
|
struct di_edid_detailed_timing_bipolar_analog_composite bipolar_analog_composite;
|
|
|
|
struct di_edid_detailed_timing_digital_composite digital_composite;
|
|
|
|
struct di_edid_detailed_timing_digital_separate digital_separate;
|
|
|
|
};
|
|
|
|
|
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;
|
2022-08-03 11:40:37 +02:00
|
|
|
struct di_edid_video_input_analog video_input_analog;
|
2022-05-10 12:20:55 +02:00
|
|
|
struct di_edid_video_input_digital video_input_digital;
|
2022-05-10 12:53:52 +02:00
|
|
|
struct di_edid_screen_size screen_size;
|
2022-05-12 11:15:26 +02:00
|
|
|
float gamma;
|
2022-05-12 11:30:54 +02:00
|
|
|
struct di_edid_dpms dpms;
|
2022-06-17 13:35:24 +02:00
|
|
|
enum di_edid_display_color_type display_color_type;
|
2022-05-13 10:07:13 +02:00
|
|
|
struct di_edid_color_encoding_formats color_encoding_formats;
|
2022-05-13 10:42:59 +02:00
|
|
|
struct di_edid_misc_features misc_features;
|
2022-05-10 12:20:55 +02:00
|
|
|
|
2022-06-06 12:03:15 +02:00
|
|
|
struct di_edid_chromaticity_coords chromaticity_coords;
|
2022-08-02 17:42:57 +02:00
|
|
|
struct di_edid_established_timings_i_ii established_timings_i_ii;
|
2022-06-06 12:03:15 +02:00
|
|
|
|
2022-06-20 16:41:09 +02:00
|
|
|
/* NULL-terminated */
|
|
|
|
struct di_edid_standard_timing *standard_timings[EDID_MAX_STANDARD_TIMING_COUNT + 1];
|
|
|
|
size_t standard_timings_len;
|
|
|
|
|
2022-06-10 18:19:38 +02:00
|
|
|
/* NULL-terminated */
|
2022-08-17 00:47:08 +02:00
|
|
|
struct di_edid_detailed_timing_def_priv *detailed_timing_defs[EDID_BYTE_DESCRIPTOR_COUNT + 1];
|
2022-06-10 18:19:38 +02:00
|
|
|
size_t detailed_timing_defs_len;
|
|
|
|
|
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-06-22 15:29:53 +02:00
|
|
|
|
2022-08-02 12:18:19 +02:00
|
|
|
struct di_logger *logger;
|
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-06-06 23:54:06 +02:00
|
|
|
/* Used for RANGE_LIMITS */
|
|
|
|
struct di_edid_display_range_limits range_limits;
|
2022-08-15 18:54:22 +02:00
|
|
|
/* Used for STD_TIMING_IDS, NULL-terminated */
|
|
|
|
struct di_edid_standard_timing *standard_timings[EDID_MAX_DESCRIPTOR_STANDARD_TIMING_COUNT + 1];
|
|
|
|
size_t standard_timings_len;
|
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-06-11 11:38:49 +02:00
|
|
|
/* Used for DI_EDID_EXT_CEA */
|
|
|
|
struct di_edid_cta cta;
|
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 *
|
2022-08-02 12:18:19 +02:00
|
|
|
_di_edid_parse(const void *data, size_t size, FILE *failure_msg_file);
|
2022-03-24 13:23:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Destroy an EDID data structure.
|
|
|
|
*/
|
|
|
|
void
|
2022-06-09 14:45:47 +02:00
|
|
|
_di_edid_destroy(struct di_edid *edid);
|
2022-03-24 13:23:07 +01:00
|
|
|
|
2022-08-02 18:56:02 +02:00
|
|
|
/**
|
|
|
|
* Parse an EDID detailed timing definition.
|
|
|
|
*/
|
2022-08-17 00:47:08 +02:00
|
|
|
struct di_edid_detailed_timing_def_priv *
|
2022-08-02 18:56:02 +02:00
|
|
|
_di_edid_parse_detailed_timing_def(const uint8_t data[static EDID_BYTE_DESCRIPTOR_SIZE]);
|
|
|
|
|
2022-03-24 13:23:07 +01:00
|
|
|
#endif
|