All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kahola, Mika" <mika.kahola@intel.com>
To: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"Deak, Imre" <imre.deak@intel.com>
Cc: "Welty, Brian" <brian.welty@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t 2/6] tests/gem_render_copy: Separate out mixed tiled ccs subtests
Date: Tue, 3 Dec 2019 14:31:55 +0000	[thread overview]
Message-ID: <125c6606dd9fd18d81401e1cf0fe810ae1193f3e.camel@intel.com> (raw)
In-Reply-To: <20191129103843.5765-3-imre.deak@intel.com>

On Fri, 2019-11-29 at 12:38 +0200, Imre Deak wrote:
> Add separate subtests for the subtests copying from multiple source
> buffers with different tiling formats into the destination buffer.
> The
> vebox engine has restrictions on specifying arbitrary regions in the
> source and destination surfaces, so we can't run these tests using
> that
> engine (at least in their current form).
> 
> Cc: Mika Kahola <mika.kahola@intel.com>
> Cc: Brian Welty <brian.welty@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Imre Deak <imre.deak@intel.com>

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

> ---
>  tests/i915/gem_render_copy.c | 167 ++++++++++++++++++++++++++-------
> --
>  1 file changed, 126 insertions(+), 41 deletions(-)
> 
> diff --git a/tests/i915/gem_render_copy.c
> b/tests/i915/gem_render_copy.c
> index cc8af1e1..15ba1704 100644
> --- a/tests/i915/gem_render_copy.c
> +++ b/tests/i915/gem_render_copy.c
> @@ -197,6 +197,26 @@ static void *linear_copy(data_t *data, struct
> igt_buf *buf)
>  	return linear;
>  }
>  
> +static void
> +copy_from_linear_buf(data_t *data, struct igt_buf *src, struct
> igt_buf *dst)
> +{
> +	void *linear;
> +
> +	igt_assert(src->tiling == I915_TILING_NONE);
> +
> +	gem_set_domain(data->drm_fd, src->bo->handle,
> +		       I915_GEM_DOMAIN_CPU, 0);
> +	linear = gem_mmap__cpu(data->drm_fd, src->bo->handle, 0,
> +			       src->bo->size, PROT_READ);
> +
> +	if (dst->tiling == I915_TILING_Yf)
> +		copy_linear_to_yf(data, dst, linear);
> +	else
> +		copy_linear_to_gtt(data, dst, linear);
> +
> +	munmap(linear, src->bo->size);
> +}
> +
>  static void scratch_buf_write_to_png(data_t *data, struct igt_buf
> *buf,
>  				     const char *filename)
>  {
> @@ -580,7 +600,7 @@ static void test(data_t *data, uint32_t
> src_tiling, uint32_t dst_tiling,
>  		 enum i915_compression dst_compression,
>  		 int flags)
>  {
> -	struct igt_buf dst, src_ccs, dst_ccs, ref;
> +	struct igt_buf ref, src_tiled, src_ccs, dst_ccs, dst;
>  	struct {
>  		struct igt_buf buf;
>  		const char *filename;
> @@ -631,6 +651,9 @@ static void test(data_t *data, uint32_t
> src_tiling, uint32_t dst_tiling,
>  	for (int i = 0; i < num_src; i++)
>  		scratch_buf_init(data, &src[i].buf, WIDTH, HEIGHT,
> src[i].tiling,
>  				 I915_COMPRESSION_NONE);
> +	if (!src_mixed_tiled)
> +		scratch_buf_init(data, &src_tiled, WIDTH, HEIGHT,
> src_tiling,
> +				 I915_COMPRESSION_NONE);
>  	scratch_buf_init(data, &dst, WIDTH, HEIGHT, dst_tiling,
>  			 I915_COMPRESSION_NONE);
>  	if (src_compressed)
> @@ -658,9 +681,15 @@ static void test(data_t *data, uint32_t
> src_tiling, uint32_t dst_tiling,
>  				 &src[i].buf, WIDTH/4, HEIGHT/4,
> WIDTH/2-2, HEIGHT/2-2,
>  				 &ref, src[i].x, src[i].y);
>  
> +	if (!src_mixed_tiled)
> +		copy_from_linear_buf(data, &ref, &src_tiled);
> +
>  	if (opt_dump_png) {
>  		for (int i = 0; i < num_src; i++)
>  			scratch_buf_write_to_png(data, &src[i].buf,
> src[i].filename);
> +		if (!src_mixed_tiled)
> +			scratch_buf_write_to_png(data, &src_tiled,
> +						 "source-tiled.png");
>  		scratch_buf_write_to_png(data, &dst,
> "destination.png");
>  		scratch_buf_write_to_png(data, &ref, "reference.png");
>  	}
> @@ -679,31 +708,51 @@ static void test(data_t *data, uint32_t
> src_tiling, uint32_t dst_tiling,
>  	 *	 |dst|src|
>  	 *	  -------
>  	 */
> -	if (src_compressed)
> -		data->render_copy(data->batch, NULL,
> -				  &dst, 0, 0, WIDTH, HEIGHT,
> -				  &src_ccs, 0, 0);
> +	if (src_mixed_tiled) {
> +		if (dst_compressed)
> +			data->render_copy(data->batch, NULL,
> +					  &dst, 0, 0, WIDTH, HEIGHT,
> +					  &dst_ccs, 0, 0);
>  
> -	for (int i = 0; i < num_src; i++)
> -		data->render_copy(data->batch, NULL,
> -				  &src[i].buf,
> -				  WIDTH/4, HEIGHT/4, WIDTH/2-2,
> HEIGHT/2-2,
> -				  src_compressed ? &src_ccs : &dst,
> -				  src[i].x, src[i].y);
> -
> -	if (src_compressed || dst_compressed)
> -		data->render_copy(data->batch, NULL,
> -				  src_compressed ? &src_ccs : &dst,
> -				  0, 0, WIDTH, HEIGHT,
> -				  dst_compressed ? &dst_ccs : &dst,
> -				  0, 0);
> +		for (int i = 0; i < num_src; i++)
> +			data->render_copy(data->batch, NULL,
> +					  &src[i].buf,
> +					  WIDTH/4, HEIGHT/4, WIDTH/2-2, 
> HEIGHT/2-2,
> +					  dst_compressed ? &dst_ccs :
> &dst,
> +					  src[i].x, src[i].y);
>  
> -	if (dst_compressed)
> -		data->render_copy(data->batch, NULL,
> -				  &dst_ccs,
> -				  0, 0, WIDTH, HEIGHT,
> -				  &dst,
> -				  0, 0);
> +		if (dst_compressed)
> +			data->render_copy(data->batch, NULL,
> +					  &dst_ccs, 0, 0, WIDTH,
> HEIGHT,
> +					  &dst, 0, 0);
> +
> +	} else {
> +		if (src_compression == I915_COMPRESSION_RENDER)
> +			data->render_copy(data->batch, NULL,
> +					  &src_tiled, 0, 0, WIDTH,
> HEIGHT,
> +					  &src_ccs,
> +					  0, 0);
> +
> +		if (dst_compression == I915_COMPRESSION_RENDER) {
> +			data->render_copy(data->batch, NULL,
> +					  src_compressed ? &src_ccs :
> &src_tiled,
> +					  0, 0, WIDTH, HEIGHT,
> +					  &dst_ccs,
> +					  0, 0);
> +
> +			data->render_copy(data->batch, NULL,
> +					  &dst_ccs,
> +					  0, 0, WIDTH, HEIGHT,
> +					  &dst,
> +					  0, 0);
> +		} else {
> +			data->render_copy(data->batch, NULL,
> +					  src_compressed ? &src_ccs :
> &src_tiled,
> +					  0, 0, WIDTH, HEIGHT,
> +					  &dst,
> +					  0, 0);
> +		}
> +	}
>  
>  	if (opt_dump_png){
>  		scratch_buf_write_to_png(data, &dst, "result.png");
> @@ -771,22 +820,45 @@ const char *help_str =
>  	"  -a\tCheck all pixels\n"
>  	;
>  
> -static const char *buf_mode_str(uint32_t tiling,
> -				enum i915_compression compression)
> +static void buf_mode_to_str(uint32_t tiling, bool mixed_tiled,
> +			    enum i915_compression compression,
> +			    char *buf, int buf_size)
>  {
> -	switch (tiling) {
> -	default:
> +	const char *compression_str;
> +	const char *tiling_str;
> +
> +	if (mixed_tiled)
> +		tiling_str = "mixed-tiled";
> +	else switch (tiling) {
>  	case I915_TILING_NONE:
> -		return "linear";
> +		tiling_str = "linear";
> +		break;
>  	case I915_TILING_X:
> -		return "x-tiled";
> +		tiling_str = "x-tiled";
> +		break;
>  	case I915_TILING_Y:
> -		return compression == I915_COMPRESSION_RENDER ? "y-
> tiled-ccs" :
> -								"y-
> tiled";
> +		tiling_str = "y-tiled";
> +		break;
>  	case I915_TILING_Yf:
> -		return compression == I915_COMPRESSION_RENDER ? "yf-
> tiled-ccs" :
> -								"yf-
> tiled";
> +		tiling_str = "yf-tiled";
> +		break;
> +	default:
> +		igt_assert(0);
>  	}
> +
> +	switch (compression) {
> +	case I915_COMPRESSION_NONE:
> +		compression_str = "";
> +		break;
> +	case I915_COMPRESSION_RENDER:
> +		compression_str = "ccs";
> +		break;
> +	default:
> +		igt_assert(0);
> +	}
> +
> +	snprintf(buf, buf_size, "%s%s%s",
> +		 tiling_str, compression_str[0] ? "-" : "",
> compression_str);
>  }
>  
>  igt_main_args("da", NULL, help_str, opt_handler, NULL)
> @@ -811,6 +883,13 @@ igt_main_args("da", NULL, help_str, opt_handler,
> NULL)
>  		  I915_COMPRESSION_NONE,	I915_COMPRESSION_NONE,
>  		  SOURCE_MIXED_TILED, },
>  
> +		{ I915_TILING_NONE,		I915_TILING_Y,
> +		  I915_COMPRESSION_NONE,	I915_COMPRESSION_RENDER,
> +		  SOURCE_MIXED_TILED },
> +		{ I915_TILING_NONE,		I915_TILING_Yf,
> +		  I915_COMPRESSION_NONE,	I915_COMPRESSION_RENDER,
> +		  SOURCE_MIXED_TILED },
> +
>  		{ I915_TILING_Y,		I915_TILING_NONE,
>  		  I915_COMPRESSION_RENDER,	I915_COMPRESSION_NONE
> ,
>  		  0, },
> @@ -874,19 +953,25 @@ igt_main_args("da", NULL, help_str,
> opt_handler, NULL)
>  
>  	for (i = 0; i < ARRAY_SIZE(tests); i++) {
>  		const struct test_desc *t = &tests[i];
> -		const char *src_mode = buf_mode_str(t->src_tiling,
> -						    t-
> >src_compression);
> -		const char *dst_mode = buf_mode_str(t->dst_tiling,
> -						    t-
> >dst_compression);
> +		char src_mode[32];
> +		char dst_mode[32];
>  		const bool src_mixed_tiled = t->flags &
> SOURCE_MIXED_TILED;
>  
> +		buf_mode_to_str(t->src_tiling, src_mixed_tiled,
> +				t->src_compression, src_mode,
> sizeof(src_mode));
> +		buf_mode_to_str(t->dst_tiling, false,
> +				t->dst_compression, dst_mode,
> sizeof(dst_mode));
> +
>  		igt_describe_f("Test render_copy() from a %s to a %s
> buffer.",
>  			       src_mode, dst_mode);
>  
> +		/* Preserve original test names */
> +		if (src_mixed_tiled &&
> +		    t->dst_compression == I915_COMPRESSION_NONE)
> +			src_mode[0] = '\0';
> +
>  		igt_subtest_f("%s%s%s",
> -			      src_mixed_tiled ? "" : src_mode,
> -			      src_mixed_tiled ? "" : "-to-",
> -			      dst_mode)
> +			      src_mode, src_mode[0] ? "-to-" : "",
> dst_mode)
>  			test(&data,
>  			     t->src_tiling, t->dst_tiling,
>  			     t->src_compression, t->dst_compression,
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-12-03 14:31 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-29 10:38 [igt-dev] [PATCH i-g-t 0/6] lib: Add tests validating media compressed surfaces Imre Deak
2019-11-29 10:38 ` [igt-dev] [PATCH i-g-t 1/6] tests/gem_render_copy: Make subtest parameters more explicit Imre Deak
2019-12-03 11:52   ` Kahola, Mika
2019-11-29 10:38 ` [igt-dev] [PATCH i-g-t 2/6] tests/gem_render_copy: Separate out mixed tiled ccs subtests Imre Deak
2019-12-03 14:31   ` Kahola, Mika [this message]
2019-11-29 10:38 ` [igt-dev] [PATCH i-g-t 3/6] lib: Move aux pgtable state prepare/emit to intel_aux_pgtable.c Imre Deak
2019-12-03 14:50   ` Kahola, Mika
2019-11-29 10:38 ` [igt-dev] [PATCH i-g-t 4/6] lib/intel_aux_pgtable: Set MMIO remap for write the AUX pagedir reg Imre Deak
2019-12-04 12:35   ` Kahola, Mika
2019-11-29 10:38 ` [igt-dev] [PATCH i-g-t 5/6] lib: Add vebox copy support Imre Deak
2019-12-04 13:09   ` Kahola, Mika
2019-12-04 13:49   ` [igt-dev] [PATCH v2 " Imre Deak
2019-12-05 10:30     ` Kahola, Mika
2019-12-05  3:30   ` [igt-dev] [PATCH i-g-t " Bai, Guangyao
2019-12-05 13:49     ` Imre Deak
2019-11-29 10:38 ` [igt-dev] [PATCH i-g-t 6/6] tests/gem_render_copy: Add media compression subtests Imre Deak
2019-12-04 13:50   ` [igt-dev] [PATCH v2 " Imre Deak
2019-12-05 11:28     ` Kahola, Mika
2019-11-29 11:19 ` [igt-dev] ✓ Fi.CI.BAT: success for lib: Add tests validating media compressed surfaces Patchwork
2019-11-30  6:06 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-12-04 15:19 ` [igt-dev] ✗ Fi.CI.BAT: failure for lib: Add tests validating media compressed surfaces (rev3) Patchwork
2019-12-04 15:59   ` Imre Deak
2019-12-09  8:36     ` Imre Deak
2019-12-09  9:55       ` Vudum, Lakshminarayana
2019-12-09  9:40 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=125c6606dd9fd18d81401e1cf0fe810ae1193f3e.camel@intel.com \
    --to=mika.kahola@intel.com \
    --cc=brian.welty@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=imre.deak@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.