[PATCH 10/12] drm/i915/selftests: Eliminate duplicate vma size check

Ville Syrjala
2026-04-07T15:51:35Z

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

Both remapped and rotated views need the exact same size check.
Currently that is being done separately for each type. Share
the code by just checking for !NORMAL view. This test doesn't
use I915_GTT_VIEW_PARTIAL so the inverse check is fine here.

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

diff --git a/drivers/gpu/drm/i915/selftests/i915_vma.c b/drivers/gpu/drm/i915/selftests/i915_vma.c
index 7c4111e60f2e..258557388a2d 100644
--- a/drivers/gpu/drm/i915/selftests/i915_vma.c
+++ b/drivers/gpu/drm/i915/selftests/i915_vma.c
@@ -634,7 +634,7 @@ static int igt_vma_rotate_remap(void *arg)

expected_pages = remapped_size(view.type, &plane_info[0], &plane_info[1]);

- if (view.type == I915_GTT_VIEW_ROTATED &&
+ if (view.type != I915_GTT_VIEW_NORMAL &&
vma->size != expected_pages * PAGE_SIZE) {
pr_err("VMA is wrong size, expected %lu, found %llu\n",
PAGE_SIZE * expected_pages, vma->size);
@@ -642,14 +642,6 @@ static int igt_vma_rotate_remap(void *arg)
goto out_object;
}

- if (view.type == I915_GTT_VIEW_REMAPPED &&
- vma->size > expected_pages * PAGE_SIZE) {
- pr_err("VMA is wrong size, expected %lu, found %llu\n",
- PAGE_SIZE * expected_pages, vma->size);
- err = -EINVAL;
- goto out_object;
- }
-
if (vma->pages->nents > expected_pages) {
pr_err("sg table is wrong sizeo, expected %u, found %u nents\n",
expected_pages, vma->pages->nents);
--
2.52.0