edid: Parse CTA-861 Colorimetry Data Block (CDB)
Parses the CTA-861 extensions data blocks to extract the supported colorimetry which can be set with the KMS connectors `Colorspace` property. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2351>
This commit is contained in:
parent
d76f9e6c4a
commit
80626edfea
@ -44,6 +44,7 @@
|
|||||||
#define EDID_EXT_CTA_DESCRIPTOR_OFFSET_ADDR 0x02
|
#define EDID_EXT_CTA_DESCRIPTOR_OFFSET_ADDR 0x02
|
||||||
#define EDID_EXT_CTA_DATA_BLOCK_OFFSET 0x04
|
#define EDID_EXT_CTA_DATA_BLOCK_OFFSET 0x04
|
||||||
#define EDID_EXT_CTA_TAG_EXTENDED 0x07
|
#define EDID_EXT_CTA_TAG_EXTENDED 0x07
|
||||||
|
#define EDID_EXT_CTA_TAG_EXTENDED_COLORIMETRY 0x0705
|
||||||
|
|
||||||
static int
|
static int
|
||||||
get_bit (int in, int bit)
|
get_bit (int in, int bit)
|
||||||
@ -554,6 +555,15 @@ decode_descriptors (const uint8_t *edid,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
decode_ext_cta_colorimetry (const uint8_t *data_block,
|
||||||
|
MetaEdidInfo *info)
|
||||||
|
{
|
||||||
|
/* CTA-861-H: Table 78 - Colorimetry Data Block (CDB) */
|
||||||
|
info->colorimetry = (data_block[3] << 8) + data_block[2];
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
decode_ext_cta (const uint8_t *cta_block,
|
decode_ext_cta (const uint8_t *cta_block,
|
||||||
MetaEdidInfo *info)
|
MetaEdidInfo *info)
|
||||||
@ -600,6 +610,10 @@ decode_ext_cta (const uint8_t *cta_block,
|
|||||||
|
|
||||||
switch (tag)
|
switch (tag)
|
||||||
{
|
{
|
||||||
|
case EDID_EXT_CTA_TAG_EXTENDED_COLORIMETRY:
|
||||||
|
if (!decode_ext_cta_colorimetry (data_block, info))
|
||||||
|
return FALSE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +60,20 @@ typedef enum
|
|||||||
META_EDID_STEREO_TYPE_SIDE_BY_SIDE
|
META_EDID_STEREO_TYPE_SIDE_BY_SIDE
|
||||||
} MetaEdidStereoType;
|
} MetaEdidStereoType;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
META_EDID_COLORIMETRY_XVYCC601 = (1 << 0),
|
||||||
|
META_EDID_COLORIMETRY_XVYCC709 = (1 << 1),
|
||||||
|
META_EDID_COLORIMETRY_SYCC601 = (1 << 2),
|
||||||
|
META_EDID_COLORIMETRY_OPYCC601 = (1 << 3),
|
||||||
|
META_EDID_COLORIMETRY_OPRGB = (1 << 4),
|
||||||
|
META_EDID_COLORIMETRY_BT2020CYCC = (1 << 5),
|
||||||
|
META_EDID_COLORIMETRY_BT2020YCC = (1 << 6),
|
||||||
|
META_EDID_COLORIMETRY_BT2020RGB = (1 << 7),
|
||||||
|
META_EDID_COLORIMETRY_ST2113RGB = (1 << 14),
|
||||||
|
META_EDID_COLORIMETRY_ICTCP = (1 << 15),
|
||||||
|
} MetaEdidColorimetry;
|
||||||
|
|
||||||
struct _MetaEdidTiming
|
struct _MetaEdidTiming
|
||||||
{
|
{
|
||||||
int width;
|
int width;
|
||||||
@ -187,6 +201,8 @@ struct _MetaEdidInfo
|
|||||||
char dsc_serial_number[14];
|
char dsc_serial_number[14];
|
||||||
char dsc_product_name[14];
|
char dsc_product_name[14];
|
||||||
char dsc_string[14]; /* Unspecified ASCII data */
|
char dsc_string[14]; /* Unspecified ASCII data */
|
||||||
|
|
||||||
|
MetaEdidColorimetry colorimetry;
|
||||||
};
|
};
|
||||||
|
|
||||||
MetaEdidInfo *meta_edid_info_new_parse (const uint8_t *data);
|
MetaEdidInfo *meta_edid_info_new_parse (const uint8_t *data);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user