All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Amber.Lin-5C7GfCeVMHo@public.gmane.org,
	felix.kuehling-5C7GfCeVMHo@public.gmane.org,
	funfunctor-dczkZgxz+BNUPWh3PAxdjQ@public.gmane.org
Subject: [PATCH] drm/ttm: partial revert "cleanup ttm_tt_(unbind|destroy)" v2
Date: Fri, 22 Jul 2016 15:10:13 +0200	[thread overview]
Message-ID: <1469193013-11482-1-git-send-email-deathsimple@vodafone.de> (raw)

From: Christian König <christian.koenig@amd.com>

We still need to unbind explicitely during a move.

This partial reverts commit ff20caa0bcbfef9f7686f8d1868a3b990921afd6.

v2: remove unnecessary check and unused variable

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo_util.c |  1 +
 drivers/gpu/drm/ttm/ttm_tt.c      | 19 ++++++++++++-------
 include/drm/ttm/ttm_bo_driver.h   |  9 +++++++++
 3 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 0c389a5..6c412c3 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -53,6 +53,7 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
 	int ret;
 
 	if (old_mem->mem_type != TTM_PL_SYSTEM) {
+		ttm_tt_unbind(ttm);
 		ttm_bo_free_old_node(bo);
 		ttm_flag_masked(&old_mem->placement, TTM_PL_FLAG_SYSTEM,
 				TTM_PL_MASK_MEM);
diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
index d28d4333..526e5a7 100644
--- a/drivers/gpu/drm/ttm/ttm_tt.c
+++ b/drivers/gpu/drm/ttm/ttm_tt.c
@@ -166,16 +166,10 @@ EXPORT_SYMBOL(ttm_tt_set_placement_caching);
 
 void ttm_tt_destroy(struct ttm_tt *ttm)
 {
-	int ret;
-
 	if (ttm == NULL)
 		return;
 
-	if (ttm->state == tt_bound) {
-		ret = ttm->func->unbind(ttm);
-		BUG_ON(ret);
-		ttm->state = tt_unbound;
-	}
+	ttm_tt_unbind(ttm);
 
 	if (ttm->state == tt_unbound)
 		ttm_tt_unpopulate(ttm);
@@ -255,6 +249,17 @@ void ttm_dma_tt_fini(struct ttm_dma_tt *ttm_dma)
 }
 EXPORT_SYMBOL(ttm_dma_tt_fini);
 
+void ttm_tt_unbind(struct ttm_tt *ttm)
+{
+	int ret;
+
+	if (ttm->state == tt_bound) {
+		ret = ttm->func->unbind(ttm);
+		BUG_ON(ret);
+		ttm->state = tt_unbound;
+	}
+}
+
 int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem)
 {
 	int ret = 0;
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 141cefb..e7d81a8 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -628,6 +628,15 @@ extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem);
 extern void ttm_tt_destroy(struct ttm_tt *ttm);
 
 /**
+ * ttm_ttm_unbind:
+ *
+ * @ttm: The struct ttm_tt.
+ *
+ * Unbind a struct ttm_tt.
+ */
+extern void ttm_tt_unbind(struct ttm_tt *ttm);
+
+/**
  * ttm_tt_swapin:
  *
  * @ttm: The struct ttm_tt.
-- 
2.5.0

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

             reply	other threads:[~2016-07-22 13:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-22 13:10 Christian König [this message]
2016-07-22 15:08 ` [PATCH] drm/ttm: partial revert "cleanup ttm_tt_(unbind|destroy)" v2 Sean Paul
     [not found] ` <1469193013-11482-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-07-22 13:12   ` Edward O'Callaghan
2016-07-27  2:26   ` Michel Dänzer
     [not found]     ` <95d462b5-7c20-2f40-c406-48f5aece0817-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-07-27 21:27       ` Felix Kuehling
     [not found]         ` <58e8df15-98dd-facc-acb6-68f94a937374-5C7GfCeVMHo@public.gmane.org>
2016-08-05 15:06           ` Felix Kuehling
     [not found]             ` <67b3c224-29e0-0a98-6c3a-8439744149da-5C7GfCeVMHo@public.gmane.org>
2016-08-11 19:52               ` Reverted another change to fix buffer move hangs (was Re: [PATCH] drm/ttm: partial revert "cleanup ttm_tt_(unbind|destroy)" v2) Felix Kuehling
     [not found]                 ` <c76c7703-6c0d-0d2a-ba9f-c012d74c01bf-5C7GfCeVMHo@public.gmane.org>
2016-08-11 20:31                   ` Deucher, Alexander
     [not found]                     ` <MWHPR12MB16948D7420076C10DCFAEEBBF71E0-Gy0DoCVfaSW4WA4dJ5YXGAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-08-12 23:22                       ` Felix Kuehling
     [not found]                         ` <12c479b4-64d0-952c-f9d2-decd25533251-5C7GfCeVMHo@public.gmane.org>
2016-08-13  9:25                           ` Christian König
     [not found]                             ` <c016cb14-f262-7432-f4ef-cdbb638807f4-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-08-15 19:06                               ` Felix Kuehling
     [not found]                                 ` <d120fde0-a175-c9b5-a3ab-b6840207190e-5C7GfCeVMHo@public.gmane.org>
2016-08-15 21:03                                   ` Alex Deucher
     [not found]                                     ` <CADnq5_M2orK5FoDD5+xZjhStj6mRRkRNho+tLHRuvKq27nSHZQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-08-16  7:53                                       ` Christian König
     [not found]                                         ` <abfdc55c-f95c-327f-fa9e-114f0b3884e3-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-08-16 18:45                                           ` Felix Kuehling
2016-08-04 10:18       ` [PATCH] drm/ttm: partial revert "cleanup ttm_tt_(unbind|destroy)" v2 Christian König
     [not found]         ` <53b30c35-782a-2668-ea8b-199efae8b650-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-08-05  1:33           ` Michel Dänzer
2016-07-27 21:55   ` Deucher, Alexander

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=1469193013-11482-1-git-send-email-deathsimple@vodafone.de \
    --to=deathsimple-antagkrnahcb1svskn2v4q@public.gmane.org \
    --cc=Amber.Lin-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=felix.kuehling-5C7GfCeVMHo@public.gmane.org \
    --cc=funfunctor-dczkZgxz+BNUPWh3PAxdjQ@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 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.