xref: /linux/drivers/gpu/drm/nouveau/nvkm/subdev/fb/priv.h (revision 6e7fd890f1d6ac83805409e9c346240de2705584)
1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVKM_FB_PRIV_H__
3 #define __NVKM_FB_PRIV_H__
4 #define nvkm_fb(p) container_of((p), struct nvkm_fb, subdev)
5 #include <subdev/fb.h>
6 #include <subdev/therm.h>
7 struct nvkm_bios;
8 
9 int r535_fb_new(const struct nvkm_fb_func *,
10 		struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fb **);
11 
12 struct nvkm_fb_func {
13 	void *(*dtor)(struct nvkm_fb *);
14 	u32 (*tags)(struct nvkm_fb *);
15 	int (*oneinit)(struct nvkm_fb *);
16 	void (*init)(struct nvkm_fb *);
17 	void (*init_remapper)(struct nvkm_fb *);
18 	int (*init_page)(struct nvkm_fb *);
19 	void (*init_unkn)(struct nvkm_fb *);
20 	void (*intr)(struct nvkm_fb *);
21 
22 	struct nvkm_fb_func_sysmem {
23 		void (*flush_page_init)(struct nvkm_fb *);
24 	} sysmem;
25 
26 	struct nvkm_fb_func_vidmem {
27 		u64 (*size)(struct nvkm_fb *);
28 	} vidmem;
29 
30 	struct {
31 		bool (*scrub_required)(struct nvkm_fb *);
32 		int (*scrub)(struct nvkm_fb *);
33 	} vpr;
34 
35 	struct {
36 		int regions;
37 		void (*init)(struct nvkm_fb *, int i, u32 addr, u32 size,
38 			     u32 pitch, u32 flags, struct nvkm_fb_tile *);
39 		void (*comp)(struct nvkm_fb *, int i, u32 size, u32 flags,
40 			     struct nvkm_fb_tile *);
41 		void (*fini)(struct nvkm_fb *, int i, struct nvkm_fb_tile *);
42 		void (*prog)(struct nvkm_fb *, int i, struct nvkm_fb_tile *);
43 	} tile;
44 
45 	int (*ram_new)(struct nvkm_fb *, struct nvkm_ram **);
46 
47 	u8 default_bigpage;
48 	const struct nvkm_therm_clkgate_pack *clkgate_pack;
49 };
50 
51 int nvkm_fb_ctor(const struct nvkm_fb_func *, struct nvkm_device *device,
52 		 enum nvkm_subdev_type type, int inst, struct nvkm_fb *);
53 int nvkm_fb_new_(const struct nvkm_fb_func *, struct nvkm_device *device,
54 		 enum nvkm_subdev_type type, int inst, struct nvkm_fb **);
55 int nvkm_fb_bios_memtype(struct nvkm_bios *);
56 
57 void nv10_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size,
58 		       u32 pitch, u32 flags, struct nvkm_fb_tile *);
59 void nv10_fb_tile_fini(struct nvkm_fb *, int i, struct nvkm_fb_tile *);
60 void nv10_fb_tile_prog(struct nvkm_fb *, int, struct nvkm_fb_tile *);
61 
62 u32 nv20_fb_tags(struct nvkm_fb *);
63 void nv20_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size,
64 		       u32 pitch, u32 flags, struct nvkm_fb_tile *);
65 void nv20_fb_tile_fini(struct nvkm_fb *, int i, struct nvkm_fb_tile *);
66 void nv20_fb_tile_prog(struct nvkm_fb *, int, struct nvkm_fb_tile *);
67 
68 void nv30_fb_init(struct nvkm_fb *);
69 void nv30_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size,
70 		       u32 pitch, u32 flags, struct nvkm_fb_tile *);
71 
72 void nv40_fb_tile_comp(struct nvkm_fb *, int i, u32 size, u32 flags,
73 		       struct nvkm_fb_tile *);
74 
75 void nv41_fb_init(struct nvkm_fb *);
76 void nv41_fb_tile_prog(struct nvkm_fb *, int, struct nvkm_fb_tile *);
77 
78 void nv44_fb_init(struct nvkm_fb *);
79 void nv44_fb_tile_prog(struct nvkm_fb *, int, struct nvkm_fb_tile *);
80 
81 void nv46_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size,
82 		       u32 pitch, u32 flags, struct nvkm_fb_tile *);
83 
84 int gf100_fb_oneinit(struct nvkm_fb *);
85 int gf100_fb_init_page(struct nvkm_fb *);
86 void gf100_fb_sysmem_flush_page_init(struct nvkm_fb *);
87 
88 int gm200_fb_init_page(struct nvkm_fb *);
89 
90 void gp100_fb_init_remapper(struct nvkm_fb *);
91 void gp100_fb_init_unkn(struct nvkm_fb *);
92 
93 int gp102_fb_oneinit(struct nvkm_fb *);
94 u64 gp102_fb_vidmem_size(struct nvkm_fb *);
95 bool gp102_fb_vpr_scrub_required(struct nvkm_fb *);
96 int gp102_fb_vpr_scrub(struct nvkm_fb *);
97 
98 int gv100_fb_init_page(struct nvkm_fb *);
99 
100 bool tu102_fb_vpr_scrub_required(struct nvkm_fb *);
101 #endif
102