All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Subject: [PATCH 11/12] drm/i915/selftests:  Use i915_gtt_view_is_*()
Date: Tue,  7 Apr 2026 18:50:52 +0300	[thread overview]
Message-ID: <20260407155053.32156-12-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20260407155053.32156-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Replace the naked GTT view type checks with the new
i915_gtt_view_is_*() helpers. This isolates some of
the code from GTT view implementation details.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/selftests/i915_vma.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_vma.c b/drivers/gpu/drm/i915/selftests/i915_vma.c
index 258557388a2d..60dbc6e04f43 100644
--- a/drivers/gpu/drm/i915/selftests/i915_vma.c
+++ b/drivers/gpu/drm/i915/selftests/i915_vma.c
@@ -533,12 +533,11 @@ assert_remapped(struct drm_i915_gem_object *obj,
 	return sg;
 }
 
-static unsigned int remapped_size(enum i915_gtt_view_type view_type,
+static unsigned int remapped_size(const struct i915_gtt_view *view,
 				  const struct intel_remapped_plane_info *a,
 				  const struct intel_remapped_plane_info *b)
 {
-
-	if (view_type == I915_GTT_VIEW_ROTATED)
+	if (i915_gtt_view_is_rotated(view))
 		return a->dst_stride * a->width + b->dst_stride * b->width;
 	else
 		return a->dst_stride * a->height + b->dst_stride * b->height;
@@ -606,11 +605,11 @@ static int igt_vma_rotate_remap(void *arg)
 			max_offset = max_pages - max_offset;
 
 			if (!plane_info[0].dst_stride)
-				plane_info[0].dst_stride = view.type == I915_GTT_VIEW_ROTATED ?
+				plane_info[0].dst_stride = i915_gtt_view_is_rotated(&view) ?
 									plane_info[0].height :
 									plane_info[0].width;
 			if (!plane_info[1].dst_stride)
-				plane_info[1].dst_stride = view.type == I915_GTT_VIEW_ROTATED ?
+				plane_info[1].dst_stride = i915_gtt_view_is_rotated(&view) ?
 									plane_info[1].height :
 									plane_info[1].width;
 
@@ -632,7 +631,7 @@ static int igt_vma_rotate_remap(void *arg)
 						goto out_object;
 					}
 
-					expected_pages = remapped_size(view.type, &plane_info[0], &plane_info[1]);
+					expected_pages = remapped_size(&view, &plane_info[0], &plane_info[1]);
 
 					if (view.type != I915_GTT_VIEW_NORMAL &&
 					    vma->size != expected_pages * PAGE_SIZE) {
@@ -664,13 +663,13 @@ static int igt_vma_rotate_remap(void *arg)
 
 					sg = vma->pages->sgl;
 					for (n = 0; n < ARRAY_SIZE(view.rotated.plane); n++) {
-						if (view.type == I915_GTT_VIEW_ROTATED)
+						if (i915_gtt_view_is_rotated(&view))
 							sg = assert_rotated(obj, &view.rotated, n, sg);
 						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, %d, %d)]\n",
-							       view.type == I915_GTT_VIEW_ROTATED ?
+							       i915_gtt_view_is_rotated(&view) ?
 							       "rotated" : "remapped", n,
 							       plane_info[0].width,
 							       plane_info[0].height,
@@ -1009,7 +1008,7 @@ static int igt_vma_remapped_gtt(void *arg)
 				goto out;
 
 			if (!plane_info[0].dst_stride)
-				plane_info[0].dst_stride = *t == I915_GTT_VIEW_ROTATED ?
+				plane_info[0].dst_stride = i915_gtt_view_is_rotated(&view) ?
 								 p->height : p->width;
 
 			vma = i915_gem_object_ggtt_pin(obj, &view, 0, 0, PIN_MAPPABLE);
@@ -1032,7 +1031,7 @@ static int igt_vma_remapped_gtt(void *arg)
 					unsigned int offset;
 					u32 val = y << 16 | x;
 
-					if (*t == I915_GTT_VIEW_ROTATED)
+					if (i915_gtt_view_is_rotated(&view))
 						offset = (x * plane_info[0].dst_stride + y) * PAGE_SIZE;
 					else
 						offset = (y * plane_info[0].dst_stride + x) * PAGE_SIZE;
@@ -1064,7 +1063,7 @@ static int igt_vma_remapped_gtt(void *arg)
 					u32 exp = y << 16 | x;
 					u32 val;
 
-					if (*t == I915_GTT_VIEW_ROTATED)
+					if (i915_gtt_view_is_rotated(&view))
 						src_idx = rotated_index(&view.rotated, 0, x, y);
 					else
 						src_idx = remapped_index(&view.remapped, 0, x, y);
@@ -1073,7 +1072,7 @@ static int igt_vma_remapped_gtt(void *arg)
 					val = ioread32(&map[offset / sizeof(*map)]);
 					if (val != exp) {
 						pr_err("%s VMA write test failed, expected 0x%x, found 0x%x\n",
-						       *t == I915_GTT_VIEW_ROTATED ? "Rotated" : "Remapped",
+						       i915_gtt_view_is_rotated(&view) ? "Rotated" : "Remapped",
 						       exp, val);
 						i915_vma_unpin_iomap(vma);
 						err = -EINVAL;
-- 
2.52.0


  parent reply	other threads:[~2026-04-07 15:51 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-07 15:50 [PATCH 00/12] drm/i915/fb: Prep work for more generic remapping support Ville Syrjala
2026-04-07 15:50 ` [PATCH 01/12] drm/i915/fb: Nuke intel_tile_row_size() Ville Syrjala
2026-04-08  8:42   ` Jani Nikula
2026-04-07 15:50 ` [PATCH 02/12] drm/i915/fb: Make intel_fb_needs_pot_stride_remap() static Ville Syrjala
2026-04-08  8:43   ` Jani Nikula
2026-04-07 15:50 ` [PATCH 03/12] drm/i915/fb: Reject per-plane remapping with DPT Ville Syrjala
2026-04-08  8:43   ` Jani Nikula
2026-04-07 15:50 ` [PATCH 04/12] drm/xe/fb: Use the correct gtt view for remapped FBs Ville Syrjala
2026-04-08  8:44   ` Jani Nikula
2026-04-07 15:50 ` [PATCH 05/12] drm/xe/fb: Remove weird VMA end alignemnt Ville Syrjala
2026-04-08  8:45   ` Jani Nikula
2026-04-07 15:50 ` [PATCH 06/12] drm/xe/fb: Extract xe_dpt_size() Ville Syrjala
2026-04-08  8:47   ` Jani Nikula
2026-04-07 15:50 ` [PATCH 07/12] drm/i915/vma: Add helpers to check GTT view type Ville Syrjala
2026-04-08  8:50   ` Jani Nikula
2026-04-08  9:11     ` Jani Nikula
2026-04-07 15:50 ` [PATCH 08/12] drm/xe/fb: Use i915_gtt_view_is_*() Ville Syrjala
2026-04-08  8:52   ` Jani Nikula
2026-04-07 15:50 ` [PATCH 09/12] drm/i915/fb: " Ville Syrjala
2026-04-08  8:53   ` Jani Nikula
2026-04-07 15:50 ` [PATCH 10/12] drm/i915/selftests: Eliminate duplicate vma size check Ville Syrjala
2026-04-08  9:01   ` Jani Nikula
2026-04-08 11:28     ` Ville Syrjälä
2026-04-07 15:50 ` Ville Syrjala [this message]
2026-04-08  9:03   ` [PATCH 11/12] drm/i915/selftests: Use i915_gtt_view_is_*() Jani Nikula
2026-04-08  9:04     ` Jani Nikula
2026-04-07 15:50 ` [PATCH 12/12] drm/i915/fb: Use intel_fb_needs_pot_stride_remap() in intel_fb_view_init() Ville Syrjala
2026-04-08  9:09   ` Jani Nikula
2026-04-07 15:57 ` ✗ CI.checkpatch: warning for drm/i915/fb: Prep work for more generic remapping support Patchwork
2026-04-07 15:58 ` ✓ CI.KUnit: success " Patchwork
2026-04-07 16:37 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-07 18:51 ` ✓ i915.CI.BAT: " Patchwork
2026-04-07 19:34 ` ✓ Xe.CI.FULL: " Patchwork
2026-04-08  1:31 ` ✓ i915.CI.Full: " Patchwork
2026-04-10 11:25 ` [PATCH 00/12] " Ville Syrjälä

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=20260407155053.32156-12-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@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 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.