Mercurial > mplayer.hg
annotate linux/vbelib.h @ 2541:88195a28576a
changed hardcoded 'emms' to EMMS according to pp/swscale.c
author | alex |
---|---|
date | Mon, 29 Oct 2001 20:28:06 +0000 |
parents | 7925f241765b |
children | 88c089c3ea45 |
rev | line source |
---|---|
2243 | 1 /* |
2 VESA VBE 2.0 compatible structures and definitions. | |
3 You can redistribute this file under terms and conditions | |
4 GNU General Public licence v2. | |
5 Written by Nick Kurshev <nickols_k@mail.ru> | |
6 */ | |
7 #ifndef __VESA_VBELIB_INCLUDED__ | |
8 #define __VESA_VBELIB_INCLUDED__ 1 | |
9 | |
10 /* Note: every pointer within structures is 32-bit protected mode pointer. | |
11 So you don't need to convert it from real mode. */ | |
12 | |
13 typedef struct tagFarPtr | |
14 { | |
15 unsigned short off; | |
16 unsigned short seg; | |
17 }FarPtr; | |
18 | |
2254
6e5b548790c9
Fixed bug of 32-bit mode interface detection and save-restore mechanism
nick
parents:
2243
diff
changeset
|
19 #define VBE_DAC_8BIT (1 << 0) |
6e5b548790c9
Fixed bug of 32-bit mode interface detection and save-restore mechanism
nick
parents:
2243
diff
changeset
|
20 #define VBE_NONVGA_CRTC (1 << 1) |
6e5b548790c9
Fixed bug of 32-bit mode interface detection and save-restore mechanism
nick
parents:
2243
diff
changeset
|
21 #define VBE_SNOWED_RAMDAC (1 << 2) |
6e5b548790c9
Fixed bug of 32-bit mode interface detection and save-restore mechanism
nick
parents:
2243
diff
changeset
|
22 #define VBE_STEREOSCOPIC (1 << 3) |
6e5b548790c9
Fixed bug of 32-bit mode interface detection and save-restore mechanism
nick
parents:
2243
diff
changeset
|
23 #define VBE_STEREO_EVC (1 << 4) |
6e5b548790c9
Fixed bug of 32-bit mode interface detection and save-restore mechanism
nick
parents:
2243
diff
changeset
|
24 |
2243 | 25 struct VbeInfoBlock { |
26 char VESASignature[4]; /* 'VESA' 4 byte signature */ | |
27 short VESAVersion; /* VBE version number */ | |
28 char * OemStringPtr; /* Pointer to OEM string */ | |
29 long Capabilities; /* Capabilities of video card */ | |
30 unsigned short* VideoModePtr; /* Pointer to supported modes */ | |
31 short TotalMemory; /* Number of 64kb memory blocks */ | |
2254
6e5b548790c9
Fixed bug of 32-bit mode interface detection and save-restore mechanism
nick
parents:
2243
diff
changeset
|
32 /* VBE 2.0 and above */ |
2243 | 33 short OemSoftwareRev; |
34 char * OemVendorNamePtr; | |
35 char * OemProductNamePtr; | |
36 char * OemProductRevPtr; | |
37 char reserved[222]; | |
38 char OemData[256]; /* Pad to 512 byte block size */ | |
39 }__attribute__ ((packed)); | |
40 | |
41 static inline FarPtr VirtToPhys(void *ptr) | |
42 { | |
43 FarPtr retval; | |
44 retval.seg = ((unsigned long)ptr) >> 4; | |
45 retval.off = ((unsigned long)ptr) & 0x0f; | |
46 return retval; | |
47 } | |
48 | |
49 static inline unsigned short VirtToPhysSeg(void *ptr) | |
50 { | |
51 return ((unsigned long)ptr) >> 4; | |
52 } | |
53 | |
54 static inline unsigned short VirtToPhysOff(void *ptr) | |
55 { | |
56 return ((unsigned long)ptr) & 0x0f; | |
57 } | |
58 | |
59 static inline void * PhysToVirt(FarPtr ptr) | |
60 { | |
61 return (void *)((ptr.seg << 4) | ptr.off); | |
62 } | |
63 | |
64 static inline void * PhysToVirtSO(unsigned short seg,unsigned short off) | |
65 { | |
66 return (void *)((seg << 4) | off); | |
67 } | |
68 | |
69 #define MODE_ATTR_MODE_SUPPORTED (1 << 0) | |
70 #define MODE_ATTR_TTY (1 << 2) | |
71 #define MODE_ATTR_COLOR (1 << 3) | |
72 #define MODE_ATTR_GRAPHICS (1 << 4) | |
73 #define MODE_ATTR_NOT_VGA (1 << 5) | |
74 #define MODE_ATTR_NOT_WINDOWED (1 << 6) | |
75 #define MODE_ATTR_LINEAR (1 << 7) | |
76 #define MODE_ATTR_DOUBLESCAN (1 << 8) | |
77 #define MODE_ATTR_INTERLACE (1 << 9) | |
78 #define MODE_ATTR_TRIPLEBUFFER (1 << 10) | |
79 #define MODE_ATTR_STEREOSCOPIC (1 << 11) | |
80 #define MODE_ATTR_DUALDISPLAY (1 << 12) | |
81 | |
82 #define MODE_WIN_RELOCATABLE (1 << 0) | |
83 #define MODE_WIN_READABLE (1 << 1) | |
84 #define MODE_WIN_WRITEABLE (1 << 2) | |
85 | |
86 /* SuperVGA mode information block */ | |
87 struct VesaModeInfoBlock { | |
88 unsigned short ModeAttributes; /* Mode attributes */ | |
89 unsigned char WinAAttributes; /* Window A attributes */ | |
90 unsigned char WinBAttributes; /* Window B attributes */ | |
91 unsigned short WinGranularity; /* Window granularity in k */ | |
92 unsigned short WinSize; /* Window size in k */ | |
93 unsigned short WinASegment; /* Window A segment */ | |
94 unsigned short WinBSegment; /* Window B segment */ | |
95 FarPtr WinFuncPtr; /* 16-bit far pointer to window function */ | |
96 unsigned short BytesPerScanLine; /* Bytes per scanline */ | |
97 /* VBE 1.2 and above */ | |
98 unsigned short XResolution; /* Horizontal resolution */ | |
99 unsigned short YResolution; /* Vertical resolution */ | |
100 unsigned char XCharSize; /* Character cell width */ | |
101 unsigned char YCharSize; /* Character cell height */ | |
102 unsigned char NumberOfPlanes; /* Number of memory planes */ | |
103 unsigned char BitsPerPixel; /* Bits per pixel */ | |
104 unsigned char NumberOfBanks; /* Number of CGA style banks */ | |
105 unsigned char MemoryModel; /* Memory model type */ | |
106 unsigned char BankSize; /* Size of CGA style banks */ | |
107 unsigned char NumberOfImagePages; /* Number of images pages */ | |
108 unsigned char res1; /* Reserved */ | |
109 /* Direct Color fields (required for direct/6 and YUV/7 memory models) */ | |
110 unsigned char RedMaskSize; /* Size of direct color red mask */ | |
111 unsigned char RedFieldPosition; /* Bit posn of lsb of red mask */ | |
112 unsigned char GreenMaskSize; /* Size of direct color green mask */ | |
113 unsigned char GreenFieldPosition; /* Bit posn of lsb of green mask */ | |
114 unsigned char BlueMaskSize; /* Size of direct color blue mask */ | |
115 unsigned char BlueFieldPosition; /* Bit posn of lsb of blue mask */ | |
116 unsigned char RsvdMaskSize; /* Size of direct color res mask */ | |
117 unsigned char RsvdFieldPosition; /* Bit posn of lsb of res mask */ | |
118 unsigned char DirectColorModeInfo; /* Direct color mode attributes */ | |
119 unsigned char res2[216]; /* Pad to 256 byte block size */ | |
120 /* VBE 2.0 and above */ | |
121 unsigned long PhysBasePtr; /* physical address for flat memory frame buffer. (Should be converted to linear before using) */ | |
122 unsigned short res3[3]; /* Reserved - always set to 0 */ | |
123 /* VBE 3.0 and above */ | |
124 unsigned short LinBytesPerScanLine; /* bytes per scan line for linear modes */ | |
125 unsigned char BnkNumberOfImagePages;/* number of images for banked modes */ | |
126 unsigned char LinNumberOfImagePages;/* number of images for linear modes */ | |
127 unsigned char LinRedMaskSize; /* size of direct color red mask (linear modes) */ | |
128 unsigned char LinRedFieldPosition; /* bit position of lsb of red mask (linear modes) */ | |
129 unsigned char LinGreenMaskSize; /* size of direct color green mask (linear modes) */ | |
130 unsigned char LinGreenFieldPosition;/* bit position of lsb of green mask (linear modes) */ | |
131 unsigned char LinBlueMaskSize; /* size of direct color blue mask (linear modes) */ | |
132 unsigned char LinBlueFieldPosition;/* bit position of lsb of blue mask (linear modes) */ | |
133 unsigned char LinRsvdMaskSize; /* size of direct color reserved mask (linear modes) */ | |
134 unsigned char LinRsvdFieldPosition;/* bit position of lsb of reserved mask (linear modes) */ | |
135 unsigned long MaxPixelClock; /* maximum pixel clock (in Hz) for graphics mode */ | |
136 char res4[189]; /* remainder of ModeInfoBlock */ | |
137 }__attribute__ ((packed)); | |
138 | |
139 typedef enum { | |
140 memText= 0, | |
141 memCGA = 1, | |
142 memHercules = 2, | |
143 memPL = 3, /* Planar memory model */ | |
144 memPK = 4, /* Packed pixel memory model */ | |
145 mem256 = 5, | |
146 memRGB = 6, /* Direct color RGB memory model */ | |
147 memYUV = 7, /* Direct color YUV memory model */ | |
148 } memModels; | |
149 | |
150 struct VesaCRTCInfoBlock { | |
151 unsigned short hTotal; /* Horizontal total in pixels */ | |
152 unsigned short hSyncStart; /* Horizontal sync start in pixels */ | |
153 unsigned short hSyncEnd; /* Horizontal sync end in pixels */ | |
154 unsigned short vTotal; /* Vertical total in lines */ | |
155 unsigned short vSyncStart; /* Vertical sync start in lines */ | |
156 unsigned short vSyncEnd; /* Vertical sync end in lines */ | |
157 unsigned char Flags; /* Flags (Interlaced, Double Scan etc) */ | |
158 unsigned long PixelClock; /* Pixel clock in units of Hz */ | |
159 unsigned short RefreshRate;/* Refresh rate in units of 0.01 Hz*/ | |
160 unsigned char Reserved[40];/* remainder of CRTCInfoBlock*/ | |
161 }__attribute__ ((packed)); | |
162 | |
163 #define VESA_CRTC_DOUBLESCAN 0x01 | |
164 #define VESA_CRTC_INTERLACED 0x02 | |
165 #define VESA_CRTC_HSYNC_NEG 0x04 | |
166 #define VESA_CRTC_VSYNC_NEG 0x08 | |
167 | |
168 #define VESA_MODE_CRTC_REFRESH (1 << 11) | |
169 #define VESA_MODE_USE_LINEAR (1 << 14) | |
170 #define VESA_MODE_NOT_CLEAR (1 << 15) | |
171 | |
172 /* This will contain accesible 32-bit protmode pointers */ | |
173 struct VesaProtModeInterface | |
174 { | |
175 void (*SetWindowCall)(void); | |
176 void (*SetDisplayStart)(void); | |
177 void (*SetPaletteData)(void); | |
178 unsigned short * iopl_ports; | |
2254
6e5b548790c9
Fixed bug of 32-bit mode interface detection and save-restore mechanism
nick
parents:
2243
diff
changeset
|
179 }; |
2243 | 180 |
181 /* | |
182 All functions below return: | |
183 0 if succesful | |
184 0xffff if vm86 syscall error occurs | |
185 0x4fxx if VESA error occurs | |
186 */ | |
187 | |
188 #define VBE_OK 0 | |
189 #define VBE_VM86_FAIL -1 | |
190 #define VBE_OUT_OF_DOS_MEM -2 | |
191 #define VBE_OUT_OF_MEM -3 | |
2359 | 192 #define VBE_BROKEN_BIOS -4 |
2254
6e5b548790c9
Fixed bug of 32-bit mode interface detection and save-restore mechanism
nick
parents:
2243
diff
changeset
|
193 #define VBE_VESA_ERROR_MASK 0x004f |
6e5b548790c9
Fixed bug of 32-bit mode interface detection and save-restore mechanism
nick
parents:
2243
diff
changeset
|
194 #define VBE_VESA_ERRCODE_MASK 0xff00 |
2243 | 195 |
196 extern int vbeInit( void ); | |
2446 | 197 extern int vbeDestroy( void ); |
2243 | 198 |
199 extern int vbeGetControllerInfo(struct VbeInfoBlock *); | |
200 extern int vbeGetModeInfo(unsigned mode,struct VesaModeInfoBlock *); | |
201 extern int vbeSetMode(unsigned mode,struct VesaCRTCInfoBlock *); | |
202 extern int vbeGetMode(unsigned *mode); | |
203 extern int vbeSaveState(void **data); /* note never copy this data */ | |
204 extern int vbeRestoreState(void *data); | |
205 extern int vbeGetWindow(unsigned *win_num); /* win_A=0 or win_B=1 */ | |
206 extern int vbeSetWindow(unsigned win_num,unsigned win_gran); | |
207 /* | |
208 Func 0x06: | |
209 Support of logical scan line length is not implemented. | |
210 We assume that logical scan line length == physical scan line length. | |
211 (Logical display memory == displayed area). | |
212 */ | |
213 /* | |
214 Func 0x07: | |
215 Support of disply start is not implemented. | |
216 We assume that display start always == 0, 0. | |
217 */ | |
218 /* | |
219 Func 0x08-0x09: | |
220 Support of palette currently is not implemented. | |
221 */ | |
222 extern int vbeGetProtModeInfo(struct VesaProtModeInterface *); | |
2410 | 223 |
224 /* Standard VGA stuff */ | |
225 int vbeWriteString(int x, int y, int attr, char *str); | |
226 | |
2460 | 227 #endif |