1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#include "nv40.h"
25#include "regs.h"
26
27#include <subdev/fb.h>
28#include <engine/fifo.h>
29
30static void
31nv44_gr_tile(struct nvkm_gr *base, int i, struct nvkm_fb_tile *tile)
32{
33 struct nv40_gr *gr = nv40_gr(base);
34 struct nvkm_device *device = gr->base.engine.subdev.device;
35 struct nvkm_fifo *fifo = device->fifo;
36 unsigned long flags;
37
38 nvkm_fifo_pause(fifo, &flags);
39 nv04_gr_idle(&gr->base);
40
41 switch (device->chipset) {
42 case 0x44:
43 case 0x4a:
44 nvkm_wr32(device, NV20_PGRAPH_TSIZE(i), tile->pitch);
45 nvkm_wr32(device, NV20_PGRAPH_TLIMIT(i), tile->limit);
46 nvkm_wr32(device, NV20_PGRAPH_TILE(i), tile->addr);
47 break;
48 case 0x46:
49 case 0x4c:
50 case 0x63:
51 case 0x67:
52 case 0x68:
53 nvkm_wr32(device, NV47_PGRAPH_TSIZE(i), tile->pitch);
54 nvkm_wr32(device, NV47_PGRAPH_TLIMIT(i), tile->limit);
55 nvkm_wr32(device, NV47_PGRAPH_TILE(i), tile->addr);
56 nvkm_wr32(device, NV40_PGRAPH_TSIZE1(i), tile->pitch);
57 nvkm_wr32(device, NV40_PGRAPH_TLIMIT1(i), tile->limit);
58 nvkm_wr32(device, NV40_PGRAPH_TILE1(i), tile->addr);
59 break;
60 case 0x4e:
61 nvkm_wr32(device, NV20_PGRAPH_TSIZE(i), tile->pitch);
62 nvkm_wr32(device, NV20_PGRAPH_TLIMIT(i), tile->limit);
63 nvkm_wr32(device, NV20_PGRAPH_TILE(i), tile->addr);
64 nvkm_wr32(device, NV40_PGRAPH_TSIZE1(i), tile->pitch);
65 nvkm_wr32(device, NV40_PGRAPH_TLIMIT1(i), tile->limit);
66 nvkm_wr32(device, NV40_PGRAPH_TILE1(i), tile->addr);
67 break;
68 default:
69 WARN_ON(1);
70 break;
71 }
72
73 nvkm_fifo_start(fifo, &flags);
74}
75
76static const struct nvkm_gr_func
77nv44_gr = {
78 .init = nv40_gr_init,
79 .intr = nv40_gr_intr,
80 .tile = nv44_gr_tile,
81 .units = nv40_gr_units,
82 .chan_new = nv40_gr_chan_new,
83 .sclass = {
84 { -1, -1, 0x0012, &nv40_gr_object },
85 { -1, -1, 0x0019, &nv40_gr_object },
86 { -1, -1, 0x0030, &nv40_gr_object },
87 { -1, -1, 0x0039, &nv40_gr_object },
88 { -1, -1, 0x0043, &nv40_gr_object },
89 { -1, -1, 0x0044, &nv40_gr_object },
90 { -1, -1, 0x004a, &nv40_gr_object },
91 { -1, -1, 0x0062, &nv40_gr_object },
92 { -1, -1, 0x0072, &nv40_gr_object },
93 { -1, -1, 0x0089, &nv40_gr_object },
94 { -1, -1, 0x008a, &nv40_gr_object },
95 { -1, -1, 0x009f, &nv40_gr_object },
96 { -1, -1, 0x3062, &nv40_gr_object },
97 { -1, -1, 0x3089, &nv40_gr_object },
98 { -1, -1, 0x309e, &nv40_gr_object },
99 { -1, -1, 0x4497, &nv40_gr_object },
100 {}
101 }
102};
103
104int
105nv44_gr_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_gr **pgr)
106{
107 return nv40_gr_new_(&nv44_gr, device, type, inst, pgr);
108}
109