1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26#include "priv.h"
27#include "ram.h"
28
29void
30nv40_fb_tile_comp(struct nvkm_fb *fb, int i, u32 size, u32 flags,
31 struct nvkm_fb_tile *tile)
32{
33 u32 tiles = DIV_ROUND_UP(size, 0x80);
34 u32 tags = round_up(tiles / fb->ram->parts, 0x100);
35 if ( (flags & 2) &&
36 !nvkm_mm_head(&fb->tags.mm, 0, 1, tags, tags, 1, &tile->tag)) {
37 tile->zcomp = 0x28000000;
38 tile->zcomp |= ((tile->tag->offset ) >> 8);
39 tile->zcomp |= ((tile->tag->offset + tags - 1) >> 8) << 13;
40#ifdef __BIG_ENDIAN
41 tile->zcomp |= 0x40000000;
42#endif
43 }
44}
45
46static void
47nv40_fb_init(struct nvkm_fb *fb)
48{
49 nvkm_mask(fb->subdev.device, 0x10033c, 0x00008000, 0x00000000);
50}
51
52static const struct nvkm_fb_func
53nv40_fb = {
54 .tags = nv20_fb_tags,
55 .init = nv40_fb_init,
56 .tile.regions = 8,
57 .tile.init = nv30_fb_tile_init,
58 .tile.comp = nv40_fb_tile_comp,
59 .tile.fini = nv20_fb_tile_fini,
60 .tile.prog = nv20_fb_tile_prog,
61 .ram_new = nv40_ram_new,
62};
63
64int
65nv40_fb_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_fb **pfb)
66{
67 return nvkm_fb_new_(&nv40_fb, device, type, inst, pfb);
68}
69