From: Swati Sharma <swati2.sharma@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Kunal Joshi <kunal1.joshi@intel.com>, petri.latvala@intel.com
Subject: [igt-dev] [PATCH 5/7] tests/kms_hdr: Add function to check HDR panel
Date: Tue, 4 Feb 2020 15:12:17 +0530 [thread overview]
Message-ID: <20200204094219.22544-6-swati2.sharma@intel.com> (raw)
In-Reply-To: <20200204094219.22544-1-swati2.sharma@intel.com>
EDID of connected panel needs to be parsed to detect whether
panel can drive hdr or not. Added new function is_panel_hdr(),
to know about hdr capabilities of panel. If panel supports hdr
then only tests will get executed else skipped.
v2: continue instead of break [Kunal]
Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
Suggested-by: Kunal Joshi <kunal1.joshi@intel.com>
Reviewed-by: Kunal Joshi <kunal1.joshi@intel.com>
---
tests/kms_hdr.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 87 insertions(+)
diff --git a/tests/kms_hdr.c b/tests/kms_hdr.c
index ce6575c5..3441c311 100644
--- a/tests/kms_hdr.c
+++ b/tests/kms_hdr.c
@@ -24,9 +24,22 @@
#include <fcntl.h>
#include <termios.h>
#include <unistd.h>
+#include "igt_edid.h"
IGT_TEST_DESCRIPTION("Test HDR metadata interfaces and bpc switch");
+/* HDR EDID parsing. */
+#define CTA_EXTENSION_VERSION 0x03
+#define HDR_STATIC_METADATA_BLOCK 0x06
+#define USE_EXTENDED_TAG 0x07
+
+/* DRM HDR definitions. Not in the UAPI header, unfortunately. */
+enum hdmi_eotf {
+ HDMI_EOTF_TRADITIONAL_GAMMA_SDR,
+ HDMI_EOTF_TRADITIONAL_GAMMA_HDR,
+ HDMI_EOTF_SMPTE_ST2084,
+};
+
/* Test flags. */
enum {
TEST_NONE = 1 << 0,
@@ -270,6 +283,80 @@ static void test_bpc_switch(data_t *data, uint32_t flags)
igt_require_f(valid_tests, "No connector found with MAX BPC connector property\n");
}
+static bool cta_block(const char *edid_ext)
+{
+ /*
+ * Byte 1: 0x07 indicates Extended Tag
+ * Byte 2: 0x06 indicates HDMI Static Metadata Block
+ * Byte 3: bits 0 to 5 identify EOTF functions supported by sink
+ * where ET_0: Traditional Gamma - SDR Luminance Range
+ * ET_1: Traditional Gamma - HDR Luminance Range
+ * ET_2: SMPTE ST 2084
+ * ET_3: Hybrid Log-Gamma (HLG)
+ * ET_4 to ET_5: Reserved for future use
+ */
+
+ if ((((edid_ext[0] & 0xe0) >> 5 == USE_EXTENDED_TAG) &&
+ (edid_ext[1] == HDR_STATIC_METADATA_BLOCK)) &&
+ ((edid_ext[2] & HDMI_EOTF_TRADITIONAL_GAMMA_HDR) ||
+ (edid_ext[2] & HDMI_EOTF_SMPTE_ST2084)))
+ return true;
+
+ return false;
+}
+
+/* Returns true if panel supports HDR. */
+static bool is_panel_hdr(data_t *data, igt_output_t *output)
+{
+ bool ok;
+ int i, j, offset;
+ uint64_t edid_blob_id;
+ drmModePropertyBlobRes *edid_blob;
+ const struct edid_ext *edid_ext;
+ const struct edid *edid;
+ const struct edid_cea *edid_cea;
+ const char *cea_data;
+ bool ret = false;
+
+ ok = kmstest_get_property(data->fd, output->id,
+ DRM_MODE_OBJECT_CONNECTOR, "EDID",
+ NULL, &edid_blob_id, NULL);
+
+ if (!ok || !edid_blob_id)
+ return ret;
+
+ edid_blob = drmModeGetPropertyBlob(data->fd, edid_blob_id);
+ igt_assert(edid_blob);
+
+ edid = (const struct edid *) edid_blob->data;
+ igt_assert(edid);
+
+ drmModeFreePropertyBlob(edid_blob);
+
+ for (i = 0; i < edid->extensions_len; i++) {
+ edid_ext = &edid->extensions[i];
+ edid_cea = &edid_ext->data.cea;
+
+ /* HDR not defined in CTA Extension Version < 3. */
+ if ((edid_ext->tag != EDID_EXT_CEA) ||
+ (edid_cea->revision != CTA_EXTENSION_VERSION))
+ continue;
+ else {
+ offset = edid_cea->dtd_start;
+ cea_data = edid_cea->data;
+
+ for (j = 0; j < offset; j += (cea_data[j] & 0x1f) + 1) {
+ ret = cta_block(cea_data + j);
+
+ if (ret)
+ break;
+ }
+ }
+ }
+
+ return ret;
+}
+
igt_main
{
data_t data = { 0 };
--
2.24.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2020-02-04 9:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-04 9:42 [igt-dev] [PATCH 0/7] Add tests for HDR metadata interfaces and bpc switch Swati Sharma
2020-02-04 9:42 ` [igt-dev] [PATCH 1/7] headers: Bump drm uapi headers Swati Sharma
2020-02-04 9:42 ` [igt-dev] [PATCH 2/7] lib/igt_kms: Add max bpc connector property Swati Sharma
2020-02-04 9:42 ` [igt-dev] [PATCH 3/7] lib/igt_kms: Add HDR_OUTPUT_METADATA " Swati Sharma
2020-02-04 9:42 ` [igt-dev] [PATCH 4/7] tests/kms_hdr: Add bpc switch subtests Swati Sharma
2020-02-04 9:42 ` Swati Sharma [this message]
2020-02-04 9:42 ` [igt-dev] [PATCH 6/7] tests/kms_hdr: Add static toggle SDR->HDR mode subtests Swati Sharma
2020-02-04 9:42 ` [igt-dev] [PATCH 7/7] tests/kms_hdr: Add subtest to swap static HDR metadata Swati Sharma
2020-02-04 14:56 ` [igt-dev] ✗ Fi.CI.BAT: failure for Add tests for HDR metadata interfaces and bpc switch (rev5) Patchwork
2020-02-05 12:00 ` Patchwork
2020-02-05 13:31 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2020-02-06 13:43 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2020-01-29 13:55 [igt-dev] [PATCH 0/7] Add tests for HDR metadata interfaces and bpc switch Swati Sharma
2020-01-29 13:55 ` [igt-dev] [PATCH 5/7] tests/kms_hdr: Add function to check HDR panel Swati Sharma
2020-01-29 15:02 ` Shankar, Uma
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=20200204094219.22544-6-swati2.sharma@intel.com \
--to=swati2.sharma@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kunal1.joshi@intel.com \
--cc=petri.latvala@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