All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/ttm: add lru notify to bo driver
@ 2019-01-10 14:52 Chunming Zhou
  2019-01-10 14:52 ` [PATCH 2/2] drm/amdgpu: set bulk_moveable to false when lru changed Chunming Zhou
       [not found] ` <20190110145244.23356-1-david1.zhou-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Chunming Zhou @ 2019-01-10 14:52 UTC (permalink / raw)
  To: Christian.Koenig-5C7GfCeVMHo,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Chunming Zhou

allow driver do somethings when lru changed.

Change-Id: Ie82053da49272881d4b52b1c406f7c221a3fcadf
Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c    | 11 +++++++----
 include/drm/ttm/ttm_bo_driver.h |  9 +++++++++
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 0ec08394e17a..ed79ea0291b7 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -198,19 +198,22 @@ static void ttm_bo_ref_bug(struct kref *list_kref)
 
 void ttm_bo_del_from_lru(struct ttm_buffer_object *bo)
 {
+	struct ttm_bo_device *bdev = bo->bdev;
+	bool notify = false;
+
 	if (!list_empty(&bo->swap)) {
 		list_del_init(&bo->swap);
 		kref_put(&bo->list_kref, ttm_bo_ref_bug);
+		notify = true;
 	}
 	if (!list_empty(&bo->lru)) {
 		list_del_init(&bo->lru);
 		kref_put(&bo->list_kref, ttm_bo_ref_bug);
+		notify = true;
 	}
 
-	/*
-	 * TODO: Add a driver hook to delete from
-	 * driver-specific LRU's here.
-	 */
+	if (notify && bdev->driver->lru_notify)
+		bdev->driver->lru_notify(bo);
 }
 
 void ttm_bo_del_sub_from_lru(struct ttm_buffer_object *bo)
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 1021106438b2..85a9b97e1c9d 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -381,6 +381,15 @@ struct ttm_bo_driver {
 	 */
 	int (*access_memory)(struct ttm_buffer_object *bo, unsigned long offset,
 			     void *buf, int len, int write);
+
+	/**
+	 * struct ttm_bo_driver member lru_notify
+	 *
+	 * @bo: the buffer object to be add
+	 *
+	 * send lru changed event to driver.
+	 */
+	void (*lru_notify)(struct ttm_buffer_object *bo);
 };
 
 /**
-- 
2.17.1

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-10 15:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-10 14:52 [PATCH 1/2] drm/ttm: add lru notify to bo driver Chunming Zhou
2019-01-10 14:52 ` [PATCH 2/2] drm/amdgpu: set bulk_moveable to false when lru changed Chunming Zhou
     [not found] ` <20190110145244.23356-1-david1.zhou-5C7GfCeVMHo@public.gmane.org>
2019-01-10 15:10   ` [PATCH 1/2] drm/ttm: add lru notify to bo driver Michel Dänzer

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.