All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/nouveau: fix multihop when move doesn't work.
@ 2020-12-17 20:09 Dave Airlie
  2020-12-17 20:29 ` Daniel Vetter
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Airlie @ 2020-12-17 20:09 UTC (permalink / raw)
  To: dri-devel

From: Dave Airlie <airlied@redhat.com>

As per the radeon/amdgpu fix don't use multihop is hw moves
aren't enabled.

Reported-by: Mike Galbraith <efault@gmx.de>
Tested-by: Mike Galbraith <efault@gmx.de>
Fixes: 0c8c0659d74 ("drm/nouveau/ttm: use multihop")
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/nouveau/nouveau_bo.c | 31 ++++++++++++++--------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 1386b0fc1640..c85b1af06b7b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -942,16 +942,6 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,
 	struct nouveau_drm_tile *new_tile = NULL;
 	int ret = 0;
 
-	if ((old_reg->mem_type == TTM_PL_SYSTEM &&
-	     new_reg->mem_type == TTM_PL_VRAM) ||
-	    (old_reg->mem_type == TTM_PL_VRAM &&
-	     new_reg->mem_type == TTM_PL_SYSTEM)) {
-		hop->fpfn = 0;
-		hop->lpfn = 0;
-		hop->mem_type = TTM_PL_TT;
-		hop->flags = 0;
-		return -EMULTIHOP;
-	}
 
 	if (new_reg->mem_type == TTM_PL_TT) {
 		ret = nouveau_ttm_tt_bind(bo->bdev, bo->ttm, new_reg);
@@ -995,14 +985,25 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,
 
 	/* Hardware assisted copy. */
 	if (drm->ttm.move) {
+		if ((old_reg->mem_type == TTM_PL_SYSTEM &&
+		     new_reg->mem_type == TTM_PL_VRAM) ||
+		    (old_reg->mem_type == TTM_PL_VRAM &&
+		     new_reg->mem_type == TTM_PL_SYSTEM)) {
+			hop->fpfn = 0;
+			hop->lpfn = 0;
+			hop->mem_type = TTM_PL_TT;
+			hop->flags = 0;
+			return -EMULTIHOP;
+		}
 		ret = nouveau_bo_move_m2mf(bo, evict, ctx,
 					   new_reg);
-		if (!ret)
-			goto out;
-	}
+	} else
+		ret = -ENODEV;
 
-	/* Fallback to software copy. */
-	ret = ttm_bo_move_memcpy(bo, ctx, new_reg);
+	if (ret) {
+		/* Fallback to software copy. */
+		ret = ttm_bo_move_memcpy(bo, ctx, new_reg);
+	}
 
 out:
 	if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA) {
-- 
2.27.0

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/nouveau: fix multihop when move doesn't work.
  2020-12-17 20:09 [PATCH] drm/nouveau: fix multihop when move doesn't work Dave Airlie
@ 2020-12-17 20:29 ` Daniel Vetter
  2020-12-18 14:15   ` Daniel Vetter
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Vetter @ 2020-12-17 20:29 UTC (permalink / raw)
  To: Dave Airlie; +Cc: dri-devel

On Fri, Dec 18, 2020 at 06:09:43AM +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
> 
> As per the radeon/amdgpu fix don't use multihop is hw moves
> aren't enabled.
> 
> Reported-by: Mike Galbraith <efault@gmx.de>
> Tested-by: Mike Galbraith <efault@gmx.de>
> Fixes: 0c8c0659d74 ("drm/nouveau/ttm: use multihop")
> Signed-off-by: Dave Airlie <airlied@redhat.com>

Pulled to drm-next directly, will go out to Linus tomorrow.
-Daniel

> ---
>  drivers/gpu/drm/nouveau/nouveau_bo.c | 31 ++++++++++++++--------------
>  1 file changed, 16 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
> index 1386b0fc1640..c85b1af06b7b 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_bo.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
> @@ -942,16 +942,6 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,
>  	struct nouveau_drm_tile *new_tile = NULL;
>  	int ret = 0;
>  
> -	if ((old_reg->mem_type == TTM_PL_SYSTEM &&
> -	     new_reg->mem_type == TTM_PL_VRAM) ||
> -	    (old_reg->mem_type == TTM_PL_VRAM &&
> -	     new_reg->mem_type == TTM_PL_SYSTEM)) {
> -		hop->fpfn = 0;
> -		hop->lpfn = 0;
> -		hop->mem_type = TTM_PL_TT;
> -		hop->flags = 0;
> -		return -EMULTIHOP;
> -	}
>  
>  	if (new_reg->mem_type == TTM_PL_TT) {
>  		ret = nouveau_ttm_tt_bind(bo->bdev, bo->ttm, new_reg);
> @@ -995,14 +985,25 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,
>  
>  	/* Hardware assisted copy. */
>  	if (drm->ttm.move) {
> +		if ((old_reg->mem_type == TTM_PL_SYSTEM &&
> +		     new_reg->mem_type == TTM_PL_VRAM) ||
> +		    (old_reg->mem_type == TTM_PL_VRAM &&
> +		     new_reg->mem_type == TTM_PL_SYSTEM)) {
> +			hop->fpfn = 0;
> +			hop->lpfn = 0;
> +			hop->mem_type = TTM_PL_TT;
> +			hop->flags = 0;
> +			return -EMULTIHOP;
> +		}
>  		ret = nouveau_bo_move_m2mf(bo, evict, ctx,
>  					   new_reg);
> -		if (!ret)
> -			goto out;
> -	}
> +	} else
> +		ret = -ENODEV;
>  
> -	/* Fallback to software copy. */
> -	ret = ttm_bo_move_memcpy(bo, ctx, new_reg);
> +	if (ret) {
> +		/* Fallback to software copy. */
> +		ret = ttm_bo_move_memcpy(bo, ctx, new_reg);
> +	}
>  
>  out:
>  	if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA) {
> -- 
> 2.27.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/nouveau: fix multihop when move doesn't work.
  2020-12-17 20:29 ` Daniel Vetter
@ 2020-12-18 14:15   ` Daniel Vetter
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2020-12-18 14:15 UTC (permalink / raw)
  To: Dave Airlie; +Cc: dri-devel

On Thu, Dec 17, 2020 at 09:29:03PM +0100, Daniel Vetter wrote:
> On Fri, Dec 18, 2020 at 06:09:43AM +1000, Dave Airlie wrote:
> > From: Dave Airlie <airlied@redhat.com>
> > 
> > As per the radeon/amdgpu fix don't use multihop is hw moves
> > aren't enabled.
> > 
> > Reported-by: Mike Galbraith <efault@gmx.de>
> > Tested-by: Mike Galbraith <efault@gmx.de>
> > Fixes: 0c8c0659d74 ("drm/nouveau/ttm: use multihop")

Also fixed the Fixes: line here, it was pointing at something else (old
rebased version from your own tree maybe?).
-Daniel

> > Signed-off-by: Dave Airlie <airlied@redhat.com>
> 
> Pulled to drm-next directly, will go out to Linus tomorrow.
> -Daniel
> 
> > ---
> >  drivers/gpu/drm/nouveau/nouveau_bo.c | 31 ++++++++++++++--------------
> >  1 file changed, 16 insertions(+), 15 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
> > index 1386b0fc1640..c85b1af06b7b 100644
> > --- a/drivers/gpu/drm/nouveau/nouveau_bo.c
> > +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
> > @@ -942,16 +942,6 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,
> >  	struct nouveau_drm_tile *new_tile = NULL;
> >  	int ret = 0;
> >  
> > -	if ((old_reg->mem_type == TTM_PL_SYSTEM &&
> > -	     new_reg->mem_type == TTM_PL_VRAM) ||
> > -	    (old_reg->mem_type == TTM_PL_VRAM &&
> > -	     new_reg->mem_type == TTM_PL_SYSTEM)) {
> > -		hop->fpfn = 0;
> > -		hop->lpfn = 0;
> > -		hop->mem_type = TTM_PL_TT;
> > -		hop->flags = 0;
> > -		return -EMULTIHOP;
> > -	}
> >  
> >  	if (new_reg->mem_type == TTM_PL_TT) {
> >  		ret = nouveau_ttm_tt_bind(bo->bdev, bo->ttm, new_reg);
> > @@ -995,14 +985,25 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,
> >  
> >  	/* Hardware assisted copy. */
> >  	if (drm->ttm.move) {
> > +		if ((old_reg->mem_type == TTM_PL_SYSTEM &&
> > +		     new_reg->mem_type == TTM_PL_VRAM) ||
> > +		    (old_reg->mem_type == TTM_PL_VRAM &&
> > +		     new_reg->mem_type == TTM_PL_SYSTEM)) {
> > +			hop->fpfn = 0;
> > +			hop->lpfn = 0;
> > +			hop->mem_type = TTM_PL_TT;
> > +			hop->flags = 0;
> > +			return -EMULTIHOP;
> > +		}
> >  		ret = nouveau_bo_move_m2mf(bo, evict, ctx,
> >  					   new_reg);
> > -		if (!ret)
> > -			goto out;
> > -	}
> > +	} else
> > +		ret = -ENODEV;
> >  
> > -	/* Fallback to software copy. */
> > -	ret = ttm_bo_move_memcpy(bo, ctx, new_reg);
> > +	if (ret) {
> > +		/* Fallback to software copy. */
> > +		ret = ttm_bo_move_memcpy(bo, ctx, new_reg);
> > +	}
> >  
> >  out:
> >  	if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA) {
> > -- 
> > 2.27.0
> > 
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-18 14:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-17 20:09 [PATCH] drm/nouveau: fix multihop when move doesn't work Dave Airlie
2020-12-17 20:29 ` Daniel Vetter
2020-12-18 14:15   ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.