All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v4 5/8] drm/i915/selftests: Add live vma selftest
Date: Tue, 23 Oct 2018 20:05:26 +0100	[thread overview]
Message-ID: <154032152612.9962.14710472595516830669@skylake-alporthouse-com> (raw)
In-Reply-To: <20181023160317.10185-1-ville.syrjala@linux.intel.com>

Quoting Ville Syrjala (2018-10-23 17:03:17)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Add a live selftest to excercise rotated/remapped vmas. We simply
> write through the rotated/remapped vma, and confirm that the data
> appears in the right page when read through the normal vma.
> 
> Not sure what the fallout of making all rotated/remapped vmas
> mappable/fenceable would be, hence I just hacked it in the test.
> 
> v2: Grab rpm reference (Chris)
>     GEM_BUG_ON(view.type not as expected) (Chris)
>     Allow CAN_FENCE for rotated/remapped vmas (Chris)
>     Update intel_plane_uses_fence() to ask for a fence
>     only for normal vmas on gen4+
> 
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_vma.c               |   8 -
>  drivers/gpu/drm/i915/intel_display.c          |   4 +-
>  .../drm/i915/selftests/i915_live_selftests.h  |   1 +
>  drivers/gpu/drm/i915/selftests/i915_vma.c     | 140 ++++++++++++++++++
>  4 files changed, 144 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
> index 2070e44eaa03..6fe0749dec32 100644
> --- a/drivers/gpu/drm/i915/i915_vma.c
> +++ b/drivers/gpu/drm/i915/i915_vma.c
> @@ -463,14 +463,6 @@ void __i915_vma_set_map_and_fenceable(struct i915_vma *vma)
>         GEM_BUG_ON(!i915_vma_is_ggtt(vma));
>         GEM_BUG_ON(!vma->fence_size);
>  
> -       /*
> -        * Explicitly disable for rotated VMA since the display does not
> -        * need the fence and the VMA is not accessible to other users.
> -        */
> -       if (vma->ggtt_view.type == I915_GGTT_VIEW_ROTATED ||
> -           vma->ggtt_view.type == I915_GGTT_VIEW_REMAPPED)
> -               return;

:)

>         fenceable = (vma->node.size >= vma->fence_size &&
>                      IS_ALIGNED(vma->node.start, vma->fence_alignment));
>  
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 41f7e0795b14..582e8d192abd 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2037,7 +2037,9 @@ static bool intel_plane_uses_fence(const struct intel_plane_state *plane_state)
>         struct intel_plane *plane = to_intel_plane(plane_state->base.plane);
>         struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
>  
> -       return INTEL_GEN(dev_priv) < 4 || plane->has_fbc;
> +       return INTEL_GEN(dev_priv) < 4 ||
> +               (plane->has_fbc &&
> +                plane_state->view.type == I915_GGTT_VIEW_NORMAL);

Hmm. We only want to use a common fence for FBC so that we have
automatic tracking. Ok. Memory is starting to fade back in.

