ReactOS  0.4.13-dev-73-gcfe54aa
video.h File Reference
#include <pshpack1.h>
#include <poppack.h>
Include dependency graph for video.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  PALETTE_ENTRY
 

Typedefs

typedef struct PALETTE_ENTRYPPALETTE_ENTRY
 

Functions

USHORT BiosIsVesaSupported (VOID)
 
BOOLEAN BiosIsVesaDdcSupported (VOID)
 
BOOLEAN BiosVesaReadEdid (VOID)
 
PVOID VideoAllocateOffScreenBuffer (VOID)
 
VOID VideoCopyOffScreenBufferToVRAM (VOID)
 
VOID VideoSavePaletteState (PPALETTE_ENTRY Palette, ULONG ColorCount)
 
VOID VideoRestorePaletteState (PPALETTE_ENTRY Palette, ULONG ColorCount)
 
VOID VideoSetAllColorsToBlack (ULONG ColorCount)
 
VOID VideoFadeIn (PPALETTE_ENTRY Palette, ULONG ColorCount)
 
VOID VideoFadeOut (ULONG ColorCount)
 

Variables

PVOID VideoOffScreenBuffer
 

Typedef Documentation

◆ PPALETTE_ENTRY

Function Documentation

◆ BiosIsVesaDdcSupported()

BOOLEAN BiosIsVesaDdcSupported ( VOID  )

Definition at line 243 of file i386vid.c.

244 {
245  REGS Regs;
246 
247  TRACE("BiosIsVesaDdcSupported()\n");
248 
249  Regs.w.ax = 0x4F15;
250  Regs.b.bl = 0;
251  Regs.w.cx = 0;
252  Regs.w.es = 0;
253  Regs.w.di = 0;
254  Int386(0x10, &Regs, &Regs);
255 
256  TRACE("AL = 0x%x\n", Regs.b.al);
257  TRACE("AH = 0x%x\n", Regs.b.ah);
258 
259  TRACE("BL = 0x%x\n", Regs.b.bl);
260 
261  if (Regs.w.ax != 0x004F)
262  {
263  WARN("VBE/DDC Installation check function not supported (AL=0x%x) or failed (AH=0x%x)\n",
264  Regs.b.al, Regs.b.ah);
265  return FALSE;
266  }
267 
268  return (Regs.b.ah == 0);
269 }
#define WARN(fmt,...)
Definition: debug.h:111
unsigned short cx
Definition: pcbios.h:93
unsigned short es
Definition: pcbios.h:101
unsigned char ah
Definition: pcbios.h:112
int __cdecl Int386(int ivec, REGS *in, REGS *out)
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char bl
Definition: pcbios.h:114
BYTEREGS b
Definition: pcbios.h:143
unsigned char al
Definition: pcbios.h:111
unsigned short ax
Definition: pcbios.h:91
Definition: pcbios.h:138
unsigned short di
Definition: pcbios.h:97
WORDREGS w
Definition: pcbios.h:142

Referenced by DetectDisplayController().

◆ BiosIsVesaSupported()

USHORT BiosIsVesaSupported ( VOID  )

Definition at line 161 of file i386vid.c.

