All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/nouveau: fix suspend bug in nvc0 fence implementation
@ 2013-02-19 10:20 Maarten Lankhorst
       [not found] ` <CAMuW1wcx8BEkase+S_+bmZp6b+CFunrmAd6PDNaZONFYLfpG-g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Maarten Lankhorst @ 2013-02-19 10:20 UTC (permalink / raw)
  To: dri-devel, nouveau

Everywhere else the constant is multiplied by 16/4, so it looks like
nvc0_fence_suspend/resume is buggy here.

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Cc: stable@vger.kernel.org [3.7+]

---

diff --git a/drivers/gpu/drm/nouveau/nvc0_fence.c
b/drivers/gpu/drm/nouveau/nvc0_fence.c
index 85a0e78..4f46d8b 100644
--- a/drivers/gpu/drm/nouveau/nvc0_fence.c
+++ b/drivers/gpu/drm/nouveau/nvc0_fence.c
@@ -161,11 +161,12 @@ nvc0_fence_suspend(struct nouveau_drm *drm)
 	struct nouveau_fifo *pfifo = nouveau_fifo(drm->device);
 	struct nvc0_fence_priv *priv = drm->fence;
 	int i;
+	u32 chan = pfifo->max + 1;

-	priv->suspend = vmalloc((pfifo->max + 1) * sizeof(u32));
+	priv->suspend = vmalloc(chan * sizeof(u32));
 	if (priv->suspend) {
-		for (i = 0; i <= pfifo->max; i++)
-			priv->suspend[i] = nouveau_bo_rd32(priv->bo, i);
+		for (i = 0; i < chan; i++)
+			priv->suspend[i] = nouveau_bo_rd32(priv->bo, i * 16/4);
 	}

 	return priv->suspend != NULL;
@@ -177,10 +178,11 @@ nvc0_fence_resume(struct nouveau_drm *drm)
 	struct nouveau_fifo *pfifo = nouveau_fifo(drm->device);
 	struct nvc0_fence_priv *priv = drm->fence;
 	int i;
+	u32 chan = pfifo->max + 1;

 	if (priv->suspend) {
-		for (i = 0; i <= pfifo->max; i++)
-			nouveau_bo_wr32(priv->bo, i, priv->suspend[i]);
+		for (i = 0; i < chan; i++)
+			nouveau_bo_wr32(priv->bo, i * 16/4, priv->suspend[i]);
 		vfree(priv->suspend);
 		priv->suspend = NULL;
 	}

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

* Re: [PATCH] drm/nouveau: fix suspend bug in nvc0 fence implementation
       [not found] ` <CAMuW1wcx8BEkase+S_+bmZp6b+CFunrmAd6PDNaZONFYLfpG-g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-02-19 19:49   ` Marcin Slusarz
       [not found]     ` <20130219194938.GA3080-OI9uyE9O0yo@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Marcin Slusarz @ 2013-02-19 19:49 UTC (permalink / raw)
  To: Maarten Lankhorst, Ben Skeggs
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On Tue, Feb 19, 2013 at 10:20:55AM +0000, Maarten Lankhorst wrote:
> Everywhere else the constant is multiplied by 16/4, so it looks like
> nvc0_fence_suspend/resume is buggy here.
> 
> Signed-off-by: Maarten Lankhorst <m.b.lankhorst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [3.7+]