>  struct i915_vma *
> diff --git a/drivers/gpu/drm/i915/selftests/i915_live_selftests.h b/drivers/gpu/drm/i915/selftests/i915_live_selftests.h
> index a15713cae3b3..095e25e92a36 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_live_selftests.h
> +++ b/drivers/gpu/drm/i915/selftests/i915_live_selftests.h
> @@ -15,6 +15,7 @@ selftest(workarounds, intel_workarounds_live_selftests)
>  selftest(requests, i915_request_live_selftests)
>  selftest(objects, i915_gem_object_live_selftests)
>  selftest(dmabuf, i915_gem_dmabuf_live_selftests)
> +selftest(vma, i915_vma_live_selftests)
>  selftest(coherency, i915_gem_coherency_live_selftests)
>  selftest(gtt, i915_gem_gtt_live_selftests)
>  selftest(gem, i915_gem_live_selftests)
> diff --git a/drivers/gpu/drm/i915/selftests/i915_vma.c b/drivers/gpu/drm/i915/selftests/i915_vma.c
> index 64c5055c83f9..208629057839 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_vma.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_vma.c
> @@ -799,3 +799,143 @@ int i915_vma_mock_selftests(void)
>         return err;
>  }
>  
> +static int igt_vma_remapped_gtt(void *arg)
> +{
> +       struct drm_i915_private *i915 = arg;
> +       const struct intel_remapped_plane_info planes[] = {
> +               { .width = 1, .height = 1, .stride = 1 },
> +               { .width = 2, .height = 2, .stride = 2 },
> +               { .width = 4, .height = 4, .stride = 4 },
> +               { .width = 8, .height = 8, .stride = 8 },
> +
> +               { .width = 3, .height = 5, .stride = 3 },
> +               { .width = 3, .height = 5, .stride = 4 },
> +               { .width = 3, .height = 5, .stride = 5 },
> +
> +               { .width = 5, .height = 3, .stride = 5 },
> +               { .width = 5, .height = 3, .stride = 7 },
> +               { .width = 5, .height = 3, .stride = 9 },
> +
> +               { .width = 4, .height = 6, .stride = 6 },
> +               { .width = 6, .height = 4, .stride = 6 },
> +               { }
> +       }, *p;
> +       enum i915_ggtt_view_type types[] = {
> +               I915_GGTT_VIEW_ROTATED,
> +               I915_GGTT_VIEW_REMAPPED,
> +               0,
> +       }, *t;
> +       struct drm_i915_gem_object *obj;
> +       int err = 0;
> +
> +       obj = i915_gem_object_create_internal(i915, 10 * 10 * PAGE_SIZE);
> +       if (IS_ERR(obj))
> +               return PTR_ERR(obj);
> +
> +       mutex_lock(&i915->drm.struct_mutex);
> +
> +       intel_runtime_pm_get(i915);
> +
> +       for (t = types; *t; t++) {
> +               for (p = planes; p->width; p++) {
> +                       struct i915_ggtt_view view = {
> +                               .type = *t,
> +                               .rotated.plane[0] = *p,
> +                       };
> +                       struct i915_vma *vma;
> +                       u32 __iomem *map;
> +                       unsigned int x, y;
> +                       int err;
> +
> +                       err = i915_gem_object_set_to_gtt_domain(obj, true);
> +                       if (err)
> +                               goto out;
> +
> +                       vma = i915_gem_object_ggtt_pin(obj, &view, 0, 0, PIN_MAPPABLE);
> +                       if (IS_ERR(vma)) {
> +                               err = PTR_ERR(vma);
> +                               goto out;
> +                       }
> +
> +                       GEM_BUG_ON(vma->ggtt_view.type != *t);
> +
> +                       map = i915_vma_pin_iomap(vma);
> +                       i915_vma_unpin(vma);
> +                       if (IS_ERR(map)) {
> +                               err = PTR_ERR(map);
> +                               goto out;
> +                       }
> +
> +                       for (y = 0 ; y < p->height; y++) {
> +                               for (x = 0 ; x < p->width; x++) {
> +                                       unsigned int offset;
> +                                       u32 val = y << 16 | x;
> +
> +                                       if (*t == I915_GGTT_VIEW_ROTATED)
> +                                               offset = (x * p->height + y) * PAGE_SIZE;
> +                                       else
> +                                               offset = (y * p->width + x) * PAGE_SIZE;
> +
> +                                       iowrite32(val, &map[offset / sizeof(*map)]);
> +                               }
> +                       }
> +
> +                       i915_vma_unpin_iomap(vma);
> +
> +                       vma = i915_gem_object_ggtt_pin(obj, NULL, 0, 0, PIN_MAPPABLE);
> +                       if (IS_ERR(vma)) {
> +                               err = PTR_ERR(vma);
> +                               goto out;
> +                       }
> +
> +                       GEM_BUG_ON(vma->ggtt_view.type != I915_GGTT_VIEW_NORMAL);
> +
> +                       map = i915_vma_pin_iomap(vma);
> +                       i915_vma_unpin(vma);
> +                       if (IS_ERR(map)) {
> +                               err = PTR_ERR(map);
> +                               goto out;
> +                       }
> +
> +                       for (y = 0 ; y < p->height; y++) {
> +                               for (x = 0 ; x < p->width; x++) {
> +                                       unsigned int offset, src_idx;
> +                                       u32 exp = y << 16 | x;
> +                                       u32 val;
> +
> +                                       if (*t == I915_GGTT_VIEW_ROTATED)
> +                                               src_idx = rotated_index(&view.rotated, 0, x, y);
> +                                       else
> +                                               src_idx = remapped_index(&view.remapped, 0, x, y);
> +                                       offset = src_idx * PAGE_SIZE;
> +
> +                                       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_GGTT_VIEW_ROTATED ? "Rotated" : "Remapped",
> +                                                      val, exp);
> +                                               i915_vma_unpin_iomap(vma);
> +                                               goto out;
> +                                       }
> +                               }
> +                       }
> +                       i915_vma_unpin_iomap(vma);
> +               }
> +       }
> +
> +out:
> +       intel_runtime_pm_put(i915);
> +       mutex_unlock(&i915->drm.struct_mutex);
> +       i915_gem_object_put(obj);
> +
> +       return err;
> +}
> +
> +int i915_vma_live_selftests(struct drm_i915_private *i915)
> +{
> +       static const struct i915_subtest tests[] = {
> +               SUBTEST(igt_vma_remapped_gtt),
> +       };
> +
> +       return i915_subtests(tests, i915);
> +}

