aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2014-08-09 14:10:29 -0400
committerBen Skeggs <bskeggs@redhat.com>2014-08-09 15:28:13 -0400
commitac9738bb3e5374495908ad236285f69cfd405f8e (patch)
tree5e242c2540190ec6da9b0fe2f9f3f72550674cef /drivers/gpu
parentf38fdb6a376ead4ce8c6c1c75f71cc35b9e40bfc (diff)
drm/gf100-/gr: add support for zero bandwidth clear
Default ZBC table is compatible with binary driver defaults. Userspace will need to be updated to take full advantage of this feature, however, some applications will see a performance boost without updated drivers. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/gk20a.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/gm107.c5
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nv108.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c219
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h23
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nvc1.c4
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nvc8.c6
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nve4.c5
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nvf0.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvif/class.h56
10 files changed, 313 insertions, 11 deletions
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/gk20a.c b/drivers/gpu/drm/nouveau/core/engine/graph/gk20a.c
index c5697133640a..74a51fc2ec8a 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/gk20a.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/gk20a.c
@@ -27,7 +27,7 @@ static struct nouveau_oclass
27gk20a_graph_sclass[] = { 27gk20a_graph_sclass[] = {
28 { 0x902d, &nouveau_object_ofuncs }, 28 { 0x902d, &nouveau_object_ofuncs },
29 { 0xa040, &nouveau_object_ofuncs }, 29 { 0xa040, &nouveau_object_ofuncs },
30 { 0xa297, &nouveau_object_ofuncs }, 30 { KEPLER_C, &nvc0_fermi_ofuncs },
31 { 0xa0c0, &nouveau_object_ofuncs }, 31 { 0xa0c0, &nouveau_object_ofuncs },
32 {} 32 {}
33}; 33};
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/gm107.c b/drivers/gpu/drm/nouveau/core/engine/graph/gm107.c
index 21c5f31d607f..60d86f314281 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/gm107.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/gm107.c
@@ -36,7 +36,7 @@ static struct nouveau_oclass
36gm107_graph_sclass[] = { 36gm107_graph_sclass[] = {
37 { 0x902d, &nouveau_object_ofuncs }, 37 { 0x902d, &nouveau_object_ofuncs },
38 { 0xa140, &nouveau_object_ofuncs }, 38 { 0xa140, &nouveau_object_ofuncs },
39 { 0xb097, &nouveau_object_ofuncs }, 39 { MAXWELL_A, &nvc0_fermi_ofuncs },
40 { 0xb0c0, &nouveau_object_ofuncs }, 40 { 0xb0c0, &nouveau_object_ofuncs },
41 {} 41 {}
42}; 42};
@@ -425,6 +425,9 @@ gm107_graph_init(struct nouveau_object *object)
425 nv_wr32(priv, 0x400134, 0xffffffff); 425 nv_wr32(priv, 0x400134, 0xffffffff);
426 426
427 nv_wr32(priv, 0x400054, 0x2c350f63); 427 nv_wr32(priv, 0x400054, 0x2c350f63);
428
429 nvc0_graph_zbc_init(priv);
430
428 return nvc0_graph_init_ctxctl(priv); 431 return nvc0_graph_init_ctxctl(priv);
429} 432}
430 433
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nv108.c b/drivers/gpu/drm/nouveau/core/engine/graph/nv108.c
index 00ea1a089822..01e99faeb9a0 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nv108.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nv108.c
@@ -33,7 +33,7 @@ static struct nouveau_oclass
33nv108_graph_sclass[] = { 33nv108_graph_sclass[] = {
34 { 0x902d, &nouveau_object_ofuncs }, 34 { 0x902d, &nouveau_object_ofuncs },
35 { 0xa140, &nouveau_object_ofuncs }, 35 { 0xa140, &nouveau_object_ofuncs },
36 { 0xa197, &nouveau_object_ofuncs }, 36 { KEPLER_B, &nvc0_fermi_ofuncs },
37 { 0xa1c0, &nouveau_object_ofuncs }, 37 { 0xa1c0, &nouveau_object_ofuncs },
38 {} 38 {}
39}; 39};
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
index cda70fca9bc4..0156862fb34d 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
@@ -26,14 +26,199 @@
26#include "ctxnvc0.h" 26#include "ctxnvc0.h"
27 27
28/******************************************************************************* 28/*******************************************************************************
29 * Zero Bandwidth Clear
30 ******************************************************************************/
31
32static void
33nvc0_graph_zbc_clear_color(struct nvc0_graph_priv *priv, int zbc)
34{
35 if (priv->zbc_color[zbc].format) {
36 nv_wr32(priv, 0x405804, priv->zbc_color[zbc].ds[0]);
37 nv_wr32(priv, 0x405808, priv->zbc_color[zbc].ds[1]);
38 nv_wr32(priv, 0x40580c, priv->zbc_color[zbc].ds[2]);
39 nv_wr32(priv, 0x405810, priv->zbc_color[zbc].ds[3]);
40 }
41 nv_wr32(priv, 0x405814, priv->zbc_color[zbc].format);
42 nv_wr32(priv, 0x405820, zbc);
43 nv_wr32(priv, 0x405824, 0x00000004); /* TRIGGER | WRITE | COLOR */
44}
45
46static int
47nvc0_graph_zbc_color_get(struct nvc0_graph_priv *priv, int format,
48 const u32 ds[4], const u32 l2[4])
49{
50 struct nouveau_ltc *ltc = nouveau_ltc(priv);
51 int zbc = -ENOSPC, i;
52
53 for (i = ltc->zbc_min; i <= ltc->zbc_max; i++) {
54 if (priv->zbc_color[i].format) {
55 if (priv->zbc_color[i].format != format)
56 continue;
57 if (memcmp(priv->zbc_color[i].ds, ds, sizeof(
58 priv->zbc_color[i].ds)))
59 continue;
60 if (memcmp(priv->zbc_color[i].l2, l2, sizeof(
61 priv->zbc_color[i].l2))) {
62 WARN_ON(1);
63 return -EINVAL;
64 }
65 return i;
66 } else {
67 zbc = (zbc < 0) ? i : zbc;
68 }
69 }
70
71 memcpy(priv->zbc_color[zbc].ds, ds, sizeof(priv->zbc_color[zbc].ds));
72 memcpy(priv->zbc_color[zbc].l2, l2, sizeof(priv->zbc_color[zbc].l2));
73 priv->zbc_color[zbc].format = format;
74 ltc->zbc_color_get(ltc, zbc, l2);
75 nvc0_graph_zbc_clear_color(priv, zbc);
76 return zbc;
77}
78
79static void
80nvc0_graph_zbc_clear_depth(struct nvc0_graph_priv *priv, int zbc)
81{
82 if (priv->zbc_depth[zbc].format)
83 nv_wr32(priv, 0x405818, priv->zbc_depth[zbc].ds);
84 nv_wr32(priv, 0x40581c, priv->zbc_depth[zbc].format);
85 nv_wr32(priv, 0x405820, zbc);
86 nv_wr32(priv, 0x405824, 0x00000005); /* TRIGGER | WRITE | DEPTH */
87}
88
89static int
90nvc0_graph_zbc_depth_get(struct nvc0_graph_priv *priv, int format,
91 const u32 ds, const u32 l2)
92{
93 struct nouveau_ltc *ltc = nouveau_ltc(priv);
94 int zbc = -ENOSPC, i;
95
96 for (i = ltc->zbc_min; i <= ltc->zbc_max; i++) {
97 if (priv->zbc_depth[i].format) {
98 if (priv->zbc_depth[i].format != format)
99 continue;
100 if (priv->zbc_depth[i].ds != ds)
101 continue;
102 if (priv->zbc_depth[i].l2 != l2) {
103 WARN_ON(1);
104 return -EINVAL;
105 }
106 return i;
107 } else {
108 zbc = (zbc < 0) ? i : zbc;
109 }
110 }
111
112 priv->zbc_depth[zbc].format = format;
113 priv->zbc_depth[zbc].ds = ds;
114 priv->zbc_depth[zbc].l2 = l2;
115 ltc->zbc_depth_get(ltc, zbc, l2);
116 nvc0_graph_zbc_clear_depth(priv, zbc);
117 return zbc;
118}
119
120/*******************************************************************************
29 * Graphics object classes 121 * Graphics object classes
30 ******************************************************************************/ 122 ******************************************************************************/
31 123
124static int
125nvc0_fermi_mthd_zbc_color(struct nouveau_object *object, void *data, u32 size)
126{
127 struct nvc0_graph_priv *priv = (void *)object->engine;
128 union {
129 struct fermi_a_zbc_color_v0 v0;
130 } *args = data;
131 int ret;
132
133 if (nvif_unpack(args->v0, 0, 0, false)) {
134 switch (args->v0.format) {
135 case FERMI_A_ZBC_COLOR_V0_FMT_ZERO:
136 case FERMI_A_ZBC_COLOR_V0_FMT_UNORM_ONE:
137 case FERMI_A_ZBC_COLOR_V0_FMT_RF32_GF32_BF32_AF32:
138 case FERMI_A_ZBC_COLOR_V0_FMT_R16_G16_B16_A16:
139 case FERMI_A_ZBC_COLOR_V0_FMT_RN16_GN16_BN16_AN16:
140 case FERMI_A_ZBC_COLOR_V0_FMT_RS16_GS16_BS16_AS16:
141 case FERMI_A_ZBC_COLOR_V0_FMT_RU16_GU16_BU16_AU16:
142 case FERMI_A_ZBC_COLOR_V0_FMT_RF16_GF16_BF16_AF16:
143 case FERMI_A_ZBC_COLOR_V0_FMT_A8R8G8B8:
144 case FERMI_A_ZBC_COLOR_V0_FMT_A8RL8GL8BL8:
145 case FERMI_A_ZBC_COLOR_V0_FMT_A2B10G10R10:
146 case FERMI_A_ZBC_COLOR_V0_FMT_AU2BU10GU10RU10:
147 case FERMI_A_ZBC_COLOR_V0_FMT_A8B8G8R8:
148 case FERMI_A_ZBC_COLOR_V0_FMT_A8BL8GL8RL8:
149 case FERMI_A_ZBC_COLOR_V0_FMT_AN8BN8GN8RN8:
150 case FERMI_A_ZBC_COLOR_V0_FMT_AS8BS8GS8RS8:
151 case FERMI_A_ZBC_COLOR_V0_FMT_AU8BU8GU8RU8:
152 case FERMI_A_ZBC_COLOR_V0_FMT_A2R10G10B10:
153 case FERMI_A_ZBC_COLOR_V0_FMT_BF10GF11RF11:
154 ret = nvc0_graph_zbc_color_get(priv, args->v0.format,
155 args->v0.ds,
156 args->v0.l2);
157 if (ret >= 0) {
158 args->v0.index = ret;
159 return 0;
160 }
161 break;
162 default:
163 return -EINVAL;
164 }
165 }
166
167 return ret;
168}
169
170static int
171nvc0_fermi_mthd_zbc_depth(struct nouveau_object *object, void *data, u32 size)
172{
173 struct nvc0_graph_priv *priv = (void *)object->engine;
174 union {
175 struct fermi_a_zbc_depth_v0 v0;
176 } *args = data;
177 int ret;
178
179 if (nvif_unpack(args->v0, 0, 0, false)) {
180 switch (args->v0.format) {
181 case FERMI_A_ZBC_DEPTH_V0_FMT_FP32:
182 ret = nvc0_graph_zbc_depth_get(priv, args->v0.format,
183 args->v0.ds,
184 args->v0.l2);
185 return (ret >= 0) ? 0 : -ENOSPC;
186 default:
187 return -EINVAL;
188 }
189 }
190
191 return ret;
192}
193
194static int
195nvc0_fermi_mthd(struct nouveau_object *object, u32 mthd, void *data, u32 size)
196{
197 switch (mthd) {
198 case FERMI_A_ZBC_COLOR:
199 return nvc0_fermi_mthd_zbc_color(object, data, size);
200 case FERMI_A_ZBC_DEPTH:
201 return nvc0_fermi_mthd_zbc_depth(object, data, size);
202 default:
203 break;
204 }
205 return -EINVAL;
206}
207
208struct nouveau_ofuncs
209nvc0_fermi_ofuncs = {
210 .ctor = _nouveau_object_ctor,
211 .dtor = nouveau_object_destroy,
212 .init = nouveau_object_init,
213 .fini = nouveau_object_fini,
214 .mthd = nvc0_fermi_mthd,
215};
216
32struct nouveau_oclass 217struct nouveau_oclass
33nvc0_graph_sclass[] = { 218nvc0_graph_sclass[] = {
34 { 0x902d, &nouveau_object_ofuncs }, 219 { 0x902d, &nouveau_object_ofuncs },
35 { 0x9039, &nouveau_object_ofuncs }, 220 { 0x9039, &nouveau_object_ofuncs },
36 { 0x9097, &nouveau_object_ofuncs }, 221 { FERMI_A, &nvc0_fermi_ofuncs },
37 { 0x90c0, &nouveau_object_ofuncs }, 222 { 0x90c0, &nouveau_object_ofuncs },
38 {} 223 {}
39}; 224};
@@ -407,6 +592,35 @@ nvc0_graph_pack_mmio[] = {
407 ******************************************************************************/ 592 ******************************************************************************/
408 593
409void 594void
595nvc0_graph_zbc_init(struct nvc0_graph_priv *priv)
596{
597 const u32 zero[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000,
598 0x00000000, 0x00000000, 0x00000000, 0x00000000 };
599 const u32 one[] = { 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000,
600 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff };
601 const u32 f32_0[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000,
602 0x00000000, 0x00000000, 0x00000000, 0x00000000 };
603 const u32 f32_1[] = { 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000,
604 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000 };
605 struct nouveau_ltc *ltc = nouveau_ltc(priv);
606 int index;
607
608 if (!priv->zbc_color[0].format) {
609 nvc0_graph_zbc_color_get(priv, 1, & zero[0], &zero[4]);
610 nvc0_graph_zbc_color_get(priv, 2, & one[0], &one[4]);
611 nvc0_graph_zbc_color_get(priv, 4, &f32_0[0], &f32_0[4]);
612 nvc0_graph_zbc_color_get(priv, 4, &f32_1[0], &f32_1[4]);
613 nvc0_graph_zbc_depth_get(priv, 1, 0x00000000, 0x00000000);
614 nvc0_graph_zbc_depth_get(priv, 1, 0x3f800000, 0x3f800000);
615 }
616
617 for (index = ltc->zbc_min; index <= ltc->zbc_max; index++)
618 nvc0_graph_zbc_clear_color(priv, index);
619 for (index = ltc->zbc_min; index <= ltc->zbc_max; index++)
620 nvc0_graph_zbc_clear_depth(priv, index);
621}
622
623void
410nvc0_graph_mmio(struct nvc0_graph_priv *priv, const struct nvc0_graph_pack *p) 624nvc0_graph_mmio(struct nvc0_graph_priv *priv, const struct nvc0_graph_pack *p)
411{ 625{
412 const struct nvc0_graph_pack *pack; 626 const struct nvc0_graph_pack *pack;
@@ -1223,6 +1437,9 @@ nvc0_graph_init(struct nouveau_object *object)
1223 nv_wr32(priv, 0x400134, 0xffffffff); 1437 nv_wr32(priv, 0x400134, 0xffffffff);
1224 1438
1225 nv_wr32(priv, 0x400054, 0x34ce3464); 1439 nv_wr32(priv, 0x400054, 0x34ce3464);
1440
1441 nvc0_graph_zbc_init(priv);
1442
1226 return nvc0_graph_init_ctxctl(priv); 1443 return nvc0_graph_init_ctxctl(priv);
1227} 1444}
1228 1445
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h
index a599b4fb5dd7..bfe9bdddbec8 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h
@@ -30,11 +30,15 @@
30#include <core/gpuobj.h> 30#include <core/gpuobj.h>
31#include <core/option.h> 31#include <core/option.h>
32 32
33#include <nvif/unpack.h>
34#include <nvif/class.h>
35
33#include <subdev/fb.h> 36#include <subdev/fb.h>
34#include <subdev/vm.h> 37#include <subdev/vm.h>
35#include <subdev/bar.h> 38#include <subdev/bar.h>
36#include <subdev/timer.h> 39#include <subdev/timer.h>
37#include <subdev/mc.h> 40#include <subdev/mc.h>
41#include <subdev/ltc.h>
38 42
39#include <engine/fifo.h> 43#include <engine/fifo.h>
40#include <engine/graph.h> 44#include <engine/graph.h>
@@ -69,6 +73,18 @@ struct nvc0_graph_fuc {
69 u32 size; 73 u32 size;
70}; 74};
71 75
76struct nvc0_graph_zbc_color {
77 u32 format;
78 u32 ds[4];
79 u32 l2[4];
80};
81
82struct nvc0_graph_zbc_depth {
83 u32 format;
84 u32 ds;
85 u32 l2;
86};
87
72struct nvc0_graph_priv { 88struct nvc0_graph_priv {
73 struct nouveau_graph base; 89 struct nouveau_graph base;
74 90
@@ -78,6 +94,9 @@ struct nvc0_graph_priv {
78 struct nvc0_graph_fuc fuc41ad; 94 struct nvc0_graph_fuc fuc41ad;
79 bool firmware; 95 bool firmware;
80 96
97 struct nvc0_graph_zbc_color zbc_color[NOUVEAU_LTC_MAX_ZBC_CNT];
98 struct nvc0_graph_zbc_depth zbc_depth[NOUVEAU_LTC_MAX_ZBC_CNT];
99
81 u8 rop_nr; 100 u8 rop_nr;
82 u8 gpc_nr; 101 u8 gpc_nr;
83 u8 tpc_nr[GPC_MAX]; 102 u8 tpc_nr[GPC_MAX];
@@ -119,11 +138,15 @@ int nvc0_graph_ctor(struct nouveau_object *, struct nouveau_object *,
119 struct nouveau_object **); 138 struct nouveau_object **);
120void nvc0_graph_dtor(struct nouveau_object *); 139void nvc0_graph_dtor(struct nouveau_object *);
121int nvc0_graph_init(struct nouveau_object *); 140int nvc0_graph_init(struct nouveau_object *);
141void nvc0_graph_zbc_init(struct nvc0_graph_priv *);
142
122int nve4_graph_fini(struct nouveau_object *, bool); 143int nve4_graph_fini(struct nouveau_object *, bool);
123int nve4_graph_init(struct nouveau_object *); 144int nve4_graph_init(struct nouveau_object *);
124 145
125int nvf0_graph_fini(struct nouveau_object *, bool); 146int nvf0_graph_fini(struct nouveau_object *, bool);
126 147
148extern struct nouveau_ofuncs nvc0_fermi_ofuncs;
149
127extern struct nouveau_oclass nvc0_graph_sclass[]; 150extern struct nouveau_oclass nvc0_graph_sclass[];
128extern struct nouveau_oclass nvc8_graph_sclass[]; 151extern struct nouveau_oclass nvc8_graph_sclass[];
129extern struct nouveau_oclass nvf0_graph_sclass[]; 152extern struct nouveau_oclass nvf0_graph_sclass[];
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc1.c b/drivers/gpu/drm/nouveau/core/engine/graph/nvc1.c
index 30cab0b2eba1..80096762e483 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc1.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc1.c
@@ -33,9 +33,9 @@ static struct nouveau_oclass
33nvc1_graph_sclass[] = { 33nvc1_graph_sclass[] = {
34 { 0x902d, &nouveau_object_ofuncs }, 34 { 0x902d, &nouveau_object_ofuncs },
35 { 0x9039, &nouveau_object_ofuncs }, 35 { 0x9039, &nouveau_object_ofuncs },
36 { 0x9097, &nouveau_object_ofuncs }, 36 { FERMI_A, &nvc0_fermi_ofuncs },
37 { FERMI_B, &nvc0_fermi_ofuncs },
37 { 0x90c0, &nouveau_object_ofuncs }, 38 { 0x90c0, &nouveau_object_ofuncs },
38 { 0x9197, &nouveau_object_ofuncs },
39 {} 39 {}
40}; 40};
41 41
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc8.c b/drivers/gpu/drm/nouveau/core/engine/graph/nvc8.c
index a6bf783e1256..c944590838d4 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc8.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc8.c
@@ -33,10 +33,10 @@ struct nouveau_oclass
33nvc8_graph_sclass[] = { 33nvc8_graph_sclass[] = {
34 { 0x902d, &nouveau_object_ofuncs }, 34 { 0x902d, &nouveau_object_ofuncs },
35 { 0x9039, &nouveau_object_ofuncs }, 35 { 0x9039, &nouveau_object_ofuncs },
36 { 0x9097, &nouveau_object_ofuncs }, 36 { FERMI_A, &nvc0_fermi_ofuncs },
37 { FERMI_B, &nvc0_fermi_ofuncs },
38 { FERMI_C, &nvc0_fermi_ofuncs },
37 { 0x90c0, &nouveau_object_ofuncs }, 39 { 0x90c0, &nouveau_object_ofuncs },
38 { 0x9197, &nouveau_object_ofuncs },
39 { 0x9297, &nouveau_object_ofuncs },
40 {} 40 {}
41}; 41};
42 42
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nve4.c b/drivers/gpu/drm/nouveau/core/engine/graph/nve4.c
index fb9cb929320d..9ba01fbb2557 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nve4.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nve4.c
@@ -35,7 +35,7 @@ static struct nouveau_oclass
35nve4_graph_sclass[] = { 35nve4_graph_sclass[] = {
36 { 0x902d, &nouveau_object_ofuncs }, 36 { 0x902d, &nouveau_object_ofuncs },
37 { 0xa040, &nouveau_object_ofuncs }, 37 { 0xa040, &nouveau_object_ofuncs },
38 { 0xa097, &nouveau_object_ofuncs }, 38 { KEPLER_A, &nvc0_fermi_ofuncs },
39 { 0xa0c0, &nouveau_object_ofuncs }, 39 { 0xa0c0, &nouveau_object_ofuncs },
40 {} 40 {}
41}; 41};
@@ -303,6 +303,9 @@ nve4_graph_init(struct nouveau_object *object)
303 nv_wr32(priv, 0x400134, 0xffffffff); 303 nv_wr32(priv, 0x400134, 0xffffffff);
304 304
305 nv_wr32(priv, 0x400054, 0x34ce3464); 305 nv_wr32(priv, 0x400054, 0x34ce3464);
306
307 nvc0_graph_zbc_init(priv);
308
306 return nvc0_graph_init_ctxctl(priv); 309 return nvc0_graph_init_ctxctl(priv);
307} 310}
308 311
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvf0.c b/drivers/gpu/drm/nouveau/core/engine/graph/nvf0.c
index 768c51f93910..b82b40a1dc11 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nvf0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvf0.c
@@ -33,7 +33,7 @@ struct nouveau_oclass
33nvf0_graph_sclass[] = { 33nvf0_graph_sclass[] = {
34 { 0x902d, &nouveau_object_ofuncs }, 34 { 0x902d, &nouveau_object_ofuncs },
35 { 0xa140, &nouveau_object_ofuncs }, 35 { 0xa140, &nouveau_object_ofuncs },
36 { 0xa197, &nouveau_object_ofuncs }, 36 { KEPLER_B, &nvc0_fermi_ofuncs },
37 { 0xa1c0, &nouveau_object_ofuncs }, 37 { 0xa1c0, &nouveau_object_ofuncs },
38 {} 38 {}
39}; 39};
diff --git a/drivers/gpu/drm/nouveau/nvif/class.h b/drivers/gpu/drm/nouveau/nvif/class.h
index c9897f4003a9..73bf1269c72e 100644
--- a/drivers/gpu/drm/nouveau/nvif/class.h
+++ b/drivers/gpu/drm/nouveau/nvif/class.h
@@ -73,6 +73,16 @@
73#define GF110_DISP_OVERLAY_CONTROL_DMA 0x0000907e 73#define GF110_DISP_OVERLAY_CONTROL_DMA 0x0000907e
74#define GK104_DISP_OVERLAY_CONTROL_DMA 0x0000917e 74#define GK104_DISP_OVERLAY_CONTROL_DMA 0x0000917e
75 75
76#define FERMI_A 0x00009097
77#define FERMI_B 0x00009197
78#define FERMI_C 0x00009297
79
80#define KEPLER_A 0x0000a097
81#define KEPLER_B 0x0000a197
82#define KEPLER_C 0x0000a297
83
84#define MAXWELL_A 0x0000b097
85
76 86
77/******************************************************************************* 87/*******************************************************************************
78 * client 88 * client
@@ -491,4 +501,50 @@ struct nv50_disp_overlay_v0 {
491 __u8 pad02[6]; 501 __u8 pad02[6];
492}; 502};
493 503
504
505/*******************************************************************************
506 * fermi
507 ******************************************************************************/
508
509#define FERMI_A_ZBC_COLOR 0x00
510#define FERMI_A_ZBC_DEPTH 0x01
511
512struct fermi_a_zbc_color_v0 {
513 __u8 version;
514#define FERMI_A_ZBC_COLOR_V0_FMT_ZERO 0x01
515#define FERMI_A_ZBC_COLOR_V0_FMT_UNORM_ONE 0x02
516#define FERMI_A_ZBC_COLOR_V0_FMT_RF32_GF32_BF32_AF32 0x04
517#define FERMI_A_ZBC_COLOR_V0_FMT_R16_G16_B16_A16 0x08
518#define FERMI_A_ZBC_COLOR_V0_FMT_RN16_GN16_BN16_AN16 0x0c
519#define FERMI_A_ZBC_COLOR_V0_FMT_RS16_GS16_BS16_AS16 0x10
520#define FERMI_A_ZBC_COLOR_V0_FMT_RU16_GU16_BU16_AU16 0x14
521#define FERMI_A_ZBC_COLOR_V0_FMT_RF16_GF16_BF16_AF16 0x16
522#define FERMI_A_ZBC_COLOR_V0_FMT_A8R8G8B8 0x18
523#define FERMI_A_ZBC_COLOR_V0_FMT_A8RL8GL8BL8 0x1c
524#define FERMI_A_ZBC_COLOR_V0_FMT_A2B10G10R10 0x20
525#define FERMI_A_ZBC_COLOR_V0_FMT_AU2BU10GU10RU10 0x24
526#define FERMI_A_ZBC_COLOR_V0_FMT_A8B8G8R8 0x28
527#define FERMI_A_ZBC_COLOR_V0_FMT_A8BL8GL8RL8 0x2c
528#define FERMI_A_ZBC_COLOR_V0_FMT_AN8BN8GN8RN8 0x30
529#define FERMI_A_ZBC_COLOR_V0_FMT_AS8BS8GS8RS8 0x34
530#define FERMI_A_ZBC_COLOR_V0_FMT_AU8BU8GU8RU8 0x38
531#define FERMI_A_ZBC_COLOR_V0_FMT_A2R10G10B10 0x3c
532#define FERMI_A_ZBC_COLOR_V0_FMT_BF10GF11RF11 0x40
533 __u8 format;
534 __u8 index;
535 __u8 pad03[5];
536 __u32 ds[4];
537 __u32 l2[4];
538};
539
540struct fermi_a_zbc_depth_v0 {
541 __u8 version;
542#define FERMI_A_ZBC_DEPTH_V0_FMT_FP32 0x01
543 __u8 format;
544 __u8 index;
545 __u8 pad03[5];
546 __u32 ds;
547 __u32 l2;
548};
549
494#endif 550#endif