VirtualBox

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

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

DdMapMemory must map the offscreen heap as well. Report DdLock updates only for the primary surface.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 9.5 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+ddraw heap+VBVA buffer+displayinfo=cScreenSize
56 */
57typedef struct _VRAMLAYOUT
58{
59 ULONG cbVRAM;
60
61 ULONG offFrameBuffer;
62 ULONG cbFrameBuffer;
63
64 ULONG offDDRAWHeap; //@todo
65 ULONG cbDDRAWHeap;
66
67 ULONG offVBVABuffer;
68 ULONG cbVBVABuffer;
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 struct {
136 DWORD bLocked;
137 RECTL rArea;
138 } ddLock;
139#endif /* VBOX_WITH_DDRAW */
140};
141
142#ifdef VBOX_WITH_OPENGL
143typedef struct
144{
145 DWORD dwVersion;
146 DWORD dwDriverVersion;
147 WCHAR szDriverName[256];
148} OPENGL_INFO, *POPENGL_INFO;
149#endif
150
151/* The global semaphore handle for all driver instances. */
152extern HSEMAPHORE ghsemHwBuffer;
153
154extern BOOL g_bOnNT40;
155
156DWORD getAvailableModes(HANDLE, PVIDEO_MODE_INFORMATION *, DWORD *);
157BOOL bInitPDEV(PPDEV, PDEVMODEW, GDIINFO *, DEVINFO *);
158BOOL bInitSURF(PPDEV, BOOL);
159BOOL bInitPaletteInfo(PPDEV, DEVINFO *);
160BOOL bInitPointer(PPDEV, DEVINFO *);
161BOOL bInit256ColorPalette(PPDEV);
162BOOL bInitNotificationThread(PPDEV);
163VOID vStopNotificationThread (PPDEV);
164VOID vDisablePalette(PPDEV);
165VOID vDisableSURF(PPDEV);
166
167#define MAX_CLUT_SIZE (sizeof(VIDEO_CLUT) + (sizeof(ULONG) * 256))
168
169//
170// Determines the size of the DriverExtra information in the DEVMODE
171// structure passed to and from the display driver.
172//
173
174#define DRIVER_EXTRA_SIZE 0
175
176#define DLL_NAME L"VBoxDisp" // Name of the DLL in UNICODE
177#define STANDARD_DEBUG_PREFIX "VBOXDISP: " // All debug output is prefixed
178#define ALLOC_TAG 'bvDD' // Four byte tag (characters in
179 // reverse order) used for memory
180 // allocations
181
182// VBOX
183typedef struct _CLIPRECTS {
184 ULONG c;
185 RECTL arcl[64];
186} CLIPRECTS;
187
188
189BOOL vboxVbvaEnable (PPDEV ppdev);
190void vboxVbvaDisable (PPDEV ppdev);
191
192BOOL vboxHwBufferBeginUpdate (PPDEV ppdev);
193void vboxHwBufferEndUpdate (PPDEV ppdev);
194
195BOOL vboxWrite (PPDEV ppdev, const void *pv, uint32_t cb);
196
197BOOL vboxOrderSupported (PPDEV ppdev, unsigned code);
198
199void VBoxProcessDisplayInfo(PPDEV ppdev);
200void VBoxUpdateDisplayInfo (PPDEV ppdev);
201
202void drvLoadEng (void);
203
204BOOL bIsScreenSurface (SURFOBJ *pso);
205
206__inline SURFOBJ *getSurfObj (SURFOBJ *pso)
207{
208 if (pso)
209 {
210 PPDEV ppdev = (PPDEV)pso->dhpdev;
211
212 if (ppdev)
213 {
214 if (ppdev->psoScreenBitmap && pso->hsurf == ppdev->hsurfScreen)
215 {
216 /* Convert the device PSO to the bitmap PSO which can be passed to Eng*. */
217 pso = ppdev->psoScreenBitmap;
218 }
219 }
220 }
221
222 return pso;
223}
224
225#define CONV_SURF(_pso) getSurfObj (_pso)
226
227__inline int format2BytesPerPixel(const SURFOBJ *pso)
228{
229 switch (pso->iBitmapFormat)
230 {
231 case BMF_16BPP: return 2;
232 case BMF_24BPP: return 3;
233 case BMF_32BPP: return 4;
234 }
235
236 return 0;
237}
238
239#ifdef VBOX_VBVA_ADJUST_RECT
240void vrdpAdjustRect (SURFOBJ *pso, RECTL *prcl);
241BOOL vbvaFindChangedRect (SURFOBJ *psoDest, SURFOBJ *psoSrc, RECTL *prclDest, POINTL *pptlSrc);
242#endif /* VBOX_VBVA_ADJUST_RECT */
243
244void vrdpReportDirtyRect (PPDEV ppdev, RECTL *prcl);
245void vbvaReportDirtyRect (PPDEV ppdev, RECTL *prcl);
246
247#include <iprt/assert.h>
248
249#define VBVA_ASSERT(expr) \
250 do { \
251 if (!(expr)) \
252 { \
253 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
254 AssertMsg2("!!!\n"); \
255 } \
256 } while (0)
257
258#ifdef STAT_sunlover
259extern ULONG gStatCopyBitsOffscreenToScreen;
260extern ULONG gStatCopyBitsScreenToScreen;
261extern ULONG gStatBitBltOffscreenToScreen;
262extern ULONG gStatBitBltScreenToScreen;
263extern ULONG gStatUnchangedOffscreenToScreen;
264extern ULONG gStatUnchangedOffscreenToScreenCRC;
265extern ULONG gStatNonTransientEngineBitmaps;
266extern ULONG gStatTransientEngineBitmaps;
267extern ULONG gStatUnchangedBitmapsCRC;
268extern ULONG gStatUnchangedBitmapsDeviceCRC;
269extern ULONG gStatBitmapsCRC;
270extern ULONG gStatBitBltScreenPattern;
271extern ULONG gStatBitBltScreenSquare;
272extern ULONG gStatBitBltScreenPatternReported;
273extern ULONG gStatBitBltScreenSquareReported;
274extern ULONG gStatCopyBitsScreenSquare;
275
276extern ULONG gStatEnablePDEV;
277extern ULONG gStatCompletePDEV;
278extern ULONG gStatDisablePDEV;
279extern ULONG gStatEnableSurface;
280extern ULONG gStatDisableSurface;
281extern ULONG gStatAssertMode;
282extern ULONG gStatDisableDriver;
283extern ULONG gStatCreateDeviceBitmap;
284extern ULONG gStatDeleteDeviceBitmap;
285extern ULONG gStatDitherColor;
286extern ULONG gStatStrokePath;
287extern ULONG gStatFillPath;
288extern ULONG gStatStrokeAndFillPath;
289extern ULONG gStatPaint;
290extern ULONG gStatBitBlt;
291extern ULONG gStatCopyBits;
292extern ULONG gStatStretchBlt;
293extern ULONG gStatSetPalette;
294extern ULONG gStatTextOut;
295extern ULONG gStatSetPointerShape;
296extern ULONG gStatMovePointer;
297extern ULONG gStatLineTo;
298extern ULONG gStatSynchronize;
299extern ULONG gStatGetModes;
300extern ULONG gStatGradientFill;
301extern ULONG gStatStretchBltROP;
302extern ULONG gStatPlgBlt;
303extern ULONG gStatAlphaBlend;
304extern ULONG gStatTransparentBlt;
305
306void statPrint (void);
307
308#define STATDRVENTRY(a, b) do { if (bIsScreenSurface (b)) gStat##a++; } while (0)
309#define STATPRINT do { statPrint (); } while (0)
310#else
311#define STATDRVENTRY(a, b)
312#define STATPRINT
313#endif /* STAT_sunlover */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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