xref: /netbsd-src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/fb/priv.h (revision 41ec02673d281bbb3d38e6c78504ce6e30c228c1)
1 /*	$NetBSD: priv.h,v 1.3 2021/12/18 23:45:39 riastradh Exp $	*/
2 
3 /* SPDX-License-Identifier: MIT */
4 #ifndef __NVKM_FB_PRIV_H__
5 #define __NVKM_FB_PRIV_H__
6 #define nvkm_fb(p) container_of((p), struct nvkm_fb, subdev)
7 #include <subdev/fb.h>
8 #include <subdev/therm.h>
9 struct nvkm_bios;
10 
11 struct nvkm_fb_func {
12 	void *(*dtor)(struct nvkm_fb *);
13 	u32 (*tags)(struct nvkm_fb *);
14 	int (*oneinit)(struct nvkm_fb *);
15 	void (*init)(struct nvkm_fb *);
16 	void (*init_remapper)(struct nvkm_fb *);
17 	int (*init_page)(struct nvkm_fb *);
18 	void (*init_unkn)(struct nvkm_fb *);
19 	void (*intr)(struct nvkm_fb *);
20 
21 	struct {
22 		bool (*scrub_required)(struct nvkm_fb *);
23 		int (*scrub)(struct nvkm_fb *);
24 	} vpr;
25 
26 	struct {
27 		int regions;
28 		void (*init)(struct nvkm_fb *, int i, u32 addr, u32 size,
29 			     u32 pitch, u32 flags, struct nvkm_fb_tile *);
30 		void (*comp)(struct nvkm_fb *, int i, u32 size, u32 flags,
31 			     struct nvkm_fb_tile *);
32 		void (*fini)(struct nvkm_fb *, int i, struct nvkm_fb_tile *);
33 		void (*prog)(struct nvkm_fb *, int i, struct nvkm_fb_tile *);
34 	} tile;
35 
36 	int (*ram_new)(struct nvkm_fb *, struct nvkm_ram **);
37 
38 	u8 default_bigpage;
39 	const struct nvkm_therm_clkgate_pack *clkgate_pack;
40 };
41 
42 void nvkm_fb_ctor(const struct nvkm_fb_func *, struct nvkm_device *device,
43 		  int index, struct nvkm_fb *);
44 int nvkm_fb_new_(const struct nvkm_fb_func *, struct nvkm_device *device,
45 		 int index, struct nvkm_fb **);
46 int nvkm_fb_bios_memtype(struct nvkm_bios *);
47 
48 void nv10_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size,
49 		       u32 pitch, u32 flags, struct nvkm_fb_tile *);
50 void nv10_fb_tile_fini(struct nvkm_fb *, int i, struct nvkm_fb_tile *);
51 void nv10_fb_tile_prog(struct nvkm_fb *, int, struct nvkm_fb_tile *);
52 
53 u32 nv20_fb_tags(struct nvkm_fb *);
54 void nv20_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size,
55 		       u32 pitch, u32 flags, struct nvkm_fb_tile *);
56 void nv20_fb_tile_fini(struct nvkm_fb *, int i, struct nvkm_fb_tile *);
57 void nv20_fb_tile_prog(struct nvkm_fb *, int, struct nvkm_fb_tile *);
58 
59 void nv30_fb_init(struct nvkm_fb *);
60 void nv30_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size,
61 		       u32 pitch, u32 flags, struct nvkm_fb_tile *);
62 
63 void nv40_fb_tile_comp(struct nvkm_fb *, int i, u32 size, u32 flags,
64 		       struct nvkm_fb_tile *);
65 
66 void nv41_fb_init(struct nvkm_fb *);
67 void nv41_fb_tile_prog(struct nvkm_fb *, int, struct nvkm_fb_tile *);
68 
69 void nv44_fb_init(struct nvkm_fb *);
70 void nv44_fb_tile_prog(struct nvkm_fb *, int, struct nvkm_fb_tile *);
71 
72 void nv46_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size,
73 		       u32 pitch, u32 flags, struct nvkm_fb_tile *);
74 
75 int gf100_fb_oneinit(struct nvkm_fb *);
76 int gf100_fb_init_page(struct nvkm_fb *);
77 
78 int gm200_fb_init_page(struct nvkm_fb *);
79 
80 void gp100_fb_init_remapper(struct nvkm_fb *);
81 void gp100_fb_init_unkn(struct nvkm_fb *);
82 
83 int gp102_fb_new_(const struct nvkm_fb_func *, struct nvkm_device *, int,
84 		  struct nvkm_fb **);
85 bool gp102_fb_vpr_scrub_required(struct nvkm_fb *);
86 int gp102_fb_vpr_scrub(struct nvkm_fb *);
87 #endif
88