[v5 i-g-t 1/3] tests/kms_color_helper: Read deep-color capability from EDID
Bhanuprakash Modem
bhanuprakash.modem at intel.com
Mon Jan 10 12:22:21 UTC 2022
Add a helper function to read the panel's deep-color capability
from EDID.
First search for Vendor Specific Data Block
-----------------------------------------------------------------
Bit field | Description
-----------------------------------------------------------------
Bit 7 | A function that needs info from ACP or ISRC packets
Bit 6 | 16-bit-per-channel deep color (48-bit)
Bit 5 | 12-bit-per-channel deep color (36-bit)
Bit 4 | 10-bit-per-channel deep color (30-bit)
Bit 3 | 4:4:4 in deep color modes
Bit 2 | Reserved, 0
Bit 1 | Reserved, 0
Bit 0 | DVI Dual Link Operation
-----------------------------------------------------------------
Then fallback to the Video Signal Interface if VSDB not found
https://glenwing.github.io/docs/VESA-EEDID-A2.pdf
(3.6.1 Video Input Definition: 1 Byte)
-----------------------------------------------------------------
| 7 | 6 5 4 3 2 1 0 | Video Signal Interface: Bit 7 |
|---|---------------|-------------------------------------------|
| 1 | x x x x x x x | Input is a Digital Video Signal Interface |
-----------------------------------------------------------------
-----------------------------------------------------
| 7 | 6 5 4 | 3 2 1 0 | Color Bit Depth: Bits 6 → 4 |
|---|-------|---------|-----------------------------|
| 1 | 0 0 0 | x x x x | Color Bit Depth is undefined|
| 1 | 0 0 1 | x x x x | 6 Bits per Primary Color |
| 1 | 0 1 0 | x x x x | 8 Bits per Primary Color |
| 1 | 0 1 1 | x x x x | 10 Bits per Primary Color |
| 1 | 1 0 0 | x x x x | 12 Bits per Primary Color |
| 1 | 1 0 1 | x x x x | 14 Bits per Primary Color |
| 1 | 1 1 0 | x x x x | 16 Bits per Primary Color |
| 1 | 1 1 1 | x x x x | Reserved (Do Not Use) |
|---|-------|---------|-----------------------------|
For deep-color we need atleast 10-bits.
Cc: Uma Shankar <uma.shankar at intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
tests/kms_color_helper.c | 92 ++++++++++++++++++++++++++++++++++++++++
tests/kms_color_helper.h | 3 ++
2 files changed, 95 insertions(+)
diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c
index d71e7bb2e6..9234b616ac 100644
--- a/tests/kms_color_helper.c
+++ b/tests/kms_color_helper.c
@@ -24,6 +24,98 @@
#include "kms_color_helper.h"
+bool
+is_panel_supports_deep_color(int fd, drmModeConnector *connector)
+{
+ uint64_t edid_blob_id;
+ const struct edid *edid;
+ uint8_t bit_depth;
+ struct edid_cea_data_block *vsdb;
+ uint8_t flags1 = 0;
+ int i;
+ drmModePropertyBlobPtr edid_blob = NULL;
+
+ igt_assert(kmstest_get_property(fd, connector->connector_id,
+ DRM_MODE_OBJECT_CONNECTOR, "EDID", NULL,
+ &edid_blob_id, NULL));
+ igt_assert(edid_blob = drmModeGetPropertyBlob(fd, edid_blob_id));
+
+ edid = (const struct edid *) edid_blob->data;
+
+ /* First search for Vendor Specific Data Block
+ * -----------------------------------------------------------------
+ * Bit field | Description
+ * -----------------------------------------------------------------
+ * Bit 7 | A function that needs info from ACP or ISRC packets
+ * Bit 6 | 16-bit-per-channel deep color (48-bit)
+ * Bit 5 | 12-bit-per-channel deep color (36-bit)
+ * Bit 4 | 10-bit-per-channel deep color (30-bit)
+ * Bit 3 | 4:4:4 in deep color modes
+ * Bit 2 | Reserved, 0
+ * Bit 1 | Reserved, 0
+ * Bit 0 | DVI Dual Link Operation
+ * -----------------------------------------------------------------
+ */
+ for (i = 0; i < edid->extensions_len; i++) {
+ vsdb = (struct edid_cea_data_block *) edid->extensions[0].data.cea.data;
+
+ if (vsdb->type_len != EDID_CEA_DATA_VENDOR_SPECIFIC)
+ continue;
+
+ flags1 = (vsdb->data.vsdbs[0].data.hdmi.flags1) & (7 << 6);
+ drmModeFreePropertyBlob(edid_blob);
+
+ if (flags1)
+ return true;
+ else
+ return false;
+ }
+
+ bit_depth = edid->input;
+ drmModeFreePropertyBlob(edid_blob);
+
+ /*
+ * If VSDB is not found then fallback to Video Signal Interface
+ *
+ * https://glenwing.github.io/docs/VESA-EEDID-A2.pdf
+ * (3.6.1 Video Input Definition: 1 Byte)
+ *
+ * -----------------------------------------------------------------
+ * | 7 | 6 5 4 3 2 1 0 | Video Signal Interface: Bit 7 |
+ * |---|---------------|-------------------------------------------|
+ * | 1 | x x x x x x x | Input is a Digital Video Signal Interface |
+ * -----------------------------------------------------------------
+ *
+ * -----------------------------------------------------
+ * | 7 | 6 5 4 | 3 2 1 0 | Color Bit Depth: Bits 6 → 4 |
+ * |---|-------|---------|-----------------------------|
+ * | 1 | 0 0 0 | x x x x | Color Bit Depth is undefined|
+ * | 1 | 0 0 1 | x x x x | 6 Bits per Primary Color |
+ * | 1 | 0 1 0 | x x x x | 8 Bits per Primary Color |
+ * | 1 | 0 1 1 | x x x x | 10 Bits per Primary Color |
+ * | 1 | 1 0 0 | x x x x | 12 Bits per Primary Color |
+ * | 1 | 1 0 1 | x x x x | 14 Bits per Primary Color |
+ * | 1 | 1 1 0 | x x x x | 16 Bits per Primary Color |
+ * | 1 | 1 1 1 | x x x x | Reserved (Do Not Use) |
+ * -----------------------------------------------------
+ *
+ * For deep-color we need atleast 10-bits.
+ */
+
+ if (!(bit_depth & (1 << 7)))
+ return false;
+ if (((bit_depth & (7 << 4)) >> 4) >= 3)
+ return true;
+
+ return false;
+}
+
+bool is_max_bpc_supported(igt_output_t *output)
+{
+ return igt_output_has_prop(output, IGT_CONNECTOR_MAX_BPC) &&
+ igt_output_get_prop(output, IGT_CONNECTOR_MAX_BPC);
+}
+
void paint_gradient_rectangles(data_t *data,
drmModeModeInfo *mode,
color_t *colors,
diff --git a/tests/kms_color_helper.h b/tests/kms_color_helper.h
index bb6f0054f3..992087ac9c 100644
--- a/tests/kms_color_helper.h
+++ b/tests/kms_color_helper.h
@@ -36,6 +36,7 @@
#include "drm.h"
#include "drmtest.h"
#include "igt.h"
+#include "igt_edid.h"
/* Internal */
@@ -64,6 +65,8 @@ typedef struct {
color_t coeffs[];
} gamma_lut_t;
+bool is_panel_supports_deep_color(int fd, drmModeConnector *connector);
+bool is_max_bpc_supported(igt_output_t *output);
void paint_gradient_rectangles(data_t *data,
drmModeModeInfo *mode,
color_t *colors,
--
2.32.0
More information about the Intel-gfx-trybot
mailing list