ReactOS 0.4.15-dev-7788-g1ad9096
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
@ JustifyBottom
Definition: vgaddi.h:153
@ JustifyTop
Definition: vgaddi.h:152

Function Documentation

◆ DbgPrint()

ULONG DbgPrint ( PCCH  Format,
  ... 
)

Definition at line 432 of file debug.c.

433{
434 return 0;
435}

◆ 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");
129 return FALSE;
130 }
131 return TRUE;
132}
#define DPRINT1
Definition: precomp.h:8
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
if(dx< 0)
Definition: linetemp.h:194
#define IOCTL_VIDEO_UNMAP_VIDEO_MEMORY
Definition: ntddvdeo.h:248
PBYTE fbScreen
Definition: vgaddi.h:137
HANDLE KMDriver
Definition: vgaddi.h:108
PVOID RequestedVirtualAddress
Definition: ntddvdeo.h:344
void * PVOID
Definition: typedefs.h:50
uint32_t ULONG
Definition: typedefs.h:59
_Analysis_noreturn_ ENGAPI VOID APIENTRY EngDebugBreak(VOID)

Referenced by DrvDisableSurface().

◆ getAvailableModes()

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

Definition at line 651 of file screen.c.

655{
656 ULONG ulTemp;
657 VIDEO_NUM_MODES modes;
658 PVIDEO_MODE_INFORMATION pVideoTemp;
659
660 //
661 // Get the number of modes supported by the mini-port
662 //
663
664 if (EngDeviceIoControl(hDriver,
666 NULL,
667 0,
668 &modes,
669 sizeof(VIDEO_NUM_MODES),
670 &ulTemp))
671 {
672 DISPDBG((0, "getAvailableModes failed VIDEO_QUERY_NUM_AVAIL_MODES\n"));
673 return 0;
674 }
675
676 *cbModeSize = modes.ModeInformationLength;
677
678 //
679 // Allocate the buffer for the mini-port to write the modes in.
680 //
681
682 *modeInformation = (PVIDEO_MODE_INFORMATION)
683 EngAllocMem(0, modes.NumModes *
685
686 if (*modeInformation == NULL)
687 {
688 DISPDBG((0, "getAvailableModes failed EngAllocMem\n"));
689
690 return 0;
691 }
692
693 //
694 // Ask the mini-port to fill in the available modes.
695 //
696
697 if (EngDeviceIoControl(hDriver,
699 NULL,
700 0,
701 *modeInformation,
702 modes.NumModes * modes.ModeInformationLength,
703 &ulTemp))
704 {
705
706 DISPDBG((0, "getAvailableModes failed VIDEO_QUERY_AVAIL_MODES\n"));
707
708 EngFreeMem(*modeInformation);
709 *modeInformation = NULL;
710
711 return 0;
712 }
713
714 //
715 // Now see which of these modes are supported by the display driver.
716 // As an internal mechanism, set the length to 0 for the modes we
717 // DO NOT support.
718 //
719
720 ulTemp = modes.NumModes;
721 pVideoTemp = *modeInformation;
722
723// eVb: 2.5 [VGARISC CHANGE] - Add correct mode checks for VGA
724 //
725 // Mode is rejected if it is not 4 planes, or not graphics, or is not
726 // one of 1 bits per pel.
727 //
728
729 while (ulTemp--)
730 {
731 if ((pVideoTemp->NumberOfPlanes != 4 ) ||
732 !(pVideoTemp->AttributeFlags & VIDEO_MODE_GRAPHICS) ||
733 ((pVideoTemp->BitsPerPlane != 1) ||
734 (pVideoTemp->VisScreenWidth > 800)))
735// eVb: 2.5 [END]
736 {
737 pVideoTemp->Length = 0;
738 }
739
740 pVideoTemp = (PVIDEO_MODE_INFORMATION)
741 (((PUCHAR)pVideoTemp) + modes.ModeInformationLength);
742 }
743
744 return modes.NumModes;
745
746}
#define ALLOC_TAG
Definition: btrfs_drv.h:87
#define VIDEO_MODE_GRAPHICS
Definition: ntddvdeo.h:364
struct _VIDEO_MODE_INFORMATION * PVIDEO_MODE_INFORMATION
#define IOCTL_VIDEO_QUERY_AVAIL_MODES
Definition: ntddvdeo.h:176
#define IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES
Definition: ntddvdeo.h:191
#define EngFreeMem
Definition: polytest.cpp:56
void * EngAllocMem(int zero, unsigned long size, int tag=0)
Definition: polytest.cpp:70
ULONG ModeInformationLength
Definition: ntddvdeo.h:398
unsigned char * PUCHAR
Definition: typedefs.h:53
#define DISPDBG(arg)
Definition: debug.h:23
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO _In_ HDEV _In_ LPWSTR _In_ HANDLE hDriver
Definition: winddi.h:3557

◆ 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
PSAVED_SCREEN_BITS VGADDI_AllocSavedScreenBits(ULONG Size)
Definition: offscreen.c:121
PVIDEO_POINTER_ATTRIBUTES pPointerAttributes
Definition: vgaddi.h:117
PSAVED_SCREEN_BITS ImageBehindCursor
Definition: vgaddi.h:118
XYPAIR xyHotSpot
Definition: vgaddi.h:114
USHORT x
Definition: vgaddi.h:85
USHORT y
Definition: vgaddi.h:86

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 = 2;
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,
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}
#define IOCTL_VIDEO_MAP_VIDEO_MEMORY
Definition: ntddvdeo.h:173
#define IOCTL_VIDEO_SET_PALETTE_REGISTERS
Definition: ntddvdeo.h:230
#define IOCTL_VIDEO_SET_CURRENT_MODE
Definition: ntddvdeo.h:221
#define IOCTL_VIDEO_SET_COLOR_REGISTERS
Definition: ntddvdeo.h:218
SIZEL sizeSurf
Definition: vgaddi.h:136
ULONG ModeNum
Definition: vgaddi.h:134
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
PBYTE vidmem
Definition: vgavideo.c:18
static WORD PaletteBuffer[]
Definition: screen.c:11
static BYTE ColorBuffer[]
Definition: screen.c:16
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

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}
base of all file and directory entries
Definition: entries.h:83
Definition: typedefs.h:120
struct _LIST_ENTRY * Blink
Definition: typedefs.h:122
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121

◆ 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}

◆ 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;
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}
#define InsertHeadList(ListHead, Entry)
static LIST_ENTRY SavedBitsList
Definition: offscreen.c:15
#define New(t)
Definition: rtf.h:1086
LIST_ENTRY ListEntry
Definition: vgaddi.h:94
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

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 {
108
110 ListEntry);
111 if (Next->Free)
112 {
113 SavedBits->Size += Next->Size;
114 RemoveEntryList(&SavedBits->ListEntry);
115 EngFreeMem(SavedBits);
116 }
117 }
118}
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986

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}
#define GRA_D
Definition: vgavideo.h:60
#define ASSIGNMK4(x, y, mask)
Definition: vgavideo.h:66
#define ASSIGNVP4(x, y, vp)
Definition: vgavideo.h:65
#define GRA_I
Definition: vgavideo.h:59
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum GLint GLuint mask
Definition: glext.h:6028
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
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 i
Definition: glfuncs.h:248
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
VOID NTAPI WRITE_PORT_USHORT(IN PUSHORT Port, IN USHORT Value)
Definition: portio.c:115
#define b
Definition: ke_i.h:79
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
#define memset(x, y, z)
Definition: compat.h:39
uint16_t * PUSHORT
Definition: typedefs.h:56
void get_masks(int x, int w)
Definition: vgavideo.c:133
static unsigned char rightMask
Definition: vgavideo.c:23
static int byteCounter
Definition: vgavideo.c:22
static unsigned char leftMask
Definition: vgavideo.c:21

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
671 WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x03); // replace
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}
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

Referenced by VGAtoVGA().