VirtualBox

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

最後變更 在這個檔案從103415是 36308,由 vboxsync 提交於 14 年 前

fix OSE

  • 屬性 svn:eol-style 設為 native
檔案大小: 8.7 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 IOADDRESS PIOOffset; /* offset + vgareg
155 = pioreg */
156 vgaHWReadProcPtr readEnable;
157 vgaHWWriteProcPtr writeEnable;
158 struct pci_device *dev;
159} vgaHWRec;
160
161/* Some macros that VGA drivers can use in their ChipProbe() function */
162#define VGAHW_GET_IOBASE() ((inb(VGA_MISC_OUT_R) & 0x01) ? \
163 VGA_IOBASE_COLOR : VGA_IOBASE_MONO)
164
165#define OVERSCAN 0x11 /* Index of OverScan register */
166
167/* Flags that define how overscan correction should take place */
168#define KGA_FIX_OVERSCAN 1 /* overcan correction required */
169#define KGA_ENABLE_ON_ZERO 2 /* if possible enable display at beginning */
170 /* of next scanline/frame */
171#define KGA_BE_TOT_DEC 4 /* always fix problem by setting blank end */
172 /* to total - 1 */
173#define BIT_PLANE 3 /* Which plane we write to in mono mode */
174#define BITS_PER_GUN 6
175#define COLORMAP_SIZE 256
176
177#if defined(__powerpc__) || defined(__arm__) || defined(__s390__) || defined(__nds32__)
178#define DACDelay(hw) /* No legacy VGA support */
179#else
180#define DACDelay(hw) \
181 do { \
182 (void)inb((hw)->PIOOffset + (hw)->IOBase + VGA_IN_STAT_1_OFFSET); \
183 (void)inb((hw)->PIOOffset + (hw)->IOBase + VGA_IN_STAT_1_OFFSET); \
184 } while (0)
185#endif
186
187/* Function Prototypes */
188
189/* vgaHW.c */
190
191typedef void vgaHWProtectProc(ScrnInfoPtr, Bool);
192typedef void vgaHWBlankScreenProc(ScrnInfoPtr, Bool);
193
194extern _X_EXPORT void vgaHWSetStdFuncs(vgaHWPtr hwp);
195extern _X_EXPORT void vgaHWSetMmioFuncs(vgaHWPtr hwp, CARD8 *base, int offset);
196extern _X_EXPORT void vgaHWProtect(ScrnInfoPtr pScrn, Bool on);
197extern _X_EXPORT vgaHWProtectProc *vgaHWProtectWeak(void);
198extern _X_EXPORT Bool vgaHWSaveScreen(ScreenPtr pScreen, int mode);
199extern _X_EXPORT void vgaHWBlankScreen(ScrnInfoPtr pScrn, Bool on);
200extern _X_EXPORT vgaHWBlankScreenProc *vgaHWBlankScreenWeak(void);
201extern _X_EXPORT void vgaHWSeqReset(vgaHWPtr hwp, Bool start);
202extern _X_EXPORT void vgaHWRestoreFonts(ScrnInfoPtr scrninfp, vgaRegPtr restore);
203extern _X_EXPORT void vgaHWRestoreMode(ScrnInfoPtr scrninfp, vgaRegPtr restore);
204extern _X_EXPORT void vgaHWRestoreColormap(ScrnInfoPtr scrninfp, vgaRegPtr restore);
205extern _X_EXPORT void vgaHWRestore(ScrnInfoPtr scrninfp, vgaRegPtr restore, int flags);
206extern _X_EXPORT void vgaHWSaveFonts(ScrnInfoPtr scrninfp, vgaRegPtr save);
207extern _X_EXPORT void vgaHWSaveMode(ScrnInfoPtr scrninfp, vgaRegPtr save);
208extern _X_EXPORT void vgaHWSaveColormap(ScrnInfoPtr scrninfp, vgaRegPtr save);
209extern _X_EXPORT void vgaHWSave(ScrnInfoPtr scrninfp, vgaRegPtr save, int flags);
210extern _X_EXPORT Bool vgaHWInit(ScrnInfoPtr scrnp, DisplayModePtr mode);
211extern _X_EXPORT Bool vgaHWSetRegCounts(ScrnInfoPtr scrp, int numCRTC, int numSequencer,
212 int numGraphics, int numAttribute);
213extern _X_EXPORT Bool vgaHWCopyReg(vgaRegPtr dst, vgaRegPtr src);
214extern _X_EXPORT Bool vgaHWGetHWRec(ScrnInfoPtr scrp);
215extern _X_EXPORT void vgaHWFreeHWRec(ScrnInfoPtr scrp);
216extern _X_EXPORT Bool vgaHWMapMem(ScrnInfoPtr scrp);
217extern _X_EXPORT void vgaHWUnmapMem(ScrnInfoPtr scrp);
218extern _X_EXPORT void vgaHWGetIOBase(vgaHWPtr hwp);
219extern _X_EXPORT void vgaHWLock(vgaHWPtr hwp);
220extern _X_EXPORT void vgaHWUnlock(vgaHWPtr hwp);
221extern _X_EXPORT void vgaHWEnable(vgaHWPtr hwp);
222extern _X_EXPORT void vgaHWDisable(vgaHWPtr hwp);
223extern _X_EXPORT void vgaHWDPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
224extern _X_EXPORT Bool vgaHWHandleColormaps(ScreenPtr pScreen);
225extern _X_EXPORT void vgaHWddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed);
226extern _X_EXPORT CARD32 vgaHWHBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits,
227 unsigned int Flags);
228extern _X_EXPORT CARD32 vgaHWVBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits,
229 unsigned int Flags);
230extern _X_EXPORT Bool vgaHWAllocDefaultRegs(vgaRegPtr regp);
231
232extern _X_EXPORT DDC1SetSpeedProc vgaHWddc1SetSpeedWeak(void);
233extern _X_EXPORT SaveScreenProcPtr vgaHWSaveScreenWeak(void);
234
235#endif /* _VGAHW_H */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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