All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v3 5/8] drm/i915/selftests: Add live vma selftest
Date: Wed, 26 Sep 2018 12:33:34 +0300	[thread overview]
Message-ID: <20180926093334.GQ9144@intel.com> (raw)
In-Reply-To: <153790803046.11177.2314335596455700564@skylake-alporthouse-com>

On Tue, Sep 25, 2018 at 09:40:30PM +0100, Chris Wilson wrote:
> Quoting Ville Syrjala (2018-09-25 20:37:11)
> > 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.
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  .../gpu/drm/i915/selftests/i915_live_selftests.h   |   1 +
> >  drivers/gpu/drm/i915/selftests/i915_vma.c          | 136 +++++++++++++++++++++
> >  2 files changed, 137 insertions(+)
> > 
> > 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 6e84e5cc93a0..e0e4d4578c4d 100644
> > --- a/drivers/gpu/drm/i915/selftests/i915_vma.c
> > +++ b/drivers/gpu/drm/i915/selftests/i915_vma.c
> > @@ -797,3 +797,139 @@ 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);
> > +
> > +       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);
> 
> Ok. Code needs a little more help to allow PIN_MAPPABLE on unfenceable
> vma. Personally, I'd just kill the exception from
> __i915_vma_set_map_and_fenceable(). Nobody actually grabs the fence for
> remapped vma afaict, so we shouldn't end with a wasted fence.

I think intel_pin_and_fence_fb_obj() would grab one. It just checks for
i915_vma_is_map_and_fenceable() currently. But we can easily avoid that
by having intel_plane_uses_fence() return false for remapped/rotated
vma.

> 
> > +                       if (IS_ERR(vma)) {
> > +                               err = PTR_ERR(vma);
> > +                               goto out;
> > +                       }
> 
> Hmm, I guess we might need a GEM_BUG_ON(vma->view.type != *t); and co
> 
> > +
> > +                       /* kludge */
> > +                       vma->flags |= I915_VMA_CAN_FENCE;
> > +
> > +                       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->view.type);
> -Chris

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

  reply	other threads:[~2018-09-26  9:33 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ä [this message]
2018-10-23 16:03   ` [PATCH v4 " Ville Syrjala
2018-10-23 19:05     ` Chris Wilson
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=20180926093334.GQ9144@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --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 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.