From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
To: igt-dev@lists.freedesktop.org, uma.shankar@intel.com
Subject: [igt-dev] [PATCH i-g-t 1/3] tests/kms_color_helper: Read deep-color capability from EDID
Date: Mon, 24 Jan 2022 16:53:50 +0530 [thread overview]
Message-ID: <20220124112352.1970255-2-bhanuprakash.modem@intel.com> (raw)
In-Reply-To: <20220124112352.1970255-1-bhanuprakash.modem@intel.com>
Add a helper function to read the panel's deep-color capability
from EDID.
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@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
lib/igt_edid.c | 16 ++++++++++++++++
lib/igt_edid.h | 1 +
tests/kms_color_helper.c | 30 ++++++++++++++++++++++++++++++
tests/kms_color_helper.h | 3 +++
4 files changed, 50 insertions(+)
diff --git a/lib/igt_edid.c b/lib/igt_edid.c
index df346c4c8c..6864896977 100644
--- a/lib/igt_edid.c
+++ b/lib/igt_edid.c
@@ -349,6 +349,22 @@ size_t edid_get_size(const struct edid *edid)
edid->extensions_len * sizeof(struct edid_ext);
}
+/**
+ * edid_get_bit_depth: return the Color Bit Depth if Input is a Digital Video
+ * Signal Interface, else return zero.
+ */
+uint8_t edid_get_bit_depth(const struct edid *edid)
+{
+ /*
+ * Video Signal Interface: Bit 7 (1:Digital, 0:Analog)
+ * Color Bit Depth: Bits 6 → 4
+ */
+ if (!(edid->input & (1 << 7)))
+ return 0;
+
+ return ((edid->input & (7 << 4)) >> 4);
+}
+
/**
* cea_sad_init_pcm:
* @channels: the number of supported channels (max. 8)
diff --git a/lib/igt_edid.h b/lib/igt_edid.h
index aac2f4a208..bb328b5a89 100644
--- a/lib/igt_edid.h
+++ b/lib/igt_edid.h
@@ -377,6 +377,7 @@ void edid_update_checksum(struct edid *edid);
void base_edid_update_checksum(struct edid *edid);
size_t edid_get_size(const struct edid *edid);
void edid_get_mfg(const struct edid *edid, char out[static 3]);
+uint8_t edid_get_bit_depth(const struct edid *edid);
void detailed_timing_set_mode(struct detailed_timing *dt, drmModeModeInfo *mode,
int width_mm, int height_mm);
void detailed_timing_set_monitor_range_mode(struct detailed_timing *dt,
diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c
index d71e7bb2e6..1adb4644c5 100644
--- a/tests/kms_color_helper.c
+++ b/tests/kms_color_helper.c
@@ -24,6 +24,36 @@
#include "kms_color_helper.h"
+bool
+is_panel_supports_deep_color(int fd, drmModeConnector *connector)
+{
+ uint64_t edid_blob_id;
+ uint8_t bit_depth;
+ drmModePropertyBlobPtr edid_blob = NULL;
+
+ igt_assert(kmstest_get_property(fd, connector->connector_id,
+ DRM_MODE_OBJECT_CONNECTOR, "EDID", NULL,
+ &edid_blob_id, NULL));
+ edid_blob = drmModeGetPropertyBlob(fd, edid_blob_id);
+ igt_require_f(edid_blob, "EDID blob is NULL\n");
+
+ bit_depth = edid_get_bit_depth((const struct edid *) edid_blob->data);
+ drmModeFreePropertyBlob(edid_blob);
+
+ if (bit_depth > 0 && bit_depth < 7)
+ igt_info("Max supported bit depth: %d\n", ((bit_depth << 1) + 4));
+ else
+ igt_info("Max supported bit depth: Undefined\n");
+
+ return (bit_depth >= 3);
+}
+
+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
next prev parent reply other threads:[~2022-01-24 11:27 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-24 11:23 [igt-dev] [PATCH i-g-t 0/3] New subtests for deep color Bhanuprakash Modem
2022-01-24 11:23 ` Bhanuprakash Modem [this message]
2022-01-26 13:15 ` [igt-dev] [v2 i-g-t 1/3] tests/kms_color_helper: Read deep-color capability from EDID Bhanuprakash Modem
2022-01-27 6:44 ` [igt-dev] [v3 " Bhanuprakash Modem
2022-02-01 9:05 ` [igt-dev] [v4 " Bhanuprakash Modem
2022-02-08 4:11 ` [igt-dev] [v5 " Bhanuprakash Modem
2022-02-17 15:54 ` [igt-dev] [v6 " Bhanuprakash Modem
2022-02-18 9:49 ` Petri Latvala
2022-03-16 5:53 ` Shankar, Uma
2022-01-24 11:23 ` [igt-dev] [PATCH i-g-t 2/3] tests/kms_color: Add support for Deep-Color Bhanuprakash Modem
2022-01-26 13:15 ` [igt-dev] [v2 " Bhanuprakash Modem
2022-02-08 4:12 ` [igt-dev] [v3 " Bhanuprakash Modem
2022-02-17 15:54 ` [igt-dev] [v4 " Bhanuprakash Modem
2022-03-16 5:59 ` Shankar, Uma
2022-01-24 11:23 ` [igt-dev] [PATCH i-g-t 3/3] HAX: Add deep-color tests to BAT Bhanuprakash Modem
2022-01-26 13:15 ` [igt-dev] [v2 " Bhanuprakash Modem
2022-01-24 14:35 ` [igt-dev] ✓ Fi.CI.BAT: success for New subtests for deep color Patchwork
2022-01-24 17:36 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2022-01-26 13:15 ` [igt-dev] [v2 i-g-t 0/3] " Bhanuprakash Modem
2022-01-26 17:40 ` [igt-dev] ✗ Fi.CI.BAT: failure for New subtests for deep color (rev4) Patchwork
2022-01-27 4:54 ` Modem, Bhanuprakash
2022-01-27 4:58 ` Modem, Bhanuprakash
2022-01-27 7:32 ` [igt-dev] ✓ Fi.CI.BAT: success for New subtests for deep color (rev5) Patchwork
2022-01-27 10:37 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2022-01-30 20:47 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork
2022-02-01 12:41 ` [igt-dev] ✓ Fi.CI.BAT: success for New subtests for deep color (rev6) Patchwork
2022-02-01 16:55 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2022-02-08 4:42 ` [igt-dev] ✓ Fi.CI.BAT: success for New subtests for deep color (rev8) Patchwork
2022-02-08 6:27 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2022-02-17 17:04 ` [igt-dev] ✓ Fi.CI.BAT: success for New subtests for deep color (rev10) Patchwork
2022-02-18 3:04 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220124112352.1970255-2-bhanuprakash.modem@intel.com \
--to=bhanuprakash.modem@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=uma.shankar@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox