diff mbox series

[05/45] drm/nouveau/ttm: handle ttm moves properly.

Message ID 20200924051845.397177-6-airlied@gmail.com (mailing list archive)
State New, archived
Headers show
Series TTM move refactoring | expand

Commit Message

Dave Airlie Sept. 24, 2020, 5:18 a.m. UTC
From: Dave Airlie <airlied@redhat.com>

The idea is to flip the core over to calling the driver always,
so add support for moves here.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/nouveau/nouveau_bo.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Christian König Sept. 24, 2020, 11:11 a.m. UTC | #1
Am 24.09.20 um 07:18 schrieb Dave Airlie:
> From: Dave Airlie <airlied@redhat.com>
>
> The idea is to flip the core over to calling the driver always,
> so add support for moves here.
>
> Signed-off-by: Dave Airlie <airlied@redhat.com>

Acked-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/nouveau/nouveau_bo.c | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
> index 8d51cfca07c8..2c10a84b2cc0 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_bo.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
> @@ -1057,6 +1057,18 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,
>   		goto out;
>   	}
>   
> +	if (old_reg->mem_type == TTM_PL_SYSTEM &&
> +	    new_reg->mem_type == TTM_PL_TT) {
> +		ttm_bo_move_null(bo, new_reg);
> +		goto out;
> +	}
> +
> +	if (old_reg->mem_type == TTM_PL_TT &&
> +	    new_reg->mem_type == TTM_PL_SYSTEM) {
> +		ret = ttm_bo_move_ttm(bo, ctx, new_reg);
> +		goto out;
> +	}
> +
>   	/* Hardware assisted copy. */
>   	if (drm->ttm.move) {
>   		if (new_reg->mem_type == TTM_PL_SYSTEM)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 8d51cfca07c8..2c10a84b2cc0 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -1057,6 +1057,18 @@  nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,
 		goto out;
 	}
 
+	if (old_reg->mem_type == TTM_PL_SYSTEM &&
+	    new_reg->mem_type == TTM_PL_TT) {
+		ttm_bo_move_null(bo, new_reg);
+		goto out;
+	}
+
+	if (old_reg->mem_type == TTM_PL_TT &&
+	    new_reg->mem_type == TTM_PL_SYSTEM) {
+		ret = ttm_bo_move_ttm(bo, ctx, new_reg);
+		goto out;
+	}
+
 	/* Hardware assisted copy. */
 	if (drm->ttm.move) {
 		if (new_reg->mem_type == TTM_PL_SYSTEM)