xref: /linux/drivers/gpu/drm/nouveau/nvkm/subdev/fb/priv.h (revision 0ea5c948cb64bab5bc7a5516774eb8536f05aa0d)
1b7019ac5SIlia Mirkin /* SPDX-License-Identifier: MIT */
2c39f472eSBen Skeggs #ifndef __NVKM_FB_PRIV_H__
3c39f472eSBen Skeggs #define __NVKM_FB_PRIV_H__
403c8952fSBen Skeggs #define nvkm_fb(p) container_of((p), struct nvkm_fb, subdev)
5c39f472eSBen Skeggs #include <subdev/fb.h>
61bab09acSLyude Paul #include <subdev/therm.h>
7639c308eSBen Skeggs struct nvkm_bios;
8c39f472eSBen Skeggs 
9*834a712bSBen Skeggs int r535_fb_new(const struct nvkm_fb_func *,
10*834a712bSBen Skeggs 		struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fb **);
11*834a712bSBen Skeggs 
1203c8952fSBen Skeggs struct nvkm_fb_func {
1303c8952fSBen Skeggs 	void *(*dtor)(struct nvkm_fb *);
14af793b8cSBen Skeggs 	u32 (*tags)(struct nvkm_fb *);
15917d95a8SBen Skeggs 	int (*oneinit)(struct nvkm_fb *);
1603c8952fSBen Skeggs 	void (*init)(struct nvkm_fb *);
172f958e82SBen Skeggs 	void (*init_remapper)(struct nvkm_fb *);
182854ab8dSBen Skeggs 	int (*init_page)(struct nvkm_fb *);
197ff51f82SBen Skeggs 	void (*init_unkn)(struct nvkm_fb *);
2003c8952fSBen Skeggs 	void (*intr)(struct nvkm_fb *);
21c39f472eSBen Skeggs 
225728d064SBen Skeggs 	struct nvkm_fb_func_sysmem {
235728d064SBen Skeggs 		void (*flush_page_init)(struct nvkm_fb *);
245728d064SBen Skeggs 	} sysmem;
255728d064SBen Skeggs 
262c0c15a2SBen Skeggs 	struct nvkm_fb_func_vidmem {
272c0c15a2SBen Skeggs 		u64 (*size)(struct nvkm_fb *);
282c0c15a2SBen Skeggs 	} vidmem;
292c0c15a2SBen Skeggs 
3003c8952fSBen Skeggs 	struct {
31ebe52a58SBen Skeggs 		bool (*scrub_required)(struct nvkm_fb *);
32ebe52a58SBen Skeggs 		int (*scrub)(struct nvkm_fb *);
33ebe52a58SBen Skeggs 	} vpr;
34ebe52a58SBen Skeggs 
35ebe52a58SBen Skeggs 	struct {
3603c8952fSBen Skeggs 		int regions;
3703c8952fSBen Skeggs 		void (*init)(struct nvkm_fb *, int i, u32 addr, u32 size,
3803c8952fSBen Skeggs 			     u32 pitch, u32 flags, struct nvkm_fb_tile *);
3903c8952fSBen Skeggs 		void (*comp)(struct nvkm_fb *, int i, u32 size, u32 flags,
4003c8952fSBen Skeggs 			     struct nvkm_fb_tile *);
4103c8952fSBen Skeggs 		void (*fini)(struct nvkm_fb *, int i, struct nvkm_fb_tile *);
4203c8952fSBen Skeggs 		void (*prog)(struct nvkm_fb *, int i, struct nvkm_fb_tile *);
4303c8952fSBen Skeggs 	} tile;
44c39f472eSBen Skeggs 
45d36a99d2SBen Skeggs 	int (*ram_new)(struct nvkm_fb *, struct nvkm_ram **);
4603c8952fSBen Skeggs 
472854ab8dSBen Skeggs 	u8 default_bigpage;
481bab09acSLyude Paul 	const struct nvkm_therm_clkgate_pack *clkgate_pack;
49c39f472eSBen Skeggs };
50c39f472eSBen Skeggs 
515728d064SBen Skeggs int nvkm_fb_ctor(const struct nvkm_fb_func *, struct nvkm_device *device,
52b7a9369aSBen Skeggs 		 enum nvkm_subdev_type type, int inst, struct nvkm_fb *);
5303c8952fSBen Skeggs int nvkm_fb_new_(const struct nvkm_fb_func *, struct nvkm_device *device,
54b7a9369aSBen Skeggs 		 enum nvkm_subdev_type type, int inst, struct nvkm_fb **);
55639c308eSBen Skeggs int nvkm_fb_bios_memtype(struct nvkm_bios *);
5603c8952fSBen Skeggs 
5703c8952fSBen Skeggs void nv10_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size,
5803c8952fSBen Skeggs 		       u32 pitch, u32 flags, struct nvkm_fb_tile *);
5903c8952fSBen Skeggs void nv10_fb_tile_fini(struct nvkm_fb *, int i, struct nvkm_fb_tile *);
6003c8952fSBen Skeggs void nv10_fb_tile_prog(struct nvkm_fb *, int, struct nvkm_fb_tile *);
6103c8952fSBen Skeggs 
62af793b8cSBen Skeggs u32 nv20_fb_tags(struct nvkm_fb *);
6303c8952fSBen Skeggs void nv20_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size,
6403c8952fSBen Skeggs 		       u32 pitch, u32 flags, struct nvkm_fb_tile *);
6503c8952fSBen Skeggs void nv20_fb_tile_fini(struct nvkm_fb *, int i, struct nvkm_fb_tile *);
6603c8952fSBen Skeggs void nv20_fb_tile_prog(struct nvkm_fb *, int, struct nvkm_fb_tile *);
6703c8952fSBen Skeggs 
6803c8952fSBen Skeggs void nv30_fb_init(struct nvkm_fb *);
6903c8952fSBen Skeggs void nv30_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size,
7003c8952fSBen Skeggs 		       u32 pitch, u32 flags, struct nvkm_fb_tile *);
7103c8952fSBen Skeggs 
7203c8952fSBen Skeggs void nv40_fb_tile_comp(struct nvkm_fb *, int i, u32 size, u32 flags,
7303c8952fSBen Skeggs 		       struct nvkm_fb_tile *);
7403c8952fSBen Skeggs 
7503c8952fSBen Skeggs void nv41_fb_init(struct nvkm_fb *);
7603c8952fSBen Skeggs void nv41_fb_tile_prog(struct nvkm_fb *, int, struct nvkm_fb_tile *);
7703c8952fSBen Skeggs 
7803c8952fSBen Skeggs void nv44_fb_init(struct nvkm_fb *);
7903c8952fSBen Skeggs void nv44_fb_tile_prog(struct nvkm_fb *, int, struct nvkm_fb_tile *);
8003c8952fSBen Skeggs 
8103c8952fSBen Skeggs void nv46_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size,
8203c8952fSBen Skeggs 		       u32 pitch, u32 flags, struct nvkm_fb_tile *);
8303c8952fSBen Skeggs 
8499c59172SBen Skeggs int gf100_fb_oneinit(struct nvkm_fb *);
852854ab8dSBen Skeggs int gf100_fb_init_page(struct nvkm_fb *);
865728d064SBen Skeggs void gf100_fb_sysmem_flush_page_init(struct nvkm_fb *);
877ff51f82SBen Skeggs 
882854ab8dSBen Skeggs int gm200_fb_init_page(struct nvkm_fb *);
893582942cSBen Skeggs 
902f958e82SBen Skeggs void gp100_fb_init_remapper(struct nvkm_fb *);
913582942cSBen Skeggs void gp100_fb_init_unkn(struct nvkm_fb *);
92ebe52a58SBen Skeggs 
931b9b4f92SBen Skeggs int gp102_fb_oneinit(struct nvkm_fb *);
942c0c15a2SBen Skeggs u64 gp102_fb_vidmem_size(struct nvkm_fb *);
95ebe52a58SBen Skeggs bool gp102_fb_vpr_scrub_required(struct nvkm_fb *);
96ebe52a58SBen Skeggs int gp102_fb_vpr_scrub(struct nvkm_fb *);
9741ba806fSBen Skeggs 
9841ba806fSBen Skeggs int gv100_fb_init_page(struct nvkm_fb *);
99b4806009SBen Skeggs 
100b4806009SBen Skeggs bool tu102_fb_vpr_scrub_required(struct nvkm_fb *);
101c39f472eSBen Skeggs #endif
102