diff mbox

[i-g-t,6/6] tests/kms_draw_crc: Skip tests for unsupported formats

Message ID 20170921143933.14618-6-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä Sept. 21, 2017, 2:39 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

10bpc formats aren't supported on all platforms, so skip the test when
we can't create the framebuffer.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/kms_draw_crc.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

Comments

Petri Latvala Sept. 27, 2017, 11:38 a.m. UTC | #1
On Thu, Sep 21, 2017 at 05:39:33PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> 10bpc formats aren't supported on all platforms, so skip the test when
> we can't create the framebuffer.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>


Reviewed-by: Petri Latvala <petri.latvala@intel.com>



> ---
>  tests/kms_draw_crc.c | 23 ++++++++++++++++++++---
>  1 file changed, 20 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/kms_draw_crc.c b/tests/kms_draw_crc.c
> index 260950c76e00..723e7a182c95 100644
> --- a/tests/kms_draw_crc.c
> +++ b/tests/kms_draw_crc.c
> @@ -153,16 +153,33 @@ static void get_method_crc(enum igt_draw_method method, uint32_t drm_format,
>  	igt_remove_fb(drm_fd, &fb);
>  }
>  
> +static bool format_is_supported(uint32_t format, uint64_t modifier)
> +{
> +	uint32_t gem_handle, fb_id;
> +	unsigned int stride;
> +	int ret;
> +
> +	gem_handle = igt_create_bo_with_dimensions(drm_fd, 64, 64,
> +						   format, modifier,
> +						   0, NULL, &stride, NULL);
> +	ret =  __kms_addfb(drm_fd, gem_handle, 64, 64,
> +			   stride, format, modifier,
> +			   LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id);
> +	drmModeRmFB(drm_fd, fb_id);
> +	gem_close(drm_fd, gem_handle);
> +
> +	return ret == 0;
> +}
> +
>  static void draw_method_subtest(enum igt_draw_method method,
>  				uint32_t format_index, uint64_t tiling)
>  {
>  	igt_crc_t crc;
>  
> -	if (tiling == LOCAL_I915_FORMAT_MOD_Y_TILED)
> -		igt_require(intel_gen(intel_get_drm_devid(drm_fd)) >= 9);
> -
>  	igt_skip_on(method == IGT_DRAW_MMAP_WC && !gem_mmap__has_wc(drm_fd));
>  
> +	igt_require(format_is_supported(formats[format_index], tiling));
> +
>  	/* Use IGT_DRAW_MMAP_GTT on an untiled buffer as the parameter for
>  	 * comparison. Cache the value so we don't recompute it for every single
>  	 * subtest. */
> -- 
> 2.13.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/tests/kms_draw_crc.c b/tests/kms_draw_crc.c
index 260950c76e00..723e7a182c95 100644
--- a/tests/kms_draw_crc.c
+++ b/tests/kms_draw_crc.c
@@ -153,16 +153,33 @@  static void get_method_crc(enum igt_draw_method method, uint32_t drm_format,
 	igt_remove_fb(drm_fd, &fb);
 }
 
+static bool format_is_supported(uint32_t format, uint64_t modifier)
+{
+	uint32_t gem_handle, fb_id;
+	unsigned int stride;
+	int ret;
+
+	gem_handle = igt_create_bo_with_dimensions(drm_fd, 64, 64,
+						   format, modifier,
+						   0, NULL, &stride, NULL);
+	ret =  __kms_addfb(drm_fd, gem_handle, 64, 64,
+			   stride, format, modifier,
+			   LOCAL_DRM_MODE_FB_MODIFIERS, &fb_id);
+	drmModeRmFB(drm_fd, fb_id);
+	gem_close(drm_fd, gem_handle);
+
+	return ret == 0;
+}
+
 static void draw_method_subtest(enum igt_draw_method method,
 				uint32_t format_index, uint64_t tiling)
 {
 	igt_crc_t crc;
 
-	if (tiling == LOCAL_I915_FORMAT_MOD_Y_TILED)
-		igt_require(intel_gen(intel_get_drm_devid(drm_fd)) >= 9);
-
 	igt_skip_on(method == IGT_DRAW_MMAP_WC && !gem_mmap__has_wc(drm_fd));
 
+	igt_require(format_is_supported(formats[format_index], tiling));
+
 	/* Use IGT_DRAW_MMAP_GTT on an untiled buffer as the parameter for
 	 * comparison. Cache the value so we don't recompute it for every single
 	 * subtest. */