VirtualBox

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

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

Additions/x11/x11include: exported and set eol-style on new headers

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

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