[v3,4/8] tests/kms_plane_scaling: Move get_num_scalers to a function.

Submitted by Maarten Lankhorst on Jan. 15, 2018, 2:28 p.m.

Details

Message ID 20180115142834.65798-5-maarten.lankhorst@linux.intel.com
State New
Headers show
Series "kms_plane_scaling tests." ( rev: 1 ) in IGT (deprecated)

Not browsing as part of any series.

Commit Message

Maarten Lankhorst Jan. 15, 2018, 2:28 p.m.
The number of scalers can depend on the pipe, so require at least 1
scaler before running any subtests.

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

Patch hide | download patch | download mbox

diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 7e9a948a6b33..d1afcc819d0a 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,16 @@  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) > 9 || 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 +178,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 +316,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);

Comments

On Mon, 2018-01-15 at 15:28 +0100, Maarten Lankhorst wrote:
> The number of scalers can depend on the pipe, so require at least 1
> scaler before running any subtests.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  tests/kms_plane_scaling.c | 20 ++++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
> index 7e9a948a6b33..d1afcc819d0a 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,16 @@ 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) > 9 || pipe != PIPE_C)
> +		return 2;
> +	else
> +		return 1;
> +}

From GEN10 onwards, we have symmetric pipes and therefore the number of
scalers is the same for all pipes. I suggest that we update this to
match with the kernel implementation from
intel_device_info_runtime_init() such as.

	if (intel_gen(devid) >= 10)
		return 2;
	else if (intel_gen(devid) == 9 && 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 +178,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 +316,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.dis
> play, 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);