162 {
163  REGS Regs;
165  //USHORT* VideoModes;
166  //USHORT Index;
167 
168  TRACE("BiosIsVesaSupported()\n");
169 
170  RtlZeroMemory(SvgaInfo, sizeof(VESA_SVGA_INFO));
171 
172  // Make sure we receive version 2.0 info
173  SvgaInfo->Signature[0] = 'V';
174  SvgaInfo->Signature[1] = 'B';
175  SvgaInfo->Signature[2] = 'E';
176  SvgaInfo->Signature[3] = '2';
177 
178  // Int 10h AX=4F00h
179  // VESA SuperVGA BIOS (VBE) - GET SuperVGA INFORMATION
180  //
181  // AX = 4F00h
182  // ES:DI -> buffer for SuperVGA information (see #00077)
183  // Return:
184  // AL = 4Fh if function supported
185  // AH = status
186  // 00h successful
187  // ES:DI buffer filled
188  // 01h failed
189  // ---VBE v2.0---
190  // 02h function not supported by current hardware configuration
191  // 03h function invalid in current video mode
192  //
193  // Determine whether VESA BIOS extensions are present and the
194  // capabilities supported by the display adapter
195  //
196  // Installation check;VESA SuperVGA
197  Regs.w.ax = 0x4F00;
198  Regs.w.es = BIOSCALLBUFSEGMENT;
199  Regs.w.di = BIOSCALLBUFOFFSET;
200  Int386(0x10, &Regs, &Regs);
201 
202  TRACE("AL = 0x%x\n", Regs.b.al);
203  TRACE("AH = 0x%x\n", Regs.b.ah);
204 
205  if (Regs.w.ax != 0x004F)
206  {
207  WARN("VBE Get SuperVGA information function not supported (AL=0x%x) or failed (AH=0x%x)\n",
208  Regs.b.al, Regs.b.ah);
209  return 0x0000;
210  }
211 
212  TRACE("Supported.\n");
213  TRACE("SvgaInfo->Signature[4] = %c%c%c%c\n", SvgaInfo->Signature[0], SvgaInfo->Signature[1], SvgaInfo->Signature[2], SvgaInfo->Signature[3]);
214  TRACE("SvgaInfo->VesaVersion = v%d.%d\n", ((SvgaInfo->VesaVersion >> 8) & 0xFF), (SvgaInfo->VesaVersion & 0xFF));
215  TRACE("SvgaInfo->OemNamePtr = 0x%x\n", SvgaInfo->OemNamePtr);
216  TRACE("SvgaInfo->Capabilities = 0x%x\n", SvgaInfo->Capabilities);
217  TRACE("SvgaInfo->VideoMemory = %dK\n", SvgaInfo->TotalVideoMemory * 64);
218  TRACE("---VBE v2.0 ---\n");
219  TRACE("SvgaInfo->OemSoftwareVersion = v%d.%d\n", ((SvgaInfo->OemSoftwareVersion >> 8) & 0x0F) + (((SvgaInfo->OemSoftwareVersion >> 12) & 0x0F) * 10), (SvgaInfo->OemSoftwareVersion & 0x0F) + (((SvgaInfo->OemSoftwareVersion >> 4) & 0x0F) * 10));
220  TRACE("SvgaInfo->VendorNamePtr = 0x%x\n", SvgaInfo->VendorNamePtr);
221  TRACE("SvgaInfo->ProductNamePtr = 0x%x\n", SvgaInfo->ProductNamePtr);
222  TRACE("SvgaInfo->ProductRevisionStringPtr = 0x%x\n", SvgaInfo->ProductRevisionStringPtr);
223  TRACE("SvgaInfo->VBE/AF Version = 0x%x (BCD WORD)\n", SvgaInfo->VBE_AF_Version);
224 
225  if (SvgaInfo->Signature[0] != 'V' ||
226  SvgaInfo->Signature[1] != 'E' ||
227  SvgaInfo->Signature[2] != 'S' ||
228  SvgaInfo->Signature[3] != 'A')
229  {
230  ERR("Bad signature in VESA information (%c%c%c%c)\n",
231  SvgaInfo->Signature[0],
232  SvgaInfo->Signature[1],
233  SvgaInfo->Signature[2],
234  SvgaInfo->Signature[3]);
235  return 0x0000;
236  }
237 
238  return SvgaInfo->VesaVersion;
239 }
USHORT VBE_AF_Version
Definition: i386vid.c:48
#define BIOSCALLBUFFER
Definition: x86common.h:12
#define WARN(fmt,...)
Definition: debug.h:111
ULONG ProductRevisionStringPtr
Definition: i386vid.c:47
unsigned short es
Definition: pcbios.h:101
unsigned char ah
Definition: pcbios.h:112
struct VESA_SVGA_INFO * PVESA_SVGA_INFO
int __cdecl Int386(int ivec, REGS *in, REGS *out)
ULONG OemNamePtr
Definition: i386vid.c:33
#define BIOSCALLBUFSEGMENT
Definition: x86common.h:21
UCHAR Signature[4]
Definition: i386vid.c:29
ULONG Capabilities
Definition: i386vid.c:35
#define TRACE(s)
Definition: solgame.cpp:4
ULONG ProductNamePtr
Definition: i386vid.c:46
#define BIOSCALLBUFOFFSET
Definition: x86common.h:22
BYTEREGS b
Definition: pcbios.h:143
unsigned char al
Definition: pcbios.h:111
#define ERR(fmt,...)
Definition: debug.h:109
unsigned short ax
Definition: pcbios.h:91
USHORT VesaVersion
Definition: i386vid.c:32
Definition: pcbios.h:138
USHORT OemSoftwareVersion
Definition: i386vid.c:44
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
USHORT TotalVideoMemory
Definition: i386vid.c:38
ULONG VendorNamePtr
Definition: i386vid.c:45
unsigned short di
Definition: pcbios.h:97
WORDREGS w
Definition: pcbios.h:142

