dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Dave Airlie <airlied@gmail.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 7/7] drm/ttm: move last binding into the drivers.
Date: Tue, 20 Oct 2020 14:16:35 +0200	[thread overview]
Message-ID: <c200fcda-7f85-c4df-0e34-2bf322932886@amd.com> (raw)
In-Reply-To: <20201020010319.1692445-8-airlied@gmail.com>

Am 20.10.20 um 03:03 schrieb Dave Airlie:
> From: Dave Airlie <airlied@redhat.com>
>
> This moves the call to tt binding into the driver move,
> and drops the driver callback.
>
> Signed-off-by: Dave Airlie <airlied@redhat.com>

amdgpu should now get some cleanup, but that is certainly not topic of 
this patch.

Really nice work, patch is Reviewed-by: Christian König 
<christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    |  7 ++++++-
>   drivers/gpu/drm/nouveau/nouveau_bo.c       |  7 ++++++-
>   drivers/gpu/drm/qxl/qxl_ttm.c              | 14 --------------
>   drivers/gpu/drm/radeon/radeon_ttm.c        |  6 +++++-
>   drivers/gpu/drm/ttm/ttm_bo.c               |  4 ----
>   drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c |  7 ++++++-
>   include/drm/ttm/ttm_bo_driver.h            | 14 --------------
>   7 files changed, 23 insertions(+), 36 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 9aba34b57e60..d1d1bd656153 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -666,6 +666,12 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,
>   	struct ttm_resource *old_mem = &bo->mem;
>   	int r;
>   
> +	if (new_mem->mem_type == TTM_PL_TT) {
> +		r = amdgpu_ttm_backend_bind(bo->bdev, bo->ttm, new_mem);
> +		if (r)
> +			return r;
> +	}
> +
>   	amdgpu_bo_move_notify(bo, evict, new_mem);
>   
>   	/* Can't move a pinned BO */
> @@ -1728,7 +1734,6 @@ static struct ttm_bo_driver amdgpu_bo_driver = {
>   	.ttm_tt_create = &amdgpu_ttm_tt_create,
>   	.ttm_tt_populate = &amdgpu_ttm_tt_populate,
>   	.ttm_tt_unpopulate = &amdgpu_ttm_tt_unpopulate,
> -	.ttm_tt_bind = &amdgpu_ttm_backend_bind,
>   	.ttm_tt_destroy = &amdgpu_ttm_backend_destroy,
>   	.eviction_valuable = amdgpu_ttm_bo_eviction_valuable,
>   	.evict_flags = &amdgpu_evict_flags,
> diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
> index ad0493c5103b..a69bd4098984 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_bo.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
> @@ -1032,6 +1032,12 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,
>   	struct nouveau_drm_tile *new_tile = NULL;
>   	int ret = 0;
>   
> +	if (new_reg->mem_type == TTM_PL_TT) {
> +		ret = nouveau_ttm_tt_bind(bo->bdev, bo->ttm, new_reg);
> +		if (ret)
> +			return ret;
> +	}
> +
>   	nouveau_bo_move_ntfy(bo, evict, new_reg);
>   	ret = ttm_bo_wait_ctx(bo, ctx);
>   	if (ret)
> @@ -1399,7 +1405,6 @@ struct ttm_bo_driver nouveau_bo_driver = {
>   	.ttm_tt_create = &nouveau_ttm_tt_create,
>   	.ttm_tt_populate = &nouveau_ttm_tt_populate,
>   	.ttm_tt_unpopulate = &nouveau_ttm_tt_unpopulate,
> -	.ttm_tt_bind = &nouveau_ttm_tt_bind,
>   	.ttm_tt_destroy = &nouveau_ttm_tt_destroy,
>   	.eviction_valuable = ttm_bo_eviction_valuable,
>   	.evict_flags = nouveau_bo_evict_flags,
> diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
> index a6149e3cc3d2..1cc3c14bc684 100644
> --- a/drivers/gpu/drm/qxl/qxl_ttm.c
> +++ b/drivers/gpu/drm/qxl/qxl_ttm.c
> @@ -100,19 +100,6 @@ int qxl_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
>   /*
>    * TTM backend functions.
>    */
> -
> -static int qxl_ttm_backend_bind(struct ttm_bo_device *bdev,
> -				struct ttm_tt *ttm,
> -				struct ttm_resource *bo_mem)
> -{
> -	if (!ttm->num_pages) {
> -		WARN(1, "nothing to bind %lu pages for mreg %p back %p!\n",
> -		     ttm->num_pages, bo_mem, ttm);
> -	}
> -	/* Not implemented */
> -	return -1;
> -}
> -
>   static void qxl_ttm_backend_destroy(struct ttm_bo_device *bdev,
>   				    struct ttm_tt *ttm)
>   {
> @@ -181,7 +168,6 @@ static int qxl_bo_move(struct ttm_buffer_object *bo, bool evict,
>   
>   static struct ttm_bo_driver qxl_bo_driver = {
>   	.ttm_tt_create = &qxl_ttm_tt_create,
> -	.ttm_tt_bind = &qxl_ttm_backend_bind,
>   	.ttm_tt_destroy = &qxl_ttm_backend_destroy,
>   	.eviction_valuable = ttm_bo_eviction_valuable,
>   	.evict_flags = &qxl_evict_flags,
> diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
> index e427194b0b50..ac916fdd54d1 100644
> --- a/drivers/gpu/drm/radeon/radeon_ttm.c
> +++ b/drivers/gpu/drm/radeon/radeon_ttm.c
> @@ -311,6 +311,11 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict,
>   	struct ttm_resource *old_mem = &bo->mem;
>   	int r;
>   
> +	if (new_mem->mem_type == TTM_PL_TT) {
> +		r = radeon_ttm_tt_bind(bo->bdev, bo->ttm, new_mem);
> +		if (r)
> +			return r;
> +	}
>   	radeon_bo_move_notify(bo, evict, new_mem);
>   
>   	r = ttm_bo_wait_ctx(bo, ctx);
> @@ -823,7 +828,6 @@ static struct ttm_bo_driver radeon_bo_driver = {
>   	.ttm_tt_create = &radeon_ttm_tt_create,
>   	.ttm_tt_populate = &radeon_ttm_tt_populate,
>   	.ttm_tt_unpopulate = &radeon_ttm_tt_unpopulate,
> -	.ttm_tt_bind = &radeon_ttm_tt_bind,
>   	.ttm_tt_destroy = &radeon_ttm_tt_destroy,
>   	.eviction_valuable = ttm_bo_eviction_valuable,
>   	.evict_flags = &radeon_evict_flags,
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index e8ac3bc45d95..4b7fdb49df52 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -256,10 +256,6 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
>   			ret = ttm_tt_populate(bo->bdev, bo->ttm, ctx);
>   			if (ret)
>   				goto out_err;
> -
> -			ret = bdev->driver->ttm_tt_bind(bo->bdev, bo->ttm, mem);
> -			if (ret)
> -				goto out_err;
>   		}
>   	}
>   
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
> index fd82c9ba2d77..de25cf016be2 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
> @@ -737,6 +737,12 @@ static int vmw_move(struct ttm_buffer_object *bo,
>   	struct ttm_resource_manager *new_man = ttm_manager_type(bo->bdev, new_mem->mem_type);
>   	int ret;
>   
> +	if (new_man->use_tt && new_mem->mem_type != TTM_PL_SYSTEM) {
> +		ret = vmw_ttm_bind(bo->bdev, bo->ttm, new_mem);
> +		if (ret)
> +			return ret;
> +	}
> +
>   	vmw_move_notify(bo, evict, new_mem);
>   
>   	if (old_man->use_tt && new_man->use_tt) {
> @@ -769,7 +775,6 @@ struct ttm_bo_driver vmw_bo_driver = {
>   	.ttm_tt_create = &vmw_ttm_tt_create,
>   	.ttm_tt_populate = &vmw_ttm_populate,
>   	.ttm_tt_unpopulate = &vmw_ttm_unpopulate,
> -	.ttm_tt_bind = &vmw_ttm_bind,
>   	.ttm_tt_destroy = &vmw_ttm_destroy,
>   	.eviction_valuable = ttm_bo_eviction_valuable,
>   	.evict_flags = vmw_evict_flags,
> diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
> index 0c4efc169f46..72f106b335e9 100644
> --- a/include/drm/ttm/ttm_bo_driver.h
> +++ b/include/drm/ttm/ttm_bo_driver.h
> @@ -90,20 +90,6 @@ struct ttm_bo_driver {
>   	 */
>   	void (*ttm_tt_unpopulate)(struct ttm_bo_device *bdev, struct ttm_tt *ttm);
>   
> -	/**
> -	 * ttm_tt_bind
> -	 *
> -	 * @bdev: Pointer to a ttm device
> -	 * @ttm: Pointer to a struct ttm_tt.
> -	 * @bo_mem: Pointer to a struct ttm_resource describing the
> -	 * memory type and location for binding.
> -	 *
> -	 * Bind the backend pages into the aperture in the location
> -	 * indicated by @bo_mem. This function should be able to handle
> -	 * differences between aperture and system page sizes.
> -	 */
> -	int (*ttm_tt_bind)(struct ttm_bo_device *bdev, struct ttm_tt *ttm, struct ttm_resource *bo_mem);
> -
>   	/**
>   	 * ttm_tt_destroy
>   	 *

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

      reply	other threads:[~2020-10-20 12:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-20  1:03 [PATCH 0/7] drm/ttm: get rid of bind/unbind Dave Airlie
2020-10-20  1:03 ` [PATCH 1/7] drm/ttm: move some move binds into the drivers Dave Airlie
2020-10-20 10:20   ` Christian König
2020-10-20  1:03 ` [PATCH 2/7] drm/ttm: minor cleanup to move to system Dave Airlie
2020-10-20 10:22   ` Christian König
2020-10-20  1:03 ` [PATCH 3/7] drm/ttm: add move to system into drivers Dave Airlie
2020-10-20 12:03   ` Christian König
2020-10-20  1:03 ` [PATCH 4/7] drm/ttm: drop unbind callback Dave Airlie
2020-10-20 12:04   ` Christian König
2020-10-20  1:03 ` [PATCH 5/7] drm/ttm: remove move to new and inline into remainging place Dave Airlie
2020-10-20 12:06   ` Christian König
2020-10-20  1:03 ` [PATCH 6/7] drm/ttm: drop move notify around move Dave Airlie
2020-10-20 12:15   ` Christian König
2020-10-20  1:03 ` [PATCH 7/7] drm/ttm: move last binding into the drivers Dave Airlie
2020-10-20 12:16   ` Christian König [this message]

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=c200fcda-7f85-c4df-0e34-2bf322932886@amd.com \
    --to=christian.koenig@amd.com \
    --cc=airlied@gmail.com \
    --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