2022-08-31 12:16:36 +02:00
|
|
|
#ifndef DISPLAYID_H
|
|
|
|
#define DISPLAYID_H
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Private header for the low-level DisplayID API.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include <libdisplay-info/displayid.h>
|
|
|
|
|
|
|
|
#include "log.h"
|
|
|
|
|
2022-09-02 12:48:35 +02:00
|
|
|
/**
|
|
|
|
* The maximum number of data blocks in a DisplayID section.
|
|
|
|
*
|
|
|
|
* A DisplayID section has a payload size of 251 bytes, and each data block has
|
|
|
|
* a minimum size of 3 bytes.
|
|
|
|
*/
|
|
|
|
#define DISPLAYID_MAX_DATA_BLOCKS 83
|
2022-09-27 09:46:42 +02:00
|
|
|
/**
|
|
|
|
* The maximum number of type I timings in a data block.
|
|
|
|
*
|
|
|
|
* A DisplayID data block has a maximum payload size of 248 bytes, and each type
|
|
|
|
* I timing takes up 20 bytes.
|
|
|
|
*/
|
|
|
|
#define DISPLAYID_MAX_TYPE_I_TIMINGS 12
|
2023-01-17 23:36:25 +01:00
|
|
|
/**
|
|
|
|
* The maximum number of type II timings in a data block.
|
|
|
|
*
|
|
|
|
* A DisplayID data block has a maximum payload size of 248 bytes, and each type
|
|
|
|
* I timing takes up 11 bytes.
|
|
|
|
*/
|
|
|
|
#define DISPLAYID_MAX_TYPE_II_TIMINGS 22
|
2022-12-18 19:40:55 +01:00
|
|
|
/**
|
|
|
|
* The maxiumum number of type III timings in a data block.
|
|
|
|
*
|
|
|
|
* A DisplayID data block has a maximum payload size of 248 bytes, and each type
|
|
|
|
* III timing takes up 3 bytes.
|
|
|
|
*/
|
|
|
|
#define DISPLAYID_MAX_TYPE_III_TIMINGS 82
|
2022-09-02 12:48:35 +02:00
|
|
|
|
2022-08-31 12:16:36 +02:00
|
|
|
struct di_displayid {
|
|
|
|
int version, revision;
|
2022-09-02 09:03:34 +02:00
|
|
|
enum di_displayid_product_type product_type;
|
2022-09-02 09:35:50 +02:00
|
|
|
|
2022-09-02 12:48:35 +02:00
|
|
|
struct di_displayid_data_block *data_blocks[DISPLAYID_MAX_DATA_BLOCKS + 1];
|
|
|
|
size_t data_blocks_len;
|
|
|
|
|
2022-09-02 09:35:50 +02:00
|
|
|
struct di_logger *logger;
|
2022-08-31 12:16:36 +02:00
|
|
|
};
|
|
|
|
|
2022-09-29 17:06:24 +02:00
|
|
|
struct di_displayid_display_params_priv {
|
|
|
|
struct di_displayid_display_params base;
|
|
|
|
struct di_displayid_display_params_features features;
|
|
|
|
};
|
|
|
|
|
2022-10-04 15:38:48 +02:00
|
|
|
struct di_displayid_tiled_topo_priv {
|
|
|
|
struct di_displayid_tiled_topo base;
|
|
|
|
struct di_displayid_tiled_topo_caps caps;
|
|
|
|
struct di_displayid_tiled_topo_bezel bezel;
|
|
|
|
};
|
|
|
|
|
2022-09-02 12:48:35 +02:00
|
|
|
struct di_displayid_data_block {
|
|
|
|
enum di_displayid_data_block_tag tag;
|
2022-09-27 09:46:42 +02:00
|
|
|
|
|
|
|
/* Used for TYPE_I_TIMING, NULL-terminated */
|
2024-03-19 17:52:12 +01:00
|
|
|
struct di_displayid_type_i_ii_vii_timing *type_i_timings[DISPLAYID_MAX_TYPE_I_TIMINGS + 1];
|
2022-09-27 09:46:42 +02:00
|
|
|
size_t type_i_timings_len;
|
2022-09-29 17:06:24 +02:00
|
|
|
|
2023-01-17 23:36:25 +01:00
|
|
|
/* Used for TYPE_II_TIMING, NULL-terminated */
|
|
|
|
struct di_displayid_type_i_ii_vii_timing *type_ii_timings[DISPLAYID_MAX_TYPE_II_TIMINGS + 1];
|
|
|
|
size_t type_ii_timings_len;
|
|
|
|
|
2022-12-18 19:40:55 +01:00
|
|
|
/* Used for TYPE_III_TIMING, NULL-terminated */
|
|
|
|
struct di_displayid_type_iii_timing *type_iii_timings[DISPLAYID_MAX_TYPE_III_TIMINGS + 1];
|
|
|
|
size_t type_iii_timings_len;
|
|
|
|
|
2022-09-29 17:06:24 +02:00
|
|
|
/* Used for DISPLAY_PARAMS */
|
|
|
|
struct di_displayid_display_params_priv display_params;
|
2022-10-04 15:38:48 +02:00
|
|
|
|
|
|
|
/* Used for TILED_DISPLAY_TOPO */
|
|
|
|
struct di_displayid_tiled_topo_priv tiled_topo;
|
2022-09-02 12:48:35 +02:00
|
|
|
};
|
|
|
|
|
2022-08-31 12:16:36 +02:00
|
|
|
bool
|
|
|
|
_di_displayid_parse(struct di_displayid *displayid, const uint8_t *data,
|
|
|
|
size_t size, struct di_logger *logger);
|
|
|
|
|
2022-09-02 12:48:35 +02:00
|
|
|
void
|
|
|
|
_di_displayid_finish(struct di_displayid *displayid);
|
|
|
|
|
2023-01-17 01:49:50 +01:00
|
|
|
bool
|
2024-03-19 17:52:12 +01:00
|
|
|
_di_displayid_parse_type_1_7_timing(struct di_displayid_type_i_ii_vii_timing *timing,
|
2023-01-17 01:49:50 +01:00
|
|
|
struct di_logger *logger,
|
|
|
|
const char *prefix,
|
|
|
|
const uint8_t *data,
|
|
|
|
bool is_type7);
|
|
|
|
|
2022-08-31 12:16:36 +02:00
|
|
|
#endif
|