Referenced by DetectDisplayController().

◆ BiosVesaReadEdid()

BOOLEAN BiosVesaReadEdid ( VOID  )

Definition at line 273 of file i386vid.c.

274 {
275  REGS Regs;
276 
277  TRACE("BiosVesaReadEdid()\n");
278 
280 
281  Regs.w.ax = 0x4F15;
282  Regs.b.bl = 1;
283  Regs.w.cx = 0;
284  Regs.w.dx = 0;
285  Regs.w.es = BIOSCALLBUFSEGMENT;
286  Regs.w.di = BIOSCALLBUFOFFSET;
287  Int386(0x10, &Regs, &Regs);
288 
289  TRACE("AL = 0x%x\n", Regs.b.al);
290  TRACE("AH = 0x%x\n", Regs.b.ah);
291 
292  if (Regs.w.ax != 0x004F)
293  {
294  WARN("VBE/DDC Read EDID function not supported (AL=0x%x) or failed (AH=0x%x)\n",
295  Regs.b.al, Regs.b.ah);
296  return FALSE;
297  }
298 
299  return (Regs.b.ah == 0);
300 }
unsigned short dx
Definition: pcbios.h:94
#define BIOSCALLBUFFER
Definition: x86common.h:12
#define WARN(fmt,...)
Definition: debug.h:111
unsigned short cx
Definition: pcbios.h:93
unsigned short es
Definition: pcbios.h:101
unsigned char ah
Definition: pcbios.h:112
int __cdecl Int386(int ivec, REGS *in, REGS *out)
#define BIOSCALLBUFSEGMENT
Definition: x86common.h:21
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char bl
Definition: pcbios.h:114
#define BIOSCALLBUFOFFSET
Definition: x86common.h:22
BYTEREGS b
Definition: pcbios.h:143
unsigned char al
Definition: pcbios.h:111
unsigned short ax
Definition: pcbios.h:91
Definition: pcbios.h:138
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
unsigned short di
Definition: pcbios.h:97
WORDREGS w
Definition: pcbios.h:142

Referenced by DetectDisplayController().

◆ VideoAllocateOffScreenBuffer()

PVOID VideoAllocateOffScreenBuffer ( VOID  )

Definition at line 24 of file video.c.

25 {
27 
29  {
32  }
33 
35 
37 
38  return VideoOffScreenBuffer;
39 }
PVOID VideoOffScreenBuffer
Definition: video.c:22
#define MachVideoGetBufferSize()
Definition: machine.h:96
smooth NULL
Definition: ftsmooth.c:416
#define BufferSize
Definition: classpnp.h:419
PVOID MmAllocateMemoryWithType(SIZE_T MemorySize, TYPE_OF_MEMORY MemoryType)
Definition: mm.c:31
VOID MmFreeMemory(PVOID MemoryPointer)
Definition: mm.c:215
unsigned int ULONG
Definition: retypes.h:1

