Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jessica Zhang <quic_jesszhan@quicinc.com>
To: Petri Latvala <adrinael@adrinael.net>,
	Arkadiusz Hiler <arek@hiler.eu>,
	Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>,
	Bhanuprakash Modem <bhanuprakash.modem@intel.com>,
	Ashutosh Dixit <ashutosh.dixit@intel.com>
Cc: Alex Hung <alex.hung@amd.com>, <quic_abhinavk@quicinc.com>,
	<igt-dev@lists.freedesktop.org>,
	Esha Bharadwaj <quic_ebharadw@quicinc.com>,
	Jessica Zhang <quic_jesszhan@quicinc.com>
Subject: [PATCH i-g-t v4 3/4] lib/igt_kms: loosen duplicate check in igt_display_refresh
Date: Wed, 25 Sep 2024 13:37:20 -0700	[thread overview]
Message-ID: <20240925-igt-cwb-v4-3-e516cd1e888e@quicinc.com> (raw)
In-Reply-To: <20240925-igt-cwb-v4-0-e516cd1e888e@quicinc.com>

From: Esha Bharadwaj <quic_ebharadw@quicinc.com>

Change the duplicate check in igt_display_refresh() so it allows for
pipes to be shared by encoders that are valid clones of each other.

Signed-off-by: Esha Bharadwaj <quic_ebharadw@quicinc.com>
Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
---
 lib/igt_kms.c | 42 +++++++++++++++++++++++++++++++++---------
 lib/igt_kms.h |  1 +
 2 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index f5fab7f73..a17efc364 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -3286,22 +3286,46 @@ int kmstest_get_encoder_idx(drmModeRes *resources, drmModeEncoder *encoder)
 	igt_assert(0);
 }
 
-static void igt_display_refresh(igt_display_t *display)
+bool igt_output_clone_valid(int drm_fd, igt_output_t *target, igt_output_t *clone)
 {
-	igt_output_t *output;
-	int i;
+	drmModeEncoder *target_enc;
+	drmModeEncoder *clone_enc;
+	drmModeRes *resources = drmModeGetResources(drm_fd);
+	uint32_t clone_mask;
+
+	if (!target || !clone)
+		return false;
+
+	target_enc = target->config.encoder;
+	clone_enc = clone->config.encoder;
+
+	if (!target_enc || !clone_enc)
+		return false;
+
+	clone_mask = 1 << kmstest_get_encoder_idx(resources, clone_enc);
 
-	unsigned long pipes_in_use = 0;
+	return ((target_enc->possible_clones & clone_mask) != clone_mask);
+}
+
+static void igt_display_refresh(igt_display_t *display)
+{
+	igt_output_t *output, *clone_output;
+	int i, j;
 
-       /* Check that two outputs aren't trying to use the same pipe */
 	for (i = 0; i < display->n_outputs; i++) {
 		output = &display->outputs[i];
 
-		if (output->pending_pipe != PIPE_NONE) {
-			if (pipes_in_use & (1 << output->pending_pipe))
-				goto report_dup;
+		for (j = i + 1; j < display->n_outputs; j++) {
+			clone_output = &display->outputs[j];
 
-			pipes_in_use |= 1 << output->pending_pipe;
+			/*
+			 * Check that any encoders with duplicated pipes are
+			 * possible clones of each other. If they aren't, report
+			 * the pipe as duplicated
+			 */
+			if (!igt_output_clone_valid(display->drm_fd,
+						output, clone_output))
+				goto report_dup;
 		}
 
 		if (output->force_reprobe)
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 72fe3b3b1..2d272f1fa 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -525,6 +525,7 @@ igt_plane_t *igt_output_get_plane_type_index(igt_output_t *output,
 					     int plane_type, int index);
 igt_output_t *igt_output_from_connector(igt_display_t *display,
     drmModeConnector *connector);
+bool igt_output_clone_valid(int drm_fd, igt_output_t *target, igt_output_t *clone);
 void igt_output_refresh(igt_output_t *output);
 drmModeModeInfo *igt_std_1024_mode_get(int vrefresh);
 void igt_output_set_writeback_fb(igt_output_t *output, struct igt_fb *fb);

-- 
2.34.1


  parent reply	other threads:[~2024-09-25 20:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-25 20:37 [PATCH i-g-t v4 0/4] tests/kms_writeback: Add clone mode subtest Jessica Zhang
2024-09-25 20:37 ` [PATCH i-g-t v4 1/4] tests/kms_writeback: clear writeback properties in teardown path Jessica Zhang
2024-09-25 20:46   ` Abhinav Kumar
2024-10-14 13:52     ` Kamil Konieczny
2024-10-14 19:05       ` Abhinav Kumar
2024-09-25 20:37 ` [PATCH i-g-t v4 2/4] lib/igt_kms: Add helper to get encoder index Jessica Zhang
2024-09-25 21:10   ` Abhinav Kumar
2024-09-25 20:37 ` Jessica Zhang [this message]
2024-09-25 21:00   ` [PATCH i-g-t v4 3/4] lib/igt_kms: loosen duplicate check in igt_display_refresh Abhinav Kumar
2024-09-25 20:37 ` [PATCH i-g-t v4 4/4] tests/kms_writeback: Add dump for valid clone mode Jessica Zhang
2024-09-25 21:55   ` Abhinav Kumar
2024-10-14 12:32     ` Juha-Pekka Heikkila
2024-09-26  9:20 ` ✗ Fi.CI.BAT: failure for tests/kms_writeback: Add clone mode subtest (rev4) Patchwork
2024-09-26  9:39 ` ✗ CI.xeBAT: " Patchwork
2024-09-27  0:56 ` ✗ CI.xeFULL: " 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=20240925-igt-cwb-v4-3-e516cd1e888e@quicinc.com \
    --to=quic_jesszhan@quicinc.com \
    --cc=adrinael@adrinael.net \
    --cc=alex.hung@amd.com \
    --cc=arek@hiler.eu \
    --cc=ashutosh.dixit@intel.com \
    --cc=bhanuprakash.modem@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=juhapekka.heikkila@gmail.com \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_ebharadw@quicinc.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