All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Petri Latvala <petri.latvala@intel.com>
Subject: [igt-dev] [PATCH i-g-t 3/5] lib/igt_kms: helper to override the mode on all connectors
Date: Sat, 10 Apr 2021 01:00:46 +0530	[thread overview]
Message-ID: <20210409193048.6857-4-bhanuprakash.modem@intel.com> (raw)
In-Reply-To: <20210409193048.6857-1-bhanuprakash.modem@intel.com>

This helper will iterate through all connectors those have a
pending_pipe != PIPE_NONE set by the test upto the point of
calling this helper. And find the combination using the most
bandwidth by ATOMIC_TEST_ONLY then return to the test.

This helper would override the mode on all connectors that will
be modeset by the next igt_display_commit() call in the test.

Cc: Imre Deak <imre.deak@intel.com>
Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Cc: Petri Latvala <petri.latvala@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
 lib/igt_kms.c | 41 +++++++++++++++++++++++++++++++++++++++++
 lib/igt_kms.h |  1 +
 2 files changed, 42 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 1ba938982..c439456c5 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -3871,6 +3871,47 @@ void igt_output_set_pipe(igt_output_t *output, enum pipe pipe)
 	}
 }
 
+#define for_each_connector_mode(output)		\
+	for (int i__ = 0;  i__ < output->config.connector->count_modes; i__++)
+
+static
+bool __override_all_active_output_modes_to_fit_link_bw(igt_display_t *display, int base)
+{
+	for ( ; base < display->n_outputs; base++) {
+		igt_output_t *output = &display->outputs[base];
+
+		if (output->pending_pipe == PIPE_NONE ||
+		    output->link_group_id <= 0)
+			continue;
+
+		for_each_connector_mode(output) {
+			igt_output_override_mode(output, &output->config.connector->modes[i__]);
+			if(__override_all_active_output_modes_to_fit_link_bw(display, base + 1))
+				return true;
+
+			if(igt_display_try_commit_atomic(display,
+					DRM_MODE_ATOMIC_TEST_ONLY |
+					DRM_MODE_ATOMIC_ALLOW_MODESET,
+					NULL) == 0)
+				return true;
+		}
+	}
+	return false;
+}
+
+/**
+ * override_all_active_output_modes_to_fit_link_bw:
+ * @display: a pointer to an #igt_display_t structure
+ *
+ * Override the mode on all connectors those are sharing the link bw
+ *
+ * Returns: true if a valid connector mode combo found, else false
+ */
+bool override_all_active_output_modes_to_fit_link_bw(igt_display_t *display)
+{
+	return __override_all_active_output_modes_to_fit_link_bw(display, 0);
+}
+
 /*
  * igt_pipe_refresh:
  * @display: a pointer to an #igt_display_t structure
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index c828e78b5..2998cf377 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -894,5 +894,6 @@ void igt_require_pipe(igt_display_t *display,
 
 void igt_dump_connectors_fd(int drmfd);
 void igt_dump_crtcs_fd(int drmfd);
+bool override_all_active_output_modes_to_fit_link_bw(igt_display_t *display);
 
 #endif /* __IGT_KMS_H__ */
-- 
2.20.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2021-04-09 11:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-09 19:30 [igt-dev] [PATCH i-g-t 0/5] Fix mode selection for 2x tests Bhanuprakash Modem
2021-04-09 13:25 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2021-04-09 15:55 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2021-04-09 19:30 ` [igt-dev] [PATCH i-g-t 1/5] lib/igt_kms: Add a support to read PATH connector property Bhanuprakash Modem
2021-04-09 19:30 ` [igt-dev] [PATCH i-g-t 2/5] lib/igt_kms: Identify outputs that shares link bandwidth Bhanuprakash Modem
2021-04-09 19:30 ` Bhanuprakash Modem [this message]
2021-04-09 19:30 ` [igt-dev] [PATCH i-g-t 4/5] tests/kms_frontbuffer_tracking: Fix mode selection for 2x tests Bhanuprakash Modem
2021-04-09 19:30 ` [igt-dev] [PATCH i-g-t 5/5] tests/kms_cursor_legacy: " Bhanuprakash Modem
2021-04-09 20:18 ` [igt-dev] [PATCH i-g-t 0/5] " Daniel Vetter
2021-04-12  3:51   ` Modem, Bhanuprakash
2021-04-14 15:24     ` Daniel Vetter
2021-04-14 16:06       ` Imre Deak
2021-04-14 18:37         ` Daniel Vetter
2021-04-14 19:01           ` Imre Deak
2021-04-15 12:13             ` Nautiyal, Ankit K
2021-04-15 12:56             ` Modem, Bhanuprakash
2021-04-15 14:15               ` Daniel Vetter

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=20210409193048.6857-4-bhanuprakash.modem@intel.com \
    --to=bhanuprakash.modem@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --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 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.