Referenced by TuiInitialize().

◆ VideoCopyOffScreenBufferToVRAM()

◆ VideoFadeIn()

VOID VideoFadeIn ( PPALETTE_ENTRY  Palette,
ULONG  ColorCount 
)

Definition at line 38 of file fade.c.

39 {
40  ULONG Index;
41  UCHAR Color;
42  PPALETTE_ENTRY PaletteColors;
43 
44  PaletteColors = FrLdrTempAlloc(sizeof(PALETTE_ENTRY) * ColorCount, TAG_PALETTE_COLORS);
45  if (!PaletteColors) return;
46 
47  for (Index=0; Index<RGB_MAX; Index++)
48  {
49 
50  for (Color=0; Color<ColorCount; Color++)
51  {
52  MachVideoGetPaletteColor(Color, &PaletteColors[Color].Red, &PaletteColors[Color].Green, &PaletteColors[Color].Blue);
53 
54  // Increment each color so it approaches its real value
55  if (PaletteColors[Color].Red < Palette[Color].Red)
56  {
57  PaletteColors[Color].Red++;
58  }
59  if (PaletteColors[Color].Green < Palette[Color].Green)
60  {
61  PaletteColors[Color].Green++;
62  }
63  if (PaletteColors[Color].Blue < Palette[Color].Blue)
64  {
65  PaletteColors[Color].Blue++;
66  }
67 
68  // Make sure we haven't exceeded the real value
69  if (PaletteColors[Color].Red > Palette[Color].Red)
70  {
71  PaletteColors[Color].Red = Palette[Color].Red;
72  }
73  if (PaletteColors[Color].Green > Palette[Color].Green)
74  {
75  PaletteColors[Color].Green = Palette[Color].Green;
76  }
77  if (PaletteColors[Color].Blue > Palette[Color].Blue)
78  {
79  PaletteColors[Color].Blue = Palette[Color].Blue;
80  }
81  }
82 
83  // Set the colors
84  for (Color=0; Color<ColorCount; Color++)
85  {
86  if ((Color % RGB_MAX_PER_ITERATION) == 0)
87  {
88  MachVideoSync();
89  }
90 
91  MachVideoSetPaletteColor(Color, PaletteColors[Color].Red, PaletteColors[Color].Green, PaletteColors[Color].Blue);
92  }
93  }
94 
95  FrLdrTempFree(PaletteColors, TAG_PALETTE_COLORS);
96 }
Definition: bl.h:202
#define MachVideoGetPaletteColor(Col, R, G, B)
Definition: machine.h:110
Definition: bl.h:199
#define MachVideoSetPaletteColor(Col, R, G, B)
Definition: machine.h:108
struct Color Color
UCHAR Red
Definition: video.h:25
#define MachVideoSync()
Definition: machine.h:112
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:177
Definition: video.h:23
UCHAR Blue
Definition: video.h:27
static const UCHAR Index[8]
Definition: usbohci.c:18
#define RGB_MAX_PER_ITERATION
Definition: fade.c:23
Definition: bl.h:200
unsigned char UCHAR
Definition: xmlstorage.h:181
UCHAR Green
Definition: video.h:26
unsigned int ULONG
Definition: retypes.h:1
#define TAG_PALETTE_COLORS
Definition: fade.c:24
#define RGB_MAX
Definition: fade.c:22
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
Definition: mm.h:186

Referenced by TuiFadeInBackdrop().

◆ VideoFadeOut()

VOID VideoFadeOut ( ULONG  ColorCount)

Definition at line 98 of file fade.c.

