Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
fb.h
Go to the documentation of this file.
1 #ifndef __NOUVEAU_FB_H__
2 #define __NOUVEAU_FB_H__
3 
4 #include <core/subdev.h>
5 #include <core/device.h>
6 #include <core/mm.h>
7 
8 #include <subdev/vm.h>
9 
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
17 
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
23 
24 #define NV_MEM_TYPE_VM 0x7f
25 #define NV_MEM_COMP_VM 0x03
26 
27 struct nouveau_mem {
28  struct drm_device *dev;
29 
31  struct nouveau_vma vma[2];
33 
40  struct sg_table *sg;
41 };
42 
49 };
50 
51 struct nouveau_fb {
53 
55 
56  struct {
57  enum {
69  } type;
72  int ranks;
73 
74  int (*get)(struct nouveau_fb *, u64 size, u32 align,
75  u32 size_nc, u32 type, struct nouveau_mem **);
76  void (*put)(struct nouveau_fb *, struct nouveau_mem **);
77  } ram;
78 
79  struct nouveau_mm vram;
80  struct nouveau_mm tags;
81 
82  struct {
83  struct nouveau_fb_tile region[16];
84  int regions;
85  void (*init)(struct nouveau_fb *, int i, u32 addr, u32 size,
86  u32 pitch, u32 flags, struct nouveau_fb_tile *);
87  void (*fini)(struct nouveau_fb *, int i,
88  struct nouveau_fb_tile *);
89  void (*prog)(struct nouveau_fb *, int i,
90  struct nouveau_fb_tile *);
91  } tile;
92 };
93 
94 static inline struct nouveau_fb *
95 nouveau_fb(void *obj)
96 {
97  return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_FB];
98 }
99 
100 #define nouveau_fb_create(p,e,c,d) \
101  nouveau_subdev_create((p), (e), (c), 0, "PFB", "fb", (d))
102 int nouveau_fb_created(struct nouveau_fb *);
103 void nouveau_fb_destroy(struct nouveau_fb *);
104 int nouveau_fb_init(struct nouveau_fb *);
105 #define nouveau_fb_fini(p,s) \
106  nouveau_subdev_fini(&(p)->base, (s))
107 
108 void _nouveau_fb_dtor(struct nouveau_object *);
109 int _nouveau_fb_init(struct nouveau_object *);
110 #define _nouveau_fb_fini _nouveau_subdev_fini
111 
112 extern struct nouveau_oclass nv04_fb_oclass;
113 extern struct nouveau_oclass nv10_fb_oclass;
114 extern struct nouveau_oclass nv20_fb_oclass;
115 extern struct nouveau_oclass nv30_fb_oclass;
116 extern struct nouveau_oclass nv40_fb_oclass;
117 extern struct nouveau_oclass nv50_fb_oclass;
118 extern struct nouveau_oclass nvc0_fb_oclass;
119 
120 struct nouveau_bios;
122 
124 
125 void nv10_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *);
126 
127 void nv30_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size,
128  u32 pitch, u32 flags, struct nouveau_fb_tile *);
129 void nv30_fb_tile_fini(struct nouveau_fb *, int i, struct nouveau_fb_tile *);
130 
131 void nv50_fb_vram_del(struct nouveau_fb *, struct nouveau_mem **);
132 void nv50_fb_trap(struct nouveau_fb *, int display);
133 
134 #endif