Yay. It will probably fix https://bugs.freedesktop.org/show_bug.cgi?id=59168.
(note: it doesn't apply on top of nouveau/master)

Reviewed-by: Marcin Slusarz <marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

> ---
> 
> diff --git a/drivers/gpu/drm/nouveau/nvc0_fence.c
> b/drivers/gpu/drm/nouveau/nvc0_fence.c
> index 85a0e78..4f46d8b 100644
> --- a/drivers/gpu/drm/nouveau/nvc0_fence.c
> +++ b/drivers/gpu/drm/nouveau/nvc0_fence.c
> @@ -161,11 +161,12 @@ nvc0_fence_suspend(struct nouveau_drm *drm)
>  	struct nouveau_fifo *pfifo = nouveau_fifo(drm->device);
>  	struct nvc0_fence_priv *priv = drm->fence;
>  	int i;
> +	u32 chan = pfifo->max + 1;
> 
> -	priv->suspend = vmalloc((pfifo->max + 1) * sizeof(u32));
> +	priv->suspend = vmalloc(chan * sizeof(u32));
>  	if (priv->suspend) {
> -		for (i = 0; i <= pfifo->max; i++)
> -			priv->suspend[i] = nouveau_bo_rd32(priv->bo, i);
> +		for (i = 0; i < chan; i++)
> +			priv->suspend[i] = nouveau_bo_rd32(priv->bo, i * 16/4);
>  	}
> 
>  	return priv->suspend != NULL;
> @@ -177,10 +178,11 @@ nvc0_fence_resume(struct nouveau_drm *drm)
>  	struct nouveau_fifo *pfifo = nouveau_fifo(drm->device);
>  	struct nvc0_fence_priv *priv = drm->fence;
>  	int i;
> +	u32 chan = pfifo->max + 1;
> 
>  	if (priv->suspend) {
> -		for (i = 0; i <= pfifo->max; i++)
> -			nouveau_bo_wr32(priv->bo, i, priv->suspend[i]);
> +		for (i = 0; i < chan; i++)
> +			nouveau_bo_wr32(priv->bo, i * 16/4, priv->suspend[i]);
>  		vfree(priv->suspend);
>  		priv->suspend = NULL;
>  	}

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

* Re: [PATCH] drm/nouveau: fix suspend bug in nvc0 fence implementation
       [not found]     ` <20130219194938.GA3080-OI9uyE9O0yo@public.gmane.org>
@ 2013-02-19 21:09       ` Michael Weirauch
       [not found]         ` <CAMpzoDBtNVH_3PXvsReC8ytNcCAebfJjHDYQ8eDOgD4ns+ekuA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Weirauch @ 2013-02-19 21:09 UTC (permalink / raw)
  To: Marcin Slusarz
  Cc: Maarten Lankhorst, Ben Skeggs,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

2013/2/19 Marcin Slusarz <marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
> Yay. It will probably fix https://bugs.freedesktop.org/show_bug.cgi?id=59168.
> (note: it doesn't apply on top of nouveau/master)

Please correct me if I am wrong, but doesn't nv84_fence_[resume,suspend]
on current nouveau-3.8.0_rc7 (master) which is "used" by nvc0_fence.c
"identical" to what this patch does?

nvc0_fence_create->
nv84_fence_create sets up:
	priv->base.suspend = nv84_fence_suspend;
	priv->base.resume = nv84_fence_resume;

There is no dedicated nvc0_fence_[resume,suspend] impl from what I grasped.

c.f.:
http://cgit.freedesktop.org/nouveau/linux-2.6/tree/drivers/gpu/drm/nouveau/nv84_fence.c#n178

Michael

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

* Re: [PATCH] drm/nouveau: fix suspend bug in nvc0 fence implementation
       [not found]         ` <CAMpzoDBtNVH_3PXvsReC8ytNcCAebfJjHDYQ8eDOgD4ns+ekuA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-02-19 21:17           ` Marcin Slusarz
       [not found]             ` <20130219211726.GC3080-OI9uyE9O0yo@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Marcin Slusarz @ 2013-02-19 21:17 UTC (permalink / raw)
  To: Michael Weirauch
  Cc: Maarten Lankhorst, Ben Skeggs,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On Tue, Feb 19, 2013 at 10:09:12PM +0100, Michael Weirauch wrote:
> 2013/2/19 Marcin Slusarz <marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
> > Yay. It will probably fix https://bugs.freedesktop.org/show_bug.cgi?id=59168.
> > (note: it doesn't apply on top of nouveau/master)
> 
> Please correct me if I am wrong, but doesn't nv84_fence_[resume,suspend]
> on current nouveau-3.8.0_rc7 (master) which is "used" by nvc0_fence.c
> "identical" to what this patch does?
> 
> nvc0_fence_create->
> nv84_fence_create sets up:
> 	priv->base.suspend = nv84_fence_suspend;
> 	priv->base.resume = nv84_fence_resume;
> 
> There is no dedicated nvc0_fence_[resume,suspend] impl from what I grasped.
> 
> c.f.:
> http://cgit.freedesktop.org/nouveau/linux-2.6/tree/drivers/gpu/drm/nouveau/nv84_fence.c#n178

This patch is only for 3.7 and 3.8 kernels. Nouveau/master contains refactored
fence code which will be submitted for 3.9.

Marcin

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

* Re: [PATCH] drm/nouveau: fix suspend bug in nvc0 fence implementation
       [not found]             ` <20130219211726.GC3080-OI9uyE9O0yo@public.gmane.org>
@ 2013-02-19 21:25               ` Michael Weirauch
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Weirauch @ 2013-02-19 21:25 UTC (permalink / raw)
  To: Marcin Slusarz
  Cc: Maarten Lankhorst, Ben Skeggs,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

2013/2/19 Marcin Slusarz <marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
> This patch is only for 3.7 and 3.8 kernels. Nouveau/master contains refactored
> fence code which will be submitted for 3.9.

Then, nevertheless, nouveau/master - which apparently carries
identical code - doesn't
fix the issue (fdo#59168) for me. (Or I screw up big time.)

I am testing nouveau/master regularly when new commits arrive.

Michael

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

end of thread, other threads:[~2013-02-19 21:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-19 10:20 [PATCH] drm/nouveau: fix suspend bug in nvc0 fence implementation Maarten Lankhorst
     [not found] ` <CAMuW1wcx8BEkase+S_+bmZp6b+CFunrmAd6PDNaZONFYLfpG-g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-19 19:49   ` Marcin Slusarz
     [not found]     ` <20130219194938.GA3080-OI9uyE9O0yo@public.gmane.org>
2013-02-19 21:09       ` Michael Weirauch
     [not found]         ` <CAMpzoDBtNVH_3PXvsReC8ytNcCAebfJjHDYQ8eDOgD4ns+ekuA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-19 21:17           ` Marcin Slusarz
     [not found]             ` <20130219211726.GC3080-OI9uyE9O0yo@public.gmane.org>
2013-02-19 21:25               ` Michael Weirauch

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.