99 {
100  ULONG Index;
101  UCHAR Color;
102  UCHAR Red;
103  UCHAR Green;
104  UCHAR Blue;
105 
106  for (Index=0; Index<RGB_MAX; Index++)
107  {
108  for (Color=0; Color<ColorCount; Color++)
109  {
110  if ((Color % RGB_MAX_PER_ITERATION) == 0)
111  {
112  MachVideoSync();
113  }
114 
116 
117  if (Red > 0)
118  {
119  Red--;
120  }
121  if (Green > 0)
122  {
123  Green--;
124  }
125  if (Blue > 0)
126  {
127  Blue--;
128  }
129 
131  }
132  }
133 }
Definition: bl.h:202
#define MachVideoGetPaletteColor(Col, R, G, B)
Definition: machine.h:110
Definition: bl.h:199
#define MachVideoSetPaletteColor(Col, R, G, B)
Definition: machine.h:108
struct Color Color
#define MachVideoSync()
Definition: machine.h:112
static const UCHAR Index[8]
Definition: usbohci.c:18
#define RGB_MAX_PER_ITERATION
Definition: fade.c:23
Definition: bl.h:200
unsigned char UCHAR
Definition: xmlstorage.h:181
unsigned int ULONG
Definition: retypes.h:1
#define RGB_MAX
Definition: fade.c:22

Referenced by TuiFadeOut().

◆ VideoRestorePaletteState()

VOID VideoRestorePaletteState ( PPALETTE_ENTRY  Palette,
ULONG  ColorCount 
)

Definition at line 31 of file palette.c.

32 {
33  ULONG Color;
34 
35  MachVideoSync();
36 
37  for (Color=0; Color<ColorCount; Color++)
38  {
39  MachVideoSetPaletteColor((UCHAR)Color, Palette[Color].Red, Palette[Color].Green, Palette[Color].Blue);
40  }
41 }
Definition: bl.h:202
Definition: bl.h:199
#define MachVideoSetPaletteColor(Col, R, G, B)
Definition: machine.h:108
struct Color Color
#define MachVideoSync()
Definition: machine.h:112
Definition: bl.h:200
unsigned char UCHAR
Definition: xmlstorage.h:181
unsigned int ULONG
Definition: retypes.h:1

Referenced by TuiFadeOut().

◆ VideoSavePaletteState()

VOID VideoSavePaletteState ( PPALETTE_ENTRY  Palette,
ULONG  ColorCount 
)

Definition at line 21 of file palette.c.

22 {
23  ULONG Color;
24 
25  for (Color=0; Color<ColorCount; Color++)
26  {
27  MachVideoGetPaletteColor((UCHAR)Color, &Palette[Color].Red, &Palette[Color].Green, &Palette[Color].Blue);
28  }
29 }
Definition: bl.h:202
#define MachVideoGetPaletteColor(Col, R, G, B)
Definition: machine.h:110
Definition: bl.h:199
struct Color Color
Definition: bl.h:200
unsigned char UCHAR
Definition: xmlstorage.h:181
unsigned int ULONG
Definition: retypes.h:1

Referenced by TuiFadeInBackdrop(), and TuiFadeOut().

◆ VideoSetAllColorsToBlack()

VOID VideoSetAllColorsToBlack ( ULONG  ColorCount)

Definition at line 26 of file fade.c.

27 {
28  UCHAR Color;
29 
30  MachVideoSync();
31 
32  for (Color=0; Color<ColorCount; Color++)
33  {
35  }
36 }
#define MachVideoSetPaletteColor(Col, R, G, B)
Definition: machine.h:108
struct Color Color
#define MachVideoSync()
Definition: machine.h:112
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by TuiFadeInBackdrop().

Variable Documentation

◆ VideoOffScreenBuffer

PVOID VideoOffScreenBuffer

Definition at line 22 of file video.c.

Referenced by VideoAllocateOffScreenBuffer(), and VideoCopyOffScreenBufferToVRAM().