intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jason Ekstrand <jason@jlekstrand.net>
To: Matthew Auld <matthew.auld@intel.com>, <intel-gfx@lists.freedesktop.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915/selftests: prefer the create_user helper
Date: Wed, 28 Jul 2021 21:14:41 -0500	[thread overview]
Message-ID: <17af00ad680.2817.c6988b7ea6112e3e892765a0d4287e0c@jlekstrand.net> (raw)
In-Reply-To: <20210728155711.1744601-1-matthew.auld@intel.com>


[-- Attachment #1.1: Type: text/plain, Size: 3846 bytes --]

On July 28, 2021 10:57:23 Matthew Auld <matthew.auld@intel.com> wrote:

> No need to hand roll the set_placements stuff, now that that we have a
> helper for this. Also no need to handle the -ENODEV case here, since
> NULL mr implies missing device support, where the for_each_memory_region
> helper will always skip over such regions.
>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Jason Ekstrand <jason@jlekstrand.net>

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>


> ---
> .../drm/i915/gem/selftests/i915_gem_mman.c    | 46 ++-----------------
> 1 file changed, 4 insertions(+), 42 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c 
> b/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
> index 0b2b73d8a364..eed1c2c64e75 100644
> --- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
> +++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
> @@ -860,24 +860,6 @@ static bool can_mmap(struct drm_i915_gem_object *obj, 
> enum i915_mmap_type type)
>  return !no_map;
> }
>
> -static void object_set_placements(struct drm_i915_gem_object *obj,
> -  struct intel_memory_region **placements,
> -  unsigned int n_placements)
> -{
> - GEM_BUG_ON(!n_placements);
> -
> - if (n_placements == 1) {
> - struct drm_i915_private *i915 = to_i915(obj->base.dev);
> - struct intel_memory_region *mr = placements[0];
> -
> - obj->mm.placements = &i915->mm.regions[mr->id];
> - obj->mm.n_placements = 1;
> - } else {
> - obj->mm.placements = placements;
> - obj->mm.n_placements = n_placements;
> - }
> -}
> -
> #define expand32(x) (((x) << 0) | ((x) << 8) | ((x) << 16) | ((x) << 24))
> static int __igt_mmap(struct drm_i915_private *i915,
>       struct drm_i915_gem_object *obj,
> @@ -972,15 +954,10 @@ static int igt_mmap(void *arg)
>  struct drm_i915_gem_object *obj;
>  int err;
>
> - obj = i915_gem_object_create_region(mr, sizes[i], 0, I915_BO_ALLOC_USER);
> - if (obj == ERR_PTR(-ENODEV))
> - continue;
> -
> + obj = __i915_gem_object_create_user(i915, sizes[i], &mr, 1);
>  if (IS_ERR(obj))
>  return PTR_ERR(obj);
>
> - object_set_placements(obj, &mr, 1);
> -
>  err = __igt_mmap(i915, obj, I915_MMAP_TYPE_GTT);
>  if (err == 0)
>  err = __igt_mmap(i915, obj, I915_MMAP_TYPE_WC);
> @@ -1101,15 +1078,10 @@ static int igt_mmap_access(void *arg)
>  struct drm_i915_gem_object *obj;
>  int err;
>
> - obj = i915_gem_object_create_region(mr, PAGE_SIZE, 0, I915_BO_ALLOC_USER);
> - if (obj == ERR_PTR(-ENODEV))
> - continue;
> -
> + obj = __i915_gem_object_create_user(i915, PAGE_SIZE, &mr, 1);
>  if (IS_ERR(obj))
>  return PTR_ERR(obj);
>
> - object_set_placements(obj, &mr, 1);
> -
>  err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_GTT);
>  if (err == 0)
>  err = __igt_mmap_access(i915, obj, I915_MMAP_TYPE_WB);
> @@ -1248,15 +1220,10 @@ static int igt_mmap_gpu(void *arg)
>  struct drm_i915_gem_object *obj;
>  int err;
>
> - obj = i915_gem_object_create_region(mr, PAGE_SIZE, 0, I915_BO_ALLOC_USER);
> - if (obj == ERR_PTR(-ENODEV))
> - continue;
> -
> + obj = __i915_gem_object_create_user(i915, PAGE_SIZE, &mr, 1);
>  if (IS_ERR(obj))
>  return PTR_ERR(obj);
>
> - object_set_placements(obj, &mr, 1);
> -
>  err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_GTT);
>  if (err == 0)
>  err = __igt_mmap_gpu(i915, obj, I915_MMAP_TYPE_WC);
> @@ -1405,15 +1372,10 @@ static int igt_mmap_revoke(void *arg)
>  struct drm_i915_gem_object *obj;
>  int err;
>
> - obj = i915_gem_object_create_region(mr, PAGE_SIZE, 0, I915_BO_ALLOC_USER);
> - if (obj == ERR_PTR(-ENODEV))
> - continue;
> -
> + obj = __i915_gem_object_create_user(i915, PAGE_SIZE, &mr, 1);
>  if (IS_ERR(obj))
>  return PTR_ERR(obj);
>
> - object_set_placements(obj, &mr, 1);
> -
>  err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_GTT);
>  if (err == 0)
>  err = __igt_mmap_revoke(i915, obj, I915_MMAP_TYPE_WC);
> --
> 2.26.3


[-- Attachment #1.2: Type: text/html, Size: 7450 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

      parent reply	other threads:[~2021-07-29  2:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-28 15:57 Matthew Auld
2021-07-28 20:38 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2021-07-28 21:06 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2021-07-29  2:14 ` Jason Ekstrand [this message]

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=17af00ad680.2817.c6988b7ea6112e3e892765a0d4287e0c@jlekstrand.net \
    --to=jason@jlekstrand.net \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --subject='Re: [Intel-gfx] [PATCH] drm/i915/selftests: prefer the create_user helper' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).