All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	daniel.vetter@ffwll.ch
Subject: [PATCH 3/6] drm/ttm: use the parent resv for ghost objects v2
Date: Fri,  7 Jun 2019 14:50:36 +0200	[thread overview]
Message-ID: <20190607125039.2240-3-christian.koenig@amd.com> (raw)
In-Reply-To: <20190607125039.2240-1-christian.koenig@amd.com>

This way we can even pipeline imported BO evictions.

v2: Limit this to only cases when the parent object uses a separate reservation
    object as well. This fixes another OOM problem.

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

diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 895d77d799e4..95f47d685921 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -517,9 +517,11 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
 	kref_init(&fbo->base.kref);
 	fbo->base.destroy = &ttm_transfered_destroy;
 	fbo->base.acc_size = 0;
-	fbo->base.resv = &fbo->base.ttm_resv;
-	reservation_object_init(fbo->base.resv);
-	ret = reservation_object_trylock(fbo->base.resv);
+	if (bo->resv == &bo->ttm_resv)
+		fbo->base.resv = &fbo->base.ttm_resv;
+
+	reservation_object_init(&fbo->base.ttm_resv);
+	ret = reservation_object_trylock(&fbo->base.ttm_resv);
 	WARN_ON(!ret);
 
 	*new_obj = &fbo->base;
@@ -716,7 +718,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
 		if (ret)
 			return ret;
 
-		reservation_object_add_excl_fence(ghost_obj->resv, fence);
+		reservation_object_add_excl_fence(&ghost_obj->ttm_resv, fence);
 
 		/**
 		 * If we're not moving to fixed memory, the TTM object
@@ -729,7 +731,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
 		else
 			bo->ttm = NULL;
 
-		ttm_bo_unreserve(ghost_obj);
+		reservation_object_unlock(&ghost_obj->ttm_resv);
 		ttm_bo_put(ghost_obj);
 	}
 
@@ -772,7 +774,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,
 		if (ret)
 			return ret;
 
-		reservation_object_add_excl_fence(ghost_obj->resv, fence);
+		reservation_object_add_excl_fence(&ghost_obj->ttm_resv, fence);
 
 		/**
 		 * If we're not moving to fixed memory, the TTM object
@@ -785,7 +787,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,
 		else
 			bo->ttm = NULL;
 
-		ttm_bo_unreserve(ghost_obj);
+		reservation_object_unlock(&ghost_obj->ttm_resv);
 		ttm_bo_put(ghost_obj);
 
 	} else if (from->flags & TTM_MEMTYPE_FLAG_FIXED) {
@@ -841,7 +843,7 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo)
 	if (ret)
 		return ret;
 
-	ret = reservation_object_copy_fences(ghost->resv, bo->resv);
+	ret = reservation_object_copy_fences(&ghost->ttm_resv, bo->resv);
 	/* Last resort, wait for the BO to be idle when we are OOM */
 	if (ret)
 		ttm_bo_wait(bo, false, false);
@@ -850,7 +852,7 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo)
 	bo->mem.mem_type = TTM_PL_SYSTEM;
 	bo->ttm = NULL;
 
-	ttm_bo_unreserve(ghost);
+	reservation_object_unlock(&ghost->ttm_resv);
 	ttm_bo_put(ghost);
 
 	return 0;
-- 
2.17.1

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

  parent reply	other threads:[~2019-06-07 12:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-07 12:50 [PATCH 1/6] dma-buf: add dynamic DMA-buf handling v9 Christian König
2019-06-07 12:50 ` [PATCH 2/6] drm/ttm: remove the backing store if no placement is given Christian König
2019-06-07 12:50 ` Christian König [this message]
2019-06-07 12:50 ` [PATCH 4/6] drm/amdgpu: use allowed_domains for exported DMA-bufs Christian König
2019-06-07 12:50 ` [PATCH 5/6] drm/amdgpu: add independent DMA-buf export v3 Christian König
2019-06-07 12:50 ` [PATCH 6/6] drm/amdgpu: add independent DMA-buf import v6 Christian König
2019-06-07 15:25 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/6] dma-buf: add dynamic DMA-buf handling v9 Patchwork
2019-06-07 15:27 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-06-07 15:44 ` ✗ Fi.CI.BAT: failure " Patchwork
2019-06-17 11:34 [PATCH 1/6] dma-buf: add dynamic DMA-buf handling v10 Christian König
     [not found] ` <20190617113413.1869-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2019-06-17 11:34   ` [PATCH 3/6] drm/ttm: use the parent resv for ghost objects v2 Christian König
2019-06-18 11:54 [PATCH 1/6] dma-buf: add dynamic DMA-buf handling v10 Christian König
2019-06-18 11:54 ` [PATCH 3/6] drm/ttm: use the parent resv for ghost objects v2 Christian König
2019-06-24 13:58 [PATCH 1/6] dma-buf: add dynamic DMA-buf handling v11 Christian König
2019-06-24 13:58 ` [PATCH 3/6] drm/ttm: use the parent resv for ghost objects v2 Christian König
2019-06-25 12:46 [PATCH 1/6] dma-buf: add dynamic DMA-buf handling v12 Christian König
2019-06-25 12:46 ` [PATCH 3/6] drm/ttm: use the parent resv for ghost objects v2 Christian König
2019-06-26 12:23 [PATCH 1/6] dma-buf: add dynamic DMA-buf handling v13 Christian König
     [not found] ` <20190626122310.1498-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2019-06-26 12:23   ` [PATCH 3/6] drm/ttm: use the parent resv for ghost objects v2 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=20190607125039.2240-3-christian.koenig@amd.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=daniel.vetter@ffwll.ch \
    --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.