VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/XFree86-4.3/Xserver/vbe.h@ 98148

Last change on this file since 98148 was 69098, checked in by vboxsync, 8 years ago

Clean up XFree86 driver header files.
bugref:3810: X11 Guest Additions maintenance
Over the years we have cleaned up the layout in the tree of the X.Org
header files we use to build drivers. The XFree86 ones were still in their
original, rather sub-optimal layout. This change fixes that.

  • Property svn:eol-style set to native
File size: 10.1 KB
Line 
1/* $XFree86: xc/programs/Xserver/hw/xfree86/vbe/vbe.h,v 1.1 2003/02/17 17:06:45 dawes Exp $ */
2
3/*
4 * XFree86 vbe module
5 * Copyright 2000 Egbert Eich
6 *
7 * The mode query/save/set/restore functions from the vesa driver
8 * have been moved here.
9 * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
10 * Authors: Paulo César Pereira de Andrade <[email protected]>
11 */
12
13#ifndef _VBE_H
14#define _VBE_H
15#include "xf86int10.h"
16#include "xf86DDC.h"
17
18typedef enum {
19 DDC_UNCHECKED,
20 DDC_NONE,
21 DDC_1,
22 DDC_2,
23 DDC_1_2
24}
25ddc_lvl;
26
27typedef struct {
28 xf86Int10InfoPtr pInt10;
29 int version;
30 pointer memory;
31 int real_mode_base;
32 int num_pages;
33 Bool init_int10;
34 ddc_lvl ddc;
35 Bool ddc_blank;
36} vbeInfoRec, *vbeInfoPtr;
37
38#define VBE_VERSION_MAJOR(x) *((CARD8*)(&x) + 1)
39#define VBE_VERSION_MINOR(x) (CARD8)(x)
40
41vbeInfoPtr VBEInit(xf86Int10InfoPtr pInt, int entityIndex);
42vbeInfoPtr VBEExtendedInit(xf86Int10InfoPtr pInt, int entityIndex, int Flags);
43void vbeFree(vbeInfoPtr pVbe);
44xf86MonPtr vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule);
45
46#pragma pack(1)
47
48typedef struct vbeControllerInfoBlock {
49 CARD8 VbeSignature[4];
50 CARD16 VbeVersion;
51 CARD32 OemStringPtr;
52 CARD8 Capabilities[4];
53 CARD32 VideoModePtr;
54 CARD16 TotalMem;
55 CARD16 OemSoftwareRev;
56 CARD32 OemVendorNamePtr;
57 CARD32 OemProductNamePtr;
58 CARD32 OemProductRevPtr;
59 CARD8 Scratch[222];
60 CARD8 OemData[256];
61} vbeControllerInfoRec, *vbeControllerInfoPtr;
62
63#pragma pack()
64
65#ifndef __GNUC__
66#define __attribute__(a)
67#endif
68
69typedef struct _VbeInfoBlock VbeInfoBlock;
70typedef struct _VbeModeInfoBlock VbeModeInfoBlock;
71typedef struct _VbeCRTCInfoBlock VbeCRTCInfoBlock;
72
73/*
74 * INT 0
75 */
76
77struct _VbeInfoBlock {
78 /* VESA 1.2 fields */
79 CARD8 VESASignature[4]; /* VESA */
80 CARD16 VESAVersion; /* Higher byte major, lower byte minor */
81 /*CARD32*/char *OEMStringPtr; /* Pointer to OEM string */
82 CARD8 Capabilities[4]; /* Capabilities of the video environment */
83
84 /*CARD32*/CARD16 *VideoModePtr; /* pointer to supported Super VGA modes */
85
86 CARD16 TotalMemory; /* Number of 64kb memory blocks on board */
87 /* if not VESA 2, 236 scratch bytes follow (256 bytes total size) */
88
89 /* VESA 2 fields */
90 CARD16 OemSoftwareRev; /* VBE implementation Software revision */
91 /*CARD32*/char *OemVendorNamePtr; /* Pointer to Vendor Name String */
92 /*CARD32*/char *OemProductNamePtr; /* Pointer to Product Name String */
93 /*CARD32*/char *OemProductRevPtr; /* Pointer to Product Revision String */
94 CARD8 Reserved[222]; /* Reserved for VBE implementation */
95 CARD8 OemData[256]; /* Data Area for OEM Strings */
96} __attribute__((packed));
97
98/* Return Super VGA Information */
99VbeInfoBlock *VBEGetVBEInfo(vbeInfoPtr pVbe);
100void VBEFreeVBEInfo(VbeInfoBlock *block);
101
102/*
103 * INT 1
104 */
105
106struct _VbeModeInfoBlock {
107 CARD16 ModeAttributes; /* mode attributes */
108 CARD8 WinAAttributes; /* window A attributes */
109 CARD8 WinBAttributes; /* window B attributes */
110 CARD16 WinGranularity; /* window granularity */
111 CARD16 WinSize; /* window size */
112 CARD16 WinASegment; /* window A start segment */
113 CARD16 WinBSegment; /* window B start segment */
114 CARD32 WinFuncPtr; /* real mode pointer to window function */
115 CARD16 BytesPerScanline; /* bytes per scanline */
116
117 /* Mandatory information for VBE 1.2 and above */
118 CARD16 XResolution; /* horizontal resolution in pixels or characters */
119 CARD16 YResolution; /* vertical resolution in pixels or characters */
120 CARD8 XCharSize; /* character cell width in pixels */
121 CARD8 YCharSize; /* character cell height in pixels */
122 CARD8 NumberOfPlanes; /* number of memory planes */
123 CARD8 BitsPerPixel; /* bits per pixel */
124 CARD8 NumberOfBanks; /* number of banks */
125 CARD8 MemoryModel; /* memory model type */
126 CARD8 BankSize; /* bank size in KB */
127 CARD8 NumberOfImages; /* number of images */
128 CARD8 Reserved; /* 1 */ /* reserved for page function */
129
130 /* Direct color fields (required for direct/6 and YUV/7 memory models) */
131 CARD8 RedMaskSize; /* size of direct color red mask in bits */
132 CARD8 RedFieldPosition; /* bit position of lsb of red mask */
133 CARD8 GreenMaskSize; /* size of direct color green mask in bits */
134 CARD8 GreenFieldPosition; /* bit position of lsb of green mask */
135 CARD8 BlueMaskSize; /* size of direct color blue mask in bits */
136 CARD8 BlueFieldPosition; /* bit position of lsb of blue mask */
137 CARD8 RsvdMaskSize; /* size of direct color reserved mask in bits */
138 CARD8 RsvdFieldPosition; /* bit position of lsb of reserved mask */
139 CARD8 DirectColorModeInfo; /* direct color mode attributes */
140
141 /* Mandatory information for VBE 2.0 and above */
142 CARD32 PhysBasePtr; /* physical address for flat memory frame buffer */
143 CARD32 Reserved32; /* 0 */ /* Reserved - always set to 0 */
144 CARD16 Reserved16; /* 0 */ /* Reserved - always set to 0 */
145
146 /* Mandatory information for VBE 3.0 and above */
147 CARD16 LinBytesPerScanLine; /* bytes per scan line for linear modes */
148 CARD8 BnkNumberOfImagePages; /* number of images for banked modes */
149 CARD8 LinNumberOfImagePages; /* number of images for linear modes */
150 CARD8 LinRedMaskSize; /* size of direct color red mask (linear modes) */
151 CARD8 LinRedFieldPosition; /* bit position of lsb of red mask (linear modes) */
152 CARD8 LinGreenMaskSize; /* size of direct color green mask (linear modes) */
153 CARD8 LinGreenFieldPosition; /* bit position of lsb of green mask (linear modes) */
154 CARD8 LinBlueMaskSize; /* size of direct color blue mask (linear modes) */
155 CARD8 LinBlueFieldPosition; /* bit position of lsb of blue mask (linear modes) */
156 CARD8 LinRsvdMaskSize; /* size of direct color reserved mask (linear modes) */
157 CARD8 LinRsvdFieldPosition; /* bit position of lsb of reserved mask (linear modes) */
158 CARD32 MaxPixelClock; /* maximum pixel clock (in Hz) for graphics mode */
159 CARD8 Reserved2[189]; /* remainder of VbeModeInfoBlock */
160} __attribute__((packed));
161
162/* Return VBE Mode Information */
163VbeModeInfoBlock *VBEGetModeInfo(vbeInfoPtr pVbe, int mode);
164void VBEFreeModeInfo(VbeModeInfoBlock *block);
165
166/*
167 * INT2
168 */
169
170#define CRTC_DBLSCAN (1<<0)
171#define CRTC_INTERLACE (1<<1)
172#define CRTC_NHSYNC (1<<2)
173#define CRTC_NVSYNC (1<<3)
174
175struct _VbeCRTCInfoBlock {
176 CARD16 HorizontalTotal; /* Horizontal total in pixels */
177 CARD16 HorizontalSyncStart; /* Horizontal sync start in pixels */
178 CARD16 HorizontalSyncEnd; /* Horizontal sync end in pixels */
179 CARD16 VerticalTotal; /* Vertical total in lines */
180 CARD16 VerticalSyncStart; /* Vertical sync start in lines */
181 CARD16 VerticalSyncEnd; /* Vertical sync end in lines */
182 CARD8 Flags; /* Flags (Interlaced, Double Scan etc) */
183 CARD32 PixelClock; /* Pixel clock in units of Hz */
184 CARD16 RefreshRate; /* Refresh rate in units of 0.01 Hz */
185 CARD8 Reserved[40]; /* remainder of ModeInfoBlock */
186} __attribute__((packed));
187/* VbeCRTCInfoBlock is in the VESA 3.0 specs */
188
189Bool VBESetVBEMode(vbeInfoPtr pVbe, int mode, VbeCRTCInfoBlock *crtc);
190
191/*
192 * INT 3
193 */
194
195Bool VBEGetVBEMode(vbeInfoPtr pVbe, int *mode);
196
197/*
198 * INT 4
199 */
200
201/* Save/Restore Super VGA video state */
202/* function values are (values stored in VESAPtr):
203 * 0 := query & allocate amount of memory to save state
204 * 1 := save state
205 * 2 := restore state
206 *
207 * function 0 called automatically if function 1 called without
208 * a previous call to function 0.
209 */
210
211typedef enum {
212 MODE_QUERY,
213 MODE_SAVE,
214 MODE_RESTORE
215} vbeSaveRestoreFunction;
216
217Bool
218VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction fuction,
219 pointer *memory, int *size, int *real_mode_pages);
220
221/*
222 * INT 5
223 */
224
225Bool
226VBEBankSwitch(vbeInfoPtr pVbe, unsigned int iBank, int window);
227
228/*
229 * INT 6
230 */
231
232typedef enum {
233 SCANWID_SET,
234 SCANWID_GET,
235 SCANWID_SET_BYTES,
236 SCANWID_GET_MAX
237} vbeScanwidthCommand;
238
239#define VBESetLogicalScanline(pVbe, width) \
240 VBESetGetLogicalScanlineLength(pVbe, SCANWID_SET, \
241 width, NULL, NULL, NULL)
242#define VBESetLogicalScanlineBytes(pVbe, width) \
243 VBESetGetLogicalScanlineLength(pVbe, SCANWID_SET_BYTES, width, \
244 NULL, NULL, NULL)
245#define VBEGetLogicalScanline(pVbe, pixels, bytes, max) \
246 VBESetGetLogicalScanlineLength(pVbe, SCANWID_GET, 0, \
247 pixels, bytes, max)
248#define VBEGetMaxLogicalScanline(pVbe, pixels, bytes, max) \
249 VBESetGetLogicalScanlineLength(pVbe, SCANWID_GET_MAX, \
250 NULL, pixels, bytes, max)
251Bool VBESetGetLogicalScanlineLength(vbeInfoPtr pVbe,
252 vbeScanwidthCommand command, int width,
253 int *pixels, int *bytes, int *max);
254
255/*
256 * INT 7
257 */
258
259/* 16 bit code */
260Bool VBESetDisplayStart(vbeInfoPtr pVbe, int x, int y, Bool wait_retrace);
261Bool VBEGetDisplayStart(vbeInfoPtr pVbe, int *x, int *y);
262
263/*
264 * INT 8
265 */
266
267/* if bits is 0, then it is a GET */
268int VBESetGetDACPaletteFormat(vbeInfoPtr pVbe, int bits);
269
270/*
271 * INT 9
272 */
273
274/*
275 * If getting a palette, the data argument is not used. It will return
276 * the data.
277 * If setting a palette, it will return the pointer received on success,
278 * NULL on failure.
279 */
280CARD32 *VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num,
281 CARD32 *data, Bool secondary, Bool wait_retrace);
282#define VBEFreePaletteData(data) xfree(data)
283
284/*
285 * INT A
286 */
287
288typedef struct _VBEpmi {
289 int seg_tbl;
290 int tbl_off;
291 int tbl_len;
292} VBEpmi;
293
294VBEpmi *VBEGetVBEpmi(vbeInfoPtr pVbe);
295#define VESAFreeVBEpmi(pmi) xfree(pmi)
296
297/* high level helper functions */
298
299typedef struct _vbeModeInfoRec {
300 int width;
301 int height;
302 int bpp;
303 int n;
304 struct _vbeModeInfoRec *next;
305} vbeModeInfoRec, *vbeModeInfoPtr;
306
307vbeModeInfoPtr VBEBuildVbeModeList(vbeInfoPtr pVbe,
308 VbeInfoBlock *vbe);
309
310unsigned short VBECalcVbeModeIndex(vbeModeInfoPtr m,
311 DisplayModePtr mode, int bpp);
312
313typedef struct {
314 CARD8 *state;
315 CARD8 *pstate;
316 int statePage;
317 int stateSize;
318 int stateMode;
319} vbeSaveRestoreRec, *vbeSaveRestorePtr;
320
321void
322VBEVesaSaveRestore(vbeInfoPtr pVbe, vbeSaveRestorePtr vbe_sr,
323 vbeSaveRestoreFunction function);
324
325int VBEGetPixelClock(vbeInfoPtr pVbe, int mode, int Clock);
326Bool VBEDPMSSet(vbeInfoPtr pVbe, int mode);
327
328#endif
Note: See TracBrowser for help on using the repository browser.

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