diff mbox

[v2,5/7] tests/kms_draw_crc: add support for Y tiling

Message ID 1493390254-5232-6-git-send-email-praveen.paneri@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Praveen Paneri April 28, 2017, 2:37 p.m. UTC
From: Paulo Zanoni <paulo.r.zanoni@intel.com>

This is the program that's supposed to test lib/igt_draw. We just
added Y tiling support for the library, so add the tests now.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Praveen Paneri <praveen.paneri@intel.com>
---
 tests/kms_draw_crc.c | 58 ++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 43 insertions(+), 15 deletions(-)

Comments

Zanoni, Paulo R July 11, 2017, 7:03 p.m. UTC | #1
Em Sex, 2017-04-28 às 20:07 +0530, Praveen Paneri escreveu:
> From: Paulo Zanoni <paulo.r.zanoni@intel.com>
> 
> This is the program that's supposed to test lib/igt_draw. We just
> added Y tiling support for the library, so add the tests now.
> 

This is not my original version of the patch, yet there's no changelog
mentioning that this is a new version.

https://patchwork.freedesktop.org/patch/72040/

Why were the kmstest_unset_all_crtcs() calls added? My guess is that
they ended up here as a rebase artifact, but please clarify if there's
an actual reason.


> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> Signed-off-by: Praveen Paneri <praveen.paneri@intel.com>
> ---
>  tests/kms_draw_crc.c | 58 ++++++++++++++++++++++++++++++++++++++--
> ------------
>  1 file changed, 43 insertions(+), 15 deletions(-)
> 
> diff --git a/tests/kms_draw_crc.c b/tests/kms_draw_crc.c
> index c57d3a3..1d91b48 100644
> --- a/tests/kms_draw_crc.c
> +++ b/tests/kms_draw_crc.c
> @@ -47,6 +47,13 @@ static const uint32_t formats[N_FORMATS] = {
>  	DRM_FORMAT_XRGB2101010,
>  };
>  
> +#define N_TILING_METHODS 3
> +static const uint64_t tilings[N_TILING_METHODS] = {
> +	LOCAL_DRM_FORMAT_MOD_NONE,
> +	LOCAL_I915_FORMAT_MOD_X_TILED,
> +	LOCAL_I915_FORMAT_MOD_Y_TILED,
> +};
> +
>  struct base_crc {
>  	bool set;
>  	igt_crc_t crc;
> @@ -151,6 +158,11 @@ static void draw_method_subtest(enum
> igt_draw_method method,
>  {
>  	igt_crc_t crc;
>  
> +	if (tiling == LOCAL_I915_FORMAT_MOD_Y_TILED)
> +		igt_require(intel_gen(intel_get_drm_devid(drm_fd))
> >= 9);
> +
> +	kmstest_unset_all_crtcs(drm_fd, drm_res);
> +
>  	/* 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. */
> @@ -208,6 +220,12 @@ static void fill_fb_subtest(void)
>  	get_fill_crc(LOCAL_I915_FORMAT_MOD_X_TILED, &crc);
>  	igt_assert_crc_equal(&crc, &base_crc);
>  
> +	if (intel_gen(intel_get_drm_devid(drm_fd)) >= 9) {
> +		get_fill_crc(LOCAL_I915_FORMAT_MOD_Y_TILED, &crc);
> +		igt_assert_crc_equal(&crc, &base_crc);
> +	}
> +
> +	kmstest_unset_all_crtcs(drm_fd, drm_res);
>  	igt_remove_fb(drm_fd, &fb);
>  }
>  
> @@ -265,28 +283,38 @@ static const char *format_str(int format_index)
>  	}
>  }
>  
> +static const char *tiling_str(int tiling_index)
> +{
> +	switch (tilings[tiling_index]) {
> +	case LOCAL_DRM_FORMAT_MOD_NONE:
> +		return "untiled";
> +	case LOCAL_I915_FORMAT_MOD_X_TILED:
> +		return "xtiled";
> +	case LOCAL_I915_FORMAT_MOD_Y_TILED:
> +		return "ytiled";
> +	default:
> +		igt_assert(false);
> +	}
> +}
> +
>  igt_main
>  {
>  	enum igt_draw_method method;
> -	int format_index;
> +	int format_idx, tiling_idx;
>  
>  	igt_fixture
>  		setup_environment();
>  
> -	for (format_index = 0; format_index < N_FORMATS;
> format_index++) {
> -		for (method = 0; method < IGT_DRAW_METHOD_COUNT;
> method++) {
> -			igt_subtest_f("draw-method-%s-%s-untiled",
> -				      format_str(format_index),
> -				      igt_draw_get_method_name(metho
> d))
> -				draw_method_subtest(method,
> format_index,
> -						    LOCAL_DRM_FORMAT
> _MOD_NONE);
> -			igt_subtest_f("draw-method-%s-%s-tiled",
> -				      format_str(format_index),
> -				      igt_draw_get_method_name(metho
> d))
> -				draw_method_subtest(method,
> format_index,
> -						LOCAL_I915_FORMAT_MO
> D_X_TILED);
> -		}
> -	}
> +	for (format_idx = 0; format_idx < N_FORMATS; format_idx++) {
> +	for (method = 0; method < IGT_DRAW_METHOD_COUNT; method++) {
> +	for (tiling_idx = 0; tiling_idx < N_TILING_METHODS;
> tiling_idx++) {
> +		igt_subtest_f("draw-method-%s-%s-%s",
> +			      format_str(format_idx),
> +			      igt_draw_get_method_name(method),
> +			      tiling_str(tiling_idx))
> +			draw_method_subtest(method, format_idx,
> +					    tilings[tiling_idx]);
> +	} } }
>  
>  	igt_subtest("fill-fb")
>  		fill_fb_subtest();
Praveen Paneri July 12, 2017, 8:15 a.m. UTC | #2
Hi Paulo,

On Wednesday 12 July 2017 12:33 AM, Paulo Zanoni wrote:
> Em Sex, 2017-04-28 às 20:07 +0530, Praveen Paneri escreveu:
>> From: Paulo Zanoni <paulo.r.zanoni@intel.com>
>>
>> This is the program that's supposed to test lib/igt_draw. We just
>> added Y tiling support for the library, so add the tests now.
>>
>
> This is not my original version of the patch, yet there's no changelog
> mentioning that this is a new version.
>
> https://patchwork.freedesktop.org/patch/72040/
>
> Why were the kmstest_unset_all_crtcs() calls added? My guess is that
> they ended up here as a rebase artifact, but please clarify if there's
> an actual reason.
Yes this is a rebase artifact and is not actually required. I will fix it.

Thanks,
Praveen
>
>
>> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
>> Signed-off-by: Praveen Paneri <praveen.paneri@intel.com>
>> ---
>>  tests/kms_draw_crc.c | 58 ++++++++++++++++++++++++++++++++++++++--
>> ------------
>>  1 file changed, 43 insertions(+), 15 deletions(-)
>>
>> diff --git a/tests/kms_draw_crc.c b/tests/kms_draw_crc.c
>> index c57d3a3..1d91b48 100644
>> --- a/tests/kms_draw_crc.c
>> +++ b/tests/kms_draw_crc.c
>> @@ -47,6 +47,13 @@ static const uint32_t formats[N_FORMATS] = {
>>  	DRM_FORMAT_XRGB2101010,
>>  };
>>
>> +#define N_TILING_METHODS 3
>> +static const uint64_t tilings[N_TILING_METHODS] = {
>> +	LOCAL_DRM_FORMAT_MOD_NONE,
>> +	LOCAL_I915_FORMAT_MOD_X_TILED,
>> +	LOCAL_I915_FORMAT_MOD_Y_TILED,
>> +};
>> +
>>  struct base_crc {
>>  	bool set;
>>  	igt_crc_t crc;
>> @@ -151,6 +158,11 @@ static void draw_method_subtest(enum
>> igt_draw_method method,
>>  {
>>  	igt_crc_t crc;
>>
>> +	if (tiling == LOCAL_I915_FORMAT_MOD_Y_TILED)
>> +		igt_require(intel_gen(intel_get_drm_devid(drm_fd))
>>> = 9);
>> +
>> +	kmstest_unset_all_crtcs(drm_fd, drm_res);
>> +
>>  	/* 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. */
>> @@ -208,6 +220,12 @@ static void fill_fb_subtest(void)
>>  	get_fill_crc(LOCAL_I915_FORMAT_MOD_X_TILED, &crc);
>>  	igt_assert_crc_equal(&crc, &base_crc);
>>
>> +	if (intel_gen(intel_get_drm_devid(drm_fd)) >= 9) {
>> +		get_fill_crc(LOCAL_I915_FORMAT_MOD_Y_TILED, &crc);
>> +		igt_assert_crc_equal(&crc, &base_crc);
>> +	}
>> +
>> +	kmstest_unset_all_crtcs(drm_fd, drm_res);
>>  	igt_remove_fb(drm_fd, &fb);
>>  }
>>
>> @@ -265,28 +283,38 @@ static const char *format_str(int format_index)
>>  	}
>>  }
>>
>> +static const char *tiling_str(int tiling_index)
>> +{
>> +	switch (tilings[tiling_index]) {
>> +	case LOCAL_DRM_FORMAT_MOD_NONE:
>> +		return "untiled";
>> +	case LOCAL_I915_FORMAT_MOD_X_TILED:
>> +		return "xtiled";
>> +	case LOCAL_I915_FORMAT_MOD_Y_TILED:
>> +		return "ytiled";
>> +	default:
>> +		igt_assert(false);
>> +	}
>> +}
>> +
>>  igt_main
>>  {
>>  	enum igt_draw_method method;
>> -	int format_index;
>> +	int format_idx, tiling_idx;
>>
>>  	igt_fixture
>>  		setup_environment();
>>
>> -	for (format_index = 0; format_index < N_FORMATS;
>> format_index++) {
>> -		for (method = 0; method < IGT_DRAW_METHOD_COUNT;
>> method++) {
>> -			igt_subtest_f("draw-method-%s-%s-untiled",
>> -				      format_str(format_index),
>> -				      igt_draw_get_method_name(metho
>> d))
>> -				draw_method_subtest(method,
>> format_index,
>> -						    LOCAL_DRM_FORMAT
>> _MOD_NONE);
>> -			igt_subtest_f("draw-method-%s-%s-tiled",
>> -				      format_str(format_index),
>> -				      igt_draw_get_method_name(metho
>> d))
>> -				draw_method_subtest(method,
>> format_index,
>> -						LOCAL_I915_FORMAT_MO
>> D_X_TILED);
>> -		}
>> -	}
>> +	for (format_idx = 0; format_idx < N_FORMATS; format_idx++) {
>> +	for (method = 0; method < IGT_DRAW_METHOD_COUNT; method++) {
>> +	for (tiling_idx = 0; tiling_idx < N_TILING_METHODS;
>> tiling_idx++) {
>> +		igt_subtest_f("draw-method-%s-%s-%s",
>> +			      format_str(format_idx),
>> +			      igt_draw_get_method_name(method),
>> +			      tiling_str(tiling_idx))
>> +			draw_method_subtest(method, format_idx,
>> +					    tilings[tiling_idx]);
>> +	} } }
>>
>>  	igt_subtest("fill-fb")
>>  		fill_fb_subtest();
Zanoni, Paulo R July 13, 2017, 8:19 p.m. UTC | #3
Em Qua, 2017-07-12 às 13:45 +0530, Praveen Paneri escreveu:
> Hi Paulo,
> 
> On Wednesday 12 July 2017 12:33 AM, Paulo Zanoni wrote:
> > Em Sex, 2017-04-28 às 20:07 +0530, Praveen Paneri escreveu:
> > > From: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > > 
> > > This is the program that's supposed to test lib/igt_draw. We just
> > > added Y tiling support for the library, so add the tests now.
> > > 
> > 
> > This is not my original version of the patch, yet there's no
> > changelog
> > mentioning that this is a new version.
> > 
> > https://patchwork.freedesktop.org/patch/72040/
> > 
> > Why were the kmstest_unset_all_crtcs() calls added? My guess is
> > that
> > they ended up here as a rebase artifact, but please clarify if
> > there's
> > an actual reason.
> 
> Yes this is a rebase artifact and is not actually required. I will
> fix it.

Or you can just give a reviewed-by tag to my original patch :).

> 
> Thanks,
> Praveen
> > 
> > 
> > > Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > > Signed-off-by: Praveen Paneri <praveen.paneri@intel.com>
> > > ---
> > >  tests/kms_draw_crc.c | 58
> > > ++++++++++++++++++++++++++++++++++++++--
> > > ------------
> > >  1 file changed, 43 insertions(+), 15 deletions(-)
> > > 
> > > diff --git a/tests/kms_draw_crc.c b/tests/kms_draw_crc.c
> > > index c57d3a3..1d91b48 100644
> > > --- a/tests/kms_draw_crc.c
> > > +++ b/tests/kms_draw_crc.c
> > > @@ -47,6 +47,13 @@ static const uint32_t formats[N_FORMATS] = {
> > >  	DRM_FORMAT_XRGB2101010,
> > >  };
> > > 
> > > +#define N_TILING_METHODS 3
> > > +static const uint64_t tilings[N_TILING_METHODS] = {
> > > +	LOCAL_DRM_FORMAT_MOD_NONE,
> > > +	LOCAL_I915_FORMAT_MOD_X_TILED,
> > > +	LOCAL_I915_FORMAT_MOD_Y_TILED,
> > > +};
> > > +
> > >  struct base_crc {
> > >  	bool set;
> > >  	igt_crc_t crc;
> > > @@ -151,6 +158,11 @@ static void draw_method_subtest(enum
> > > igt_draw_method method,
> > >  {
> > >  	igt_crc_t crc;
> > > 
> > > +	if (tiling == LOCAL_I915_FORMAT_MOD_Y_TILED)
> > > +		igt_require(intel_gen(intel_get_drm_devid(drm_fd
> > > ))
> > > > = 9);
> > > 
> > > +
> > > +	kmstest_unset_all_crtcs(drm_fd, drm_res);
> > > +
> > >  	/* 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. */
> > > @@ -208,6 +220,12 @@ static void fill_fb_subtest(void)
> > >  	get_fill_crc(LOCAL_I915_FORMAT_MOD_X_TILED, &crc);
> > >  	igt_assert_crc_equal(&crc, &base_crc);
> > > 
> > > +	if (intel_gen(intel_get_drm_devid(drm_fd)) >= 9) {
> > > +		get_fill_crc(LOCAL_I915_FORMAT_MOD_Y_TILED,
> > > &crc);
> > > +		igt_assert_crc_equal(&crc, &base_crc);
> > > +	}
> > > +
> > > +	kmstest_unset_all_crtcs(drm_fd, drm_res);
> > >  	igt_remove_fb(drm_fd, &fb);
> > >  }
> > > 
> > > @@ -265,28 +283,38 @@ static const char *format_str(int
> > > format_index)
> > >  	}
> > >  }
> > > 
> > > +static const char *tiling_str(int tiling_index)
> > > +{
> > > +	switch (tilings[tiling_index]) {
> > > +	case LOCAL_DRM_FORMAT_MOD_NONE:
> > > +		return "untiled";
> > > +	case LOCAL_I915_FORMAT_MOD_X_TILED:
> > > +		return "xtiled";
> > > +	case LOCAL_I915_FORMAT_MOD_Y_TILED:
> > > +		return "ytiled";
> > > +	default:
> > > +		igt_assert(false);
> > > +	}
> > > +}
> > > +
> > >  igt_main
> > >  {
> > >  	enum igt_draw_method method;
> > > -	int format_index;
> > > +	int format_idx, tiling_idx;
> > > 
> > >  	igt_fixture
> > >  		setup_environment();
> > > 
> > > -	for (format_index = 0; format_index < N_FORMATS;
> > > format_index++) {
> > > -		for (method = 0; method < IGT_DRAW_METHOD_COUNT;
> > > method++) {
> > > -			igt_subtest_f("draw-method-%s-%s-
> > > untiled",
> > > -				      format_str(format_index),
> > > -				      igt_draw_get_method_name(m
> > > etho
> > > d))
> > > -				draw_method_subtest(method,
> > > format_index,
> > > -						    LOCAL_DRM_FO
> > > RMAT
> > > _MOD_NONE);
> > > -			igt_subtest_f("draw-method-%s-%s-tiled",
> > > -				      format_str(format_index),
> > > -				      igt_draw_get_method_name(m
> > > etho
> > > d))
> > > -				draw_method_subtest(method,
> > > format_index,
> > > -						LOCAL_I915_FORMA
> > > T_MO
> > > D_X_TILED);
> > > -		}
> > > -	}
> > > +	for (format_idx = 0; format_idx < N_FORMATS;
> > > format_idx++) {
> > > +	for (method = 0; method < IGT_DRAW_METHOD_COUNT;
> > > method++) {
> > > +	for (tiling_idx = 0; tiling_idx < N_TILING_METHODS;
> > > tiling_idx++) {
> > > +		igt_subtest_f("draw-method-%s-%s-%s",
> > > +			      format_str(format_idx),
> > > +			      igt_draw_get_method_name(method),
> > > +			      tiling_str(tiling_idx))
> > > +			draw_method_subtest(method, format_idx,
> > > +					    tilings[tiling_idx])
> > > ;
> > > +	} } }
> > > 
> > >  	igt_subtest("fill-fb")
> > >  		fill_fb_subtest();
Praveen Paneri July 14, 2017, 2 p.m. UTC | #4
On Friday 14 July 2017 01:49 AM, Paulo Zanoni wrote:
> Em Qua, 2017-07-12 às 13:45 +0530, Praveen Paneri escreveu:
>> Hi Paulo,
>>
>> On Wednesday 12 July 2017 12:33 AM, Paulo Zanoni wrote:
>>> Em Sex, 2017-04-28 às 20:07 +0530, Praveen Paneri escreveu:
>>>> From: Paulo Zanoni <paulo.r.zanoni@intel.com>
>>>>
>>>> This is the program that's supposed to test lib/igt_draw. We just
>>>> added Y tiling support for the library, so add the tests now.
>>>>
>>>
>>> This is not my original version of the patch, yet there's no
>>> changelog
>>> mentioning that this is a new version.
>>>
>>> https://patchwork.freedesktop.org/patch/72040/
>>>
>>> Why were the kmstest_unset_all_crtcs() calls added? My guess is
>>> that
>>> they ended up here as a rebase artifact, but please clarify if
>>> there's
>>> an actual reason.
>>
>> Yes this is a rebase artifact and is not actually required. I will
>> fix it.
>
> Or you can just give a reviewed-by tag to my original patch :).
Sure! I will add that in the next series :)
>
>>
>> Thanks,
>> Praveen
>>>
>>>
>>>> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
>>>> Signed-off-by: Praveen Paneri <praveen.paneri@intel.com>
>>>> ---
>>>>  tests/kms_draw_crc.c | 58
>>>> ++++++++++++++++++++++++++++++++++++++--
>>>> ------------
>>>>  1 file changed, 43 insertions(+), 15 deletions(-)
>>>>
>>>> diff --git a/tests/kms_draw_crc.c b/tests/kms_draw_crc.c
>>>> index c57d3a3..1d91b48 100644
>>>> --- a/tests/kms_draw_crc.c
>>>> +++ b/tests/kms_draw_crc.c
>>>> @@ -47,6 +47,13 @@ static const uint32_t formats[N_FORMATS] = {
>>>>  	DRM_FORMAT_XRGB2101010,
>>>>  };
>>>>
>>>> +#define N_TILING_METHODS 3
>>>> +static const uint64_t tilings[N_TILING_METHODS] = {
>>>> +	LOCAL_DRM_FORMAT_MOD_NONE,
>>>> +	LOCAL_I915_FORMAT_MOD_X_TILED,
>>>> +	LOCAL_I915_FORMAT_MOD_Y_TILED,
>>>> +};
>>>> +
>>>>  struct base_crc {
>>>>  	bool set;
>>>>  	igt_crc_t crc;
>>>> @@ -151,6 +158,11 @@ static void draw_method_subtest(enum
>>>> igt_draw_method method,
>>>>  {
>>>>  	igt_crc_t crc;
>>>>
>>>> +	if (tiling == LOCAL_I915_FORMAT_MOD_Y_TILED)
>>>> +		igt_require(intel_gen(intel_get_drm_devid(drm_fd
>>>> ))
>>>>> = 9);
>>>>
>>>> +
>>>> +	kmstest_unset_all_crtcs(drm_fd, drm_res);
>>>> +
>>>>  	/* 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. */
>>>> @@ -208,6 +220,12 @@ static void fill_fb_subtest(void)
>>>>  	get_fill_crc(LOCAL_I915_FORMAT_MOD_X_TILED, &crc);
>>>>  	igt_assert_crc_equal(&crc, &base_crc);
>>>>
>>>> +	if (intel_gen(intel_get_drm_devid(drm_fd)) >= 9) {
>>>> +		get_fill_crc(LOCAL_I915_FORMAT_MOD_Y_TILED,
>>>> &crc);
>>>> +		igt_assert_crc_equal(&crc, &base_crc);
>>>> +	}
>>>> +
>>>> +	kmstest_unset_all_crtcs(drm_fd, drm_res);
>>>>  	igt_remove_fb(drm_fd, &fb);
>>>>  }
>>>>
>>>> @@ -265,28 +283,38 @@ static const char *format_str(int
>>>> format_index)
>>>>  	}
>>>>  }
>>>>
>>>> +static const char *tiling_str(int tiling_index)
>>>> +{
>>>> +	switch (tilings[tiling_index]) {
>>>> +	case LOCAL_DRM_FORMAT_MOD_NONE:
>>>> +		return "untiled";
>>>> +	case LOCAL_I915_FORMAT_MOD_X_TILED:
>>>> +		return "xtiled";
>>>> +	case LOCAL_I915_FORMAT_MOD_Y_TILED:
>>>> +		return "ytiled";
>>>> +	default:
>>>> +		igt_assert(false);
>>>> +	}
>>>> +}
>>>> +
>>>>  igt_main
>>>>  {
>>>>  	enum igt_draw_method method;
>>>> -	int format_index;
>>>> +	int format_idx, tiling_idx;
>>>>
>>>>  	igt_fixture
>>>>  		setup_environment();
>>>>
>>>> -	for (format_index = 0; format_index < N_FORMATS;
>>>> format_index++) {
>>>> -		for (method = 0; method < IGT_DRAW_METHOD_COUNT;
>>>> method++) {
>>>> -			igt_subtest_f("draw-method-%s-%s-
>>>> untiled",
>>>> -				      format_str(format_index),
>>>> -				      igt_draw_get_method_name(m
>>>> etho
>>>> d))
>>>> -				draw_method_subtest(method,
>>>> format_index,
>>>> -						    LOCAL_DRM_FO
>>>> RMAT
>>>> _MOD_NONE);
>>>> -			igt_subtest_f("draw-method-%s-%s-tiled",
>>>> -				      format_str(format_index),
>>>> -				      igt_draw_get_method_name(m
>>>> etho
>>>> d))
>>>> -				draw_method_subtest(method,
>>>> format_index,
>>>> -						LOCAL_I915_FORMA
>>>> T_MO
>>>> D_X_TILED);
>>>> -		}
>>>> -	}
>>>> +	for (format_idx = 0; format_idx < N_FORMATS;
>>>> format_idx++) {
>>>> +	for (method = 0; method < IGT_DRAW_METHOD_COUNT;
>>>> method++) {
>>>> +	for (tiling_idx = 0; tiling_idx < N_TILING_METHODS;
>>>> tiling_idx++) {
>>>> +		igt_subtest_f("draw-method-%s-%s-%s",
>>>> +			      format_str(format_idx),
>>>> +			      igt_draw_get_method_name(method),
>>>> +			      tiling_str(tiling_idx))
>>>> +			draw_method_subtest(method, format_idx,
>>>> +					    tilings[tiling_idx])
>>>> ;
>>>> +	} } }
>>>>
>>>>  	igt_subtest("fill-fb")
>>>>  		fill_fb_subtest();
diff mbox

Patch

diff --git a/tests/kms_draw_crc.c b/tests/kms_draw_crc.c
index c57d3a3..1d91b48 100644
--- a/tests/kms_draw_crc.c
+++ b/tests/kms_draw_crc.c
@@ -47,6 +47,13 @@  static const uint32_t formats[N_FORMATS] = {
 	DRM_FORMAT_XRGB2101010,
 };
 
+#define N_TILING_METHODS 3
+static const uint64_t tilings[N_TILING_METHODS] = {
+	LOCAL_DRM_FORMAT_MOD_NONE,
+	LOCAL_I915_FORMAT_MOD_X_TILED,
+	LOCAL_I915_FORMAT_MOD_Y_TILED,
+};
+
 struct base_crc {
 	bool set;
 	igt_crc_t crc;
@@ -151,6 +158,11 @@  static void draw_method_subtest(enum igt_draw_method method,
 {
 	igt_crc_t crc;
 
+	if (tiling == LOCAL_I915_FORMAT_MOD_Y_TILED)
+		igt_require(intel_gen(intel_get_drm_devid(drm_fd)) >= 9);
+
+	kmstest_unset_all_crtcs(drm_fd, drm_res);
+
 	/* 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. */
@@ -208,6 +220,12 @@  static void fill_fb_subtest(void)
 	get_fill_crc(LOCAL_I915_FORMAT_MOD_X_TILED, &crc);
 	igt_assert_crc_equal(&crc, &base_crc);
 
+	if (intel_gen(intel_get_drm_devid(drm_fd)) >= 9) {
+		get_fill_crc(LOCAL_I915_FORMAT_MOD_Y_TILED, &crc);
+		igt_assert_crc_equal(&crc, &base_crc);
+	}
+
+	kmstest_unset_all_crtcs(drm_fd, drm_res);
 	igt_remove_fb(drm_fd, &fb);
 }
 
@@ -265,28 +283,38 @@  static const char *format_str(int format_index)
 	}
 }
 
+static const char *tiling_str(int tiling_index)
+{
+	switch (tilings[tiling_index]) {
+	case LOCAL_DRM_FORMAT_MOD_NONE:
+		return "untiled";
+	case LOCAL_I915_FORMAT_MOD_X_TILED:
+		return "xtiled";
+	case LOCAL_I915_FORMAT_MOD_Y_TILED:
+		return "ytiled";
+	default:
+		igt_assert(false);
+	}
+}
+
 igt_main
 {
 	enum igt_draw_method method;
-	int format_index;
+	int format_idx, tiling_idx;
 
 	igt_fixture
 		setup_environment();
 
-	for (format_index = 0; format_index < N_FORMATS; format_index++) {
-		for (method = 0; method < IGT_DRAW_METHOD_COUNT; method++) {
-			igt_subtest_f("draw-method-%s-%s-untiled",
-				      format_str(format_index),
-				      igt_draw_get_method_name(method))
-				draw_method_subtest(method, format_index,
-						    LOCAL_DRM_FORMAT_MOD_NONE);
-			igt_subtest_f("draw-method-%s-%s-tiled",
-				      format_str(format_index),
-				      igt_draw_get_method_name(method))
-				draw_method_subtest(method, format_index,
-						LOCAL_I915_FORMAT_MOD_X_TILED);
-		}
-	}
+	for (format_idx = 0; format_idx < N_FORMATS; format_idx++) {
+	for (method = 0; method < IGT_DRAW_METHOD_COUNT; method++) {
+	for (tiling_idx = 0; tiling_idx < N_TILING_METHODS; tiling_idx++) {
+		igt_subtest_f("draw-method-%s-%s-%s",
+			      format_str(format_idx),
+			      igt_draw_get_method_name(method),
+			      tiling_str(tiling_idx))
+			draw_method_subtest(method, format_idx,
+					    tilings[tiling_idx]);
+	} } }
 
 	igt_subtest("fill-fb")
 		fill_fb_subtest();