VirtualBox

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

Last change on this file since 3423 was 3423, checked in by vboxsync, 17 years ago

Or maybe not. Sigh.

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