All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	dri-devel@lists.freedesktop.org
Subject: [PATCH v2 4/6] drm/i915/ttm: pass along the I915_BO_ALLOC_CONTIGUOUS
Date: Tue,  8 Jun 2021 09:44:26 +0100	[thread overview]
Message-ID: <20210608084428.142676-5-matthew.auld@intel.com> (raw)
In-Reply-To: <20210608084428.142676-1-matthew.auld@intel.com>

Currently we just ignore the I915_BO_ALLOC_CONTIGUOUS flag, which is
fine since everything is already contiguous with the ttm range manager.
However in the next patch we want to switch over to the ttm buddy
manager, where allocations are by default not contiguous.

v2(Thomas):
    - Forward ALLOC_CONTIG for all regions

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
index 73d52df8f2be..c612275c36c9 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
@@ -86,10 +86,14 @@ i915_ttm_select_tt_caching(const struct drm_i915_gem_object *obj)
 
 static void
 i915_ttm_place_from_region(const struct intel_memory_region *mr,
-			   struct ttm_place *place)
+			   struct ttm_place *place,
+			   unsigned int flags)
 {
 	memset(place, 0, sizeof(*place));
 	place->mem_type = intel_region_to_ttm_type(mr);
+
+	if (flags & I915_BO_ALLOC_CONTIGUOUS)
+		place->flags = TTM_PL_FLAG_CONTIGUOUS;
 }
 
 static void
@@ -100,15 +104,16 @@ i915_ttm_placement_from_obj(const struct drm_i915_gem_object *obj,
 {
 	unsigned int i;
 	unsigned int num_allowed = obj->mm.n_placements;
+	unsigned int flags = obj->flags;
 
 	placement->num_placement = 1;
 	i915_ttm_place_from_region(num_allowed ? obj->mm.placements[0] :
-				   obj->mm.region, requested);
+				   obj->mm.region, requested, flags);
 
 	/* Cache this on object? */
 	placement->num_busy_placement = num_allowed;
 	for (i = 0; i < placement->num_busy_placement; ++i)
-		i915_ttm_place_from_region(obj->mm.placements[i], busy + i);
+		i915_ttm_place_from_region(obj->mm.placements[i], busy + i, flags);
 
 	if (num_allowed == 0) {
 		*busy = *requested;
-- 
2.26.3


WARNING: multiple messages have this Message-ID (diff)
From: Matthew Auld <matthew.auld@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	dri-devel@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH v2 4/6] drm/i915/ttm: pass along the I915_BO_ALLOC_CONTIGUOUS
Date: Tue,  8 Jun 2021 09:44:26 +0100	[thread overview]
Message-ID: <20210608084428.142676-5-matthew.auld@intel.com> (raw)
In-Reply-To: <20210608084428.142676-1-matthew.auld@intel.com>

Currently we just ignore the I915_BO_ALLOC_CONTIGUOUS flag, which is
fine since everything is already contiguous with the ttm range manager.
However in the next patch we want to switch over to the ttm buddy
manager, where allocations are by default not contiguous.

v2(Thomas):
    - Forward ALLOC_CONTIG for all regions

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
index 73d52df8f2be..c612275c36c9 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
@@ -86,10 +86,14 @@ i915_ttm_select_tt_caching(const struct drm_i915_gem_object *obj)
 
 static void
 i915_ttm_place_from_region(const struct intel_memory_region *mr,
-			   struct ttm_place *place)
+			   struct ttm_place *place,
+			   unsigned int flags)
 {
 	memset(place, 0, sizeof(*place));
 	place->mem_type = intel_region_to_ttm_type(mr);
+
+	if (flags & I915_BO_ALLOC_CONTIGUOUS)
+		place->flags = TTM_PL_FLAG_CONTIGUOUS;
 }
 
 static void
@@ -100,15 +104,16 @@ i915_ttm_placement_from_obj(const struct drm_i915_gem_object *obj,
 {
 	unsigned int i;
 	unsigned int num_allowed = obj->mm.n_placements;
+	unsigned int flags = obj->flags;
 
 	placement->num_placement = 1;
 	i915_ttm_place_from_region(num_allowed ? obj->mm.placements[0] :
-				   obj->mm.region, requested);
+				   obj->mm.region, requested, flags);
 
 	/* Cache this on object? */
 	placement->num_busy_placement = num_allowed;
 	for (i = 0; i < placement->num_busy_placement; ++i)
-		i915_ttm_place_from_region(obj->mm.placements[i], busy + i);
+		i915_ttm_place_from_region(obj->mm.placements[i], busy + i, flags);
 
 	if (num_allowed == 0) {
 		*busy = *requested;
-- 
2.26.3

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

  parent reply	other threads:[~2021-06-08  8:45 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08  8:44 [PATCH v2 0/6] Add back the buddy allocator Matthew Auld
2021-06-08  8:44 ` [Intel-gfx] " Matthew Auld
2021-06-08  8:44 ` [PATCH v2 1/6] drm/i915/ttm: add ttm_buddy_man Matthew Auld
2021-06-08  8:44   ` [Intel-gfx] " Matthew Auld
2021-06-08  8:44 ` [PATCH v2 2/6] drm/i915/ttm: add i915_sg_from_buddy_resource Matthew Auld
2021-06-08  8:44   ` [Intel-gfx] " Matthew Auld
2021-06-08  8:44 ` [PATCH v2 3/6] drm/i915/ttm: Calculate the object placement at get_pages time Matthew Auld
2021-06-08  8:44   ` [Intel-gfx] " Matthew Auld
2021-06-08  8:44 ` Matthew Auld [this message]
2021-06-08  8:44   ` [Intel-gfx] [PATCH v2 4/6] drm/i915/ttm: pass along the I915_BO_ALLOC_CONTIGUOUS Matthew Auld
2021-06-08  9:48   ` Thomas Hellström
2021-06-08  9:48     ` [Intel-gfx] " Thomas Hellström
2021-06-08  8:44 ` [PATCH v2 5/6] drm/i915/ttm: switch over to ttm_buddy_man Matthew Auld
2021-06-08  8:44   ` [Intel-gfx] " Matthew Auld
2021-06-08  9:53   ` Thomas Hellström
2021-06-08  9:53     ` [Intel-gfx] " Thomas Hellström
2021-06-08 10:08     ` Matthew Auld
2021-06-08 10:08       ` [Intel-gfx] " Matthew Auld
2021-06-08 10:14       ` Thomas Hellström
2021-06-08 10:14         ` [Intel-gfx] " Thomas Hellström
2021-06-08  8:44 ` [PATCH v2 6/6] drm/i915/ttm: restore min_page_size behaviour Matthew Auld
2021-06-08  8:44   ` [Intel-gfx] " Matthew Auld
2021-06-08  9:49   ` Thomas Hellström
2021-06-08  9:49     ` [Intel-gfx] " Thomas Hellström
2021-06-08  9:13 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for Add back the buddy allocator (rev2) 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=20210608084428.142676-5-matthew.auld@intel.com \
    --to=matthew.auld@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=thomas.hellstrom@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.