[Intel-gfx] [PATCH i-g-t] tests/kms_plane_scaling: Move get_num_scalers to a function, v2.

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Tue Jan 16 10:03:33 UTC 2018


The number of scalers can depend on the pipe, so require at least 1
scaler before running any subtests.

Changes since v1:
- More closely match kernel implementation. (Mika)

Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
 tests/kms_plane_scaling.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 7e9a948a6b33..dd87bd090705 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -38,8 +38,6 @@ typedef struct {
 	int image_w;
 	int image_h;
 
-	int num_scalers;
-
 	struct igt_fb fb1;
 	struct igt_fb fb2;
 	struct igt_fb fb3;
@@ -53,6 +51,18 @@ typedef struct {
 	igt_plane_t *plane4;
 } data_t;
 
+static int get_num_scalers(uint32_t devid, enum pipe pipe)
+{
+	igt_require(intel_gen(devid) >= 9);
+
+	if (intel_gen(devid) >= 10)
+		return 2;
+	else if (pipe != PIPE_C)
+		return 2;
+	else
+		return 1;
+}
+
 static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 			igt_plane_t *plane, drmModeModeInfo *mode, enum igt_commit_style s)
 {
@@ -170,8 +180,6 @@ test_plane_scaling_on_pipe(data_t *d, enum pipe pipe, igt_output_t *output)
 	drmModeModeInfo *mode;
 	int primary_plane_scaling = 0; /* For now */
 
-	igt_require(d->num_scalers > 0);
-
 	igt_display_reset(display);
 	igt_output_set_pipe(output, pipe);
 	mode = igt_output_get_mode(output);
@@ -310,15 +318,17 @@ igt_main
 		igt_require_pipe_crc(data.drm_fd);
 		igt_display_init(&data.display, data.drm_fd);
 		data.devid = intel_get_drm_devid(data.drm_fd);
-		data.num_scalers = intel_gen(data.devid) >= 9 ? 2 : 0;
 	}
 
 	for_each_pipe_static(pipe) igt_subtest_group {
 		igt_output_t *output;
 
-		igt_fixture
+		igt_fixture {
 			igt_display_require_output_on_pipe(&data.display, pipe);
 
+			igt_require(get_num_scalers(data.devid, pipe) > 0);
+		}
+
 		igt_subtest_f("pipe-%s-plane-scaling", kmstest_pipe_name(pipe))
 			for_each_valid_output_on_pipe(&data.display, pipe, output)
 				test_plane_scaling_on_pipe(&data, pipe, output);
-- 
2.15.1



More information about the Intel-gfx mailing list