diff options
Diffstat (limited to 'src/nv_type.h')
-rw-r--r-- | src/nv_type.h | 124 |
1 files changed, 38 insertions, 86 deletions
diff --git a/src/nv_type.h b/src/nv_type.h index 6face1f..510ec11 100644 --- a/src/nv_type.h +++ b/src/nv_type.h | |||
@@ -17,14 +17,6 @@ | |||
17 | #error "This driver requires a DRI-enabled X server" | 17 | #error "This driver requires a DRI-enabled X server" |
18 | #endif | 18 | #endif |
19 | 19 | ||
20 | #include "nouveau_bios.h" | ||
21 | |||
22 | #include "nouveau_ms.h" | ||
23 | |||
24 | #include "nouveau_crtc.h" | ||
25 | #include "nouveau_connector.h" | ||
26 | #include "nouveau_output.h" | ||
27 | |||
28 | #define NV_ARCH_03 0x03 | 20 | #define NV_ARCH_03 0x03 |
29 | #define NV_ARCH_04 0x04 | 21 | #define NV_ARCH_04 0x04 |
30 | #define NV_ARCH_10 0x10 | 22 | #define NV_ARCH_10 0x10 |
@@ -69,74 +61,31 @@ | |||
69 | #define CHIPSET_C512 0x03D0 | 61 | #define CHIPSET_C512 0x03D0 |
70 | #define CHIPSET_G73_BRIDGED 0x02E0 | 62 | #define CHIPSET_G73_BRIDGED 0x02E0 |
71 | 63 | ||
72 | |||
73 | #undef SetBit /* some input related header also includes a macro called SetBit, which gives a lot of warnings. */ | ||
74 | #define BITMASK(t,b) (((unsigned)(1U << (((t)-(b)+1)))-1) << (b)) | ||
75 | #define MASKEXPAND(mask) BITMASK(1?mask,0?mask) | ||
76 | #define SetBF(mask,value) ((value) << (0?mask)) | ||
77 | #define GetBF(var,mask) (((unsigned)((var) & MASKEXPAND(mask))) >> (0?mask) ) | ||
78 | #define SetBitField(value,from,to) SetBF(to, GetBF(value,from)) | ||
79 | #define SetBit(n) (1<<(n)) | ||
80 | #define Set8Bits(value) ((value)&0xff) | ||
81 | |||
82 | /* NV50 */ | 64 | /* NV50 */ |
83 | typedef enum ORNum { | ||
84 | DAC0 = 0, | ||
85 | DAC1 = 1, | ||
86 | DAC2 = 2, | ||
87 | SOR0 = 0, | ||
88 | SOR1 = 1, | ||
89 | SOR2 = 2, | ||
90 | } ORNum; | ||
91 | |||
92 | typedef struct _NVRec *NVPtr; | 65 | typedef struct _NVRec *NVPtr; |
93 | typedef struct _NVRec { | 66 | typedef struct _NVRec { |
94 | struct nouveau_mode_state saved_regs; | ||
95 | struct nouveau_mode_state set_state; | ||
96 | uint32_t saved_vga_font[4][16384]; | ||
97 | uint32_t Architecture; | 67 | uint32_t Architecture; |
98 | EntityInfoPtr pEnt; | 68 | EntityInfoPtr pEnt; |
99 | struct pci_device *PciInfo; | 69 | struct pci_device *PciInfo; |
100 | int Chipset; | 70 | int Chipset; |
101 | int NVArch; | 71 | int NVArch; |
102 | Bool Primary; | 72 | Bool Primary; |
103 | CARD32 IOAddress; | ||
104 | 73 | ||
105 | /* VRAM physical address */ | 74 | /* VRAM physical address */ |
106 | unsigned long VRAMPhysical; | 75 | unsigned long VRAMPhysical; |
107 | /* Size of VRAM BAR */ | ||
108 | unsigned long VRAMPhysicalSize; | ||
109 | /* Accesible VRAM size (by the GPU) */ | ||
110 | unsigned long VRAMSize; | ||
111 | /* Mapped VRAM BAR */ | ||
112 | void * VRAMMap; | ||
113 | /* Accessible AGP size */ | ||
114 | unsigned long AGPSize; | ||
115 | 76 | ||
116 | /* Various pinned memory regions */ | 77 | /* Various pinned memory regions */ |
117 | struct nouveau_bo * scanout; | 78 | struct nouveau_bo * scanout; |
118 | struct nouveau_bo * offscreen; | 79 | struct nouveau_bo * offscreen; |
119 | void * offscreen_map; | 80 | void * offscreen_map; |
120 | //struct nouveau_bo * FB_old; /* for KMS */ | ||
121 | struct nouveau_bo * shadow[2]; /* for easy acces by exa */ | ||
122 | struct nouveau_bo * Cursor; | ||
123 | struct nouveau_bo * Cursor2; | ||
124 | struct nouveau_bo * GART; | 81 | struct nouveau_bo * GART; |
125 | 82 | ||
126 | struct nvbios VBIOS; | ||
127 | struct nouveau_bios_info *vbios; | ||
128 | Bool NoAccel; | 83 | Bool NoAccel; |
129 | Bool HWCursor; | 84 | Bool HWCursor; |
130 | Bool FpScale; | ||
131 | Bool ShadowFB; | 85 | Bool ShadowFB; |
132 | unsigned char * ShadowPtr; | 86 | unsigned char * ShadowPtr; |
133 | int ShadowPitch; | 87 | int ShadowPitch; |
134 | uint32_t RamAmountKBytes; | ||
135 | 88 | ||
136 | volatile CARD32 *REGS; | ||
137 | volatile CARD32 *FB_BAR; | ||
138 | |||
139 | uint8_t cur_head; | ||
140 | ExaDriverPtr EXADriverPtr; | 89 | ExaDriverPtr EXADriverPtr; |
141 | Bool exa_driver_pixmaps; | 90 | Bool exa_driver_pixmaps; |
142 | Bool exa_force_cp; | 91 | Bool exa_force_cp; |
@@ -146,48 +95,24 @@ typedef struct _NVRec { | |||
146 | CreateScreenResourcesProcPtr CreateScreenResources; | 95 | CreateScreenResourcesProcPtr CreateScreenResources; |
147 | CloseScreenProcPtr CloseScreen; | 96 | CloseScreenProcPtr CloseScreen; |
148 | /* Cursor */ | 97 | /* Cursor */ |
149 | uint32_t curImage[256]; | 98 | uint32_t curImage[256]; |
150 | /* I2C / DDC */ | 99 | void (*VideoTimerCallback)(ScrnInfoPtr, Time); |
151 | xf86Int10InfoPtr pInt10; | ||
152 | unsigned Int10Mode; | ||
153 | void (*VideoTimerCallback)(ScrnInfoPtr, Time); | ||
154 | XF86VideoAdaptorPtr overlayAdaptor; | 100 | XF86VideoAdaptorPtr overlayAdaptor; |
155 | XF86VideoAdaptorPtr blitAdaptor; | 101 | XF86VideoAdaptorPtr blitAdaptor; |
156 | XF86VideoAdaptorPtr textureAdaptor[2]; | 102 | XF86VideoAdaptorPtr textureAdaptor[2]; |
157 | int videoKey; | 103 | int videoKey; |
158 | Bool FPDither; | ||
159 | int Mobile; | ||
160 | int vtOWNER; | ||
161 | OptionInfoPtr Options; | 104 | OptionInfoPtr Options; |
162 | bool alphaCursor; | ||
163 | bool twoHeads; | ||
164 | bool gf4_disp_arch; | ||
165 | bool two_reg_pll; | ||
166 | 105 | ||
167 | Bool LockedUp; | 106 | Bool LockedUp; |
168 | 107 | ||
169 | CARD32 currentRop; | 108 | CARD32 currentRop; |
170 | 109 | ||
171 | Bool WaitVSyncPossible; | ||
172 | Bool BlendingPossible; | ||
173 | DRIInfoPtr pDRIInfo; | 110 | DRIInfoPtr pDRIInfo; |
174 | drmVersionPtr pLibDRMVersion; | 111 | drmVersionPtr pLibDRMVersion; |
175 | drmVersionPtr pKernelDRMVersion; | 112 | drmVersionPtr pKernelDRMVersion; |
176 | 113 | ||
177 | Bool kms_enable; | ||
178 | |||
179 | I2CBusPtr pI2CBus[DCB_MAX_NUM_I2C_ENTRIES]; | ||
180 | struct nouveau_encoder *encoders; | ||
181 | |||
182 | #ifdef XF86DRM_MODE | ||
183 | void *drmmode; /* for KMS */ | 114 | void *drmmode; /* for KMS */ |
184 | Bool allow_dpms; | 115 | Bool allow_dpms; |
185 | #endif | ||
186 | |||
187 | nouveauCrtcPtr crtc[2]; | ||
188 | nouveauOutputPtr output; /* this a linked list. */ | ||
189 | /* Assume a connector can exist for each i2c bus. */ | ||
190 | nouveauConnectorPtr connector[DCB_MAX_NUM_I2C_ENTRIES]; | ||
191 | 116 | ||
192 | /* DRM interface */ | 117 | /* DRM interface */ |
193 | struct nouveau_device *dev; | 118 | struct nouveau_device *dev; |
@@ -228,15 +153,6 @@ typedef struct _NVRec { | |||
228 | 153 | ||
229 | #define NVPTR(p) ((NVPtr)((p)->driverPrivate)) | 154 | #define NVPTR(p) ((NVPtr)((p)->driverPrivate)) |
230 | 155 | ||
231 | #define nvReadCurVGA(pNv, reg) NVReadVgaCrtc(pNv, pNv->cur_head, reg) | ||
232 | #define nvWriteCurVGA(pNv, reg, val) NVWriteVgaCrtc(pNv, pNv->cur_head, reg, val) | ||
233 | |||
234 | #define nvReadCurRAMDAC(pNv, reg) NVReadRAMDAC(pNv, pNv->cur_head, reg) | ||
235 | #define nvWriteCurRAMDAC(pNv, reg, val) NVWriteRAMDAC(pNv, pNv->cur_head, reg, val) | ||
236 | |||
237 | #define nvReadCurCRTC(pNv, reg) NVReadCRTC(pNv, pNv->cur_head, reg) | ||
238 | #define nvWriteCurCRTC(pNv, reg, val) NVWriteCRTC(pNv, pNv->cur_head, reg, val) | ||
239 | |||
240 | typedef struct _NVPortPrivRec { | 156 | typedef struct _NVPortPrivRec { |
241 | short brightness; | 157 | short brightness; |
242 | short contrast; | 158 | short contrast; |
@@ -329,4 +245,40 @@ nouveau_pixmap_offset(PixmapPtr ppix) | |||
329 | return exaGetPixmapOffset(ppix); | 245 | return exaGetPixmapOffset(ppix); |
330 | } | 246 | } |
331 | 247 | ||
248 | static inline uint32_t | ||
249 | nv_pitch_align(NVPtr pNv, uint32_t width, int bpp) | ||
250 | { | ||
251 | int mask; | ||
252 | |||
253 | if (bpp == 15) | ||
254 | bpp = 16; | ||
255 | if (bpp == 24 || bpp == 30) | ||
256 | bpp = 8; | ||
257 | |||
258 | /* Alignment requirements taken from the Haiku driver */ | ||
259 | if (pNv->Architecture == NV_ARCH_04) | ||
260 | mask = 128 / bpp - 1; | ||
261 | else | ||
262 | mask = 512 / bpp - 1; | ||
263 | |||
264 | return (width + mask) & ~mask; | ||
265 | } | ||
266 | |||
267 | /* nv04 cursor max dimensions of 32x32 (A1R5G5B5) */ | ||
268 | #define NV04_CURSOR_SIZE 32 | ||
269 | /* limit nv10 cursors to 64x64 (ARGB8) (we could go to 64x255) */ | ||
270 | #define NV10_CURSOR_SIZE 64 | ||
271 | |||
272 | static inline int nv_cursor_width(NVPtr pNv) | ||
273 | { | ||
274 | return pNv->NVArch >= 0x10 ? NV10_CURSOR_SIZE : NV04_CURSOR_SIZE; | ||
275 | } | ||
276 | |||
277 | static inline int nv_cursor_pixels(NVPtr pNv) | ||
278 | { | ||
279 | int width = nv_cursor_width(pNv); | ||
280 | |||
281 | return width * width; | ||
282 | } | ||
283 | |||
332 | #endif /* __NV_STRUCT_H__ */ | 284 | #endif /* __NV_STRUCT_H__ */ |