From: "Christian König" <deathsimple@vodafone.de>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH 5/7] drm/ttm: add optional LRU removal callback v2
Date: Wed, 6 Apr 2016 11:12:06 +0200 [thread overview]
Message-ID: <1459933928-4663-6-git-send-email-deathsimple@vodafone.de> (raw)
In-Reply-To: <1459933928-4663-1-git-send-email-deathsimple@vodafone.de>
From: Christian König <christian.koenig@amd.com>
Useful for driver specific LRU handling.
v2: fix typo in comment
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
---
drivers/gpu/drm/ttm/ttm_bo.c | 12 +++++++-----
include/drm/ttm/ttm_bo_driver.h | 6 ++++++
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index dbb0bb7..84ad992 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -186,8 +186,12 @@ EXPORT_SYMBOL(ttm_bo_add_to_lru);
int ttm_bo_del_from_lru(struct ttm_buffer_object *bo)
{
+ struct ttm_bo_device *bdev = bo->bdev;
int put_count = 0;
+ if (bdev->driver->lru_removal)
+ bdev->driver->lru_removal(bo);
+
if (!list_empty(&bo->swap)) {
list_del_init(&bo->swap);
++put_count;
@@ -197,11 +201,6 @@ int ttm_bo_del_from_lru(struct ttm_buffer_object *bo)
++put_count;
}
- /*
- * TODO: Add a driver hook to delete from
- * driver-specific LRU's here.
- */
-
return put_count;
}
@@ -235,6 +234,9 @@ void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo)
lockdep_assert_held(&bo->resv->lock.base);
+ if (bdev->driver->lru_removal)
+ bdev->driver->lru_removal(bo);
+
if (bo->mem.placement & TTM_PL_FLAG_NO_EVICT) {
list_del_init(&bo->swap);
list_del_init(&bo->lru);
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 391ef04..23a30b3 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -434,6 +434,12 @@ struct ttm_bo_driver {
*/
int (*io_mem_reserve)(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem);
void (*io_mem_free)(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem);
+
+ /**
+ * Optional driver callback for when BO is removed from the LRU.
+ * Called with LRU lock held immediately before the removal.
+ */
+ void (*lru_removal)(struct ttm_buffer_object *bo);
};
/**
--
2.5.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2016-04-06 9:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-06 9:12 RFC: Some TTM patches Christian König
2016-04-06 9:12 ` [PATCH 1/7] drm/ttm: don't wait for BO on initial allocation Christian König
2016-04-06 16:06 ` Sinclair Yeh
2016-04-13 17:38 ` Christian König
2016-04-13 17:51 ` Sinclair Yeh
2016-04-06 9:12 ` [PATCH 2/7] drm/ttm: remove use_ticket parameter from ttm_bo_reserve Christian König
2016-04-06 9:12 ` [PATCH 3/7] drm/ttm: remove lazy parameter from ttm_bo_wait Christian König
2016-04-06 9:12 ` [PATCH 4/7] drm/ttm: remove unused validation sequence Christian König
2016-04-06 9:12 ` Christian König [this message]
2016-04-06 9:12 ` [PATCH 6/7] drm/ttm: implement LRU add callbacks v2 Christian König
2016-04-06 9:12 ` [PATCH 7/7] drm/amdgpu: prefer VM page tables over normal BOs 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=1459933928-4663-6-git-send-email-deathsimple@vodafone.de \
--to=deathsimple@vodafone.de \
--cc=dri-devel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).