Re: [PATCH 30/45] drm/ttm: add a new invalidate notify callback.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 24.09.20 um 07:18 schrieb Dave Airlie:
From: Dave Airlie <airlied@xxxxxxxxxx>

Signed-off-by: Dave Airlie <airlied@xxxxxxxxxx>

NAK, completely unnecessary.

We should rather do the remaining accounting in the already existing release_notify() callback.

That makes much more sense and if I'm not completely mistaken could actually fix a bug in amdgpu.

Christian.

---
  drivers/gpu/drm/ttm/ttm_bo.c    | 4 +++-
  include/drm/ttm/ttm_bo_driver.h | 7 +++++++
  2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index a2a61a8d1394..ba69c682e53b 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -282,7 +282,9 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo)
  {
-	if (bo->bdev->driver->move_notify)
+	if (bo->bdev->driver->invalidate_notify)
+		bo->bdev->driver->invalidate_notify(bo);
+	else if (bo->bdev->driver->move_notify)
  		bo->bdev->driver->move_notify(bo, false, NULL);
ttm_bo_tt_destroy(bo);
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index cfb151dbb2d0..da4afe669664 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -165,6 +165,13 @@ struct ttm_bo_driver {
  	void (*move_notify)(struct ttm_buffer_object *bo,
  			    bool evict,
  			    struct ttm_resource *new_mem);
+
+	/**
+	 * Hook to notify driver about a bo being torn down.
+	 * can be used for invalidation instead of move_notify.
+	 */
+	void (*invalidate_notify)(struct ttm_buffer_object *bo);
+
  	/* notify the driver we are taking a fault on this BO
  	 * and have reserved it */
  	int (*fault_reserve_notify)(struct ttm_buffer_object *bo);

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux