public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Mika Kahola <mika.kahola@intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t] tests/kms_ccs: Use correct CCS plane for semiplanar formats
Date: Thu, 13 Feb 2020 13:31:26 +0200	[thread overview]
Message-ID: <20200213113126.GA6331@ideak-desk.fi.intel.com> (raw)
In-Reply-To: <20200213093041.10120-1-mika.kahola@intel.com>

On Thu, Feb 13, 2020 at 11:30:41AM +0200, Mika Kahola wrote:
> In case with semiplanar formats, we should use correct CCS plane
> when these formats are under a test.
> 
> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> ---
>  lib/igt_fb.c    |  2 +-
>  lib/igt_fb.h    |  1 +
>  tests/kms_ccs.c | 27 ++++++++++++++++++++-------
>  3 files changed, 22 insertions(+), 8 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 8bdb0a09..0f8435a5 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -359,7 +359,7 @@ static const struct format_desc_struct *lookup_drm_format(uint32_t drm_format)
>  	return NULL;
>  }
>  
> -static bool igt_format_is_yuv_semiplanar(uint32_t format)
> +bool igt_format_is_yuv_semiplanar(uint32_t format)
>  {
>  	const struct format_desc_struct *f = lookup_drm_format(format);
>  
> diff --git a/lib/igt_fb.h b/lib/igt_fb.h
> index 5ed9e35a..587f7a44 100644
> --- a/lib/igt_fb.h
> +++ b/lib/igt_fb.h
> @@ -201,6 +201,7 @@ uint32_t igt_drm_format_to_bpp(uint32_t drm_format);
>  const char *igt_format_str(uint32_t drm_format);
>  bool igt_fb_supported_format(uint32_t drm_format);
>  bool igt_format_is_yuv(uint32_t drm_format);
> +bool igt_format_is_yuv_semiplanar(uint32_t format);
>  bool igt_format_is_fp16(uint32_t drm_format);
>  int igt_format_plane_bpp(uint32_t drm_format, int plane);
>  void igt_format_array_fill(uint32_t **formats_array, unsigned int *count,
> diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c
> index 35c4ceee..284cbbc8 100644
> --- a/tests/kms_ccs.c
> +++ b/tests/kms_ccs.c
> @@ -163,6 +163,16 @@ static void check_all_ccs_planes(int drm_fd, igt_fb_t *fb)
>  	}
>  }
>  
> +static int get_ccs_plane_index(uint32_t format)
> +{
> +	int index = 1;
> +
> +	if (igt_format_is_yuv_semiplanar(format))
> +		return 2;
> +
> +	return index;
> +}
> +
>  static void generate_fb(data_t *data, struct igt_fb *fb,
>  			int width, int height,
>  			enum test_fb_flags fb_flags)
> @@ -172,6 +182,7 @@ static void generate_fb(data_t *data, struct igt_fb *fb,
>  	uint64_t modifier;
>  	cairo_t *cr;
>  	int unit;
> +	int index;
>  	int ret;
>  
>  	if (intel_gen(intel_get_drm_devid(data->drm_fd)) >= 12)
> @@ -196,6 +207,8 @@ static void generate_fb(data_t *data, struct igt_fb *fb,
>  	else
>  		format = data->format;
>  
> +	index = get_ccs_plane_index(format);
> +
>  	igt_create_bo_for_fb(data->drm_fd, width, height, format, modifier, fb);
>  	igt_assert(fb->gem_handle > 0);
>  
> @@ -205,27 +218,27 @@ static void generate_fb(data_t *data, struct igt_fb *fb,
>  		if (fb_flags & FB_MISALIGN_AUX_STRIDE) {
>  			igt_skip_on_f(width <= 1024,
>  				      "FB already has the smallest possible stride\n");
> -			f.pitches[1] -= (unit/2);
> +			f.pitches[index] -= (unit/2);
>  		}
>  
>  		if (fb_flags & FB_SMALL_AUX_STRIDE) {
>  			igt_skip_on_f(width <= 1024,
>  				      "FB already has the smallest possible stride\n");
> -			f.pitches[1] = ALIGN(f.pitches[1]/2, unit);
> +			f.pitches[index] = ALIGN(f.pitches[1]/2, unit);
>  		}
>  
>  		if (fb_flags & FB_ZERO_AUX_STRIDE)
> -			f.pitches[1] = 0;
> +			f.pitches[index] = 0;
>  
>  		/* Put the CCS buffer on a different BO. */
>  		if (data->flags & TEST_BAD_CCS_HANDLE)
>  			f.handles[1] = gem_create(data->drm_fd, fb->size);

The above needs to be updated as well.

Looks ok for the Y CCS plane. We should also check the UV CCS plane, but
that can be added later. With the above fixed:

Reviewed-by: Imre Deak <imre.deak@intel.com>

>  
>  		if (data->flags & TEST_NO_AUX_BUFFER) {
> -			f.handles[1] = 0;
> -			f.modifier[1] = 0;
> -			f.pitches[1] = 0;
> -			f.offsets[1] = 0;
> +			f.handles[index] = 0;
> +			f.modifier[index] = 0;
> +			f.pitches[index] = 0;
> +			f.offsets[index] = 0;
>  		}
>  	}
>  
> -- 
> 2.17.1
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2020-02-13 11:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-13  9:30 [igt-dev] [PATCH i-g-t] tests/kms_ccs: Use correct CCS plane for semiplanar formats Mika Kahola
2020-02-13 11:31 ` Imre Deak [this message]
2020-02-13 14:03   ` Kahola, Mika
2020-02-17 11:28   ` Kahola, Mika
2020-02-13 12:01 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2020-02-13 12:03 ` [igt-dev] [PATCH i-g-t] " Petri Latvala
2020-02-13 14:05   ` Kahola, Mika
2020-02-17  9:55 ` [igt-dev] ✓ Fi.CI.IGT: success for " 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=20200213113126.GA6331@ideak-desk.fi.intel.com \
    --to=imre.deak@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=mika.kahola@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox