]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.6.2/drm-nvc0-fence-restore-pre-suspend-fence-buffer-context-on-resume.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.6.2 / drm-nvc0-fence-restore-pre-suspend-fence-buffer-context-on-resume.patch
1 From d6ba6d215a538a58f0f0026f0961b0b9125e8042 Mon Sep 17 00:00:00 2001
2 From: Ben Skeggs <bskeggs@redhat.com>
3 Date: Fri, 28 Sep 2012 11:50:29 +1000
4 Subject: drm/nvc0/fence: restore pre-suspend fence buffer context on resume
5
6 From: Ben Skeggs <bskeggs@redhat.com>
7
8 commit d6ba6d215a538a58f0f0026f0961b0b9125e8042 upstream.
9
10 Fixes some unfortunate races on resume. The G84 version of the code doesn't
11 need this as "gpuobj"s are automagically suspended/resumed by the core code
12 whereas pinned buffer objects are not.
13
14 Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
15 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16
17 ---
18 drivers/gpu/drm/nouveau/nvc0_fence.c | 25 +++++++++++++++++++++++++
19 1 file changed, 25 insertions(+)
20
21 --- a/drivers/gpu/drm/nouveau/nvc0_fence.c
22 +++ b/drivers/gpu/drm/nouveau/nvc0_fence.c
23 @@ -32,6 +32,7 @@
24 struct nvc0_fence_priv {
25 struct nouveau_fence_priv base;
26 struct nouveau_bo *bo;
27 + u32 *suspend;
28 };
29
30 struct nvc0_fence_chan {
31 @@ -125,12 +126,36 @@ nvc0_fence_context_new(struct nouveau_ch
32 static int
33 nvc0_fence_fini(struct drm_device *dev, int engine, bool suspend)
34 {
35 + struct nouveau_fifo_priv *pfifo = nv_engine(dev, NVOBJ_ENGINE_FIFO);
36 + struct nvc0_fence_priv *priv = nv_engine(dev, engine);
37 + int i;
38 +
39 + if (suspend) {
40 + priv->suspend = vmalloc(pfifo->channels * sizeof(u32));
41 + if (!priv->suspend)
42 + return -ENOMEM;
43 +
44 + for (i = 0; i < pfifo->channels; i++)
45 + priv->suspend[i] = nouveau_bo_rd32(priv->bo, i);
46 + }
47 +
48 return 0;
49 }
50
51 static int
52 nvc0_fence_init(struct drm_device *dev, int engine)
53 {
54 + struct nouveau_fifo_priv *pfifo = nv_engine(dev, NVOBJ_ENGINE_FIFO);
55 + struct nvc0_fence_priv *priv = nv_engine(dev, engine);
56 + int i;
57 +
58 + if (priv->suspend) {
59 + for (i = 0; i < pfifo->channels; i++)
60 + nouveau_bo_wr32(priv->bo, i, priv->suspend[i]);
61 + vfree(priv->suspend);
62 + priv->suspend = NULL;
63 + }
64 +
65 return 0;
66 }
67