~ubuntu-branches/ubuntu/gutsy/vnc4/gutsy

« back to all changes in this revision

Viewing changes to unix/xc/programs/Xserver/hw/xfree86/drivers/i810/i830.h

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2006-05-15 20:35:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515203517-l4lre1ku942mn26k
Tags: 4.1.1+X4.3.0-10
* Correction of critical security issue. Thanks to Martin Kogler
  <e9925248@student.tuwien.ac.at> that informed me about the issue,
  and provided the patch.
  This flaw was originally found by Steve Wiseman of intelliadmin.com.
* Applied patch from Javier Kohen <jkohen@users.sourceforge.net> that
  inform the user that only 8 first characters of the password will
  actually be used when typing more than 8 characters, closes:
  #355619.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/**************************************************************************
 
3
 
 
4
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
 
5
Copyright � 2002 David Dawes
 
6
 
 
7
All Rights Reserved.
 
8
 
 
9
Permission is hereby granted, free of charge, to any person obtaining a
 
10
copy of this software and associated documentation files (the
 
11
"Software"), to deal in the Software without restriction, including
 
12
without limitation the rights to use, copy, modify, merge, publish,
 
13
distribute, sub license, and/or sell copies of the Software, and to
 
14
permit persons to whom the Software is furnished to do so, subject to
 
15
the following conditions:
 
16
 
 
17
The above copyright notice and this permission notice (including the
 
18
next paragraph) shall be included in all copies or substantial portions
 
19
of the Software.
 
20
 
 
21
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 
22
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
23
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
 
24
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
 
25
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 
26
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 
27
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
28
 
 
29
**************************************************************************/
 
30
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830.h,v 1.7 2003/01/28 22:47:09 dawes Exp $ */
 
31
 
 
32
/*
 
33
 * Authors:
 
34
 *   Keith Whitwell <keith@tungstengraphics.com>
 
35
 *   David Dawes <dawes@tungstengraphics.com>
 
36
 *
 
37
 */
 
38
 
 
39
#if 0
 
40
#define I830DEBUG
 
41
#endif
 
42
 
 
43
#ifndef REMAP_RESERVED
 
44
#define REMAP_RESERVED 0
 
45
#endif
 
46
 
 
47
#ifndef _I830_H_
 
48
#define _I830_H_
 
49
 
 
50
#include "xf86_ansic.h"
 
51
#include "compiler.h"
 
52
#include "xf86PciInfo.h"
 
53
#include "xf86Pci.h"
 
54
#include "i810_reg.h"
 
55
#include "xaa.h"
 
56
#include "xf86Cursor.h"
 
57
#include "xf86xv.h"
 
58
#include "xf86int10.h"
 
59
#include "vbe.h"
 
60
#include "vgaHW.h"
 
61
 
 
62
#ifdef XF86DRI
 
63
#include "xf86drm.h"
 
64
#include "sarea.h"
 
65
#define _XF86DRI_SERVER_
 
66
#include "xf86dri.h"
 
67
#include "dri.h"
 
68
#include "GL/glxint.h"
 
69
#include "i830_dri.h"
 
70
#endif
 
71
 
 
72
#include "common.h"
 
73
 
 
74
/* I830 Video BIOS support */
 
75
 
 
76
/*
 
77
 * The mode handling is based upon the VESA driver written by
 
78
 * Paulo C�sar Pereira de Andrade <pcpa@conectiva.com.br>.
 
79
 */
 
80
 
 
81
typedef struct _VESARec {
 
82
   /* SVGA state */
 
83
   pointer state, pstate;
 
84
   int statePage, stateSize, stateMode;
 
85
   CARD32 *savedPal;
 
86
   int savedScanlinePitch;
 
87
   xf86MonPtr monitor;
 
88
   /* Don't try to set the refresh rate for any modes. */
 
89
   Bool useDefaultRefresh;
 
90
} VESARec, *VESAPtr;
 
91
 
 
92
 
 
93
typedef struct _I830Rec *I830Ptr;
 
94
 
 
95
typedef void (*I830WriteIndexedByteFunc)(I830Ptr pI830, IOADDRESS addr,
 
96
                                         CARD8 index, CARD8 value);
 
97
typedef CARD8(*I830ReadIndexedByteFunc)(I830Ptr pI830, IOADDRESS addr,
 
98
                                        CARD8 index);
 
99
typedef void (*I830WriteByteFunc)(I830Ptr pI830, IOADDRESS addr, CARD8 value);
 
100
typedef CARD8(*I830ReadByteFunc)(I830Ptr pI830, IOADDRESS addr);
 
