2022-06-11 11:38:49 +02:00
|
|
|
#ifndef CTA_H
|
|
|
|
#define CTA_H
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Private header for the low-level CTA API.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include <libdisplay-info/cta.h>
|
|
|
|
|
2022-08-02 18:56:55 +02:00
|
|
|
/**
|
|
|
|
* The maximum number of detailed timing definitions included in an EDID CTA
|
|
|
|
* block.
|
|
|
|
*
|
|
|
|
* The CTA extension leaves at most 122 bytes for timings, and each timing takes
|
|
|
|
* 18 bytes.
|
|
|
|
*/
|
|
|
|
#define EDID_CTA_MAX_DETAILED_TIMING_DEFS 6
|
2022-08-29 15:17:11 +02:00
|
|
|
/**
|
|
|
|
* The maximum number of SVD entries in a video data block.
|
|
|
|
*
|
|
|
|
* Each data block has its size described in a 5-bit field, so its maximum size
|
|
|
|
* is 63 bytes, and each SVD uses 1 byte.
|
|
|
|
*/
|
|
|
|
#define EDID_CTA_MAX_VIDEO_BLOCK_ENTRIES 63
|
2022-08-02 18:56:55 +02:00
|
|
|
|
2022-06-11 11:38:49 +02:00
|
|
|
struct di_edid_cta {
|
|
|
|
int revision;
|
2022-06-11 12:19:27 +02:00
|
|
|
struct di_edid_cta_flags flags;
|
2022-06-11 14:06:23 +02:00
|
|
|
|
|
|
|
/* NULL-terminated */
|
|
|
|
struct di_cta_data_block *data_blocks[128];
|
|
|
|
size_t data_blocks_len;
|
2022-08-02 12:48:33 +02:00
|
|
|
|
2022-08-02 18:56:55 +02:00
|
|
|
/* NULL-terminated */
|
2022-08-17 00:47:08 +02:00
|
|
|
struct di_edid_detailed_timing_def_priv *detailed_timing_defs[EDID_CTA_MAX_DETAILED_TIMING_DEFS + 1];
|
2022-08-02 18:56:55 +02:00
|
|
|
size_t detailed_timing_defs_len;
|
|
|
|
|
2022-08-02 12:48:33 +02:00
|
|
|
struct di_logger *logger;
|
2022-06-11 14:06:23 +02:00
|
|
|
};
|
|
|
|
|
2022-08-03 10:37:07 +02:00
|
|
|
struct di_cta_hdr_static_metadata_block_priv {
|
|
|
|
struct di_cta_hdr_static_metadata_block base;
|
|
|
|
struct di_cta_hdr_static_metadata_block_eotfs eotfs;
|
|
|
|
struct di_cta_hdr_static_metadata_block_descriptors descriptors;
|
|
|
|
};
|
|
|
|
|
2022-08-29 15:17:11 +02:00
|
|
|
struct di_cta_video_block {
|
|
|
|
/* NULL-terminated */
|
|
|
|
struct di_cta_svd *svds[EDID_CTA_MAX_VIDEO_BLOCK_ENTRIES + 1];
|
|
|
|
size_t svds_len;
|
|
|
|
};
|
|
|
|
|
2022-06-11 14:06:23 +02:00
|
|
|
struct di_cta_data_block {
|
|
|
|
enum di_cta_data_block_tag tag;
|
2022-07-27 17:51:53 +02:00
|
|
|
|
2022-08-29 15:17:11 +02:00
|
|
|
/* Used for DI_CTA_DATA_BLOCK_VIDEO */
|
|
|
|
struct di_cta_video_block video;
|
2022-09-01 13:43:22 +02:00
|
|
|
/* Used for DI_CTA_DATA_BLOCK_VIDEO_CAP */
|
|
|
|
struct di_cta_video_cap_block video_cap;
|
2022-07-27 17:51:53 +02:00
|
|
|
/* Used for DI_CTA_DATA_BLOCK_COLORIMETRY */
|
|
|
|
struct di_cta_colorimetry_block colorimetry;
|
2022-08-03 10:37:07 +02:00
|
|
|
/* Used for DI_CTA_DATA_BLOCK_HDR_STATIC_METADATA */
|
|
|
|
struct di_cta_hdr_static_metadata_block_priv hdr_static_metadata;
|
2022-06-11 11:38:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
bool
|
2022-08-02 12:48:33 +02:00
|
|
|
_di_edid_cta_parse(struct di_edid_cta *cta, const uint8_t *data, size_t size,
|
|
|
|
struct di_logger *logger);
|
2022-06-11 11:38:49 +02:00
|
|
|
|
2022-06-11 14:06:23 +02:00
|
|
|
void
|
|
|
|
_di_edid_cta_finish(struct di_edid_cta *cta);
|
|
|
|
|
2022-06-11 11:38:49 +02:00
|
|
|
#endif
|