Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
To: igt-dev@lists.freedesktop.org, manasi.d.navare@intel.com
Subject: [igt-dev] [i-g-t 4/5] tests/kms_vrr: Add a test for VRR range capability
Date: Thu, 24 Feb 2022 10:46:47 +0530	[thread overview]
Message-ID: <20220224051648.91470-5-bhanuprakash.modem@intel.com> (raw)
In-Reply-To: <20220224051648.91470-1-bhanuprakash.modem@intel.com>

VRR range capability is parsed from EDID and reported to debugfs.
The new tests check if the parsing is correct by reading it from
EDID.

Cc: Manasi Navare <manasi.d.navare@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 tests/kms_vrr.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/tests/kms_vrr.c b/tests/kms_vrr.c
index 7deab77311..526c261436 100644
--- a/tests/kms_vrr.c
+++ b/tests/kms_vrr.c
@@ -24,6 +24,7 @@
 #include "sw_sync.h"
 #include <fcntl.h>
 #include <signal.h>
+#include "igt_edid.h"
 
 #define NSECS_PER_SEC (1000000000ull)
 
@@ -485,6 +486,47 @@ test_negative_basic(data_t *data, enum pipe pipe,
 	igt_remove_fb(data->drm_fd, &data->fb0);
 }
 
+static void
+test_vrr_range(data_t *data, enum pipe pipe,
+		igt_output_t *output, uint32_t flags)
+{
+	uint64_t edid_blob_id;
+	const struct edid *edid;
+	struct detailed_data_monitor_range expected_range;
+	drmModePropertyBlobPtr edid_blob = NULL;
+	drmModeConnector *connector = output->config.connector;
+
+	igt_assert(kmstest_get_property(data->drm_fd, connector->connector_id,
+					DRM_MODE_OBJECT_CONNECTOR, "EDID", NULL,
+					&edid_blob_id, NULL));
+	edid_blob = drmModeGetPropertyBlob(data->drm_fd, edid_blob_id);
+	igt_require_f(edid_blob, "EDID blob is NULL\n");
+
+	edid = (const struct edid *) edid_blob->data;
+	igt_assert(edid);
+
+	prepare_negative_test(data, output, pipe);
+	expected_range = detailed_timing_get_monitor_range(edid);
+	drmModeFreePropertyBlob(edid_blob);
+
+	igt_assert_f(data->range.min == expected_range.min_vfreq &&
+		     data->range.max == expected_range.max_vfreq,
+		     "Expecting VRR range %d-%d, got %d-%d\n",
+		     expected_range.min_vfreq, expected_range.max_vfreq,
+		     data->range.min, data->range.max);
+
+	igt_info("Monitor range from EDID: %d-%d, Kernel parsed VRR range as: %d-%d\n",
+			expected_range.min_vfreq, expected_range.max_vfreq,
+			data->range.min, data->range.max);
+
+	/* Clean-up */
+	igt_plane_set_fb(data->primary, NULL);
+	igt_output_set_pipe(output, PIPE_NONE);
+	set_vrr_on_pipe(data, pipe, false);
+
+	igt_remove_fb(data->drm_fd, &data->fb0);
+}
+
 /* Runs tests on outputs that are VRR capable. */
 static void
 run_vrr_test(data_t *data, test_t test, uint32_t flags)
@@ -514,6 +556,25 @@ run_vrr_test(data_t *data, test_t test, uint32_t flags)
 	}
 }
 
+static void
+run_parse_test(data_t *data, test_t test, uint32_t flags)
+{
+	igt_output_t *output;
+
+	for_each_connected_output(&data->display, output) {
+		enum pipe pipe;
+
+		for_each_pipe(&data->display, pipe) {
+			if (igt_pipe_connector_valid(pipe, output)) {
+				igt_dynamic_f("pipe-%s-%s",
+					      kmstest_pipe_name(pipe), output->name)
+					test(data, pipe, output, flags);
+				break;
+			}
+		}
+	}
+}
+
 igt_main
 {
 	data_t data = {};
@@ -551,6 +612,11 @@ igt_main
 	igt_subtest_with_dynamic("negative-basic")
 		run_vrr_test(&data, test_negative_basic, TEST_NEGATIVE);
 
+	igt_describe("Read the monitor RR range from monitor and make sure that "
+		     "Kernel is parsing it properly.");
+	igt_subtest_with_dynamic("parse-vrr-range")
+		run_parse_test(&data, test_vrr_range, TEST_NONE);
+
 	igt_fixture {
 		igt_display_fini(&data.display);
 	}
-- 
2.35.0

  parent reply	other threads:[~2022-02-24  5:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-24  5:16 [igt-dev] [i-g-t 0/5] Add Negative tests to VRR Bhanuprakash Modem
2022-02-24  5:16 ` [igt-dev] [i-g-t 1/5] tests/kms_vrr: Create dynamic subtests Bhanuprakash Modem
2022-03-04  1:01   ` Navare, Manasi
2022-02-24  5:16 ` [igt-dev] [i-g-t 2/5] lib/igt_edid: Helper to read monitor range from EDID Bhanuprakash Modem
2022-02-24  8:32   ` [igt-dev] [v2 i-g-t " Bhanuprakash Modem
2022-03-04  1:07   ` [igt-dev] [i-g-t " Navare, Manasi
2022-03-04  3:12     ` Modem, Bhanuprakash
2022-02-24  5:16 ` [igt-dev] [i-g-t 3/5] tests/kms_vrr: Add Negative tests to validate VRR Bhanuprakash Modem
2022-03-04  1:20   ` Navare, Manasi
2022-03-04  4:02     ` Modem, Bhanuprakash
2022-03-07  4:57       ` Modem, Bhanuprakash
2022-03-07 20:06       ` Navare, Manasi
2022-03-08  4:13         ` Modem, Bhanuprakash
2022-02-24  5:16 ` Bhanuprakash Modem [this message]
2022-02-24  5:16 ` [igt-dev] [i-g-t 5/5] HAX: Add VRR negative tests to BAT Bhanuprakash Modem
2022-02-24  6:53 ` [igt-dev] ✓ Fi.CI.BAT: success for Add Negative tests to VRR (rev3) Patchwork
2022-02-24  8:59 ` [igt-dev] ✗ GitLab.Pipeline: warning for Add Negative tests to VRR (rev4) Patchwork
2022-02-24  9:27 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2022-02-24 18:53 ` [igt-dev] ✓ Fi.CI.IGT: success for Add Negative tests to VRR (rev3) Patchwork
2022-02-24 22:01 ` [igt-dev] ✗ Fi.CI.IGT: failure for Add Negative tests to VRR (rev4) 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=20220224051648.91470-5-bhanuprakash.modem@intel.com \
    --to=bhanuprakash.modem@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=manasi.d.navare@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