forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgv100.c
....@@ -25,7 +25,7 @@
2525 * PGRAPH context implementation
2626 ******************************************************************************/
2727
28
-static const struct gf100_gr_init
28
+const struct gf100_gr_init
2929 gv100_grctx_init_sw_veid_bundle_init_0[] = {
3030 { 0x00001000, 64, 0x00100000, 0x00000008 },
3131 { 0x00000941, 64, 0x00100000, 0x00000000 },
....@@ -58,7 +58,7 @@
5858 {}
5959 };
6060
61
-static void
61
+void
6262 gv100_grctx_generate_attrib(struct gf100_grctx *info)
6363 {
6464 struct gf100_gr *gr = info->gr;
....@@ -67,14 +67,14 @@
6767 const u32 attrib = grctx->attrib_nr;
6868 const u32 gfxp = grctx->gfxp_nr;
6969 const int s = 12;
70
- const int max_batches = 0xffff;
7170 u32 size = grctx->alpha_nr_max * gr->tpc_total;
7271 u32 ao = 0;
7372 u32 bo = ao + size;
7473 int gpc, ppc, b, n = 0;
7574
76
- size += grctx->gfxp_nr * gr->tpc_total;
77
- size = ((size * 0x20) + 128) & ~127;
75
+ for (gpc = 0; gpc < gr->gpc_nr; gpc++)
76
+ size += grctx->gfxp_nr * gr->ppc_nr[gpc] * gr->ppc_tpc_max;
77
+ size = ((size * 0x20) + 127) & ~127;
7878 b = mmio_vram(info, size, (1 << s), false);
7979
8080 mmio_refn(info, 0x418810, 0x80000000, s, b);
....@@ -84,13 +84,12 @@
8484 mmio_wr32(info, 0x419e04, 0x80000000 | size >> 7);
8585 mmio_wr32(info, 0x405830, attrib);
8686 mmio_wr32(info, 0x40585c, alpha);
87
- mmio_wr32(info, 0x4064c4, ((alpha / 4) << 16) | max_batches);
8887
8988 for (gpc = 0; gpc < gr->gpc_nr; gpc++) {
9089 for (ppc = 0; ppc < gr->ppc_nr[gpc]; ppc++, n++) {
9190 const u32 as = alpha * gr->ppc_tpc_nr[gpc][ppc];
92
- const u32 bs = attrib * gr->ppc_tpc_nr[gpc][ppc];
93
- const u32 gs = gfxp * gr->ppc_tpc_nr[gpc][ppc];
91
+ const u32 bs = attrib * gr->ppc_tpc_max;
92
+ const u32 gs = gfxp * gr->ppc_tpc_max;
9493 const u32 u = 0x418ea0 + (n * 0x04);
9594 const u32 o = PPC_UNIT(gpc, ppc, 0);
9695 if (!(gr->ppc_mask[gpc] & (1 << ppc)))
....@@ -110,7 +109,7 @@
110109 mmio_wr32(info, 0x41befc, 0x00000100);
111110 }
112111
113
-static void
112
+void
114113 gv100_grctx_generate_rop_mapping(struct gf100_gr *gr)
115114 {
116115 struct nvkm_device *device = gr->base.engine.subdev.device;
....@@ -147,7 +146,7 @@
147146 gr->screen_tile_row_offset);
148147 }
149148
150
-static void
149
+void
151150 gv100_grctx_generate_r400088(struct gf100_gr *gr, bool on)
152151 {
153152 struct nvkm_device *device = gr->base.engine.subdev.device;
....@@ -163,7 +162,7 @@
163162 nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x088), sm);
164163 }
165164
166
-static void
165
+void
167166 gv100_grctx_generate_unkn(struct gf100_gr *gr)
168167 {
169168 struct nvkm_device *device = gr->base.engine.subdev.device;
....@@ -174,7 +173,7 @@
174173 nvkm_mask(device, 0x419c00, 0x00000008, 0x00000008);
175174 }
176175
177
-static void
176
+void
178177 gv100_grctx_unkn88c(struct gf100_gr *gr, bool on)
179178 {
180179 struct nvkm_device *device = gr->base.engine.subdev.device;