[igt-dev] [PATCH i-g-t] tests/kms_plane: test odd size planar yuv

Kamil Konieczny kamil.konieczny at linux.intel.com
Mon Oct 16 10:11:35 UTC 2023


Hi Juha-Pekka,
On 2023-10-10 at 14:47:26 +0300, Juha-Pekka Heikkila wrote:
> Test odd size planar yuv formats are allowed on graphics ver >= 20
> 
> Rename invalid pixel format settings test to planar pixel format settings
> test to refect the changes.
------------ ^
s/refect/reflect/

Regards,
Kamil

> 
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> ---
>  tests/kms_plane.c | 43 +++++++++++++++++++++++++++++++------------
>  1 file changed, 31 insertions(+), 12 deletions(-)
> 
> diff --git a/tests/kms_plane.c b/tests/kms_plane.c
> index 9a515559c..a13fcc36e 100644
> --- a/tests/kms_plane.c
> +++ b/tests/kms_plane.c
> @@ -1229,27 +1229,30 @@ test_pixel_formats(data_t *data, enum pipe pipe)
>  }
>  
>  /**
> - * SUBTEST: invalid-pixel-format-settings
> - * Description: verify invalid settings for pixel format are not accepted
> + * SUBTEST: planar-pixel-format-settings
> + * Description: verify planar settings for pixel format are handled correctly
>   * Driver requirement: i915, xe
>   * Functionality: pixel_format, plane
>   * Mega feature: General Display Features
>   * Test category: functionality test
>   */
> -static void test_invalid_settings(data_t *data)
> +static void test_planar_settings(data_t *data)
>  {
>  	enum pipe pipe = PIPE_A;
>  	igt_output_t *output;
>  	igt_fb_t fb;
>  	igt_plane_t *primary;
> +	int devid;
>  	int rval;
>  
>  	/*
>  	 * If here is added non-intel tests below require will need to be
>  	 * changed to if(..)
>  	 */
> +	igt_require(data->display.is_atomic);
>  	igt_require_intel(data->drm_fd);
> -	igt_require(intel_display_ver(intel_get_drm_devid(data->drm_fd)) >= 9);
> +	devid = intel_get_drm_devid(data->drm_fd);
> +	igt_require(intel_display_ver(devid) >= 9);
>  
>  	output = igt_get_single_output_for_pipe(&data->display, pipe);
>  	igt_require(output);
> @@ -1257,17 +1260,26 @@ static void test_invalid_settings(data_t *data)
>  	igt_output_set_pipe(output, pipe);
>  	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
>  
> -	igt_display_commit2(&data->display, data->display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
> +	igt_display_commit_atomic(&data->display,
> +				  DRM_MODE_ATOMIC_ALLOW_MODESET,
> +				  NULL);
>  
>  	/* test against intel_plane_check_src_coordinates() in i915 */
>  	if (igt_plane_has_format_mod(primary, DRM_FORMAT_NV12,
>  				     DRM_FORMAT_MOD_LINEAR)) {
> +		int expected_rval = -EINVAL;
> +
> +		if (intel_display_ver(devid) >= 20)
> +			expected_rval = 0;
> +
>  		igt_create_fb(data->drm_fd, 257, 256,
>  			      DRM_FORMAT_NV12, DRM_FORMAT_MOD_LINEAR, &fb);
>  		igt_plane_set_fb(primary, &fb);
> -		rval = igt_display_try_commit_atomic(&data->display, 0, NULL);
> +		rval = igt_display_try_commit_atomic(&data->display,
> +						     DRM_MODE_ATOMIC_ALLOW_MODESET,
> +						     NULL);
>  		igt_remove_fb(data->drm_fd, &fb);
> -		igt_assert_f(rval == -EINVAL, "Odd width NV12 framebuffer\n");
> +		igt_assert_f(rval == expected_rval, "Odd width NV12 framebuffer\n");
>  	} else {
>  		igt_debug("Odd width NV12 framebuffer test skipped\n");
>  	}
> @@ -1275,12 +1287,19 @@ static void test_invalid_settings(data_t *data)
>  	/* test against intel_plane_check_src_coordinates() in i915 */
>  	if (igt_plane_has_format_mod(primary, DRM_FORMAT_NV12,
>  				     DRM_FORMAT_MOD_LINEAR)) {
> +		int expected_rval = -EINVAL;
> +
> +		if (intel_display_ver(devid) >= 20)
> +			expected_rval = 0;
> +
>  		igt_create_fb(data->drm_fd, 256, 257,
>  			      DRM_FORMAT_NV12, DRM_FORMAT_MOD_LINEAR, &fb);
>  		igt_plane_set_fb(primary, &fb);
> -		rval = igt_display_try_commit_atomic(&data->display, 0, NULL);
> +		rval = igt_display_try_commit_atomic(&data->display,
> +						     DRM_MODE_ATOMIC_ALLOW_MODESET,
> +						     NULL);
>  		igt_remove_fb(data->drm_fd, &fb);
> -		igt_assert_f(rval == -EINVAL, "Odd height NV12 framebuffer\n");
> +		igt_assert_f(rval == expected_rval, "Odd height NV12 framebuffer\n");
>  	} else {
>  		igt_debug("Odd height NV12 framebuffer test skipped\n");
>  	}
> @@ -1367,9 +1386,9 @@ run_tests_for_pipe_plane(data_t *data)
>  		run_test(data, test_plane_panning);
>  	}
>  
> -	igt_describe("verify invalid settings for pixel format are not accepted");
> -	igt_subtest_f("invalid-pixel-format-settings")
> -		test_invalid_settings(data);
> +	igt_describe("verify planar settings for pixel format are accepted or rejected correctly");
> +	igt_subtest_f("planar-pixel-format-settings")
> +		test_planar_settings(data);
>  }
>  
>  static int opt_handler(int opt, int opt_index, void *_data)
> -- 
> 2.34.1
> 


More information about the igt-dev mailing list