VirtualBox

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

最後變更 在這個檔案從40349是 40349,由 vboxsync 提交於 13 年 前

Additions/xorg: support X.Org Server 1.12.

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

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