All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: [PATCH v3 35/38] drm: Apply range restriction after color adjustment when allocation
Date: Fri, 16 Dec 2016 19:25:47 +0000	[thread overview]
Message-ID: <20161216192550.8352-36-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <20161216192550.8352-1-chris@chris-wilson.co.uk>

mm->color_adjust() compares the hole with its neighbouring nodes. They
only abutt before we restrict the hole, so we have to apply color_adjust
before we apply the range restriction.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/drm_mm.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index c0024719f32b..e279ac7c7aaf 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -410,14 +410,12 @@ static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node,
 
 	DRM_MM_BUG_ON(!drm_mm_hole_follows(hole_node) || node->allocated);
 
-	if (adj_start < start)
-		adj_start = start;
-	if (adj_end > end)
-		adj_end = end;
-
 	if (mm->color_adjust)
 		mm->color_adjust(hole_node, color, &adj_start, &adj_end);
 
+	adj_start = max(adj_start, start);
+	adj_end = min(adj_end, end);
+
 	if (flags & DRM_MM_CREATE_TOP)
 		adj_start = adj_end - size;
 
@@ -625,17 +623,15 @@ static struct drm_mm_node *drm_mm_search_free_in_range_generic(const struct drm_
 			       flags & DRM_MM_SEARCH_BELOW) {
 		u64 hole_size = adj_end - adj_start;
 
-		if (adj_start < start)
-			adj_start = start;
-		if (adj_end > end)
-			adj_end = end;
-
 		if (mm->color_adjust) {
 			mm->color_adjust(entry, color, &adj_start, &adj_end);
 			if (adj_end <= adj_start)
 				continue;
 		}
 
+		adj_start = max(adj_start, start);
+		adj_end = min(adj_end, end);
+
 		if (!check_free_hole(adj_start, adj_end, size, alignment))
 			continue;
 
-- 
2.11.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2016-12-16 19:25 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-16 19:25 drm_mm fixes, take 3, final? Chris Wilson
2016-12-16 19:25 ` [PATCH v3 01/38] drm/i915: Use the MRU stack search after evicting Chris Wilson
2016-12-19 12:55   ` Chris Wilson
2016-12-16 19:25 ` [PATCH v3 02/38] drm: Use drm_mm_nodes() as shorthand for the list of nodes under struct drm_mm Chris Wilson
2016-12-16 19:25 ` [PATCH v3 03/38] drm: Compile time enabling for asserts in drm_mm Chris Wilson
2016-12-16 19:25 ` [PATCH v3 04/38] lib: Add a simple prime number generator Chris Wilson
2016-12-16 19:38   ` Chris Wilson
2016-12-17 12:41   ` [PATCH] " Chris Wilson
2016-12-19 10:05     ` [PATCH v6] " Chris Wilson
2016-12-16 19:25 ` [PATCH v3 05/38] drm: Add a simple generator of random permutations Chris Wilson
2016-12-16 19:25 ` [PATCH v3 06/38] drm: Add some kselftests for the DRM range manager (struct drm_mm) Chris Wilson
2016-12-16 19:25 ` [PATCH v3 07/38] drm: kselftest for drm_mm_init() Chris Wilson
2016-12-16 19:25 ` [PATCH v3 08/38] drm: kselftest for drm_mm_debug() Chris Wilson
2016-12-16 19:25 ` [PATCH v3 09/38] drm: kselftest for drm_mm_reserve_node() Chris Wilson
2016-12-16 19:25 ` [PATCH v3 10/38] drm: kselftest for drm_mm_insert_node() Chris Wilson
2016-12-16 19:25 ` [PATCH v3 11/38] drm: kselftest for drm_mm_replace_node() Chris Wilson
2016-12-16 19:25 ` [PATCH v3 12/38] drm: kselftest for drm_mm_insert_node_in_range() Chris Wilson
2016-12-17 10:16   ` [PATCH] " Chris Wilson
2016-12-16 19:25 ` [PATCH v3 13/38] drm: kselftest for drm_mm and alignment Chris Wilson
2016-12-16 19:25 ` [PATCH v3 14/38] drm: kselftest for drm_mm and eviction Chris Wilson
2016-12-16 19:25 ` [PATCH v3 15/38] drm: kselftest for drm_mm and range restricted eviction Chris Wilson
2016-12-16 19:25 ` [PATCH v3 16/38] drm: kselftest for drm_mm and top-down allocation Chris Wilson
2016-12-17 10:17   ` [PATCH] " Chris Wilson
2016-12-16 19:25 ` [PATCH v3 17/38] drm: kselftest for drm_mm and color adjustment Chris Wilson
2016-12-16 19:25 ` [PATCH v3 18/38] drm: kselftest for drm_mm and color eviction Chris Wilson
2016-12-16 19:25 ` [PATCH v3 19/38] drm: kselftest for drm_mm and restricted " Chris Wilson
2016-12-16 19:25 ` [PATCH v3 20/38] drm/i915: Build DRM range manager selftests for CI Chris Wilson
2016-12-16 19:25 ` [PATCH v3 21/38] drm: Promote drm_mm alignment to u64 Chris Wilson
2016-12-16 19:25 ` [PATCH v3 22/38] drm: Fix kerneldoc for drm_mm_scan_remove_block() Chris Wilson
2016-12-16 19:25 ` [PATCH v3 23/38] drm: Detect overflow in drm_mm_reserve_node() Chris Wilson
2016-12-16 19:25 ` [PATCH v3 24/38] drm: Simplify drm_mm_clean() Chris Wilson
2016-12-16 19:25 ` [PATCH v3 25/38] drm: Add asserts to catch overflow in drm_mm_init() and drm_mm_init_scan() Chris Wilson
2016-12-16 19:25 ` [PATCH v3 26/38] drm: Extract struct drm_mm_scan from struct drm_mm Chris Wilson
2016-12-16 19:25 ` [PATCH v3 27/38] drm: Rename prev_node to hole in drm_mm_scan_add_block() Chris Wilson
2016-12-16 19:25 ` [PATCH v3 28/38] drm: Unconditionally do the range check " Chris Wilson
2016-12-16 19:25 ` [PATCH v3 29/38] drm: Fix application of color vs range restriction when scanning drm_mm Chris Wilson
2016-12-16 19:25 ` [PATCH v3 30/38] drm: Compute tight evictions for drm_mm_scan Chris Wilson
2016-12-16 19:25 ` [PATCH v3 31/38] drm: Optimise power-of-two alignments in drm_mm_scan_add_block() Chris Wilson
2016-12-16 19:25 ` [PATCH v3 32/38] drm: Simplify drm_mm scan-list manipulation Chris Wilson
2016-12-16 19:25 ` [PATCH v3 33/38] drm: Apply tight eviction scanning to color_adjust Chris Wilson
2016-12-16 19:25 ` [PATCH v3 34/38] drm: Wrap drm_mm_node.hole_follows Chris Wilson
2016-12-16 19:25 ` Chris Wilson [this message]
2016-12-16 19:25 ` [PATCH v3 36/38] drm: Use drm_mm_insert_node_in_range_generic() for everyone Chris Wilson
2016-12-16 19:25 ` [PATCH v3 37/38] drm: Improve drm_mm search (and fix topdown allocation) with rbtrees Chris Wilson
2016-12-20 14:20   ` [PATCH v3] " Chris Wilson
2016-12-16 19:25 ` [PATCH v3 38/38] drm: kselftest for drm_mm and bottom-up allocation Chris Wilson
2016-12-16 20:23 ` ✗ Fi.CI.BAT: warning for series starting with [v3,01/38] drm/i915: Use the MRU stack search after evicting Patchwork
2016-12-17 10:45 ` ✓ Fi.CI.BAT: success for series starting with [v3,01/38] drm/i915: Use the MRU stack search after evicting (rev3) Patchwork
2016-12-17 13:15 ` ✗ Fi.CI.BAT: warning for series starting with [v3,01/38] drm/i915: Use the MRU stack search after evicting (rev4) Patchwork
2016-12-19 10:45 ` ✗ Fi.CI.BAT: failure for series starting with [v3,01/38] drm/i915: Use the MRU stack search after evicting (rev5) Patchwork
2016-12-20 16:45 ` ✓ Fi.CI.BAT: success for series starting with [v3,01/38] drm/i915: Use the MRU stack search after evicting (rev6) Patchwork
2016-12-23  4:07 ` drm_mm crash with multi threads Mark yao
2016-12-23  5:57   ` [Intel-gfx] " Rob Clark
2016-12-23  6:31     ` Mark yao

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=20161216192550.8352-36-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --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.