101
 
 
102
/* Linear region allocated in framebuffer. */
 
103
typedef struct _I830MemPool *I830MemPoolPtr;
 
104
typedef struct _I830MemRange *I830MemRangePtr;
 
105
typedef struct _I830MemRange {
 
106
   long Start;
 
107
   long End;
 
108
   long Size;
 
109
   unsigned long Physical;
 
110
   unsigned long Offset;                /* Offset of AGP-allocated portion */
 
111
   unsigned long Alignment;
 
112
   int Key;
 
113
   I830MemPoolPtr Pool;
 
114
} I830MemRange;
 
115
 
 
116
typedef struct _I830MemPool {
 
117
   I830MemRange Total;
 
118
   I830MemRange Free;
 
119
   I830MemRange Fixed;
 
120
   I830MemRange Allocated;
 
121
} I830MemPool;
 
122
 
 
123
typedef struct {
 
124
   int tail_mask;
 
125
   I830MemRange mem;
 
126
   unsigned char *virtual_start;
 
127
   int head;
 
128
   int tail;
 
129
   int space;
 
130
} I830RingBuffer;
 
131
 
 
132
typedef struct {
 
133
   unsigned int Fence[8];
 
134
} I830RegRec, *I830RegPtr;
 
135
 
 
136
typedef struct _I830Rec {
 
137
   unsigned char *MMIOBase;
 
138
   unsigned char *FbBase;
 
139
   int cpp;
 
140
 
 
141
   unsigned int bufferOffset;           /* for I830SelectBuffer */
 
142
   BoxRec FbMemBox;
 
143
   int CacheLines;
 
144
 
 
145
   /* These are set in PreInit and never changed. */
 
146
   unsigned long FbMapSize;
 
147
   unsigned long TotalVideoRam;
 
148
   I830MemRange StolenMemory;           /* pre-allocated memory */
 
149
   unsigned long BIOSMemorySize;        /* min stolen pool size */
 
150
 
 
151
   /* These change according to what has been allocated. */
 
152
   long FreeMemory;
 
153
   I830MemRange MemoryAperture;
 
154
   I830MemPool StolenPool;
 
155
   unsigned long allocatedMemory;
 
156
 
 
157
   /* Regions allocated either from the above pools, or from agpgart. */
 
158
   I830MemRange FrontBuffer;
 
159
   I830MemRange CursorMem;
 
160
   I830RingBuffer LpRing;
 
161
   I830MemRange Scratch;
 
162
 
 
163
#if REMAP_RESERVED
 
164
   I830MemRange Dummy;
 
165
#endif
 
166
 
 
167
#ifdef I830_XV
 
168
   /* For Xvideo */
 
169
   I830MemRange OverlayMem;
 
170
#endif
 
171
 
 
172
#ifdef XF86DRI
 
173
   I830MemRange BackBuffer;
 
174
   I830MemRange DepthBuffer;
 
175
   I830MemRange TexMem;
 
176
   I830MemRange BufferMem;
 
177
   I830MemRange ContextMem;
 
178
   int TexGranularity;
 
179
   int drmMinor;
 
180
   Bool have3DWindows;
 
181
#endif
 
182
 
 
183
   Bool NeedRingBufferLow;
 
184
   Bool allowPageFlip;
 
185
 
 
186
   int auxPitch;
 
187
   int auxPitchBits;
 
188
 
 
189
   Bool CursorNeedsPhysical;
 
190
 
 
191
   DGAModePtr DGAModes;
 
192
   int numDGAModes;
 
193
   Bool DGAactive;
 
194
   int DGAViewportStatus;
 
195
 
 
196
   int Chipset;
 
197
   unsigned long LinearAddr;
 
198
   unsigned long MMIOAddr;
 
199
   IOADDRESS ioBase;
 
200
   EntityInfoPtr pEnt;
 
201
   pciVideoPtr PciInfo;
 
202
   PCITAG PciTag;
 
203
   CARD8 variant;
 
204
 
 
205
   unsigned int BR[20];
 
206
 
 
207
   int GttBound;
 
208
 
 
209
   unsigned char **ScanlineColorExpandBuffers;
 
210
   int NumScanlineColorExpandBuffers;
 
211
   int nextColorExpandBuf;
 
212
 
 
213
   I830RegRec SavedReg;
 
214
   I830RegRec ModeReg;
 
215
 
 
216
   Bool noAccel;
 
217
   Bool SWCursor;
 
218
   Bool cursorOn;
 
219
   XAAInfoRecPtr AccelInfoRec;
 
220
   xf86CursorInfoPtr CursorInfoRec;
 
221
   CloseScreenProcPtr CloseScreen;
 
222
   ScreenBlockHandlerProcPtr BlockHandler;
 
223
 
 
224
   I830WriteIndexedByteFunc writeControl;
 
225
   I830ReadIndexedByteFunc readControl;
 
226
   I830WriteByteFunc writeStandard;
 
227
   I830ReadByteFunc readStandard;
 
228
 
 
229
   Bool XvDisabled;                     /* Xv disabled in PreInit. */
 
230
   Bool XvEnabled;                      /* Xv enabled for this generation. */
 
231
 
 
232
#ifdef I830_XV
 
233
   int colorKey;
 
234
   XF86VideoAdaptorPtr adaptor;
 
235
   Bool overlayOn;
 
236
#endif
 
237
 
 
238
   Bool directRenderingDisabled;        /* DRI disabled in PreInit. */
 
239
   Bool directRenderingEnabled;         /* DRI enabled this generation. */
 
240
 
 
241
#ifdef XF86DRI
 
242
   Bool directRenderingOpen;
 
243
   int LockHeld;
 
244
   DRIInfoPtr pDRIInfo;
 
245
   int drmSubFD;
 
246
   int numVisualConfigs;
 
247
   __GLXvisualConfig *pVisualConfigs;
 
248
   I830ConfigPrivPtr pVisualConfigsPriv;
 
249
   drmHandle buffer_map;
 
250
   drmHandle ring_map;
 
251
#endif
 
252
 
 
253
   OptionInfoPtr Options;
 
254
 
 
255
   /* Stolen memory support */
 
256
   Bool StolenOnly;
 
257
 
 
258
   /* Video BIOS support. */
 
259
   vbeInfoPtr pVbe;
 
260
   VbeInfoBlock *vbeInfo;
 
261
   VESAPtr vesa;
 
262
 
 
263
   Bool overrideBIOSMemSize;
 
264
   int saveBIOSMemSize;
 
265
   int newBIOSMemSize;
 
266
   Bool useSWF1;
 
267
   int saveSWF1;
 
268
 
 
269
   Bool swfSaved;
 
270
   CARD32 saveSWF0;
 
271
   CARD32 saveSWF4;
 
272
 
 
273
   /* Use BIOS call 0x5f64 to explicitly enable displays. */
 
274
   Bool enableDisplays;
 
275
   /* Use BIOS call 0x5f05 to set the refresh rate. */
 
276
   Bool useExtendedRefresh;
 
277
 
 
278
   int configuredDevices;
 
279
 
 
280
   /* These are indexed by the display types */
 
281
   Bool displayAttached[NumDisplayTypes];
 
282
   Bool displayPresent[NumDisplayTypes];
 
283
   BoxRec displaySize[NumDisplayTypes];
 
284
 
 
285
   /* [0] is Pipe A, [1] is Pipe B. */
 
286
   int availablePipes;
 
287
   int pipeDevices[MAX_DISPLAY_PIPES];
 
288
   /* [0] is display plane A, [1] is display plane B. */
 
289
   Bool pipeEnabled[MAX_DISPLAY_PIPES];
 
290
   BoxRec pipeDisplaySize[MAX_DISPLAY_PIPES];
 
291
   int planeEnabled[MAX_DISPLAY_PIPES];
 
292
 
 
293
   /* Driver phase/state information */
 
294
   Bool starting;
 
295
   Bool closing;
 
296
   Bool suspended;
 
297
 
 
298
} I830Rec;
 
