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

Ville Syrjälä
2026-04-08T11:28:27Z

On Wed, Apr 08, 2026 at 12:01:26PM +0300, Jani Nikula wrote:
> On Tue, 07 Apr 2026, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Both remapped and rotated views need the exact same size check.
>
> This is misleading, see below. At the very least the commit message
> needs amending.
>
> > 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) {
>
> This check becomes stricter now, expecting exact match. Does it matter?

I didn't even notice tbh.

>
> History points at you! ;)
>
> e2e394bffa19 ("drm/i915/selftests: Add mock selftest for remapped vmas")
>
> If you think the change in the check is okay, and with the commit
> message amended,

Hmm. I don't actually know why I did the more relaxed check originally.
Can't think right now why the exact check wouldn't be correct for both.
I suppose actually running the test should tell us...

And now that I think about this, the strict check would be incorrect if
we were testing the plane_alignment stuff. But we seem to lack selftests
for that stuff for some reason. I should really add that, and switch
the size calculations to use the real intel_remapped_info_size()...

>
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>
>
> > - 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);
>
> --
> Jani Nikula, Intel

--
Ville Syrjälä
Intel