Re: [PATCH 3/5] drm/ttm: Add release_notify callback to ttm_bo_driver

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

 



[adding dri-devel]

On 2019-07-09 11:59 p.m., Kuehling, Felix wrote:
> This notifies the driver that a BO is about to be released.
>
> Releasing a BO also invokes the move_notify callback from
> ttm_bo_cleanup_memtype_use, but that happens too late for anything
> that would add fences to the BO and require a delayed delete.
>
> Signed-off-by: Felix Kuehling <Felix.Kuehling@xxxxxxx>
> ---
>   drivers/gpu/drm/ttm/ttm_bo.c    |  3 +++
>   include/drm/ttm/ttm_bo_driver.h | 10 ++++++++++
>   2 files changed, 13 insertions(+)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index 58c403eda04e..2070e8a57ed8 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -671,6 +671,9 @@ static void ttm_bo_release(struct kref *kref)
>   	struct ttm_bo_device *bdev = bo->bdev;
>   	struct ttm_mem_type_manager *man = &bdev->man[bo->mem.mem_type];
>   
> +	if (bo->bdev->driver->release_notify)
> +		bo->bdev->driver->release_notify(bo);
> +
>   	drm_vma_offset_remove(&bdev->vma_manager, &bo->vma_node);
>   	ttm_mem_io_lock(man, false);
>   	ttm_mem_io_free_vm(bo);
> diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
> index c9b8ba492f24..d69121c43e58 100644
> --- a/include/drm/ttm/ttm_bo_driver.h
> +++ b/include/drm/ttm/ttm_bo_driver.h
> @@ -390,6 +390,16 @@ struct ttm_bo_driver {
>   	 * notify driver that a BO was deleted from LRU.
>   	 */
>   	void (*del_from_lru_notify)(struct ttm_buffer_object *bo);
> +
> +	/**
> +	 * Notify the driver that we're about to release a BO
> +	 *
> +	 * @bo: BO that is about to be released
> +	 *
> +	 * Gives the driver a chance to do any cleanup, including
> +	 * adding fences that may force a delayed delete
> +	 */
> +	void (*release_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