Neat,
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-10-23 19:05 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-25 19:37 [PATCH v3 0/8] drm/i915: GTT remapping for display Ville Syrjala
2018-09-25 19:37 ` [PATCH v3 1/8] drm/i915: Make sure fb gtt offsets stay within 32bits Ville Syrjala
2018-09-25 20:29   ` Chris Wilson
2018-09-26  9:27     ` Ville Syrjälä
2018-09-26 20:09       ` Chris Wilson
2018-09-27 12:24         ` Ville Syrjälä
2018-10-23 16:02   ` [PATCH v4 " Ville Syrjala
2018-10-23 18:49     ` Chris Wilson
2018-10-23 19:16       ` Ville Syrjälä
2018-09-25 19:37 ` [PATCH v3 2/8] drm/i915: Decouple SKL stride units from intel_fb_stride_alignment() Ville Syrjala
2018-10-23 18:50   ` Chris Wilson
2018-09-25 19:37 ` [PATCH v3 3/8] drm/i915: Add a new "remapped" gtt_view Ville Syrjala
2018-09-26  7:50   ` Tvrtko Ursulin
2018-10-01 15:03     ` Ville Syrjälä
2018-10-01 15:12       ` Chris Wilson
2018-10-01 15:27         ` Ville Syrjälä
2018-10-01 15:37           ` Chris Wilson
2018-10-01 15:48             ` Tvrtko Ursulin
2018-10-05 18:42               ` Ville Syrjälä
2018-10-09  8:24                 ` Tvrtko Ursulin
2018-10-09  8:41                   ` Chris Wilson
2018-10-09 11:54                   ` Ville Syrjälä
2018-10-10  7:04                     ` Tvrtko Ursulin
2018-10-01 15:38           ` Tvrtko Ursulin
2018-10-01 15:35         ` Tvrtko Ursulin
2018-10-23 16:02   ` [PATCH v4 " Ville Syrjala
2018-10-23 18:56     ` Chris Wilson
2018-10-23 19:10       ` Ville Syrjälä
2018-10-26  9:19     ` Tvrtko Ursulin
2018-10-26 12:43       ` Ville Syrjälä
2018-10-26 12:48         ` Tvrtko Ursulin
2018-09-25 19:37 ` [PATCH v3 4/8] drm/i915/selftests: Add mock selftest for remapped vmas Ville Syrjala
2018-09-25 20:22   ` Chris Wilson
2018-09-26  9:28     ` Ville Syrjälä
2018-10-23 16:03   ` [PATCH v4 " Ville Syrjala
2018-10-23 19:02     ` Chris Wilson
2018-10-23 19:14       ` Ville Syrjälä
2018-09-25 19:37 ` [PATCH v3 5/8] drm/i915/selftests: Add live vma selftest Ville Syrjala
2018-09-25 20:19   ` Chris Wilson
2018-09-25 20:40   ` Chris Wilson
2018-09-26  9:33     ` Ville Syrjälä
2018-10-23 16:03   ` [PATCH v4 " Ville Syrjala
2018-10-23 19:05     ` Chris Wilson [this message]
2018-09-25 19:37 ` [PATCH v3 6/8] drm/i915: Overcome display engine stride limits via GTT remapping Ville Syrjala
2018-10-23 19:16   ` Chris Wilson
2018-10-25 13:45     ` Ville Syrjälä
2018-09-25 19:37 ` [PATCH v3 7/8] drm/i915: Bump gen4+ fb stride limit to 256KiB Ville Syrjala
2018-09-25 20:13   ` Chris Wilson
2018-09-28 19:19     ` Ville Syrjälä
2018-09-25 19:37 ` [PATCH v3 8/8] drm/i915: Bump gen7+ fb size limits to 16kx16k Ville Syrjala
2018-09-25 19:59   ` Chris Wilson
2018-09-26  9:25     ` Ville Syrjälä
2018-09-25 20:05 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: GTT remapping for display Patchwork
2018-09-25 20:08 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-09-25 20:30 ` ✓ Fi.CI.BAT: success " Patchwork
2018-09-25 21:21 ` ✓ Fi.CI.IGT: " Patchwork
2018-10-23 16:21 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: GTT remapping for display (rev5) Patchwork
2018-10-23 16:24 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-10-23 16:43 ` ✓ Fi.CI.BAT: success " Patchwork
2018-10-23 18:13 ` ✓ Fi.CI.IGT: " Patchwork
2019-01-09  9:45 ` [PATCH v3 0/8] drm/i915: GTT remapping for display Timo Aaltonen

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=154032152612.9962.14710472595516830669@skylake-alporthouse-com \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.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 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.