From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: matthew.auld@intel.com
Subject: Re: [Intel-gfx] [PATCH v2 1/5] drm/i915/gem: Implement object migration
Date: Mon, 28 Jun 2021 11:47:56 +0200 [thread overview]
Message-ID: <bc70ed00-e5a9-e892-c8b2-3c01bd562017@linux.intel.com> (raw)
In-Reply-To: <20210628090943.45690-2-thomas.hellstrom@linux.intel.com>
On 6/28/21 11:09 AM, Thomas Hellström wrote:
> Introduce an interface to migrate objects between regions.
> This is primarily intended to migrate objects to LMEM for display and
> to SYSTEM for dma-buf, but might be reused in one form or another for
> performande-based migration.
>
> v2:
> - Verify that the memory region given as an id really exists.
> (Reported by Matthew Auld)
> - Call i915_gem_object_{init,release}_memory_region() when switching region
> to handle also switching region lists. (Reported by Matthew Auld)
>
> Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> ---
> drivers/gpu/drm/i915/gem/i915_gem_object.c | 96 +++++++++++++++++++
> drivers/gpu/drm/i915/gem/i915_gem_object.h | 12 +++
> .../gpu/drm/i915/gem/i915_gem_object_types.h | 9 ++
> drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 69 +++++++++----
> drivers/gpu/drm/i915/gem/i915_gem_wait.c | 19 ++++
> 5 files changed, 188 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c b/drivers/gpu/drm/i915/gem/i915_gem_object.c
> index 07e8ff9a8aae..52a37619054d 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_object.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c
> @@ -513,6 +513,102 @@ bool i915_gem_object_has_iomem(const struct drm_i915_gem_object *obj)
> return obj->mem_flags & I915_BO_FLAG_IOMEM;
> }
>
> +/**
> + * i915_gem_object_can_migrate - Whether an object likely can be migrated
> + *
> + * @obj: The object to migrate
> + * @id: The region intended to migrate to
> + *
> + * Check whether the object backend supports migration to the
> + * given region. Note that pinning may affect the ability to migrate.
> + *
> + * Return: true if migration is possible, false otherwise.
> + */
> +bool i915_gem_object_can_migrate(struct drm_i915_gem_object *obj,
> + enum intel_region_id id)
> +{
> + struct drm_i915_private *i915 = to_i915(obj->base.dev);
> + unsigned int num_allowed = obj->mm.n_placements;
> + struct intel_memory_region *mr;
> + unsigned int i;
> +
> + GEM_BUG_ON(id >= INTEL_REGION_UNKNOWN);
> + GEM_BUG_ON(obj->mm.madv != I915_MADV_WILLNEED);
> +
> + if (!obj->ops->migrate)
> + return false;
> +
> + mr = i915->mm.regions[id];
> + if (!mr)
> + return false;
Hmm. Should probably switch order between these two, otherwise
can_migrate will always return false on !TTM
/Thomas
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
WARNING: multiple messages have this Message-ID (diff)
From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: matthew.auld@intel.com
Subject: Re: [PATCH v2 1/5] drm/i915/gem: Implement object migration
Date: Mon, 28 Jun 2021 11:47:56 +0200 [thread overview]
Message-ID: <bc70ed00-e5a9-e892-c8b2-3c01bd562017@linux.intel.com> (raw)
In-Reply-To: <20210628090943.45690-2-thomas.hellstrom@linux.intel.com>
On 6/28/21 11:09 AM, Thomas Hellström wrote:
> Introduce an interface to migrate objects between regions.
> This is primarily intended to migrate objects to LMEM for display and
> to SYSTEM for dma-buf, but might be reused in one form or another for
> performande-based migration.
>
> v2:
> - Verify that the memory region given as an id really exists.
> (Reported by Matthew Auld)
> - Call i915_gem_object_{init,release}_memory_region() when switching region
> to handle also switching region lists. (Reported by Matthew Auld)
>
> Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> ---
> drivers/gpu/drm/i915/gem/i915_gem_object.c | 96 +++++++++++++++++++
> drivers/gpu/drm/i915/gem/i915_gem_object.h | 12 +++
> .../gpu/drm/i915/gem/i915_gem_object_types.h | 9 ++
> drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 69 +++++++++----
> drivers/gpu/drm/i915/gem/i915_gem_wait.c | 19 ++++
> 5 files changed, 188 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c b/drivers/gpu/drm/i915/gem/i915_gem_object.c
> index 07e8ff9a8aae..52a37619054d 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_object.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c
> @@ -513,6 +513,102 @@ bool i915_gem_object_has_iomem(const struct drm_i915_gem_object *obj)
> return obj->mem_flags & I915_BO_FLAG_IOMEM;
> }
>
> +/**
> + * i915_gem_object_can_migrate - Whether an object likely can be migrated
> + *
> + * @obj: The object to migrate
> + * @id: The region intended to migrate to
> + *
> + * Check whether the object backend supports migration to the
> + * given region. Note that pinning may affect the ability to migrate.
> + *
> + * Return: true if migration is possible, false otherwise.
> + */
> +bool i915_gem_object_can_migrate(struct drm_i915_gem_object *obj,
> + enum intel_region_id id)
> +{
> + struct drm_i915_private *i915 = to_i915(obj->base.dev);
> + unsigned int num_allowed = obj->mm.n_placements;
> + struct intel_memory_region *mr;
> + unsigned int i;
> +
> + GEM_BUG_ON(id >= INTEL_REGION_UNKNOWN);
> + GEM_BUG_ON(obj->mm.madv != I915_MADV_WILLNEED);
> +
> + if (!obj->ops->migrate)
> + return false;
> +
> + mr = i915->mm.regions[id];
> + if (!mr)
> + return false;
Hmm. Should probably switch order between these two, otherwise
can_migrate will always return false on !TTM
/Thomas
next prev parent reply other threads:[~2021-06-28 9:48 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-28 9:09 [Intel-gfx] [PATCH v2 0/5] drm/i915/gem: Introduce a migrate interface Thomas Hellström
2021-06-28 9:09 ` Thomas Hellström
2021-06-28 9:09 ` [Intel-gfx] [PATCH v2 1/5] drm/i915/gem: Implement object migration Thomas Hellström
2021-06-28 9:09 ` Thomas Hellström
2021-06-28 9:47 ` Thomas Hellström [this message]
2021-06-28 9:47 ` Thomas Hellström
2021-06-28 11:28 ` [Intel-gfx] " kernel test robot
2021-06-28 11:28 ` kernel test robot
2021-06-28 11:28 ` kernel test robot
2021-06-28 12:54 ` [Intel-gfx] " kernel test robot
2021-06-28 12:54 ` kernel test robot
2021-06-28 12:54 ` kernel test robot
2021-06-28 9:09 ` [Intel-gfx] [PATCH v2 2/5] drm/i915/gem: Introduce a selftest for the gem object migrate functionality Thomas Hellström
2021-06-28 9:09 ` Thomas Hellström
2021-06-28 9:09 ` [Intel-gfx] [PATCH v2 3/5] drm/i915/display: Migrate objects to LMEM if possible for display Thomas Hellström
2021-06-28 9:09 ` Thomas Hellström
2021-06-28 9:09 ` [Intel-gfx] [PATCH v2 4/5] drm/i915/gem: Fix same-driver-another-instance dma-buf export Thomas Hellström
2021-06-28 9:09 ` Thomas Hellström
2021-06-28 9:09 ` [Intel-gfx] [PATCH v2 5/5] drm/i915/gem: Migrate to system at dma-buf map time Thomas Hellström
2021-06-28 9:09 ` Thomas Hellström
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=bc70ed00-e5a9-e892-c8b2-3c01bd562017@linux.intel.com \
--to=thomas.hellstrom@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=matthew.auld@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.