VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/7.0/xorg/vgaHW.h@ 17240

Last change on this file since 17240 was 17236, checked in by vboxsync, 16 years ago

Additions/x11/x11include: blast! Reverted r43555 and r43556

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