[igt-dev] [PATCH i-g-t v2 2/2] tests/kms_plane_multiple: Set highest mode for PCU messaging test.

Karthik B S karthik.b.s at intel.com
Mon Aug 5 06:54:54 UTC 2019


Set the highest mode allows for the stress test for PCU messaging, as
the BW requirement is the highest in this case.

v2: Rebase.

Signed-off-by: Karthik B S <karthik.b.s at intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
Reviewed-by: Mika Kahola <mika.kahola at intel.com>
---
 tests/kms_plane_multiple.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
index bed337c..fcf66ac 100644
--- a/tests/kms_plane_multiple.c
+++ b/tests/kms_plane_multiple.c
@@ -355,6 +355,48 @@ prepare_planes2(data_t *data, enum pipe pipe_id, color_t *color,
 	}
 }
 
+static drmModeModeInfo
+get_highest_mode(int drmfd, int connector_id)
+{
+	drmModeRes *mode_resources = drmModeGetResources(drmfd);
+	drmModeModeInfo highestmode;
+	drmModeConnector *connector;
+	int i;
+	bool highestmodefound = false;
+
+	igt_require(mode_resources);
+
+	for (i = 0; i < mode_resources->count_connectors; i++) {
+		connector = drmModeGetConnectorCurrent(drmfd,
+					mode_resources->connectors[i]);
+		if (!connector) {
+			igt_warn("could not get connector %i: %s\n",
+				 mode_resources->connectors[i],
+				 strerror(errno));
+			continue;
+		}
+
+		if (connector->connector_id != connector_id)
+			continue;
+
+		if (!connector->count_modes)
+			continue;
+
+		/* First mode has the highest pixel rate */
+		highestmodefound = true;
+		highestmode = connector->modes[0];
+		break;
+	}
+
+	if (connector)
+		drmModeFreeConnector(connector);
+
+	drmModeFreeResources(mode_resources);
+
+	igt_require(highestmodefound);
+	return highestmode;
+}
+
 /*
  * Multiple plane position test.
  *   - We start by grabbing a reference CRC of a full blue fb being scanned
@@ -371,6 +413,7 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 				igt_output_t *output, int n_planes,
 				uint64_t tiling)
 {
+	drmModeModeInfo mode_highres;
 	color_t blue  = { 0.0f, 0.0f, 1.0f };
 	igt_crc_t crc;
 	igt_plane_t *plane;
@@ -412,6 +455,11 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 			info, opt.seed);
 
 	if (data->flag == TEST_BANDWIDTH) {
+		mode_highres = get_highest_mode(data->drm_fd, output->id);
+
+		/* switch to highest resolution */
+		igt_output_override_mode(output, &mode_highres);
+
 		for (i = BW_PRIMARY_LOW; i < BW_INVALID; i++) {
 			if (i == BW_PRIMARY_LOW || i == BW_PRIMARY_LOW2)
 				get_reference_crc(data, output, pipe, &blue,
@@ -429,6 +477,9 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 
 			igt_assert_crc_equal(&data->ref_crc, &crc);
 		}
+
+		/* switch back to default mode */
+		igt_output_override_mode(output, NULL);
 	} else {
 		i = 0;
 		get_reference_crc(data, output, pipe, &blue,
-- 
2.7.4



More information about the igt-dev mailing list