ReactOS  0.4.14-dev-297-g23e575c
vgaddi.h File Reference
#include <stdarg.h>
#include <windef.h>
#include <wingdi.h>
#include <winddi.h>
#include <winioctl.h>
#include <ntddvdeo.h>
#include <ioaccess.h>
#include "vgavideo/vgavideo.h"
Include dependency graph for vgaddi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _RECT_ENUM
 
struct  _XYPAIR
 
struct  _SAVED_SCREEN_BITS
 
struct  _PDEV
 
struct  BANK_INFO
 
struct  _DEVSURF
 

Macros

#define _WINBASE_
 
#define _WINDOWS_H
 
#define DPRINT   DbgPrint
 
#define DPRINT1   DbgPrint
 
#define DDKFASTAPI   __fastcall
 
#define FASTCALL   __fastcall
 
#define DS_SOLIDBRUSH   0x00000001
 
#define DS_GREYBRUSH   0x00000002
 
#define DS_BRUSH   0x00000004
 
#define DS_DIB   0x00000008
 
#define POW2(stride)   (!((stride) & ((stride)-1)))
 
#define BROKEN_RASTERS(stride, cy)   ((!(POW2(stride))) && ((stride*cy) > 0x10000))
 
#define ENUM_RECT_LIMIT   50
 
#define CURSOR_COLOR   0x00000004
 
#define CURSOR_HW   0x00000010
 
#define CURSOR_HW_ACTIVE   0x00000020
 
#define CURSOR_ANIMATE   0x00000040
 
#define BMF_PHYSDEVICE   0xFF
 
#define BMF_DFB   0xFE
 
#define PDEV_IDENT   ('V' + ('P' << 8) + ('D' << 16) + ('V' << 24))
 
#define DEVSURF_IDENT   ('V' + ('S' << 8) + ('R' << 16) + ('F' << 24))
 
#define DRIVER_EXTRA_SIZE   0
 
#define ALLOC_TAG   'agvD'
 
#define DLL_NAME   L"vga"
 
#define MAX_SCAN_WIDTH   2048
 
#define DRIVER_OFFSCREEN_REFRESHED   0x04L
 
#define PLANAR_PELS_PER_CPU_ADDRESS   8
 
#define PACKED_PELS_PER_CPU_ADDRESS   2
 

Typedefs

typedef struct _RECT_ENUM RECT_ENUM
 
typedef struct _XYPAIR XYPAIR
 
typedef struct _SAVED_SCREEN_BITS SAVED_SCREEN_BITS
 
typedef struct _SAVED_SCREEN_BITSPSAVED_SCREEN_BITS
 
typedef struct _PDEV PDEV
 
typedef struct _PDEVPPDEV
 
typedef struct BANK_INFOPBANK_INFO
 
typedef VOID(* PFN_BankControl) (PVOID, ULONG, BANK_JUST)
 
typedef struct _DEVSURF DEVSURF
 
typedef struct _DEVSURFPDEVSURF
 
typedef VOID(* PFN_ScreenToScreenBlt) (PDEVSURF, PRECTL, PPOINTL, INT)
 

Enumerations

enum  BANK_JUST { JustifyTop = 0, JustifyBottom }
 

Functions

ULONG DbgPrint (PCCH Format,...)
 
static __inline BOOLEAN RemoveEntryList (IN PLIST_ENTRY Entry)
 
static __inline VOID InsertHeadList (IN PLIST_ENTRY ListHead, IN PLIST_ENTRY Entry)
 
static __inline VOID InitializeListHead (IN PLIST_ENTRY ListHead)
 
BOOL InitVGA (PPDEV ppdev, BOOL bFirst)
 
BOOL DeinitVGA (PPDEV ppdev)
 
BOOL VGAtoGDI (SURFOBJ *Dest, SURFOBJ *Source, SURFOBJ *Mask, XLATEOBJ *ColorTranslation, RECTL *DestRect, POINTL *SourcePoint)
 
VOID VGADDI_BltFromSavedScreenBits (ULONG DestX, ULONG DestY, PSAVED_SCREEN_BITS Src, ULONG SizeX, ULONG SizeY)
 
VOID VGADDI_BltToSavedScreenBits (PSAVED_SCREEN_BITS Dest, ULONG SourceX, ULONG SourceY, ULONG SizeX, ULONG SizeY)
 
VOID VGADDI_FreeSavedScreenBits (PSAVED_SCREEN_BITS SavedBits)
 
PSAVED_SCREEN_BITS VGADDI_AllocSavedScreenBits (ULONG Size)
 
VOID VGADDI_InitializeOffScreenMem (ULONG Start, ULONG Length)
 
BOOL InitPointer (PPDEV ppdev)
 
DWORD getAvailableModes (HANDLE Driver, PVIDEO_MODE_INFORMATION *modeInformation, DWORD *ModeSize)
 
VOID FASTCALL vgaReadScan (int x, int y, int w, void *b)
 
VOID FASTCALL vgaWriteScan (int x, int y, int w, void *b)
 

Macro Definition Documentation

◆ _WINBASE_

#define _WINBASE_

Definition at line 4 of file vgaddi.h.

◆ _WINDOWS_H

#define _WINDOWS_H

Definition at line 5 of file vgaddi.h.

◆ ALLOC_TAG

#define ALLOC_TAG   'agvD'

Definition at line 246 of file vgaddi.h.

◆ BMF_DFB

#define BMF_DFB   0xFE

Definition at line 235 of file vgaddi.h.

◆ BMF_PHYSDEVICE

#define BMF_PHYSDEVICE   0xFF

Definition at line 234 of file vgaddi.h.

◆ BROKEN_RASTERS

#define BROKEN_RASTERS (   stride,
  cy 
)    ((!(POW2(stride))) && ((stride*cy) > 0x10000))

Definition at line 72 of file vgaddi.h.

◆ CURSOR_ANIMATE

#define CURSOR_ANIMATE   0x00000040

Definition at line 101 of file vgaddi.h.

◆ CURSOR_COLOR

#define CURSOR_COLOR   0x00000004

Definition at line 98 of file vgaddi.h.

◆ CURSOR_HW

#define CURSOR_HW   0x00000010

Definition at line 99 of file vgaddi.h.

◆ CURSOR_HW_ACTIVE

#define CURSOR_HW_ACTIVE   0x00000020

Definition at line 100 of file vgaddi.h.

◆ DDKFASTAPI

#define DDKFASTAPI   __fastcall

Definition at line 25 of file vgaddi.h.

◆ DEVSURF_IDENT

#define DEVSURF_IDENT   ('V' + ('S' << 8) + ('R' << 16) + ('F' << 24))

Definition at line 240 of file vgaddi.h.

◆ DLL_NAME

#define DLL_NAME   L"vga"

Definition at line 247 of file vgaddi.h.

◆ DPRINT

#define DPRINT   DbgPrint

Definition at line 17 of file vgaddi.h.

◆ DPRINT1

#define DPRINT1   DbgPrint

Definition at line 21 of file vgaddi.h.

◆ DRIVER_EXTRA_SIZE

#define DRIVER_EXTRA_SIZE   0

Definition at line 245 of file vgaddi.h.

◆ DRIVER_OFFSCREEN_REFRESHED

#define DRIVER_OFFSCREEN_REFRESHED   0x04L

Definition at line 250 of file vgaddi.h.

◆ DS_BRUSH

#define DS_BRUSH   0x00000004

Definition at line 68 of file vgaddi.h.

◆ DS_DIB

#define DS_DIB   0x00000008

Definition at line 69 of file vgaddi.h.

◆ DS_GREYBRUSH

#define DS_GREYBRUSH   0x00000002

Definition at line 67 of file vgaddi.h.

◆ DS_SOLIDBRUSH

#define DS_SOLIDBRUSH   0x00000001

Definition at line 66 of file vgaddi.h.

◆ ENUM_RECT_LIMIT

#define ENUM_RECT_LIMIT   50

Definition at line 74 of file vgaddi.h.

◆ FASTCALL

#define FASTCALL   __fastcall

Definition at line 26 of file vgaddi.h.

◆ MAX_SCAN_WIDTH

#define MAX_SCAN_WIDTH   2048

Definition at line 249 of file vgaddi.h.

◆ PACKED_PELS_PER_CPU_ADDRESS

#define PACKED_PELS_PER_CPU_ADDRESS   2

Definition at line 252 of file vgaddi.h.

◆ PDEV_IDENT

#define PDEV_IDENT   ('V' + ('P' << 8) + ('D' << 16) + ('V' << 24))

Definition at line 239 of file vgaddi.h.

◆ PLANAR_PELS_PER_CPU_ADDRESS

#define PLANAR_PELS_PER_CPU_ADDRESS   8

Definition at line 251 of file vgaddi.h.

◆ POW2

#define POW2 (   stride)    (!((stride) & ((stride)-1)))

Definition at line 71 of file vgaddi.h.

Typedef Documentation

◆ DEVSURF

◆ PBANK_INFO

◆ PDEV

typedef struct _PDEV PDEV

◆ PDEVSURF

◆ PFN_BankControl

typedef VOID(* PFN_BankControl) (PVOID, ULONG, BANK_JUST)

Definition at line 158 of file vgaddi.h.

◆ PFN_ScreenToScreenBlt

typedef VOID(* PFN_ScreenToScreenBlt) (PDEVSURF, PRECTL, PPOINTL, INT)

Definition at line 230 of file vgaddi.h.

◆ PPDEV

typedef struct _PDEV * PPDEV

◆ PSAVED_SCREEN_BITS

◆ RECT_ENUM

◆ SAVED_SCREEN_BITS

◆ XYPAIR

Enumeration Type Documentation

◆ BANK_JUST

Enumerator
JustifyTop 
JustifyBottom 

Definition at line 151 of file vgaddi.h.

151  {
152  JustifyTop = 0,
154 } BANK_JUST;
BANK_JUST
Definition: vgaddi.h:151

Function Documentation

◆ DbgPrint()

◆ DeinitVGA()

BOOL DeinitVGA ( PPDEV  ppdev)

Definition at line 112 of file screen.c.

113 {
114  VIDEO_MEMORY VideoMemory;
115  ULONG ReturnedDataLength;
116 
117  VideoMemory.RequestedVirtualAddress = (PVOID)ppdev->fbScreen;
118 
119  if (EngDeviceIoControl(ppdev->KMDriver,
121  (PVOID)&VideoMemory,
122  sizeof(VIDEO_MEMORY),
123  NULL,
124  0,
125  &ReturnedDataLength))
126  {
127  DPRINT1("Failed to unmap video memory.\n");
128  EngDebugBreak();
129  return FALSE;
130  }
131  return TRUE;
132 }
#define TRUE
Definition: types.h:120
_Analysis_noreturn_ ENGAPI VOID APIENTRY EngDebugBreak(VOID)
PVOID RequestedVirtualAddress
Definition: ntddvdeo.h:274
smooth NULL
Definition: ftsmooth.c:416
void * PVOID
Definition: retypes.h:9
PBYTE fbScreen
Definition: vgaddi.h:137
#define IOCTL_VIDEO_UNMAP_VIDEO_MEMORY
Definition: ntddvdeo.h:179
HANDLE KMDriver
Definition: vgaddi.h:108
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1

Referenced by DrvDisableSurface().

◆ getAvailableModes()

DWORD getAvailableModes ( HANDLE  Driver,
PVIDEO_MODE_INFORMATION modeInformation,
DWORD ModeSize 
)

Definition at line 507 of file screen.c.

511 {
512  ULONG ulTemp;
513  VIDEO_NUM_MODES modes;
514  PVIDEO_MODE_INFORMATION pVideoTemp;
515 
516  //
517  // Get the number of modes supported by the mini-port
518  //
519 
520  if (EngDeviceIoControl(hDriver,
522  NULL,
523  0,
524  &modes,
525  sizeof(VIDEO_NUM_MODES),
526  &ulTemp))
527  {
528  DISPDBG((0, "getAvailableModes failed VIDEO_QUERY_NUM_AVAIL_MODES\n"));
529  return(0);
530  }
531 
532  *cbModeSize = modes.ModeInformationLength;
533 
534  //
535  // Allocate the buffer for the mini-port to write the modes in.
536  //
537 
538  *modeInformation = (PVIDEO_MODE_INFORMATION)
539  EngAllocMem(0, modes.NumModes *
541 
542  if (*modeInformation == (PVIDEO_MODE_INFORMATION) NULL)
543  {
544  DISPDBG((0, "getAvailableModes failed EngAllocMem\n"));
545 
546  return 0;
547  }
548 
549  //
550  // Ask the mini-port to fill in the available modes.
551  //
552 
553  if (EngDeviceIoControl(hDriver,
555  NULL,
556  0,
557  *modeInformation,
558  modes.NumModes * modes.ModeInformationLength,
559  &ulTemp))
560  {
561 
562  DISPDBG((0, "getAvailableModes failed VIDEO_QUERY_AVAIL_MODES\n"));
563 
564  EngFreeMem(*modeInformation);
565  *modeInformation = (PVIDEO_MODE_INFORMATION) NULL;
566 
567  return(0);
568  }
569 
570  //
571  // Now see which of these modes are supported by the display driver.
572  // As an internal mechanism, set the length to 0 for the modes we
573  // DO NOT support.
574  //
575 
576  ulTemp = modes.NumModes;
577  pVideoTemp = *modeInformation;
578 
579  //
580  // Mode is rejected if it is not one plane, or not graphics, or is not
581  // one of 8, 16 or 32 bits per pel.
582  //
583 
584  while (ulTemp--)
585  {
586  if ((pVideoTemp->NumberOfPlanes != 1 ) ||
587  !(pVideoTemp->AttributeFlags & VIDEO_MODE_GRAPHICS) ||
588 // eVb: 2.6 [DDK CHANGE] - Do not process banked video modes
589  (pVideoTemp->AttributeFlags & VIDEO_MODE_BANKED) ||
590 // eVb: 2.6 [END]
591  ((pVideoTemp->BitsPerPlane != 8) &&
592  (pVideoTemp->BitsPerPlane != 16) &&
593  (pVideoTemp->BitsPerPlane != 24) &&
594  (pVideoTemp->BitsPerPlane != 32)))
595  {
596  pVideoTemp->Length = 0;
597  }
598 
599  pVideoTemp = (PVIDEO_MODE_INFORMATION)
600  (((PUCHAR)pVideoTemp) + modes.ModeInformationLength);
601  }
602 
603  return modes.NumModes;
604 
605 }
ULONG ModeInformationLength
Definition: ntddvdeo.h:328
#define EngFreeMem
Definition: polytest.cpp:56
unsigned char * PUCHAR
Definition: retypes.h:3
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO _In_ HDEV _In_ LPWSTR _In_ HANDLE hDriver
Definition: winddi.h:3553
#define ALLOC_TAG
Definition: btrfs_drv.h:91
struct _VIDEO_MODE_INFORMATION * PVIDEO_MODE_INFORMATION
smooth NULL
Definition: ftsmooth.c:416
#define VIDEO_MODE_BANKED
Definition: ntddvdeo.h:300
#define DISPDBG(arg)
Definition: debug.h:23
void * EngAllocMem(int zero, unsigned long size, int tag=0)
Definition: polytest.cpp:70
#define IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES
Definition: ntddvdeo.h:122
#define IOCTL_VIDEO_QUERY_AVAIL_MODES
Definition: ntddvdeo.h:107
unsigned int ULONG
Definition: retypes.h:1
#define VIDEO_MODE_GRAPHICS
Definition: ntddvdeo.h:294

◆ InitializeListHead()

static __inline VOID InitializeListHead ( IN PLIST_ENTRY  ListHead)
static

Definition at line 58 of file vgaddi.h.

60 {
61  ListHead->Flink = ListHead->Blink = ListHead;
62 }

◆ InitPointer()

BOOL InitPointer ( PPDEV  ppdev)

Definition at line 143 of file pointer.c.

144 {
145  ULONG CursorWidth = 32, CursorHeight = 32;
146  ULONG PointerAttributesSize;
147  ULONG SavedMemSize;
148 
149  ppdev->xyHotSpot.x = 0;
150  ppdev->xyHotSpot.y = 0;
151 
152  /* Determine the size of the pointer attributes */
153  PointerAttributesSize = sizeof(VIDEO_POINTER_ATTRIBUTES) +
154  ((CursorWidth * CursorHeight * 2) >> 3);
155 
156  /* Allocate memory for pointer attributes */
157  ppdev->pPointerAttributes = EngAllocMem(0, PointerAttributesSize, ALLOC_TAG);
158 
159  ppdev->pPointerAttributes->Flags = 0; /* FIXME: Do this right */
160  ppdev->pPointerAttributes->Width = CursorWidth;
161  ppdev->pPointerAttributes->Height = CursorHeight;
162  ppdev->pPointerAttributes->WidthInBytes = CursorWidth >> 3;
163  ppdev->pPointerAttributes->Enable = 0;
164  ppdev->pPointerAttributes->Column = 0;
165  ppdev->pPointerAttributes->Row = 0;
166 
167  /* Allocate memory for the pixels behind the cursor */
168  SavedMemSize = ((((CursorWidth + 7) & ~0x7) + 16) * CursorHeight) >> 3;
169  ppdev->ImageBehindCursor = VGADDI_AllocSavedScreenBits(SavedMemSize);
170 
171  return TRUE;
172 }
struct _VIDEO_POINTER_ATTRIBUTES VIDEO_POINTER_ATTRIBUTES
#define TRUE
Definition: types.h:120
PSAVED_SCREEN_BITS ImageBehindCursor
Definition: vgaddi.h:118
#define ALLOC_TAG
Definition: btrfs_drv.h:91
USHORT y
Definition: vgaddi.h:86
USHORT x
Definition: vgaddi.h:85
void * EngAllocMem(int zero, unsigned long size, int tag=0)
Definition: polytest.cpp:70
PVIDEO_POINTER_ATTRIBUTES pPointerAttributes
Definition: driver.h:45
unsigned int ULONG
Definition: retypes.h:1
XYPAIR xyHotSpot
Definition: vgaddi.h:114
PSAVED_SCREEN_BITS VGADDI_AllocSavedScreenBits(ULONG Size)
Definition: offscreen.c:121

Referenced by DrvAssertMode(), and DrvEnableSurface().

◆ InitVGA()

BOOL InitVGA ( PPDEV  ppdev,
BOOL  bFirst 
)

Definition at line 134 of file screen.c.

135 {
136  ULONG ReturnedDataLength;
137  VIDEO_MEMORY VideoMemory;
138  VIDEO_MEMORY_INFORMATION VideoMemoryInfo;
139 
140  ppdev->sizeSurf.cx = 640;
141  ppdev->sizeSurf.cy = 480;
142  ppdev->ModeNum = 12;
143 
144  /* Set the mode that was requested */
145  if (EngDeviceIoControl(ppdev->KMDriver,
147  &ppdev->ModeNum,
148  sizeof(VIDEO_MODE),
149  NULL,
150  0,
151  &ReturnedDataLength))
152  {
153  return FALSE;
154  }
155 
156  /* set up internal palette */
157  if (EngDeviceIoControl(ppdev->KMDriver,
161  NULL,
162  0,
163  &ReturnedDataLength))
164  {
165  return FALSE;
166  }
167 
168  /* set up the DAC */
169  if (EngDeviceIoControl(ppdev->KMDriver,
171  (PVOID) ColorBuffer,
173  NULL,
174  0,
175  &ReturnedDataLength))
176  {
177  return FALSE;
178  }
179 
180  if (bFirst)
181  {
182  /* map video memory into virtual memory */
183  VideoMemory.RequestedVirtualAddress = NULL;
184 
185  if (EngDeviceIoControl(ppdev->KMDriver,
187  (PVOID) &VideoMemory,
189  (PVOID) &VideoMemoryInfo,
190  sizeof (VideoMemoryInfo),
191  &ReturnedDataLength))
192  {
193  /* Failed to map to virtual memory */
194  return FALSE;
195  }
196 
197  ppdev->fbScreen = VideoMemoryInfo.FrameBufferBase;
198  vidmem = (PUCHAR)ppdev->fbScreen;
199  }
200 
201  return TRUE;
202 }
PBYTE vidmem
Definition: vgavideo.c:18
#define TRUE
Definition: types.h:120
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
unsigned char * PUCHAR
Definition: retypes.h:3
#define IOCTL_VIDEO_MAP_VIDEO_MEMORY
Definition: ntddvdeo.h:104
PVOID RequestedVirtualAddress
Definition: ntddvdeo.h:274
#define IOCTL_VIDEO_SET_CURRENT_MODE
Definition: ntddvdeo.h:152
#define IOCTL_VIDEO_SET_PALETTE_REGISTERS
Definition: ntddvdeo.h:161
SIZEL sizeSurf
Definition: vgaddi.h:136
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:319
PBYTE fbScreen
Definition: vgaddi.h:137
HANDLE KMDriver
Definition: vgaddi.h:108
static BYTE ColorBuffer[]
Definition: screen.c:16
static WORD PaletteBuffer[]
Definition: screen.c:11
ULONG ModeNum
Definition: vgaddi.h:134
unsigned int ULONG
Definition: retypes.h:1
LONG cy
Definition: windef.h:320
#define IOCTL_VIDEO_SET_COLOR_REGISTERS
Definition: ntddvdeo.h:149

Referenced by DrvAssertMode(), and DrvEnableSurface().

◆ InsertHeadList()

static __inline VOID InsertHeadList ( IN PLIST_ENTRY  ListHead,
IN PLIST_ENTRY  Entry 
)
static

Definition at line 45 of file vgaddi.h.

48 {
49  PLIST_ENTRY OldFlink;
50  OldFlink = ListHead->Flink;
51  Entry->Flink = OldFlink;
52  Entry->Blink = ListHead;
53  OldFlink->Blink = Entry;
54  ListHead->Flink = Entry;
55 }
struct _Entry Entry
Definition: kefuncs.h:640
struct _LIST_ENTRY * Blink
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
Definition: typedefs.h:117
base of all file and directory entries
Definition: entries.h:82

◆ RemoveEntryList()

static __inline BOOLEAN RemoveEntryList ( IN PLIST_ENTRY  Entry)
static

Definition at line 31 of file vgaddi.h.

33 {
34  PLIST_ENTRY OldFlink;
35  PLIST_ENTRY OldBlink;
36 
37  OldFlink = Entry->Flink;
38  OldBlink = Entry->Blink;
39  OldFlink->Blink = OldBlink;
40  OldBlink->Flink = OldFlink;
41  return (OldFlink == OldBlink);
42 }
struct _LIST_ENTRY * Blink
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
Definition: typedefs.h:117
base of all file and directory entries
Definition: entries.h:82

◆ VGADDI_AllocSavedScreenBits()

PSAVED_SCREEN_BITS VGADDI_AllocSavedScreenBits ( ULONG  Size)

Definition at line 121 of file offscreen.c.

122 {
123  PSAVED_SCREEN_BITS Current;
124  PLIST_ENTRY CurrentEntry;
125  PSAVED_SCREEN_BITS Best;
127 
128  Best = NULL;
129  CurrentEntry = SavedBitsList.Flink;
130  while (CurrentEntry != &SavedBitsList)
131  {
132  Current = CONTAINING_RECORD(CurrentEntry, SAVED_SCREEN_BITS, ListEntry);
133 
134  if (Current->Free && Current->Size >= Size &&
135  (Best == NULL || (Current->Size - Size) < (Best->Size - Size)))
136  {
137  Best = Current;
138  }
139 
140  CurrentEntry = CurrentEntry->Flink;
141  }
142 
143  if (!Best)
144  return NULL;
145 
146  if (Best->Size == Size)
147  {
148  Best->Free = FALSE;
149  return Best;
150  }
151  else
152  {
154  New->Free = FALSE;
155  New->Offset = Best->Offset + Size;
156  New->Size = Size;
157  Best->Size -= Size;
158  InsertHeadList(&Best->ListEntry, &New->ListEntry);
159  return New;
160  }
161 }
FORCEINLINE VOID InsertHeadList(_Inout_ PLIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PLIST_ENTRY Entry)
Definition: rtlfuncs.h:201
#define New(t)
Definition: rtf.h:1086
#define ALLOC_TAG
Definition: btrfs_drv.h:91
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
void * EngAllocMem(int zero, unsigned long size, int tag=0)
Definition: polytest.cpp:70
Definition: typedefs.h:117
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
LIST_ENTRY ListEntry
Definition: vgaddi.h:94
static LIST_ENTRY SavedBitsList
Definition: offscreen.c:15

Referenced by DrvSetPointerShape(), and InitPointer().

◆ VGADDI_BltFromSavedScreenBits()

VOID VGADDI_BltFromSavedScreenBits ( ULONG  DestX,
ULONG  DestY,
PSAVED_SCREEN_BITS  Src,
ULONG  SizeX,
ULONG  SizeY 
)

◆ VGADDI_BltToSavedScreenBits()

VOID VGADDI_BltToSavedScreenBits ( PSAVED_SCREEN_BITS  Dest,
ULONG  SourceX,
ULONG  SourceY,
ULONG  SizeX,
ULONG  SizeY 
)

◆ VGADDI_FreeSavedScreenBits()

VOID VGADDI_FreeSavedScreenBits ( PSAVED_SCREEN_BITS  SavedBits)

Definition at line 87 of file offscreen.c.

88 {
89  SavedBits->Free = TRUE;
90 
91  if (SavedBits->ListEntry.Blink != &SavedBitsList)
92  {
93  PSAVED_SCREEN_BITS Previous;
94 
95  Previous = CONTAINING_RECORD(SavedBits->ListEntry.Blink,
96  SAVED_SCREEN_BITS, ListEntry);
97  if (Previous->Free)
98  {
99  Previous->Size += SavedBits->Size;
100  RemoveEntryList(&SavedBits->ListEntry);
101  EngFreeMem(SavedBits);
102  SavedBits = Previous;
103  }
104  }
105  if (SavedBits->ListEntry.Flink != &SavedBitsList)
106  {
107  PSAVED_SCREEN_BITS Next;
108 
110  ListEntry);
111  if (Next->Free)
112  {
113  SavedBits->Size += Next->Size;
114  RemoveEntryList(&SavedBits->ListEntry);
115  EngFreeMem(SavedBits);
116  }
117  }
118 }
#define TRUE
Definition: types.h:120
#define EngFreeMem
Definition: polytest.cpp:56
struct _LIST_ENTRY * Blink
Definition: typedefs.h:120
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
LIST_ENTRY ListEntry
Definition: vgaddi.h:94
static LIST_ENTRY SavedBitsList
Definition: offscreen.c:15

Referenced by DrvSetPointerShape().

◆ VGADDI_InitializeOffScreenMem()

VOID VGADDI_InitializeOffScreenMem ( ULONG  Start,
ULONG  Length 
)

◆ vgaReadScan()

VOID FASTCALL vgaReadScan ( int  x,
int  y,
int  w,
void b 
)

Definition at line 579 of file vgavideo.c.

580 {
581  unsigned char *vp, *vpP;
582  unsigned char data, mask, maskP;
583  unsigned char *bp;
584  unsigned char plane_mask;
585  int plane, i;
586 
587  ASSIGNVP4(x, y, vpP)
588  ASSIGNMK4(x, y, maskP)
589  get_masks(x, w);
590  WRITE_PORT_USHORT((PUSHORT)GRA_I, 0x0005); // read mode 0
591  WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x04); // read map select
592 
593  memset ( b, 0, w );
594 
595  for ( plane=0, plane_mask=1; plane < 4; plane++, plane_mask<<=1 )
596  {
597  WRITE_PORT_UCHAR((PUCHAR)GRA_D, plane); // read map select
598 
599  vp = vpP;
600  bp = b;
601  if ( leftMask )
602  {
603  mask = maskP;
604  data = *vp++;
605  do
606  {
607  if (data & mask)
608  *bp |= plane_mask;
609  bp++;
610  mask >>= 1;
611  } while (mask & leftMask);
612  }
613  if (byteCounter)
614  {
615  for (i=byteCounter; i>0; i--)
616  {
617  data = *vp++;
618  if (data & 0x80) *bp |= plane_mask;
619  bp++;
620 
621  if (data & 0x40) *bp |= plane_mask;
622  bp++;
623  if (data & 0x20) *bp |= plane_mask;
624  bp++;
625  if (data & 0x10) *bp |= plane_mask;
626  bp++;
627  if (data & 0x08) *bp |= plane_mask;
628  bp++;
629  if (data & 0x04) *bp |= plane_mask;
630  bp++;
631  if (data & 0x02) *bp |= plane_mask;
632  bp++;
633  if (data & 0x01) *bp |= plane_mask;
634  bp++;
635  }
636  }
637  if (rightMask)
638  {
639  mask = 0x80;
640  data = *vp;
641  do
642  {
643  if (data & mask)
644  *bp |= plane_mask;
645  bp++;
646  mask >>= 1;
647  } while (mask & rightMask);
648  }
649  }
650 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum GLint const GLfloat GLenum GLint const GLushort GLint GLint GLsizei GLsizei GLenum GLsizei GLsizei GLenum GLenum const GLvoid GLenum plane
Definition: glfuncs.h:270
static int byteCounter
Definition: vgavideo.c:22
VOID NTAPI WRITE_PORT_USHORT(IN PUSHORT Port, IN USHORT Value)
Definition: portio.c:115
unsigned char * PUCHAR
Definition: retypes.h:3
#define GRA_I
Definition: vgavideo.h:59
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define ASSIGNMK4(x, y, mask)
Definition: vgavideo.h:66
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLenum GLint GLuint mask
Definition: glext.h:6028
#define b
Definition: ke_i.h:79
#define ASSIGNVP4(x, y, vp)
Definition: vgavideo.h:65
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
static unsigned char rightMask
Definition: vgavideo.c:23
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
void get_masks(int x, int w)
Definition: vgavideo.c:133
static unsigned char leftMask
Definition: vgavideo.c:21
#define GRA_D
Definition: vgavideo.h:60
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532
#define memset(x, y, z)
Definition: compat.h:39
unsigned short * PUSHORT
Definition: retypes.h:2

Referenced by VGAtoVGA().

◆ VGAtoGDI()

BOOL VGAtoGDI ( SURFOBJ Dest,
SURFOBJ Source,
SURFOBJ Mask,
XLATEOBJ ColorTranslation,
RECTL DestRect,
POINTL SourcePoint 
)

◆ vgaWriteScan()

VOID FASTCALL vgaWriteScan ( int  x,
int  y,
int  w,
void b 
)

Definition at line 655 of file vgavideo.c.

656 {
657  unsigned char *bp;
658  unsigned char *vp;
659  //unsigned char init_mask;
660  volatile unsigned char dummy;
661  //int byte_per_line;
662  int i, j, off, init_off = x&7;
663 
664  bp = b;
665  ASSIGNVP4(x, y, vp)
666  //ASSIGNMK4(x, y, init_mask)
667  //byte_per_line = SCREEN_X >> 3;
668 
669  WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x05); // write mode 2
670  WRITE_PORT_UCHAR((PUCHAR)GRA_D, 0x02);
671  WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x03); // replace
672  WRITE_PORT_UCHAR((PUCHAR)GRA_D, 0x00);
673  WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x08); // bit mask
674 
675  for ( j = 0; j < 8; j++)
676  {
677  unsigned int mask = 0x80 >> j;
678  WRITE_PORT_UCHAR ( (PUCHAR)GRA_D, (unsigned char)mask );
679  i = j - init_off;
680  off = 0;
681  if (j < init_off)
682  i += 8, off++;
683  while (i < w)
684  {
685  /*
686  * In write mode 2, the incoming data is 4-bit and represents the
687  * value of entire bytes on each of the 4 memory planes. First, VGA
688  * performs a logical operation on these bytes and the value of the
689  * latch register, but in this case there is none. Then, only the
690  * bits that are set in the bit mask are used from the resulting
691  * bytes, and the other bits are taken from the latch register.
692  *
693  * The latch register always contains the value previously read from
694  * VGA memory, and therefore, we must first read from vp[off] to
695  * load the latch register, and then write bp[i] to vp[off], which
696  * will be converted to 4 bytes of VGA memory as described.
697  */
698  dummy = vp[off];
699  dummy = bp[i];
700  vp[off] = dummy;
701  i += 8;
702  off++;
703  }
704  }
705 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
unsigned char * PUCHAR
Definition: retypes.h:3
#define GRA_I
Definition: vgavideo.h:59
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLenum GLint GLuint mask
Definition: glext.h:6028
#define b
Definition: ke_i.h:79
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define ASSIGNVP4(x, y, vp)
Definition: vgavideo.h:65
unsigned char dummy
Definition: maze.c:118
#define GRA_D
Definition: vgavideo.h:60
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532
off
Definition: i386-dis.c:3909

Referenced by VGAtoVGA().