All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.william.auld@gmail.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH v2 32/38] drm/i915: Verify page layout for rotated VMA
Date: Wed, 1 Feb 2017 13:26:25 +0000	[thread overview]
Message-ID: <CAM0jSHPx1+hxvE5QTc8_5wpVqkuaH9N-jjVS0f-t0N75s+vLXA@mail.gmail.com> (raw)
In-Reply-To: <20170119114158.17941-33-chris@chris-wilson.co.uk>

On 19 January 2017 at 11:41, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> Exercise creating rotated VMA and checking the page order within.
>
> v2: Be more creative in rotated params
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/selftests/i915_vma.c | 177 ++++++++++++++++++++++++++++++
>  1 file changed, 177 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/selftests/i915_vma.c b/drivers/gpu/drm/i915/selftests/i915_vma.c
> index b45b392444e4..2bda93f53b47 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_vma.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_vma.c
> @@ -310,11 +310,188 @@ static int igt_vma_pin1(void *arg)
>         return err;
>  }
>
> +static unsigned long rotated_index(const struct intel_rotation_info *r,
> +                                  unsigned int n,
> +                                  unsigned int x,
> +                                  unsigned int y)
> +{
> +       return (r->plane[n].stride * (r->plane[n].height - y - 1) +
> +               r->plane[n].offset + x);
> +}
> +
> +static struct scatterlist *
> +assert_rotated(struct drm_i915_gem_object *obj,
> +              const struct intel_rotation_info *r, unsigned int n,
> +              struct scatterlist *sg)
> +{
> +       unsigned int x, y;
> +
> +       for (x = 0; x < r->plane[n].width; x++) {
> +               for (y = 0; y < r->plane[n].height; y++) {
> +                       unsigned long src_idx;
> +                       dma_addr_t src;
> +
> +                       src_idx = rotated_index(r, n, x, y);
> +                       src = i915_gem_object_get_dma_address(obj, src_idx);
> +
> +                       if (sg_dma_len(sg) != PAGE_SIZE) {
> +                               pr_err("Invalid sg.length, found %d, expected %lu for rotated page (%d, %d) [src index %lu]\n",
> +                                      sg_dma_len(sg), PAGE_SIZE,
> +                                      x, y, src_idx);
> +                               return ERR_PTR(-EINVAL);
> +                       }
> +
> +                       if (sg_dma_address(sg) != src) {
> +                               pr_err("Invalid address for rotated page (%d, %d) [src index %lu]\n",
> +                                      x, y, src_idx);
> +                               return ERR_PTR(-EINVAL);
> +                       }
> +
> +                       sg = ____sg_next(sg);
> +               }
> +       }
> +
> +       return sg;
> +}
> +
> +static unsigned int rotated_size(const struct intel_rotation_plane_info *a,
> +                                const struct intel_rotation_plane_info *b)
> +{
> +       return a->width * a->height + b->width * b->height;
> +}
> +
> +static int igt_vma_rotate(void *arg)
> +{
> +       struct drm_i915_private *i915 = arg;
> +       struct drm_i915_gem_object *obj;
> +       const struct intel_rotation_plane_info planes[] = {
> +               { .width = 1, .height = 1, .stride = 1 },
> +               { .width = 3, .height = 5, .stride = 4 },
> +               { .width = 5, .height = 3, .stride = 7 },
> +               { .width = 6, .height = 4, .stride = 6 },
> +               { }
> +       }, *a, *b;
> +       const unsigned int max_pages = 64;
> +       int err = -ENOMEM;
> +
> +       /* Create VMA for many different combinations of planes and check
> +        * that the page layout within the rotated VMA match our expectations.
> +        */
> +
> +       obj = i915_gem_object_create_internal(i915, max_pages * PAGE_SIZE);
> +       if (IS_ERR(obj))
> +               goto err;
> +
> +       for (a = planes; a->width; a++) {
> +               for (b = planes + ARRAY_SIZE(planes); b-- != planes; ) {
> +                       struct i915_ggtt_view view;
> +                       struct scatterlist *sg;
> +                       unsigned int n, max_offset;
> +
> +                       max_offset = max(a->stride * a->height,
> +                                        b->stride * b->height);
> +                       GEM_BUG_ON(max_offset >= max_pages);
> +                       max_offset = max_pages - max_offset;
> +
> +                       view.type = I915_GGTT_VIEW_ROTATED;
> +                       view.rotated.plane[0] = *a;
> +                       view.rotated.plane[1] = *b;
> +
> +                       for_each_prime_number_from(view.rotated.plane[0].offset, 0, max_offset) {
> +                               for_each_prime_number_from(view.rotated.plane[1].offset, 0, max_offset) {
> +                                       struct i915_address_space *vm =
> +                                               &i915->ggtt.base;
> +                                       struct i915_vma *vma;
> +
> +                                       vma = i915_vma_instance(obj, vm, &view);
> +                                       if (IS_ERR(vma)) {
> +                                               err = PTR_ERR(vma);
> +                                               goto err_object;
> +                                       }
> +
> +                                       if (!i915_vma_is_ggtt(vma) ||
> +                                           vma->vm != vm) {
> +                                               pr_err("VMA is not in the GGTT!\n");
> +                                               err = -EINVAL;
> +                                               goto err_object;
> +                                       }
> +
> +                                       if (memcmp(&vma->ggtt_view, &view, sizeof(view))) {
> +                                               pr_err("VMA mismatch upon creation!\n");
> +                                               err = -EINVAL;
> +                                               goto err_object;
> +                                       }
> +
> +                                       if (i915_vma_compare(vma,
> +                                                            vma->vm,
> +                                                            &vma->ggtt_view)) {
> +                                               pr_err("VMA compmare failed with itself\n");
s/compmare/compare/

Reviewed-by: Matthew Auld <matthew.auld@intel.com>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-02-01 13:26 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-19 11:41 More selftests Chris Wilson
2017-01-19 11:41 ` [PATCH v2 01/38] drm: Provide a driver hook for drm_dev_release() Chris Wilson
2017-01-25 11:12   ` Joonas Lahtinen
2017-01-25 11:16     ` Chris Wilson
2017-01-19 11:41 ` [PATCH v2 02/38] drm/i915: Provide a hook for selftests Chris Wilson
2017-01-25 11:50   ` Joonas Lahtinen
2017-02-01 13:57     ` Chris Wilson
2017-01-19 11:41 ` [PATCH v2 03/38] drm/i915: Add some selftests for sg_table manipulation Chris Wilson
2017-02-01 11:17   ` Tvrtko Ursulin
2017-02-01 11:34     ` Chris Wilson
2017-02-02 12:41       ` Tvrtko Ursulin
2017-02-02 13:38         ` Chris Wilson
2017-01-19 11:41 ` [PATCH v2 04/38] drm/i915: Add unit tests for the breadcrumb rbtree, insert/remove Chris Wilson
2017-01-19 11:41 ` [PATCH v2 05/38] drm/i915: Add unit tests for the breadcrumb rbtree, completion Chris Wilson
2017-01-19 11:41 ` [PATCH v2 06/38] drm/i915: Add unit tests for the breadcrumb rbtree, wakeups Chris Wilson
2017-02-01 11:27   ` Tvrtko Ursulin
2017-02-01 11:43     ` Chris Wilson
2017-02-01 13:19     ` [PATCH v3] " Chris Wilson
2017-02-01 16:57       ` Tvrtko Ursulin
2017-02-01 17:08         ` Chris Wilson
2017-01-19 11:41 ` [PATCH v2 07/38] drm/i915: Mock the GEM device for self-testing Chris Wilson
2017-01-19 11:41 ` [PATCH v2 08/38] drm/i915: Mock a GGTT " Chris Wilson
2017-01-19 11:41 ` [PATCH v2 09/38] drm/i915: Mock infrastructure for request emission Chris Wilson
2017-01-19 11:41 ` [PATCH v2 10/38] drm/i915: Create a fake object for testing huge allocations Chris Wilson
2017-01-19 13:09   ` Matthew Auld
2017-01-19 11:41 ` [PATCH v2 11/38] drm/i915: Add selftests for i915_gem_request Chris Wilson
2017-01-19 11:41 ` [PATCH v2 12/38] drm/i915: Add a simple request selftest for waiting Chris Wilson
2017-01-19 11:41 ` [PATCH v2 13/38] drm/i915: Add a simple fence selftest to i915_gem_request Chris Wilson
2017-01-19 11:41 ` [PATCH v2 14/38] drm/i915: Simple selftest to exercise live requests Chris Wilson
2017-02-01  8:14   ` Joonas Lahtinen
2017-02-01 10:31     ` Chris Wilson
2017-01-19 11:41 ` [PATCH v2 15/38] drm/i915: Test simultaneously submitting requests to all engines Chris Wilson
2017-02-01  8:03   ` Joonas Lahtinen
2017-02-01 10:15     ` Chris Wilson
2017-01-19 11:41 ` [PATCH v2 16/38] drm/i915: Add selftests for object allocation, phys Chris Wilson
2017-01-19 11:41 ` [PATCH v2 17/38] drm/i915: Add a live seftest for GEM objects Chris Wilson
2017-01-19 11:41 ` [PATCH v2 18/38] drm/i915: Test partial mappings Chris Wilson
2017-01-19 11:41 ` [PATCH v2 19/38] drm/i915: Test exhaustion of the mmap space Chris Wilson
2017-01-19 11:41 ` [PATCH v2 20/38] drm/i915: Test coherency of and barriers between cache domains Chris Wilson
2017-01-19 13:01   ` Matthew Auld
2017-01-19 11:41 ` [PATCH v2 21/38] drm/i915: Move uncore selfchecks to live selftest infrastructure Chris Wilson
2017-01-19 11:41 ` [PATCH v2 22/38] drm/i915: Test all fw tables during mock selftests Chris Wilson
2017-01-19 11:41 ` [PATCH v2 23/38] drm/i915: Sanity check all registers for matching fw domains Chris Wilson
2017-01-19 11:41 ` [PATCH v2 24/38] drm/i915: Add some mock tests for dmabuf interop Chris Wilson
2017-01-19 11:41 ` [PATCH v2 25/38] drm/i915: Add initial selftests for i915_gem_gtt Chris Wilson
2017-01-19 11:41 ` [PATCH v2 26/38] drm/i915: Exercise filling the top/bottom portions of the ppgtt Chris Wilson
2017-01-31 12:32   ` Joonas Lahtinen
2017-01-19 11:41 ` [PATCH v2 27/38] drm/i915: Exercise filling the top/bottom portions of the global GTT Chris Wilson
2017-01-19 11:41 ` [PATCH v2 28/38] drm/i915: Fill different pages of the GTT Chris Wilson
2017-01-19 11:41 ` [PATCH v2 29/38] drm/i915: Exercise filling and removing random ranges from the live GTT Chris Wilson
2017-01-20 10:39   ` Matthew Auld
2017-01-19 11:41 ` [PATCH v2 30/38] drm/i915: Test creation of VMA Chris Wilson
2017-01-31 10:50   ` Joonas Lahtinen
2017-02-01 14:07     ` Chris Wilson
2017-01-19 11:41 ` [PATCH v2 31/38] drm/i915: Exercise i915_vma_pin/i915_vma_insert Chris Wilson
2017-01-19 11:41 ` [PATCH v2 32/38] drm/i915: Verify page layout for rotated VMA Chris Wilson
2017-02-01 13:26   ` Matthew Auld [this message]
2017-02-01 14:33   ` Tvrtko Ursulin
2017-02-01 14:55     ` Chris Wilson
2017-02-01 15:44       ` Tvrtko Ursulin
2017-01-19 11:41 ` [PATCH v2 33/38] drm/i915: Test creation of partial VMA Chris Wilson
2017-01-31 12:03   ` Joonas Lahtinen
2017-01-19 11:41 ` [PATCH v2 34/38] drm/i915: Live testing for context execution Chris Wilson
2017-01-25 14:51   ` Joonas Lahtinen
2017-01-19 11:41 ` [PATCH v2 35/38] drm/i915: Initial selftests for exercising eviction Chris Wilson
2017-01-19 11:41 ` [PATCH v2 36/38] drm/i915: Add mock exercise for i915_gem_gtt_reserve Chris Wilson
2017-01-25 13:30   ` Joonas Lahtinen
2017-01-19 11:41 ` [PATCH v2 37/38] drm/i915: Add mock exercise for i915_gem_gtt_insert Chris Wilson
2017-01-25 13:31   ` Joonas Lahtinen
2017-01-19 11:41 ` [PATCH v2 38/38] drm/i915: Add initial selftests for hang detection and resets Chris Wilson
2017-02-01 11:43   ` Mika Kuoppala
2017-02-01 13:31     ` Chris Wilson
2017-01-19 13:54 ` ✗ Fi.CI.BAT: failure for series starting with [v2,01/38] drm: Provide a driver hook for drm_dev_release() Patchwork

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=CAM0jSHPx1+hxvE5QTc8_5wpVqkuaH9N-jjVS0f-t0N75s+vLXA@mail.gmail.com \
    --to=matthew.william.auld@gmail.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.