All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [V4 3/3] tests/kms_color: Skip if current & requested BPC doesn't match
Date: Tue, 31 May 2022 17:28:05 +0530	[thread overview]
Message-ID: <20220531115805.3941871-4-bhanuprakash.modem@intel.com> (raw)
In-Reply-To: <20220531115805.3941871-1-bhanuprakash.modem@intel.com>

The "max bpc" property only ensures that the bpc will not go beyond
the value set through this property. It does not guarantee that the
same bpc will be used for the given mode.

If clock/bandwidth constraints permit, the max bpc will be used to
show the mode, otherwise the bpc will be reduced. So, if we really
want a particular bpc set, we can try reducing the resolution, till
we get the bpc that we set in max bpc property.

This patch will skip the test, if there is no valid resolution to get
the same bpc as set by max_bpc property.

V2:
* Refactor the logic
V3:
* Minor changes
V4:
* Set output to pipe (igt_output_set_pipe)

Cc: Swati Sharma <swati2.sharma@intel.com>
CC: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
 tests/kms_color.c | 35 ++++++++++++++++++++++++++++++-----
 1 file changed, 30 insertions(+), 5 deletions(-)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index 93957f50..ba06947b 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -635,6 +635,28 @@ static void test_pipe_limited_range_ctm(data_t *data,
 }
 #endif
 
+static bool i915_clock_constraint(data_t *data, enum pipe pipe, int bpc)
+{
+	igt_output_t *output = data->output;
+	drmModeConnector *connector = output->config.connector;
+
+	igt_sort_connector_modes(connector, sort_drm_modes_by_clk_dsc);
+
+	for_each_connector_mode(output) {
+		igt_output_override_mode(output, &connector->modes[j__]);
+		igt_display_commit_atomic(&data->display, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+
+		if (!igt_check_output_bpc_equal(data->drm_fd, pipe,
+						data->output->name, bpc))
+			continue;
+
+		return true;
+	}
+
+	igt_output_override_mode(output, NULL);
+	return false;
+}
+
 static void
 prep_pipe(data_t *data, enum pipe p)
 {
@@ -866,6 +888,9 @@ run_tests_for_pipe(data_t *data, enum pipe p)
 	igt_subtest_f("pipe-%s-legacy-gamma-reset", kmstest_pipe_name(p))
 		test_pipe_legacy_gamma_reset(data, primary);
 
+	igt_fixture
+		igt_require(data->display.is_atomic);
+
 	igt_describe("Verify that deep color works correctly");
 	igt_subtest_with_dynamic_f("pipe-%s-deep-color", kmstest_pipe_name(p)) {
 		igt_output_t *output;
@@ -896,12 +921,12 @@ run_tests_for_pipe(data_t *data, enum pipe p)
 			data->drm_format = DRM_FORMAT_XRGB2101010;
 			data->output = output;
 			igt_output_set_prop_value(output, IGT_CONNECTOR_MAX_BPC, 10);
-			igt_display_commit(&data->display);
+			igt_output_set_pipe(output, p);
+			igt_display_commit_atomic(&data->display, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
 
-			if (!igt_check_output_bpc_equal(data->drm_fd, p, output->name, 10)) {
-				igt_output_set_prop_value(output, IGT_CONNECTOR_MAX_BPC, max_bpc);
-				igt_fail_on_f(true, "Failed to set max_bpc as: 10\n");
-			}
+			if (is_i915_device(data->drm_fd) &&
+			    !i915_clock_constraint(data, p, 10))
+				continue;
 
 			igt_dynamic_f("gamma-%s", output->name) {
 				ret = test_pipe_gamma(data, primary);
-- 
2.35.1

  parent reply	other threads:[~2022-05-31 12:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-31 11:58 [igt-dev] [V4 0/3] Skip if current & requested BPC doesn't match Bhanuprakash Modem
2022-05-31 11:58 ` [igt-dev] [V4 1/3] lib/igt_kms: Add helper functions to sort drm modes Bhanuprakash Modem
2022-05-31 11:58 ` [igt-dev] [V4 2/3] tests/kms_hdr: Skip if current & requested BPC doesn't match Bhanuprakash Modem
2022-05-31 11:58 ` Bhanuprakash Modem [this message]
2022-05-31 13:24 ` [igt-dev] ✓ Fi.CI.BAT: success for Skip if current & requested BPC doesn't match (rev7) Patchwork
2022-05-31 15:26 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2022-06-01  6:41 ` [igt-dev] ✓ Fi.CI.BAT: success for Skip if current & requested BPC doesn't match (rev8) Patchwork
2022-06-01  7:47 ` [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=20220531115805.3941871-4-bhanuprakash.modem@intel.com \
    --to=bhanuprakash.modem@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.