299
 
 
300
#define I830PTR(p) ((I830Ptr)((p)->driverPrivate))
 
301
#define I830REGPTR(p) (&(I830PTR(p)->ModeReg))
 
302
 
 
303
#define I830_SELECT_FRONT       0
 
304
#define I830_SELECT_BACK        1
 
305
#define I830_SELECT_DEPTH       2
 
306
 
 
307
/* I830 specific functions */
 
308
extern int I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis);
 
309
extern void I830SetPIOAccess(I830Ptr pI830);
 
310
extern void I830SetMMIOAccess(I830Ptr pI830);
 
311
extern void I830PrintErrorState(ScrnInfoPtr pScrn);
 
312
extern void I830Sync(ScrnInfoPtr pScrn);
 
313
extern void I830InitHWCursor(ScrnInfoPtr pScrn);
 
314
extern Bool I830CursorInit(ScreenPtr pScreen);
 
315
extern void I830EmitInvarientState(ScrnInfoPtr pScrn);
 
316
extern void I830SelectBuffer(ScrnInfoPtr pScrn, int buffer);
 
317
 
 
318
extern void I830RefreshRing(ScrnInfoPtr pScrn);
 
319
extern void I830EmitFlush(ScrnInfoPtr pScrn);
 
320
 
 
321
extern Bool I830DGAInit(ScreenPtr pScreen);
 
