VirtualBox

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

最後變更 在這個檔案從4637是 4265,由 vboxsync 提交於 17 年 前

Implemented DrvDeriveSurface in the Windows guest diplay driver.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 9.3 KB
 
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
53/* VRAM
54 * | | | | |
55 * 0+framebuffer+VBVA buffer+ddraw heap+displayinfo=cScreenSize
56 */
57typedef struct _VRAMLAYOUT
58{
59 ULONG cbVRAM;
60
61 ULONG offFrameBuffer;
62 ULONG cbFrameBuffer;
63
64 ULONG offVBVABuffer;
65 ULONG cbVBVABuffer;
66
67 ULONG offDDRAWHeap;
68 ULONG cbDDRAWHeap;
69
70 ULONG offDisplayInformation;
71 ULONG cbDisplayInformation;
72} VRAMLAYOUT;
73
74typedef struct
75{
76 PPDEV ppdev;
77} VBOXSURF, *PVBOXSURF;
78
79struct _PDEV
80{
81 HANDLE hDriver; // Handle to \Device\Screen
82 HDEV hdevEng; // Engine's handle to PDEV
83 HSURF hsurfScreenBitmap; // Engine's handle to VRAM screen bitmap surface
84 SURFOBJ *psoScreenBitmap; // VRAM screen bitmap surface
85 HSURF hsurfScreen; // Engine's handle to VRAM screen device surface
86 ULONG ulBitmapType;
87 HPALETTE hpalDefault; // Handle to the default palette for device.
88 PBYTE pjScreen; // This is pointer to base screen address
89 ULONG cxScreen; // Visible screen width
90 ULONG cyScreen; // Visible screen height
91 POINTL ptlOrg; // Where this display is anchored in
92 // the virtual desktop.
93 POINTL ptlDevOrg; // Device origin for DualView (0,0 for primary view).
94 ULONG ulMode; // Mode the mini-port driver is in.
95 LONG lDeltaScreen; // Distance from one scan to the next.
96
97 PVOID pOffscreenList; // linked list of DCI offscreen surfaces.
98 FLONG flRed; // For bitfields device, Red Mask
99 FLONG flGreen; // For bitfields device, Green Mask
100 FLONG flBlue; // For bitfields device, Blue Mask
101 ULONG cPaletteShift; // number of bits the 8-8-8 palette must
102 // be shifted by to fit in the hardware
103 // palette.
104 ULONG ulBitCount; // # of bits per pel 8,16,24,32 are only supported.
105 POINTL ptlHotSpot; // adjustment for pointer hot spot
106 VIDEO_POINTER_CAPABILITIES PointerCapabilities; // HW pointer abilities
107 PVIDEO_POINTER_ATTRIBUTES pPointerAttributes; // hardware pointer attributes
108 DWORD cjPointerAttributes; // Size of buffer allocated
109 BOOL fHwCursorActive; // Are we currently using the hw cursor
110 PALETTEENTRY *pPal; // If this is pal managed, this is the pal
111 BOOL bSupportDCI; // Does the miniport support DCI?
112 FLONG flHooks;
113
114 VBVAENABLERESULT vbva;
115 uint32_t u32VRDPResetFlag;
116 BOOL fHwBufferOverflow;
117 VBVARECORD *pRecord;
118 VRDPBC cache;
119
120 ULONG cSSB; // Number of active saved screen bits records in the following array.
121 SSB aSSB[4]; // LIFO type stack for saved screen areas.
122
123 VBOXDISPLAYINFO *pInfo;
124 BOOLEAN bVBoxVideoSupported;
125 ULONG iDevice;
126 VRAMLAYOUT layout;
127
128 PVBOXSURF pdsurfScreen;
129
130#ifdef VBOX_WITH_DDRAW
131 BOOL bDdExclusiveMode;
132 DWORD dwNewDDSurfaceOffset;
133 DWORD cHeaps;
134 VIDEOMEMORY* pvmList;
135#endif
136};
137
138#ifdef VBOX_WITH_OPENGL
139typedef struct
140{
141 DWORD dwVersion;
142 DWORD dwDriverVersion;
143 WCHAR szDriverName[256];
144} OPENGL_INFO, *POPENGL_INFO;
145#endif
146
147/* The global semaphore handle for all driver instances. */
148extern HSEMAPHORE ghsemHwBuffer;
149
150extern BOOL g_bOnNT40;
151
152DWORD getAvailableModes(HANDLE, PVIDEO_MODE_INFORMATION *, DWORD *);
153BOOL bInitPDEV(PPDEV, PDEVMODEW, GDIINFO *, DEVINFO *);
154BOOL bInitSURF(PPDEV, BOOL);
155BOOL bInitPaletteInfo(PPDEV, DEVINFO *);
156BOOL bInitPointer(PPDEV, DEVINFO *);
157BOOL bInit256ColorPalette(PPDEV);
158BOOL bInitNotificationThread(PPDEV);
159VOID vStopNotificationThread (PPDEV);
160VOID vDisablePalette(PPDEV);
161VOID vDisableSURF(PPDEV);
162
163#define MAX_CLUT_SIZE (sizeof(VIDEO_CLUT) + (sizeof(ULONG) * 256))
164
165//
166// Determines the size of the DriverExtra information in the DEVMODE
167// structure passed to and from the display driver.
168//
169
170#define DRIVER_EXTRA_SIZE 0
171
172#define DLL_NAME L"VBoxDisp" // Name of the DLL in UNICODE
173#define STANDARD_DEBUG_PREFIX "VBOXDISP: " // All debug output is prefixed
174#define ALLOC_TAG 'bvDD' // Four byte tag (characters in
175 // reverse order) used for memory
176 // allocations
177
178// VBOX
179typedef struct _CLIPRECTS {
180 ULONG c;
181 RECTL arcl[64];
182} CLIPRECTS;
183
184
185BOOL vboxVbvaEnable (PPDEV ppdev);
186void vboxVbvaDisable (PPDEV ppdev);
187
188BOOL vboxHwBufferBeginUpdate (PPDEV ppdev);
189void vboxHwBufferEndUpdate (PPDEV ppdev);
190
191BOOL vboxWrite (PPDEV ppdev, const void *pv, uint32_t cb);
192
193BOOL vboxOrderSupported (PPDEV ppdev, unsigned code);
194
195void VBoxProcessDisplayInfo(PPDEV ppdev);
196void VBoxUpdateDisplayInfo (PPDEV ppdev);
197
198void drvLoadEng (void);
199
200BOOL bIsScreenSurface (SURFOBJ *pso);
201
202__inline SURFOBJ *getSurfObj (SURFOBJ *pso)
203{
204 if (pso)
205 {
206 PPDEV ppdev = (PPDEV)pso->dhpdev;
207
208 if (ppdev)
209 {
210 if (ppdev->psoScreenBitmap && pso->hsurf == ppdev->hsurfScreen)
211 {
212 /* Convert the device PSO to the bitmap PSO which can be passed to Eng*. */
213 pso = ppdev->psoScreenBitmap;
214 }
215 }
216 }
217
218 return pso;
219}
220
221#define CONV_SURF(_pso) getSurfObj (_pso)
222
223__inline int format2BytesPerPixel(const SURFOBJ *pso)
224{
225 switch (pso->iBitmapFormat)
226 {
227 case BMF_16BPP: return 2;
228 case BMF_24BPP: return 3;
229 case BMF_32BPP: return 4;
230 }
231
232 return 0;
233}
234
235#ifdef VBOX_VBVA_ADJUST_RECT
236void vrdpAdjustRect (SURFOBJ *pso, RECTL *prcl);
237BOOL vbvaFindChangedRect (SURFOBJ *psoDest, SURFOBJ *psoSrc, RECTL *prclDest, POINTL *pptlSrc);
238#endif /* VBOX_VBVA_ADJUST_RECT */
239
240
241#include <iprt/assert.h>
242
243#define VBVA_ASSERT(expr) \
244 do { \
245 if (!(expr)) \
246 { \
247 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
248 AssertMsg2("!!!\n"); \
249 } \
250 } while (0)
251
252#ifdef STAT_sunlover
253extern ULONG gStatCopyBitsOffscreenToScreen;
254extern ULONG gStatCopyBitsScreenToScreen;
255extern ULONG gStatBitBltOffscreenToScreen;
256extern ULONG gStatBitBltScreenToScreen;
257extern ULONG gStatUnchangedOffscreenToScreen;
258extern ULONG gStatUnchangedOffscreenToScreenCRC;
259extern ULONG gStatNonTransientEngineBitmaps;
260extern ULONG gStatTransientEngineBitmaps;
261extern ULONG gStatUnchangedBitmapsCRC;
262extern ULONG gStatUnchangedBitmapsDeviceCRC;
263extern ULONG gStatBitmapsCRC;
264extern ULONG gStatBitBltScreenPattern;
265extern ULONG gStatBitBltScreenSquare;
266extern ULONG gStatBitBltScreenPatternReported;
267extern ULONG gStatBitBltScreenSquareReported;
268extern ULONG gStatCopyBitsScreenSquare;
269
270extern ULONG gStatEnablePDEV;
271extern ULONG gStatCompletePDEV;
272extern ULONG gStatDisablePDEV;
273extern ULONG gStatEnableSurface;
274extern ULONG gStatDisableSurface;
275extern ULONG gStatAssertMode;
276extern ULONG gStatDisableDriver;
277extern ULONG gStatCreateDeviceBitmap;
278extern ULONG gStatDeleteDeviceBitmap;
279extern ULONG gStatDitherColor;
280extern ULONG gStatStrokePath;
281extern ULONG gStatFillPath;
282extern ULONG gStatStrokeAndFillPath;
283extern ULONG gStatPaint;
284extern ULONG gStatBitBlt;
285extern ULONG gStatCopyBits;
286extern ULONG gStatStretchBlt;
287extern ULONG gStatSetPalette;
288extern ULONG gStatTextOut;
289extern ULONG gStatSetPointerShape;
290extern ULONG gStatMovePointer;
291extern ULONG gStatLineTo;
292extern ULONG gStatSynchronize;
293extern ULONG gStatGetModes;
294extern ULONG gStatGradientFill;
295extern ULONG gStatStretchBltROP;
296extern ULONG gStatPlgBlt;
297extern ULONG gStatAlphaBlend;
298extern ULONG gStatTransparentBlt;
299
300void statPrint (void);
301
302#define STATDRVENTRY(a, b) do { if (bIsScreenSurface (b)) gStat##a++; } while (0)
303#define STATPRINT do { statPrint (); } while (0)
304#else
305#define STATDRVENTRY(a, b)
306#define STATPRINT
307#endif /* STAT_sunlover */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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