1 #ifndef __NOUVEAU_FB_H__
2 #define __NOUVEAU_FB_H__
4 #include <core/subdev.h>
5 #include <core/device.h>
10 /* memory type/access flags, do not match hardware values */
11 #define NV_MEM_ACCESS_RO 1
12 #define NV_MEM_ACCESS_WO 2
13 #define NV_MEM_ACCESS_RW (NV_MEM_ACCESS_RO | NV_MEM_ACCESS_WO)
14 #define NV_MEM_ACCESS_SYS 4
15 #define NV_MEM_ACCESS_VM 8
16 #define NV_MEM_ACCESS_NOSNOOP 16
18 #define NV_MEM_TARGET_VRAM 0
19 #define NV_MEM_TARGET_PCI 1
20 #define NV_MEM_TARGET_PCI_NOSNOOP 2
21 #define NV_MEM_TARGET_VM 3
22 #define NV_MEM_TARGET_GART 4
24 #define NV_MEM_TYPE_VM 0x7f
25 #define NV_MEM_COMP_VM 0x03
28 struct drm_device *dev;
30 struct nouveau_vma bar_vma;
31 struct nouveau_vma vma[2];
34 struct nouveau_mm_node *tag;
35 struct list_head regions;
43 struct nouveau_fb_tile {
44 struct nouveau_mm_node *tag;
52 struct nouveau_subdev base;
54 bool (*memtype_valid)(struct nouveau_fb *, u32 memtype);
58 NV_MEM_TYPE_UNKNOWN = 0,
76 int (*init)(struct nouveau_fb *);
77 int (*get)(struct nouveau_fb *, u64 size, u32 align,
78 u32 size_nc, u32 type, struct nouveau_mem **);
79 void (*put)(struct nouveau_fb *, struct nouveau_mem **);
82 struct nouveau_mm vram;
83 struct nouveau_mm tags;
86 struct nouveau_fb_tile region[16];
88 void (*init)(struct nouveau_fb *, int i, u32 addr, u32 size,
89 u32 pitch, u32 flags, struct nouveau_fb_tile *);
90 void (*comp)(struct nouveau_fb *, int i, u32 size, u32 flags,
91 struct nouveau_fb_tile *);
92 void (*fini)(struct nouveau_fb *, int i,
93 struct nouveau_fb_tile *);
94 void (*prog)(struct nouveau_fb *, int i,
95 struct nouveau_fb_tile *);
99 static inline struct nouveau_fb *
100 nouveau_fb(void *obj)
102 return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_FB];
105 #define nouveau_fb_create(p,e,c,d) \
106 nouveau_subdev_create((p), (e), (c), 0, "PFB", "fb", (d))
107 int nouveau_fb_preinit(struct nouveau_fb *);
108 void nouveau_fb_destroy(struct nouveau_fb *);
109 int nouveau_fb_init(struct nouveau_fb *);
110 #define nouveau_fb_fini(p,s) \
111 nouveau_subdev_fini(&(p)->base, (s))
113 void _nouveau_fb_dtor(struct nouveau_object *);
114 int _nouveau_fb_init(struct nouveau_object *);
115 #define _nouveau_fb_fini _nouveau_subdev_fini
117 extern struct nouveau_oclass nv04_fb_oclass;
118 extern struct nouveau_oclass nv10_fb_oclass;
119 extern struct nouveau_oclass nv1a_fb_oclass;
120 extern struct nouveau_oclass nv20_fb_oclass;
121 extern struct nouveau_oclass nv25_fb_oclass;
122 extern struct nouveau_oclass nv30_fb_oclass;
123 extern struct nouveau_oclass nv35_fb_oclass;
124 extern struct nouveau_oclass nv36_fb_oclass;
125 extern struct nouveau_oclass nv40_fb_oclass;
126 extern struct nouveau_oclass nv41_fb_oclass;
127 extern struct nouveau_oclass nv44_fb_oclass;
128 extern struct nouveau_oclass nv46_fb_oclass;
129 extern struct nouveau_oclass nv47_fb_oclass;
130 extern struct nouveau_oclass nv49_fb_oclass;
131 extern struct nouveau_oclass nv4e_fb_oclass;
132 extern struct nouveau_oclass nv50_fb_oclass;
133 extern struct nouveau_oclass nvc0_fb_oclass;
136 int nouveau_fb_bios_memtype(struct nouveau_bios *);
138 bool nv04_fb_memtype_valid(struct nouveau_fb *, u32 memtype);
140 void nv10_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size,
141 u32 pitch, u32 flags, struct nouveau_fb_tile *);
142 void nv10_fb_tile_fini(struct nouveau_fb *, int i, struct nouveau_fb_tile *);
143 void nv10_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *);
145 int nv20_fb_vram_init(struct nouveau_fb *);
146 void nv20_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size,
147 u32 pitch, u32 flags, struct nouveau_fb_tile *);
148 void nv20_fb_tile_fini(struct nouveau_fb *, int i, struct nouveau_fb_tile *);
149 void nv20_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *);
151 int nv30_fb_init(struct nouveau_object *);
152 void nv30_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size,
153 u32 pitch, u32 flags, struct nouveau_fb_tile *);
155 void nv40_fb_tile_comp(struct nouveau_fb *, int i, u32 size, u32 flags,
156 struct nouveau_fb_tile *);
158 int nv41_fb_vram_init(struct nouveau_fb *);
159 int nv41_fb_init(struct nouveau_object *);
160 void nv41_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *);
162 int nv44_fb_vram_init(struct nouveau_fb *);
163 int nv44_fb_init(struct nouveau_object *);
164 void nv44_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *);
166 void nv46_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size,
167 u32 pitch, u32 flags, struct nouveau_fb_tile *);
169 void nv50_fb_vram_del(struct nouveau_fb *, struct nouveau_mem **);