322
 
 
323
#ifdef I830_XV
 
324
extern void I830InitVideo(ScreenPtr pScreen);
 
325
extern void I830VideoSwitchModeBefore(ScrnInfoPtr pScrn, DisplayModePtr mode);
 
326
extern void I830VideoSwitchModeAfter(ScrnInfoPtr pScrn, DisplayModePtr mode);
 
327
#endif
 
328
 
 
329
#ifdef XF86DRI
 
330
extern Bool I830Allocate3DMemory(ScrnInfoPtr pScrn, const int flags);
 
331
extern void I830SetupMemoryTiling(ScrnInfoPtr pScrn);
 
332
extern Bool I830DRIScreenInit(ScreenPtr pScreen);
 
333
extern Bool I830DRIDoMappings(ScreenPtr pScreen);
 
334
extern void I830DRICloseScreen(ScreenPtr pScreen);
 
335
extern Bool I830DRIFinishScreenInit(ScreenPtr pScreen);
 
336
#endif
 
337
extern Bool I830AccelInit(ScreenPtr pScreen);
 
338
extern void I830SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir,
 
339
                                           int ydir, int rop,
 
340
                                           unsigned int planemask,
 
341
                                           int trans_color);
 
342
extern void I830SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int srcX,
 
343
                                             int srcY, int dstX, int dstY,
 
344
                                             int w, int h);
 
345
extern void I830SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
 
346
                                  unsigned int planemask);
 
347
extern void I830SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y,
 
348
                                        int w, int h);
 
349
 
 
350
extern void I830ResetAllocations(ScrnInfoPtr pScrn, const int flags);
 
351
extern long I830CheckAvailableMemory(ScrnInfoPtr pScrn);
 
352
extern long I830GetExcessMemoryAllocations(ScrnInfoPtr pScrn);
 
353
extern Bool I830Allocate2DMemory(ScrnInfoPtr pScrn, const int flags);
 
354
extern Bool I830DoPoolAllocation(ScrnInfoPtr pScrn, I830MemPool *pool);
 
355
extern Bool I830FixupOffsets(ScrnInfoPtr pScrn);
 
356
extern Bool I830BindGARTMemory(ScrnInfoPtr pScrn);
 
357
extern Bool I830UnbindGARTMemory(ScrnInfoPtr pScrn);
 
358
extern unsigned long I830AllocVidMem(ScrnInfoPtr pScrn, I830MemRange *result,
 
359
                                     I830MemPool *pool, unsigned long size,
 
360
                                     unsigned long alignment, int flags);
 
361
 
 
362
extern void I830PrintAllRegisters(I830RegPtr i830Reg);
 
363
extern void I830ReadAllRegisters(I830Ptr pI830, I830RegPtr i830Reg);
 
364
 
 
365
extern void I830ChangeFrontbuffer(ScrnInfoPtr pScrn,int buffer);
 
366
 
 
367
/*
 
368
 * 12288 is set as the maximum, chosen because it is enough for
 
369
 * 1920x1440@32bpp with a 2048 pixel line pitch with some to spare.
 
370
 */
 
371
#define I830_MAXIMUM_VBIOS_MEM          12288
 
372
#define I830_DEFAULT_VIDEOMEM_2D        (MB(8) / 1024)
 
373
#define I830_DEFAULT_VIDEOMEM_3D        (MB(32) / 1024)
 
374
 
 
375
/* Flags for memory allocation function */
 
376
#define FROM_ANYWHERE                   0x00000000
 
377
#define FROM_POOL_ONLY                  0x00000001
 
378
#define FROM_NEW_ONLY                   0x00000002
 
379
#define FROM_MASK                       0x0000000f
 
380
 
 
381
#define ALLOCATE_AT_TOP                 0x00000010
 
382
#define ALLOCATE_AT_BOTTOM              0x00000020
 
383
#define FORCE_GAPS                      0x00000040
 
384
 
 
385
#define NEED_PHYSICAL_ADDR              0x00000100
 
386
#define ALIGN_BOTH_ENDS                 0x00000200
 
387
#define FORCE_LOW                       0x00000400
 
388
 
 
389
#define ALLOC_NO_TILING                 0x00001000
 
390
#define ALLOC_INITIAL                   0x00002000
 
391
 
 
392
#define ALLOCATE_DRY_RUN                0x80000000
 
393
 
 
394
 
 
395
#endif /* _I830_H_ */