dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH 8/8] drm/ttm: drop the extra reservation for pipelined BO moves
Date: Thu,  4 Oct 2018 15:12:50 +0200	[thread overview]
Message-ID: <20181004131250.2373-8-christian.koenig@amd.com> (raw)
In-Reply-To: <20181004131250.2373-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>

The driver is now responsible to allocate enough shared slots.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c | 27 ++++++---------------------
 1 file changed, 6 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 83b4657ffb10..7bdfc1e8236d 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -858,12 +858,11 @@ EXPORT_SYMBOL(ttm_bo_mem_put);
 /**
  * Add the last move fence to the BO and reserve a new shared slot.
  */
-static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo,
-				 struct ttm_mem_type_manager *man,
-				 struct ttm_mem_reg *mem)
+static void ttm_bo_add_move_fence(struct ttm_buffer_object *bo,
+				  struct ttm_mem_type_manager *man,
+				  struct ttm_mem_reg *mem)
 {
 	struct dma_fence *fence;
-	int ret;
 
 	spin_lock(&man->move_lock);
 	fence = dma_fence_get(man->move);
@@ -871,16 +870,9 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo,
 
 	if (fence) {
 		reservation_object_add_shared_fence(bo->resv, fence);
-
-		ret = reservation_object_reserve_shared(bo->resv, 1);
-		if (unlikely(ret))
-			return ret;
-
 		dma_fence_put(bo->moving);
 		bo->moving = fence;
 	}
-
-	return 0;
 }
 
 /**
@@ -908,7 +900,8 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo,
 			return ret;
 	} while (1);
 	mem->mem_type = mem_type;
-	return ttm_bo_add_move_fence(bo, man, mem);
+	ttm_bo_add_move_fence(bo, man, mem);
+	return 0;
 }
 
 static uint32_t ttm_bo_select_caching(struct ttm_mem_type_manager *man,
@@ -977,10 +970,6 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo,
 	bool has_erestartsys = false;
 	int i, ret;
 
-	ret = reservation_object_reserve_shared(bo->resv, 1);
-	if (unlikely(ret))
-		return ret;
-
 	mem->mm_node = NULL;
 	for (i = 0; i < placement->num_placement; ++i) {
 		const struct ttm_place *place = &placement->placement[i];
@@ -1016,11 +1005,7 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo,
 			return ret;
 
 		if (mem->mm_node) {
-			ret = ttm_bo_add_move_fence(bo, man, mem);
-			if (unlikely(ret)) {
-				(*man->func->put_node)(man, mem);
-				return ret;
-			}
+			ttm_bo_add_move_fence(bo, man, mem);
 			break;
 		}
 	}
-- 
2.14.1

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

  parent reply	other threads:[~2018-10-04 13:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-04 13:12 [PATCH 1/8] dma-buf: remove shared fence staging in reservation object Christian König
2018-10-04 13:12 ` [PATCH 4/8] drm/ttm: allow reserving more than one shared slot v2 Christian König
2018-10-04 13:12 ` [PATCH 7/8] drm/amdgpu: always reserve one more shared slot for pipelined BO moves Christian König
     [not found] ` <20181004131250.2373-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-10-04 13:12   ` [PATCH 2/8] dma-buf: allow reserving more than one shared fence slot Christian König
2018-10-04 13:12   ` [PATCH 3/8] dma-buf: test shared slot allocation when mutex debugging is active Christian König
2018-10-04 13:12   ` [PATCH 5/8] drm/amdgpu: fix using shared fence for exported BOs v2 Christian König
     [not found]     ` <20181004131250.2373-5-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-10-23 13:40       ` Michel Dänzer
2018-10-04 13:12   ` [PATCH 6/8] drm/amdgpu: always reserve two slots for the VM Christian König
     [not found]     ` <20181004131250.2373-6-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-10-24  5:27       ` Zhang, Jerry(Junwei)
2018-10-04 13:12   ` Christian König [this message]
2018-10-12  8:22   ` [PATCH 1/8] dma-buf: remove shared fence staging in reservation object Christian König
     [not found]     ` <30ba1fc8-58d5-1c75-406e-d10e68ec4b18-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-10-23 12:20       ` Christian König
     [not found]         ` <42ee3d74-9dac-6573-448c-c70ea28cb9ff-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-10-23 13:40           ` Michel Dänzer
2018-10-24  5:12           ` Huang, Ray
2018-10-24 11:10           ` Huang, Ray
2018-10-24  5:25   ` Zhang, Jerry(Junwei)
2018-10-25 20:15 ` Chris Wilson
2018-10-25 20:20   ` Chris Wilson
2018-10-25 21:21     ` Chris Wilson
2018-10-26  8:01       ` Christian König

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=20181004131250.2373-8-christian.koenig@amd.com \
    --to=ckoenig.leichtzumerken-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox