VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Display/driver.h@ 2705

Last change on this file since 2705 was 2558, checked in by vboxsync, 18 years ago

Undid incorrect commit.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.5 KB
Line 
1/******************************Module*Header*******************************\
2*
3* *******************
4* * GDI SAMPLE CODE *
5* *******************
6*
7* Module Name: driver.h
8*
9* contains prototypes for the frame buffer driver.
10*
11* Copyright (c) 1992-1998 Microsoft Corporation
12\**************************************************************************/
13
14#include "stddef.h"
15#include <stdarg.h>
16#include "windef.h"
17#include "wingdi.h"
18#include "winddi.h"
19#include "devioctl.h"
20#include "ntddvdeo.h"
21#include "debug.h"
22
23#include "../Miniport/vboxioctl.h"
24
25/* Forward declaration. */
26struct _PDEV;
27typedef struct _PDEV PDEV;
28typedef PDEV *PPDEV;
29
30#include "vbvavrdp.h"
31#include "vrdpbmp.h"
32
33/* Saved screen bits information. */
34typedef struct _SSB
35{
36 ULONG ident; /* 1 based index in the stack = the handle returned by DrvSaveScreenBits (SS_SAVE) */
37 BYTE *pBuffer; /* Buffer where screen bits are saved. */
38} SSB;
39
40struct _PDEV
41{
42 HANDLE hDriver; // Handle to \Device\Screen
43 HDEV hdevEng; // Engine's handle to PDEV
44 HSURF hsurfScreenBitmap; // Engine's handle to VRAM screen bitmap surface
45 SURFOBJ *psoScreenBitmap; // VRAM screen bitmap surface
46 HSURF hsurfScreen; // Engine's handle to VRAM screen device surface
47 ULONG ulBitmapType;
48 HPALETTE hpalDefault; // Handle to the default palette for device.
49 PBYTE pjScreen; // This is pointer to base screen address
50 ULONG cxScreen; // Visible screen width
51 ULONG cyScreen; // Visible screen height
52 POINTL ptlOrg; // Where this display is anchored in
53 // the virtual desktop.
54 ULONG ulMode; // Mode the mini-port driver is in.
55 LONG lDeltaScreen; // Distance from one scan to the next.
56 ULONG cScreenSize; // size of video memory, including
57 // offscreen memory.
58 PVOID pOffscreenList; // linked list of DCI offscreen surfaces.
59 FLONG flRed; // For bitfields device, Red Mask
60 FLONG flGreen; // For bitfields device, Green Mask
61 FLONG flBlue; // For bitfields device, Blue Mask
62 ULONG cPaletteShift; // number of bits the 8-8-8 palette must
63 // be shifted by to fit in the hardware
64 // palette.
65 ULONG ulBitCount; // # of bits per pel 8,16,24,32 are only supported.
66 POINTL ptlHotSpot; // adjustment for pointer hot spot
67 VIDEO_POINTER_CAPABILITIES PointerCapabilities; // HW pointer abilities
68 PVIDEO_POINTER_ATTRIBUTES pPointerAttributes; // hardware pointer attributes
69 DWORD cjPointerAttributes; // Size of buffer allocated
70 BOOL fHwCursorActive; // Are we currently using the hw cursor
71 PALETTEENTRY *pPal; // If this is pal managed, this is the pal
72 BOOL bSupportDCI; // Does the miniport support DCI?
73 FLONG flHooks;
74
75 VBVAENABLERESULT vbva;
76 HSEMAPHORE hsemHwBuffer;
77 BOOL fHwBufferOverflow;
78 VBVARECORD *pRecord;
79 VRDPBC cache;
80
81 ULONG cSSB; // Number of active saved screen bits records in the following array.
82 SSB aSSB[4]; // LIFO type stack for saved screen areas.
83};
84
85DWORD getAvailableModes(HANDLE, PVIDEO_MODE_INFORMATION *, DWORD *);
86BOOL bInitPDEV(PPDEV, PDEVMODEW, GDIINFO *, DEVINFO *);
87BOOL bInitSURF(PPDEV, BOOL);
88BOOL bInitPaletteInfo(PPDEV, DEVINFO *);
89BOOL bInitPointer(PPDEV, DEVINFO *);
90BOOL bInit256ColorPalette(PPDEV);
91BOOL bInitNotificationThread(PPDEV);
92VOID vStopNotificationThread (PPDEV);
93VOID vDisablePalette(PPDEV);
94VOID vDisableSURF(PPDEV);
95
96#define MAX_CLUT_SIZE (sizeof(VIDEO_CLUT) + (sizeof(ULONG) * 256))
97
98//
99// Determines the size of the DriverExtra information in the DEVMODE
100// structure passed to and from the display driver.
101//
102
103#define DRIVER_EXTRA_SIZE 0
104
105#define DLL_NAME L"VBoxDisp" // Name of the DLL in UNICODE
106#define STANDARD_DEBUG_PREFIX "VBOXDISP: " // All debug output is prefixed
107#define ALLOC_TAG 'bvDD' // Four byte tag (characters in
108 // reverse order) used for memory
109 // allocations
110
111// VBOX
112typedef struct _CLIPRECTS {
113 ULONG c;
114 RECTL arcl[64];
115} CLIPRECTS;
116
117
118BOOL vboxVbvaEnable (PPDEV ppdev);
119void vboxVbvaDisable (PPDEV ppdev);
120
121BOOL vboxHwBufferBeginUpdate (PPDEV ppdev);
122void vboxHwBufferEndUpdate (PPDEV ppdev);
123
124BOOL vboxWrite (PPDEV ppdev, const void *pv, uint32_t cb);
125
126BOOL vboxOrderSupported (PPDEV ppdev, unsigned code);
127
128
129void drvLoadEng (void);
130
131BOOL bIsScreenSurface (SURFOBJ *pso);
132
133__inline SURFOBJ *getSurfObj (SURFOBJ *pso)
134{
135 if (pso)
136 {
137 PPDEV ppdev = (PPDEV)pso->dhpdev;
138
139 if (ppdev)
140 {
141 if (bIsScreenSurface(pso))
142 {
143 pso = ppdev->psoScreenBitmap;
144 }
145 }
146 }
147
148 return pso;
149}
150
151#define CONV_SURF(_pso) getSurfObj (_pso)
152
153__inline int format2BytesPerPixel(const SURFOBJ *pso)
154{
155 switch (pso->iBitmapFormat)
156 {
157 case BMF_16BPP: return 2;
158 case BMF_24BPP: return 3;
159 case BMF_32BPP: return 4;
160 }
161
162 return 0;
163}
164
165#include <iprt/assert.h>
166
167#define VBVA_ASSERT(expr) \
168 do { \
169 if (!(expr)) \
170 { \
171 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
172 AssertMsg2("!!!\n"); \
173 } \
174 } while (0)
175
176#ifdef STAT_sunlover
177extern ULONG gStatCopyBitsOffscreenToScreen;
178extern ULONG gStatCopyBitsScreenToScreen;
179extern ULONG gStatBitBltOffscreenToScreen;
180extern ULONG gStatBitBltScreenToScreen;
181extern ULONG gStatUnchangedOffscreenToScreen;
182extern ULONG gStatUnchangedOffscreenToScreenCRC;
183extern ULONG gStatNonTransientEngineBitmaps;
184extern ULONG gStatTransientEngineBitmaps;
185extern ULONG gStatUnchangedBitmapsCRC;
186extern ULONG gStatUnchangedBitmapsDeviceCRC;
187extern ULONG gStatBitmapsCRC;
188extern ULONG gStatBitBltScreenPattern;
189extern ULONG gStatBitBltScreenSquare;
190extern ULONG gStatBitBltScreenPatternReported;
191extern ULONG gStatBitBltScreenSquareReported;
192extern ULONG gStatCopyBitsScreenSquare;
193
194extern ULONG gStatEnablePDEV;
195extern ULONG gStatCompletePDEV;
196extern ULONG gStatDisablePDEV;
197extern ULONG gStatEnableSurface;
198extern ULONG gStatDisableSurface;
199extern ULONG gStatAssertMode;
200extern ULONG gStatDisableDriver;
201extern ULONG gStatCreateDeviceBitmap;
202extern ULONG gStatDeleteDeviceBitmap;
203extern ULONG gStatDitherColor;
204extern ULONG gStatStrokePath;
205extern ULONG gStatFillPath;
206extern ULONG gStatStrokeAndFillPath;
207extern ULONG gStatPaint;
208extern ULONG gStatBitBlt;
209extern ULONG gStatCopyBits;
210extern ULONG gStatStretchBlt;
211extern ULONG gStatSetPalette;
212extern ULONG gStatTextOut;
213extern ULONG gStatSetPointerShape;
214extern ULONG gStatMovePointer;
215extern ULONG gStatLineTo;
216extern ULONG gStatSynchronize;
217extern ULONG gStatGetModes;
218extern ULONG gStatGradientFill;
219extern ULONG gStatStretchBltROP;
220extern ULONG gStatPlgBlt;
221extern ULONG gStatAlphaBlend;
222extern ULONG gStatTransparentBlt;
223
224void statPrint (void);
225
226#define STATDRVENTRY(a, b) do { if (bIsScreenSurface (b)) gStat##a++; } while (0)
227#define STATPRINT do { statPrint (); } while (0)
228#else
229#define STATDRVENTRY(a, b)
230#define STATPRINT
231#endif /* STAT_sunlover */
Note: See TracBrowser for help on using the repository browser.

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