public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Imre Deak <imre.deak@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 22/23] drm/i915/selftest: Add remap/rotate vma subtests when dst_stride!=width/height
Date: Fri, 12 Mar 2021 20:03:54 +0200	[thread overview]
Message-ID: <YEutCvl4JdfZ73d7@intel.com> (raw)
In-Reply-To: <20210310221736.2963264-23-imre.deak@intel.com>

On Thu, Mar 11, 2021 at 12:17:35AM +0200, Imre Deak wrote:
> Add selftests to test the POT stride padding functionality added in the
> previous patch.
> 
> Signed-off-by: Imre Deak <imre.deak@intel.com>

Looks sensible.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/selftests/i915_vma.c | 93 +++++++++++++++++++++--
>  1 file changed, 86 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/i915_vma.c b/drivers/gpu/drm/i915/selftests/i915_vma.c
> index 4631db0cdfe5..b88de1257ee9 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_vma.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_vma.c
> @@ -373,6 +373,8 @@ assert_rotated(struct drm_i915_gem_object *obj,
>  	unsigned int x, y;
>  
>  	for (x = 0; x < r->plane[n].width; x++) {
> +		unsigned int left;
> +
>  		for (y = 0; y < r->plane[n].height; y++) {
>  			unsigned long src_idx;
>  			dma_addr_t src;
> @@ -401,6 +403,31 @@ assert_rotated(struct drm_i915_gem_object *obj,
>  
>  			sg = sg_next(sg);
>  		}
> +
> +		left = (r->plane[n].dst_stride - y) * PAGE_SIZE;
> +
> +		if (!left)
> +			continue;
> +
> +		if (!sg) {
> +			pr_err("Invalid sg table: too short at plane %d, (%d, %d)!\n",
> +			       n, x, y);
> +			return ERR_PTR(-EINVAL);
> +		}
> +
> +		if (sg_dma_len(sg) != left) {
> +			pr_err("Invalid sg.length, found %d, expected %u for rotated page (%d, %d)\n",
> +			       sg_dma_len(sg), left, x, y);
> +			return ERR_PTR(-EINVAL);
> +		}
> +
> +		if (sg_dma_address(sg) != 0) {
> +			pr_err("Invalid address, found %pad, expected 0 for remapped page (%d, %d)\n",
> +			       &sg_dma_address(sg), x, y);
> +			return ERR_PTR(-EINVAL);
> +		}
> +
> +		sg = sg_next(sg);
>  	}
>  
>  	return sg;
> @@ -462,15 +489,55 @@ assert_remapped(struct drm_i915_gem_object *obj,
>  			if (!left)
>  				sg = sg_next(sg);
>  		}
> +
> +		if (left) {
> +			pr_err("Unexpected sg tail with %d size for remapped page (%d, %d)\n",
> +			       left,
> +			       x, y);
> +			return ERR_PTR(-EINVAL);
> +		}
> +
> +		left = (r->plane[n].dst_stride - r->plane[n].width) * PAGE_SIZE;
> +
> +		if (!left)
> +			continue;
> +
> +		if (!sg) {
> +			pr_err("Invalid sg table: too short at plane %d, (%d, %d)!\n",
> +			       n, x, y);
> +			return ERR_PTR(-EINVAL);
> +		}
> +
> +		if (sg_dma_len(sg) != left) {
> +			pr_err("Invalid sg.length, found %u, expected %u for remapped page (%d, %d)\n",
> +			       sg_dma_len(sg), left,
> +			       x, y);
> +			return ERR_PTR(-EINVAL);
> +		}
> +
> +		if (sg_dma_address(sg) != 0) {
> +			pr_err("Invalid address, found %pad, expected 0 for remapped page (%d, %d)\n",
> +			       &sg_dma_address(sg),
> +			       x, y);
> +			return ERR_PTR(-EINVAL);
> +		}
> +
> +		sg = sg_next(sg);
> +		left = 0;
>  	}
>  
>  	return sg;
>  }
>  
> -static unsigned int rotated_size(const struct intel_remapped_plane_info *a,
> -				 const struct intel_remapped_plane_info *b)
> +static unsigned int remapped_size(enum i915_ggtt_view_type view_type,
> +				  const struct intel_remapped_plane_info *a,
> +				  const struct intel_remapped_plane_info *b)
>  {
> -	return a->width * a->height + b->width * b->height;
> +
> +	if (view_type == I915_GGTT_VIEW_ROTATED)
> +		return a->dst_stride * a->width + b->dst_stride * b->width;
> +	else
> +		return a->dst_stride * a->height + b->dst_stride * b->height;
>  }
>  
>  static int igt_vma_rotate_remap(void *arg)
> @@ -494,6 +561,11 @@ static int igt_vma_rotate_remap(void *arg)
>  
>  		{ .width = 4, .height = 6, .src_stride = 6 },
>  		{ .width = 6, .height = 4, .src_stride = 6 },
> +
> +		{ .width = 2, .height = 2, .src_stride = 2, .dst_stride = 2 },
> +		{ .width = 3, .height = 3, .src_stride = 3, .dst_stride = 4 },
> +		{ .width = 5, .height = 6, .src_stride = 7, .dst_stride = 8 },
> +
>  		{ }
>  	}, *a, *b;
>  	enum i915_ggtt_view_type types[] = {
> @@ -555,7 +627,7 @@ static int igt_vma_rotate_remap(void *arg)
>  						goto out_object;
>  					}
>  
> -					expected_pages = rotated_size(&plane_info[0], &plane_info[1]);
> +					expected_pages = remapped_size(view.type, &plane_info[0], &plane_info[1]);
>  
>  					if (view.type == I915_GGTT_VIEW_ROTATED &&
>  					    vma->size != expected_pages * PAGE_SIZE) {
> @@ -600,16 +672,18 @@ static int igt_vma_rotate_remap(void *arg)
>  						else
>  							sg = assert_remapped(obj, &view.remapped, n, sg);
>  						if (IS_ERR(sg)) {
> -							pr_err("Inconsistent %s VMA pages for plane %d: [(%d, %d, %d, %d), (%d, %d, %d, %d)]\n",
> +							pr_err("Inconsistent %s VMA pages for plane %d: [(%d, %d, %d, %d, %d), (%d, %d, %d, %d, %d)]\n",
>  							       view.type == I915_GGTT_VIEW_ROTATED ?
>  							       "rotated" : "remapped", n,
>  							       plane_info[0].width,
>  							       plane_info[0].height,
>  							       plane_info[0].src_stride,
> +							       plane_info[0].dst_stride,
>  							       plane_info[0].offset,
>  							       plane_info[1].width,
>  							       plane_info[1].height,
>  							       plane_info[1].src_stride,
> +							       plane_info[1].dst_stride,
>  							       plane_info[1].offset);
>  							err = -EINVAL;
>  							goto out_object;
> @@ -877,6 +951,11 @@ static int igt_vma_remapped_gtt(void *arg)
>  
>  		{ .width = 4, .height = 6, .src_stride = 6 },
>  		{ .width = 6, .height = 4, .src_stride = 6 },
> +
> +		{ .width = 2, .height = 2, .src_stride = 2, .dst_stride = 2 },
> +		{ .width = 3, .height = 3, .src_stride = 3, .dst_stride = 4 },
> +		{ .width = 5, .height = 6, .src_stride = 7, .dst_stride = 8 },
> +
>  		{ }
>  	}, *p;
>  	enum i915_ggtt_view_type types[] = {
> @@ -930,9 +1009,9 @@ static int igt_vma_remapped_gtt(void *arg)
>  					u32 val = y << 16 | x;
>  
>  					if (*t == I915_GGTT_VIEW_ROTATED)
> -						offset = (x * plane_info[0].height + y) * PAGE_SIZE;
> +						offset = (x * plane_info[0].dst_stride + y) * PAGE_SIZE;
>  					else
> -						offset = (y * plane_info[0].width + x) * PAGE_SIZE;
> +						offset = (y * plane_info[0].dst_stride + x) * PAGE_SIZE;
>  
>  					iowrite32(val, &map[offset / sizeof(*map)]);
>  				}
> -- 
> 2.25.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2021-03-12 18:04 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 22:17 [Intel-gfx] [PATCH 00/23] drm/i915: Add support for FBs requiring a POT stride padding Imre Deak
2021-03-10 22:17 ` [Intel-gfx] [PATCH 01/23] drm/i915: Fix rotation setup during plane HW readout Imre Deak
2021-03-11 16:04   ` Ville Syrjälä
2021-03-11 16:52     ` Imre Deak
2021-03-11 17:25       ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 02/23] drm/i915/selftest: Fix error handling in igt_vma_remapped_gtt() Imre Deak
2021-03-11 16:05   ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 03/23] drm/i915/selftest: Fix debug message " Imre Deak
2021-03-11 16:06   ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 04/23] drm/i915: Make sure i915_ggtt_view is inited when creating an FB Imre Deak
2021-03-11 16:07   ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 05/23] drm/i915/selftest: Make sure to init i915_ggtt_view in igt_vma_rotate_remap() Imre Deak
2021-03-11 16:11   ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 06/23] drm/i915: Remove duplicate intel_surf_alignment() declaration Imre Deak
2021-03-11 16:12   ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 07/23] drm/i915/intel_fb: Pull FB plane functions from intel_display_types.h Imre Deak
2021-03-11 16:15   ` Ville Syrjälä
2021-03-11 16:31     ` Imre Deak
2021-03-10 22:17 ` [Intel-gfx] [PATCH 08/23] drm/i915/intel_fb: Pull FB plane functions from skl_universal_plane.c Imre Deak
2021-03-11 16:18   ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 09/23] drm/i915/intel_fb: Pull is_surface_linear() from intel_display.c/skl_universal_plane.c Imre Deak
2021-03-11 16:19   ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 10/23] drm/i915/intel_fb: Pull FB plane functions from intel_sprite.c Imre Deak
2021-03-11 16:20   ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 11/23] drm/i915/intel_fb: Pull FB plane functions from intel_display.c Imre Deak
2021-03-11 16:23   ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 12/23] drm/i915/intel_fb: Unexport intel_fb_check_stride() Imre Deak
2021-03-11 16:23   ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 13/23] drm/i915/intel_fb: s/dev_priv/i915/ Imre Deak
2021-03-11 16:23   ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 14/23] drm/i915/intel_fb: Factor out convert_plane_offset_to_xy() Imre Deak
2021-03-11 16:32   ` Ville Syrjälä
2021-03-11 16:37     ` Ville Syrjälä
2021-03-11 16:57     ` Imre Deak
2021-03-10 22:17 ` [Intel-gfx] [PATCH 15/23] drm/i915/intel_fb: Factor out calc_plane_aligned_offset() Imre Deak
2021-03-11 16:39   ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 16/23] drm/i915/intel_fb: Factor out calc_plane_normal_size() Imre Deak
2021-03-11 16:52   ` Ville Syrjälä
2021-03-11 17:02     ` Imre Deak
2021-03-11 17:26       ` Ville Syrjälä
2021-03-11 17:47         ` Imre Deak
2021-03-11 17:58           ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 17/23] drm/i915/intel_fb: Factor out plane_calc_remap_info() Imre Deak
2021-03-11 17:21   ` Ville Syrjälä
2021-03-11 19:04     ` Imre Deak
2021-03-11 19:35       ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 18/23] drm/i915: Shrink the size of intel_remapped_plane_info struct Imre Deak
2021-03-11 19:45   ` Ville Syrjälä
2021-03-11 22:19     ` Imre Deak
2021-03-12 18:09       ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 19/23] drm/i915/selftest: Unify use of intel_remapped_plane_info in igt_vma_rotate_remap() Imre Deak
2021-03-11 21:17   ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 20/23] drm/i915: s/stride/src_stride/ in the intel_remapped_plane_info struct Imre Deak
2021-03-12 17:51   ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 21/23] drm/i915: Add support for FBs requiring a POT stride alignment Imre Deak
2021-03-12 18:02   ` Ville Syrjälä
2021-03-13 14:36     ` Imre Deak
2021-03-15 14:44       ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 22/23] drm/i915/selftest: Add remap/rotate vma subtests when dst_stride!=width/height Imre Deak
2021-03-12 18:03   ` Ville Syrjälä [this message]
2021-03-10 22:17 ` [Intel-gfx] [PATCH 23/23] drm/i915: For-CI: Force remapping the FB with a POT aligned stride Imre Deak
2021-03-10 23:53 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Add support for FBs requiring a POT stride padding Patchwork
2021-03-10 23:54 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-03-11  0:22 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " 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=YEutCvl4JdfZ73d7@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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