VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.17.1/vgaHW.h@ 69058

Last change on this file since 69058 was 54163, checked in by vboxsync, 10 years ago

Additions/x11/vboxvideo: support X.Org Server 1.17 (still untested).

  • Property svn:eol-style set to native
File size: 9.2 KB
Line 
1
2/*
3 * Copyright (c) 1997,1998 The XFree86 Project, Inc.
4 *
5 * Loosely based on code bearing the following copyright:
6 *
7 * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
8 *
9 * Author: Dirk Hohndel
10 */
11
12#ifndef _VGAHW_H
13#define _VGAHW_H
14
15#include <X11/X.h>
16#include "misc.h"
17#include "input.h"
18#include "scrnintstr.h"
19#include "colormapst.h"
20
21#include "xf86str.h"
22#include "xf86Pci.h"
23
24#include "xf86DDC.h"
25
26#include "globals.h"
27#include <X11/extensions/dpmsconst.h>
28
29extern _X_EXPORT int vgaHWGetIndex(void);
30
31/*
32 * access macro
33 */
34#define VGAHWPTR(p) ((vgaHWPtr)((p)->privates[vgaHWGetIndex()].ptr))
35
36/* Standard VGA registers */
37#define VGA_ATTR_INDEX 0x3C0
38#define VGA_ATTR_DATA_W 0x3C0
39#define VGA_ATTR_DATA_R 0x3C1
40#define VGA_IN_STAT_0 0x3C2 /* read */
41#define VGA_MISC_OUT_W 0x3C2 /* write */
42#define VGA_ENABLE 0x3C3
43#define VGA_SEQ_INDEX 0x3C4
44#define VGA_SEQ_DATA 0x3C5
45#define VGA_DAC_MASK 0x3C6
46#define VGA_DAC_READ_ADDR 0x3C7
47#define VGA_DAC_WRITE_ADDR 0x3C8
48#define VGA_DAC_DATA 0x3C9
49#define VGA_FEATURE_R 0x3CA /* read */
50#define VGA_MISC_OUT_R 0x3CC /* read */
51#define VGA_GRAPH_INDEX 0x3CE
52#define VGA_GRAPH_DATA 0x3CF
53
54#define VGA_IOBASE_MONO 0x3B0
55#define VGA_IOBASE_COLOR 0x3D0
56
57#define VGA_CRTC_INDEX_OFFSET 0x04
58#define VGA_CRTC_DATA_OFFSET 0x05
59#define VGA_IN_STAT_1_OFFSET 0x0A /* read */
60#define VGA_FEATURE_W_OFFSET 0x0A /* write */
61
62/* default number of VGA registers stored internally */
63#define VGA_NUM_CRTC 25
64#define VGA_NUM_SEQ 5
65#define VGA_NUM_GFX 9
66#define VGA_NUM_ATTR 21
67
68/* Flags for vgaHWSave() and vgaHWRestore() */
69#define VGA_SR_MODE 0x01
70#define VGA_SR_FONTS 0x02
71#define VGA_SR_CMAP 0x04
72#define VGA_SR_ALL (VGA_SR_MODE | VGA_SR_FONTS | VGA_SR_CMAP)
73
74/* Defaults for the VGA memory window */
75#define VGA_DEFAULT_PHYS_ADDR 0xA0000
76#define VGA_DEFAULT_MEM_SIZE (64 * 1024)
77
78/*
79 * vgaRegRec contains settings of standard VGA registers.
80 */
81typedef struct {
82 unsigned char MiscOutReg; /* */
83 unsigned char *CRTC; /* Crtc Controller */
84 unsigned char *Sequencer; /* Video Sequencer */
85 unsigned char *Graphics; /* Video Graphics */
86 unsigned char *Attribute; /* Video Atribute */
87 unsigned char DAC[768]; /* Internal Colorlookuptable */
88 unsigned char numCRTC; /* number of CRTC registers, def=VGA_NUM_CRTC */
89 unsigned char numSequencer; /* number of seq registers, def=VGA_NUM_SEQ */
90 unsigned char numGraphics; /* number of gfx registers, def=VGA_NUM_GFX */
91 unsigned char numAttribute; /* number of attr registers, def=VGA_NUM_ATTR */
92} vgaRegRec, *vgaRegPtr;
93
94typedef struct _vgaHWRec *vgaHWPtr;
95
96typedef void (*vgaHWWriteIndexProcPtr) (vgaHWPtr hwp, CARD8 indx, CARD8 value);
97typedef CARD8 (*vgaHWReadIndexProcPtr) (vgaHWPtr hwp, CARD8 indx);
98typedef void (*vgaHWWriteProcPtr) (vgaHWPtr hwp, CARD8 value);
99typedef CARD8 (*vgaHWReadProcPtr) (vgaHWPtr hwp);
100typedef void (*vgaHWMiscProcPtr) (vgaHWPtr hwp);
101
102/*
103 * vgaHWRec contains per-screen information required by the vgahw module.
104 *
105 * Note, the palette referred to by the paletteEnabled, enablePalette and
106 * disablePalette is the 16-entry (+overscan) EGA-compatible palette accessed
107 * via the first 17 attribute registers and not the main 8-bit palette.
108 */
109typedef struct _vgaHWRec {
110 void *Base; /* Address of "VGA" memory */
111 int MapSize; /* Size of "VGA" memory */
112 unsigned long MapPhys; /* phys location of VGA mem */
113 int IOBase; /* I/O Base address */
114 CARD8 *MMIOBase; /* Pointer to MMIO start */
115 int MMIOOffset; /* base + offset + vgareg
116 = mmioreg */
117 void *FontInfo1; /* save area for fonts in
118 plane 2 */
119 void *FontInfo2; /* save area for fonts in
120 plane 3 */
121 void *TextInfo; /* save area for text */
122 vgaRegRec SavedReg; /* saved registers */
123 vgaRegRec ModeReg; /* register settings for
124 current mode */
125 Bool ShowOverscan;
126 Bool paletteEnabled;
127 Bool cmapSaved;
128 ScrnInfoPtr pScrn;
129 vgaHWWriteIndexProcPtr writeCrtc;
130 vgaHWReadIndexProcPtr readCrtc;
131 vgaHWWriteIndexProcPtr writeGr;
132 vgaHWReadIndexProcPtr readGr;
133 vgaHWReadProcPtr readST00;
134 vgaHWReadProcPtr readST01;
135 vgaHWReadProcPtr readFCR;
136 vgaHWWriteProcPtr writeFCR;
137 vgaHWWriteIndexProcPtr writeAttr;
138 vgaHWReadIndexProcPtr readAttr;
139 vgaHWWriteIndexProcPtr writeSeq;
140 vgaHWReadIndexProcPtr readSeq;
141 vgaHWWriteProcPtr writeMiscOut;
142 vgaHWReadProcPtr readMiscOut;
143 vgaHWMiscProcPtr enablePalette;
144 vgaHWMiscProcPtr disablePalette;
145 vgaHWWriteProcPtr writeDacMask;
146 vgaHWReadProcPtr readDacMask;
147 vgaHWWriteProcPtr writeDacWriteAddr;
148 vgaHWWriteProcPtr writeDacReadAddr;
149 vgaHWWriteProcPtr writeDacData;
150 vgaHWReadProcPtr readDacData;
151 void *ddc;
152 struct pci_io_handle *io;
153 vgaHWReadProcPtr readEnable;
154 vgaHWWriteProcPtr writeEnable;
155 struct pci_device *dev;
156} vgaHWRec;
157
158/* Some macros that VGA drivers can use in their ChipProbe() function */
159#define OVERSCAN 0x11 /* Index of OverScan register */
160
161/* Flags that define how overscan correction should take place */
162#define KGA_FIX_OVERSCAN 1 /* overcan correction required */
163#define KGA_ENABLE_ON_ZERO 2 /* if possible enable display at beginning */
164 /* of next scanline/frame */
165#define KGA_BE_TOT_DEC 4 /* always fix problem by setting blank end */
166 /* to total - 1 */
167#define BIT_PLANE 3 /* Which plane we write to in mono mode */
168#define BITS_PER_GUN 6
169#define COLORMAP_SIZE 256
170
171#define DACDelay(hw) \
172 do { \
173 (hw)->readST01((hw)); \
174 (hw)->readST01((hw)); \
175 } while (0)
176
177/* Function Prototypes */
178
179/* vgaHW.c */
180
181typedef void vgaHWProtectProc(ScrnInfoPtr, Bool);
182typedef void vgaHWBlankScreenProc(ScrnInfoPtr, Bool);
183
184extern _X_EXPORT void vgaHWSetStdFuncs(vgaHWPtr hwp);
185extern _X_EXPORT void vgaHWSetMmioFuncs(vgaHWPtr hwp, CARD8 *base, int offset);
186extern _X_EXPORT void vgaHWProtect(ScrnInfoPtr pScrn, Bool on);
187extern _X_EXPORT vgaHWProtectProc *vgaHWProtectWeak(void);
188extern _X_EXPORT Bool vgaHWSaveScreen(ScreenPtr pScreen, int mode);
189extern _X_EXPORT void vgaHWBlankScreen(ScrnInfoPtr pScrn, Bool on);
190extern _X_EXPORT vgaHWBlankScreenProc *vgaHWBlankScreenWeak(void);
191extern _X_EXPORT void vgaHWSeqReset(vgaHWPtr hwp, Bool start);
192extern _X_EXPORT void vgaHWRestoreFonts(ScrnInfoPtr scrninfp,
193 vgaRegPtr restore);
194extern _X_EXPORT void vgaHWRestoreMode(ScrnInfoPtr scrninfp, vgaRegPtr restore);
195extern _X_EXPORT void vgaHWRestoreColormap(ScrnInfoPtr scrninfp,
196 vgaRegPtr restore);
197extern _X_EXPORT void vgaHWRestore(ScrnInfoPtr scrninfp, vgaRegPtr restore,
198 int flags);
199extern _X_EXPORT void vgaHWSaveFonts(ScrnInfoPtr scrninfp, vgaRegPtr save);
200extern _X_EXPORT void vgaHWSaveMode(ScrnInfoPtr scrninfp, vgaRegPtr save);
201extern _X_EXPORT void vgaHWSaveColormap(ScrnInfoPtr scrninfp, vgaRegPtr save);
202extern _X_EXPORT void vgaHWSave(ScrnInfoPtr scrninfp, vgaRegPtr save,
203 int flags);
204extern _X_EXPORT Bool vgaHWInit(ScrnInfoPtr scrnp, DisplayModePtr mode);
205extern _X_EXPORT Bool vgaHWSetRegCounts(ScrnInfoPtr scrp, int numCRTC,
206 int numSequencer, int numGraphics,
207 int numAttribute);
208extern _X_EXPORT Bool vgaHWCopyReg(vgaRegPtr dst, vgaRegPtr src);
209extern _X_EXPORT Bool vgaHWGetHWRec(ScrnInfoPtr scrp);
210extern _X_EXPORT void vgaHWFreeHWRec(ScrnInfoPtr scrp);
211extern _X_EXPORT Bool vgaHWMapMem(ScrnInfoPtr scrp);
212extern _X_EXPORT void vgaHWUnmapMem(ScrnInfoPtr scrp);
213extern _X_EXPORT void vgaHWGetIOBase(vgaHWPtr hwp);
214extern _X_EXPORT void vgaHWLock(vgaHWPtr hwp);
215extern _X_EXPORT void vgaHWUnlock(vgaHWPtr hwp);
216extern _X_EXPORT void vgaHWEnable(vgaHWPtr hwp);
217extern _X_EXPORT void vgaHWDisable(vgaHWPtr hwp);
218extern _X_EXPORT void vgaHWDPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode,
219 int flags);
220extern _X_EXPORT Bool vgaHWHandleColormaps(ScreenPtr pScreen);
221extern _X_EXPORT void vgaHWddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed);
222extern _X_EXPORT CARD32 vgaHWHBlankKGA(DisplayModePtr mode, vgaRegPtr regp,
223 int nBits, unsigned int Flags);
224extern _X_EXPORT CARD32 vgaHWVBlankKGA(DisplayModePtr mode, vgaRegPtr regp,
225 int nBits, unsigned int Flags);
226extern _X_EXPORT Bool vgaHWAllocDefaultRegs(vgaRegPtr regp);
227
228extern _X_EXPORT DDC1SetSpeedProc vgaHWddc1SetSpeedWeak(void);
229extern _X_EXPORT SaveScreenProcPtr vgaHWSaveScreenWeak(void);
230extern _X_EXPORT void xf86GetClocks(ScrnInfoPtr pScrn, int num,
231 Bool (*ClockFunc) (ScrnInfoPtr, int),
232 void (*ProtectRegs) (ScrnInfoPtr, Bool),
233 void (*BlankScreen) (ScrnInfoPtr, Bool),
234 unsigned long vertsyncreg, int maskval,
235 int knownclkindex, int knownclkvalue);
236
237#endif /* _VGAHW_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette