1 | /******************************Module*Header*******************************\
|
---|
2 | *
|
---|
3 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
4 | *
|
---|
5 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
6 | * available from http://www.virtualbox.org. This file is free software;
|
---|
7 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
8 | * General Public License (GPL) as published by the Free Software
|
---|
9 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
10 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
11 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
12 | *
|
---|
13 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
14 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
15 | * additional information or have any questions.
|
---|
16 | */
|
---|
17 | /*
|
---|
18 | * Based in part on Microsoft DDK sample code
|
---|
19 | *
|
---|
20 | * *******************
|
---|
21 | * * GDI SAMPLE CODE *
|
---|
22 | * *******************
|
---|
23 | *
|
---|
24 | * Module Name: enable.c
|
---|
25 | *
|
---|
26 | * This module contains the functions that enable and disable the
|
---|
27 | * driver, the pdev, and the surface.
|
---|
28 | *
|
---|
29 | * Copyright (c) 1992-1998 Microsoft Corporation
|
---|
30 | \**************************************************************************/
|
---|
31 |
|
---|
32 | #include "driver.h"
|
---|
33 | #include "dd.h"
|
---|
34 | #include <VBoxDisplay.h>
|
---|
35 |
|
---|
36 | // The driver function table with all function index/address pairs
|
---|
37 |
|
---|
38 | // Hook functions to track dirty rectangles and generate RDP orders.
|
---|
39 | // NT4 functions
|
---|
40 | DRVFN gadrvfn_nt4[] = {
|
---|
41 | { INDEX_DrvEnablePDEV, (PFN) DrvEnablePDEV }, // 0
|
---|
42 | { INDEX_DrvCompletePDEV, (PFN) DrvCompletePDEV }, // 1
|
---|
43 | { INDEX_DrvDisablePDEV, (PFN) DrvDisablePDEV }, // 2
|
---|
44 | { INDEX_DrvEnableSurface, (PFN) DrvEnableSurface }, // 3
|
---|
45 | { INDEX_DrvDisableSurface, (PFN) DrvDisableSurface }, // 4
|
---|
46 | { INDEX_DrvAssertMode, (PFN) DrvAssertMode }, // 5
|
---|
47 | { INDEX_DrvOffset, (PFN) DrvOffset }, // 6
|
---|
48 | { INDEX_DrvDisableDriver, (PFN) DrvDisableDriver }, // 8
|
---|
49 | // { INDEX_DrvCreateDeviceBitmap, (PFN) DrvCreateDeviceBitmap }, // 10
|
---|
50 | // { INDEX_DrvDeleteDeviceBitmap, (PFN) DrvDeleteDeviceBitmap }, // 11
|
---|
51 | { INDEX_DrvRealizeBrush, (PFN) DrvRealizeBrush }, // 12
|
---|
52 | { INDEX_DrvDitherColor, (PFN) DrvDitherColor }, // 13
|
---|
53 | { INDEX_DrvStrokePath, (PFN) DrvStrokePath }, // 14
|
---|
54 | { INDEX_DrvFillPath, (PFN) DrvFillPath }, // 15
|
---|
55 | { INDEX_DrvPaint, (PFN) DrvPaint }, // 17
|
---|
56 | { INDEX_DrvBitBlt, (PFN) DrvBitBlt }, // 18
|
---|
57 | { INDEX_DrvCopyBits, (PFN) DrvCopyBits }, // 19
|
---|
58 | { INDEX_DrvStretchBlt, (PFN) DrvStretchBlt, }, // 20
|
---|
59 | { INDEX_DrvSetPalette, (PFN) DrvSetPalette }, // 22
|
---|
60 | { INDEX_DrvTextOut, (PFN) DrvTextOut }, // 23
|
---|
61 | { INDEX_DrvEscape, (PFN) DrvEscape }, // 24
|
---|
62 | { INDEX_DrvSetPointerShape, (PFN) DrvSetPointerShape }, // 29
|
---|
63 | { INDEX_DrvMovePointer, (PFN) DrvMovePointer }, // 30
|
---|
64 | { INDEX_DrvLineTo, (PFN) DrvLineTo }, // 31
|
---|
65 | { INDEX_DrvSynchronize, (PFN) DrvSynchronize }, // 38
|
---|
66 | { INDEX_DrvSaveScreenBits, (PFN) DrvSaveScreenBits }, // 40
|
---|
67 | { INDEX_DrvGetModes, (PFN) DrvGetModes }, // 41
|
---|
68 | #ifdef VBOX_WITH_DDRAW
|
---|
69 | { INDEX_DrvGetDirectDrawInfo, (PFN) DrvGetDirectDrawInfo }, // 59 0x3b
|
---|
70 | { INDEX_DrvEnableDirectDraw, (PFN) DrvEnableDirectDraw }, // 60 0x3c
|
---|
71 | { INDEX_DrvDisableDirectDraw, (PFN) DrvDisableDirectDraw }, // 61 0x3d
|
---|
72 | #endif
|
---|
73 | };
|
---|
74 | /* Experimental begin */
|
---|
75 | BOOL APIENTRY DrvResetPDEV(DHPDEV dhpdevOld, DHPDEV dhpdevNew)
|
---|
76 | {
|
---|
77 | DISPDBG((0, "Experimental %s: %p, %p\n", __FUNCTION__, dhpdevOld, dhpdevNew));
|
---|
78 | return TRUE;
|
---|
79 | }
|
---|
80 |
|
---|
81 | BOOL DrvNineGrid (PVOID x1, PVOID x2, PVOID x3, PVOID x4, PVOID x5, PVOID x6, PVOID x7, PVOID x8, PVOID x9)
|
---|
82 | {
|
---|
83 | DISPDBG((0, "Experimental %s: %p, %p, %p, %p, %p, %p, %p, %p, %p\n", __FUNCTION__, x1, x2, x3, x4, x5, x6, x7, x8, x9));
|
---|
84 | return FALSE;
|
---|
85 | }
|
---|
86 |
|
---|
87 | VOID APIENTRY DrvDestroyFont(FONTOBJ *pfo)
|
---|
88 | {
|
---|
89 | DISPDBG((0, "Experimental %s: %p\n", __FUNCTION__, pfo));
|
---|
90 | }
|
---|
91 |
|
---|
92 | ULONG APIENTRY DrvEscape(SURFOBJ *pso, ULONG iEsc, ULONG cjIn, PVOID pvIn, ULONG cjOut, PVOID pvOut)
|
---|
93 | {
|
---|
94 | PDEV* ppdev = (PDEV*) pso->dhpdev;
|
---|
95 |
|
---|
96 | DISPDBG((0, "%s: %p, %p, %p, %p, %p, %p\n", __FUNCTION__, pso, iEsc, cjIn, pvIn, cjOut, pvOut));
|
---|
97 |
|
---|
98 | switch(iEsc)
|
---|
99 | {
|
---|
100 | #ifdef VBOX_WITH_OPENGL
|
---|
101 | case OPENGL_GETINFO:
|
---|
102 | {
|
---|
103 | if ( cjOut >= sizeof(OPENGL_INFO)
|
---|
104 | && pvOut)
|
---|
105 | {
|
---|
106 | POPENGL_INFO pInfo = (POPENGL_INFO)pvOut;
|
---|
107 |
|
---|
108 | pInfo->dwVersion = 2;
|
---|
109 | pInfo->dwDriverVersion = 1;
|
---|
110 | pInfo->szDriverName[0] = 'V';
|
---|
111 | pInfo->szDriverName[1] = 'B';
|
---|
112 | pInfo->szDriverName[2] = 'o';
|
---|
113 | pInfo->szDriverName[3] = 'x';
|
---|
114 | pInfo->szDriverName[4] = 'O';
|
---|
115 | pInfo->szDriverName[5] = 'G';
|
---|
116 | pInfo->szDriverName[6] = 'L';
|
---|
117 | pInfo->szDriverName[7] = 0;
|
---|
118 |
|
---|
119 | DISPDBG((0, "OPENGL_GETINFO\n"));
|
---|
120 | return cjOut;
|
---|
121 | }
|
---|
122 | else
|
---|
123 | DISPDBG((0, "OPENGL_GETINFO invalid size %d\n", cjOut)); /* It doesn't matter that we fail here. Opengl32 will fall back to software rendering when this escape is not supported. */
|
---|
124 | break;
|
---|
125 | }
|
---|
126 | #endif
|
---|
127 |
|
---|
128 | case VBOXESC_ISVRDPACTIVE:
|
---|
129 | {
|
---|
130 | ULONG ret = 0;
|
---|
131 |
|
---|
132 | #ifndef VBOX_WITH_HGSMI
|
---|
133 | if (ppdev && ppdev->pInfo && vboxHwBufferBeginUpdate (ppdev))
|
---|
134 | {
|
---|
135 | if (ppdev->vbva.pVbvaMemory->fu32ModeFlags
|
---|
136 | & VBVA_F_MODE_VRDP)
|
---|
137 | {
|
---|
138 | ret = 1;
|
---|
139 | }
|
---|
140 | DISPDBG((0, "VBOXESC_ISVRDPACTIVE -> %d (%x)\n", ret, ppdev->vbva.pVbvaMemory->fu32ModeFlags));
|
---|
141 | vboxHwBufferEndUpdate (ppdev);
|
---|
142 | }
|
---|
143 | else
|
---|
144 | DISPDBG((0, "VBOXESC_ISVRDPACTIVE -> 0\n"));
|
---|
145 | #else
|
---|
146 | if (ppdev && ppdev->pVBVA)
|
---|
147 | {
|
---|
148 | if (ppdev->pVBVA->u32HostEvents & VBVA_F_MODE_VRDP)
|
---|
149 | {
|
---|
150 | ret = 1;
|
---|
151 | }
|
---|
152 | DISPDBG((0, "VBOXESC_ISVRDPACTIVE -> %d (%x)\n", ret, ppdev->pVBVA->u32HostEvents));
|
---|
153 | }
|
---|
154 | else
|
---|
155 | DISPDBG((0, "VBOXESC_ISVRDPACTIVE -> 0\n"));
|
---|
156 | #endif /* VBOX_WITH_HGSMI */
|
---|
157 | return ret;
|
---|
158 | }
|
---|
159 |
|
---|
160 | case VBOXESC_SETVISIBLEREGION:
|
---|
161 | {
|
---|
162 | LPRGNDATA lpRgnData = (LPRGNDATA)pvIn;
|
---|
163 |
|
---|
164 | DISPDBG((0, "VBOXESC_SETVISIBLEREGION\n"));
|
---|
165 |
|
---|
166 | if ( cjIn >= sizeof(RGNDATAHEADER)
|
---|
167 | && pvIn
|
---|
168 | && lpRgnData->rdh.dwSize == sizeof(RGNDATAHEADER)
|
---|
169 | && lpRgnData->rdh.iType == RDH_RECTANGLES
|
---|
170 | && cjIn == lpRgnData->rdh.nCount * sizeof(RECT) + sizeof(RGNDATAHEADER))
|
---|
171 | {
|
---|
172 | DWORD ulReturn, i;
|
---|
173 | PRTRECT pRTRect;
|
---|
174 | RECT *pRect = (RECT *)&lpRgnData->Buffer;
|
---|
175 |
|
---|
176 | pRTRect = (PRTRECT) EngAllocMem(0, lpRgnData->rdh.nCount*sizeof(RTRECT), ALLOC_TAG);
|
---|
177 | for (i=0;i<lpRgnData->rdh.nCount;i++)
|
---|
178 | {
|
---|
179 | DISPDBG((0, "New visible rectangle (%d,%d) (%d,%d)\n", pRect[i].left, pRect[i].bottom, pRect[i].right, pRect[i].top));
|
---|
180 | pRTRect[i].xLeft = pRect[i].left;
|
---|
181 | pRTRect[i].yBottom = pRect[i].bottom;
|
---|
182 | pRTRect[i].xRight = pRect[i].right;
|
---|
183 | pRTRect[i].yTop = pRect[i].top;
|
---|
184 | }
|
---|
185 |
|
---|
186 | if (EngDeviceIoControl(ppdev->hDriver,
|
---|
187 | IOCTL_VIDEO_VBOX_SETVISIBLEREGION,
|
---|
188 | pRTRect,
|
---|
189 | lpRgnData->rdh.nCount*sizeof(RTRECT),
|
---|
190 | NULL,
|
---|
191 | 0,
|
---|
192 | &ulReturn))
|
---|
193 | {
|
---|
194 | DISPDBG((0, "DISP DrvAssertMode failed IOCTL_VIDEO_VBOX_SETVISIBLEREGION\n"));
|
---|
195 | return 0;
|
---|
196 | }
|
---|
197 | else
|
---|
198 | {
|
---|
199 | DISPDBG((0, "DISP IOCTL_VIDEO_VBOX_SETVISIBLEREGION successful\n"));
|
---|
200 | return 1;
|
---|
201 | }
|
---|
202 |
|
---|
203 | }
|
---|
204 | else
|
---|
205 | {
|
---|
206 | if (pvIn)
|
---|
207 | DISPDBG((0, "check failed rdh.dwSize=%x iType=%d size=%d expected size=%d\n", lpRgnData->rdh.dwSize, lpRgnData->rdh.iType, cjIn, lpRgnData->rdh.nCount * sizeof(RECT) + sizeof(RGNDATAHEADER)));
|
---|
208 | }
|
---|
209 |
|
---|
210 | break;
|
---|
211 | }
|
---|
212 |
|
---|
213 | case QUERYESCSUPPORT:
|
---|
214 | if ( cjIn == sizeof(DWORD)
|
---|
215 | && pvIn)
|
---|
216 | {
|
---|
217 | DWORD nEscapeQuery = *(DWORD *)pvIn;
|
---|
218 |
|
---|
219 | switch(nEscapeQuery)
|
---|
220 | {
|
---|
221 | #ifdef VBOX_WITH_OPENGL
|
---|
222 | case OPENGL_GETINFO:
|
---|
223 | return 1;
|
---|
224 | #endif
|
---|
225 | default:
|
---|
226 | DISPDBG((0, "QUERYESCSUPPORT %d unsupported\n", nEscapeQuery));
|
---|
227 | break;
|
---|
228 | }
|
---|
229 | }
|
---|
230 | else
|
---|
231 | DISPDBG((0, "QUERYESCSUPPORT invalid size %d\n", cjOut));
|
---|
232 | break;
|
---|
233 |
|
---|
234 | default:
|
---|
235 | DISPDBG((0, "Unsupported Escape %d\n", iEsc));
|
---|
236 | break;
|
---|
237 | }
|
---|
238 | return 0;
|
---|
239 | }
|
---|
240 |
|
---|
241 | BOOL DrvConnect (PVOID x1, PVOID x2, PVOID x3, PVOID x4)
|
---|
242 | {
|
---|
243 | DISPDBG((0, "Experimental %s: %p, %p, %p, %p\n", __FUNCTION__, x1, x2, x3, x4));
|
---|
244 | return TRUE;
|
---|
245 | }
|
---|
246 |
|
---|
247 | BOOL DrvDisconnect (PVOID x1, PVOID x2)
|
---|
248 | {
|
---|
249 | DISPDBG((0, "Experimental %s: %p, %p\n", __FUNCTION__, x1, x2));
|
---|
250 | return FALSE;
|
---|
251 | }
|
---|
252 |
|
---|
253 | BOOL DrvReconnect (PVOID x1, PVOID x2)
|
---|
254 | {
|
---|
255 | DISPDBG((0, "Experimental %s: %p, %p\n", __FUNCTION__, x1, x2));
|
---|
256 | return FALSE;
|
---|
257 | }
|
---|
258 |
|
---|
259 | BOOL DrvShadowConnect (PVOID x1, PVOID x2)
|
---|
260 | {
|
---|
261 | DISPDBG((0, "Experimental %s: %p, %p\n", __FUNCTION__, x1, x2));
|
---|
262 | return FALSE;
|
---|
263 | }
|
---|
264 |
|
---|
265 | BOOL DrvShadowDisconnect (PVOID x1, PVOID x2)
|
---|
266 | {
|
---|
267 | DISPDBG((0, "Experimental %s: %p, %p\n", __FUNCTION__, x1, x2));
|
---|
268 | return FALSE;
|
---|
269 | }
|
---|
270 |
|
---|
271 |
|
---|
272 | /* Experimental end */
|
---|
273 |
|
---|
274 | // W2K,XP functions
|
---|
275 | DRVFN gadrvfn_nt5[] = {
|
---|
276 | { INDEX_DrvEnablePDEV, (PFN) DrvEnablePDEV }, // 0 0x0
|
---|
277 | { INDEX_DrvCompletePDEV, (PFN) DrvCompletePDEV }, // 1 0x1
|
---|
278 | { INDEX_DrvDisablePDEV, (PFN) DrvDisablePDEV }, // 2 0x2
|
---|
279 | { INDEX_DrvEnableSurface, (PFN) DrvEnableSurface }, // 3 0x3
|
---|
280 | { INDEX_DrvDisableSurface, (PFN) DrvDisableSurface }, // 4 0x4
|
---|
281 | { INDEX_DrvAssertMode, (PFN) DrvAssertMode }, // 5 0x5
|
---|
282 | { INDEX_DrvDisableDriver, (PFN) DrvDisableDriver }, // 8 0x8
|
---|
283 | // { INDEX_DrvCreateDeviceBitmap, (PFN) DrvCreateDeviceBitmap }, // 10
|
---|
284 | // { INDEX_DrvDeleteDeviceBitmap, (PFN) DrvDeleteDeviceBitmap }, // 11
|
---|
285 | { INDEX_DrvRealizeBrush, (PFN) DrvRealizeBrush }, // 12 0xc
|
---|
286 | { INDEX_DrvDitherColor, (PFN) DrvDitherColor }, // 13 0xd
|
---|
287 | { INDEX_DrvStrokePath, (PFN) DrvStrokePath }, // 14 0xe
|
---|
288 | { INDEX_DrvFillPath, (PFN) DrvFillPath }, // 15 0xf
|
---|
289 | // { INDEX_DrvStrokeAndFillPath, (PFN) DrvStrokeAndFillPath }, // 16 0x10
|
---|
290 | { INDEX_DrvPaint, (PFN) DrvPaint }, // 17 0x11
|
---|
291 | { INDEX_DrvBitBlt, (PFN) DrvBitBlt }, // 18 0x12
|
---|
292 | { INDEX_DrvCopyBits, (PFN) DrvCopyBits }, // 19 0x13
|
---|
293 | { INDEX_DrvStretchBlt, (PFN) DrvStretchBlt, }, // 20 0x14
|
---|
294 | { INDEX_DrvSetPalette, (PFN) DrvSetPalette }, // 22 0x16
|
---|
295 | { INDEX_DrvTextOut, (PFN) DrvTextOut }, // 23 0x17
|
---|
296 | { INDEX_DrvEscape, (PFN) DrvEscape }, // 24 0x18
|
---|
297 | { INDEX_DrvSetPointerShape, (PFN) DrvSetPointerShape }, // 29 0x1d
|
---|
298 | { INDEX_DrvMovePointer, (PFN) DrvMovePointer }, // 30 0x1e
|
---|
299 | { INDEX_DrvLineTo, (PFN) DrvLineTo }, // 31 0x1f
|
---|
300 | { INDEX_DrvSynchronize, (PFN) DrvSynchronize }, // 38 0x26
|
---|
301 | { INDEX_DrvSaveScreenBits, (PFN) DrvSaveScreenBits }, // 40 0x28
|
---|
302 | { INDEX_DrvGetModes, (PFN) DrvGetModes }, // 41 0x29
|
---|
303 | #ifdef VBOX_WITH_DDRAW
|
---|
304 | { INDEX_DrvGetDirectDrawInfo, (PFN) DrvGetDirectDrawInfo }, // 59 0x3b
|
---|
305 | { INDEX_DrvEnableDirectDraw, (PFN) DrvEnableDirectDraw }, // 60 0x3c
|
---|
306 | { INDEX_DrvDisableDirectDraw, (PFN) DrvDisableDirectDraw }, // 61 0x3d
|
---|
307 | { INDEX_DrvDeriveSurface, (PFN) DrvDeriveSurface }, // 85 0x55
|
---|
308 | #endif
|
---|
309 | { INDEX_DrvNotify, (PFN) DrvNotify }, // 87 0x57
|
---|
310 | // /* Experimental. */
|
---|
311 | // { 0x7, (PFN) DrvResetPDEV }, // 0x7
|
---|
312 | // { 0x5b, (PFN) DrvNineGrid }, // 0x5b
|
---|
313 | // { 0x2b, (PFN) DrvDestroyFont }, // 0x2b
|
---|
314 | // { 0x18, (PFN) DrvEscape }, // 0x18
|
---|
315 | // { 0x4d, (PFN) DrvConnect }, // 0x4d
|
---|
316 | // { 0x4e, (PFN) DrvDisconnect }, // 0x4e
|
---|
317 | // { 0x4f, (PFN) DrvReconnect }, // 0x4f
|
---|
318 | // { 0x50, (PFN) DrvShadowConnect }, // 0x50
|
---|
319 | // { 0x51, (PFN) DrvShadowDisconnect }, // 0x51
|
---|
320 |
|
---|
321 | };
|
---|
322 |
|
---|
323 | // Required hook bits will be set up according to DDI version
|
---|
324 | static ULONG gflHooks = 0;
|
---|
325 | BOOL g_bOnNT40 = TRUE; /* assume NT4 guest by default */
|
---|
326 |
|
---|
327 | #define HOOKS_BMF8BPP gflHooks
|
---|
328 | #define HOOKS_BMF16BPP gflHooks
|
---|
329 | #define HOOKS_BMF24BPP gflHooks
|
---|
330 | #define HOOKS_BMF32BPP gflHooks
|
---|
331 |
|
---|
332 | #ifndef VBOX_WITH_HGSMI
|
---|
333 | HSEMAPHORE ghsemHwBuffer = 0;
|
---|
334 | #endif /* !VBOX_WITH_HGSMI */
|
---|
335 |
|
---|
336 | /******************************Public*Routine******************************\
|
---|
337 | * DrvEnableDriver
|
---|
338 | *
|
---|
339 | * Enables the driver by retrieving the drivers function table and version.
|
---|
340 | *
|
---|
341 | \**************************************************************************/
|
---|
342 |
|
---|
343 | BOOL DrvEnableDriver(ULONG iEngineVersion, ULONG cj, PDRVENABLEDATA pded)
|
---|
344 | {
|
---|
345 | // Engine Version is passed down so future drivers can support previous
|
---|
346 | // engine versions. A next generation driver can support both the old
|
---|
347 | // and new engine conventions if told what version of engine it is
|
---|
348 | // working with. For the first version the driver does nothing with it.
|
---|
349 |
|
---|
350 | DISPDBG((0, "VBoxDisp::DrvEnableDriver called. iEngine version = %08X\n", iEngineVersion));
|
---|
351 |
|
---|
352 | // Set up hook flags to intercept all functions which can generate VRDP orders
|
---|
353 | gflHooks = HOOK_BITBLT | HOOK_TEXTOUT | HOOK_FILLPATH |
|
---|
354 | HOOK_COPYBITS | HOOK_STROKEPATH | HOOK_LINETO | /* HOOK_STROKEANDFILLPATH | */
|
---|
355 | #ifdef VBOX_NEW_SURFACE_CODE
|
---|
356 | HOOK_PAINT | HOOK_STRETCHBLT | HOOK_SYNCHRONIZE;
|
---|
357 | #else
|
---|
358 | HOOK_PAINT | HOOK_STRETCHBLT | HOOK_SYNCHRONIZEACCESS;
|
---|
359 | #endif
|
---|
360 | // Set up g_bOnNT40 based on the value in iEngineVersion
|
---|
361 | if(iEngineVersion >= DDI_DRIVER_VERSION_NT5)
|
---|
362 | g_bOnNT40 = FALSE;
|
---|
363 |
|
---|
364 | // Fill in as much as we can.
|
---|
365 |
|
---|
366 | if (cj >= sizeof(DRVENABLEDATA))
|
---|
367 | pded->pdrvfn = (iEngineVersion >= DDI_DRIVER_VERSION_NT5)?
|
---|
368 | gadrvfn_nt5:
|
---|
369 | gadrvfn_nt4;
|
---|
370 |
|
---|
371 |
|
---|
372 | if (cj >= (sizeof(ULONG) * 2))
|
---|
373 | pded->c = (iEngineVersion >= DDI_DRIVER_VERSION_NT5)?
|
---|
374 | sizeof(gadrvfn_nt5) / sizeof(DRVFN):
|
---|
375 | sizeof(gadrvfn_nt4) / sizeof(DRVFN);
|
---|
376 |
|
---|
377 | // DDI version this driver was targeted for is passed back to engine.
|
---|
378 | // Future graphic's engine may break calls down to old driver format.
|
---|
379 |
|
---|
380 | if (cj >= sizeof(ULONG))
|
---|
381 | pded->iDriverVersion = (iEngineVersion >= DDI_DRIVER_VERSION_NT5)?
|
---|
382 | DDI_DRIVER_VERSION_NT5:
|
---|
383 | DDI_DRIVER_VERSION_NT4;
|
---|
384 |
|
---|
385 | #ifndef VBOX_WITH_HGSMI
|
---|
386 | if (!ghsemHwBuffer)
|
---|
387 | {
|
---|
388 | ghsemHwBuffer = EngCreateSemaphore ();
|
---|
389 | }
|
---|
390 | #endif /* !VBOX_WITH_HGSMI */
|
---|
391 |
|
---|
392 | return(TRUE);
|
---|
393 | }
|
---|
394 |
|
---|
395 | /******************************Public*Routine******************************\
|
---|
396 | * DrvDisableDriver
|
---|
397 | *
|
---|
398 | * Tells the driver it is being disabled. Release any resources allocated in
|
---|
399 | * DrvEnableDriver.
|
---|
400 | *
|
---|
401 | \**************************************************************************/
|
---|
402 |
|
---|
403 | VOID DrvDisableDriver(VOID)
|
---|
404 | {
|
---|
405 | DISPDBG((0, "VBoxDisp::DrvDisableDriver called.\n"));
|
---|
406 |
|
---|
407 | #ifndef VBOX_WITH_HGSMI
|
---|
408 | if (ghsemHwBuffer)
|
---|
409 | {
|
---|
410 | EngDeleteSemaphore (ghsemHwBuffer);
|
---|
411 | ghsemHwBuffer = NULL;
|
---|
412 | }
|
---|
413 | #endif /* !VBOX_WITH_HGSMI */
|
---|
414 |
|
---|
415 | return;
|
---|
416 | }
|
---|
417 |
|
---|
418 | /******************************Public*Routine******************************\
|
---|
419 | * DrvEnablePDEV
|
---|
420 | *
|
---|
421 | * DDI function, Enables the Physical Device.
|
---|
422 | *
|
---|
423 | * Return Value: device handle to pdev.
|
---|
424 | *
|
---|
425 | \**************************************************************************/
|
---|
426 |
|
---|
427 | DHPDEV DrvEnablePDEV(
|
---|
428 | DEVMODEW *pDevmode, // Pointer to DEVMODE
|
---|
429 | PWSTR pwszLogAddress, // Logical address
|
---|
430 | ULONG cPatterns, // number of patterns
|
---|
431 | HSURF *ahsurfPatterns, // return standard patterns
|
---|
432 | ULONG cjGdiInfo, // Length of memory pointed to by pGdiInfo
|
---|
433 | ULONG *pGdiInfo, // Pointer to GdiInfo structure
|
---|
434 | ULONG cjDevInfo, // Length of following PDEVINFO structure
|
---|
435 | DEVINFO *pDevInfo, // physical device information structure
|
---|
436 | HDEV hdev, // HDEV, used for callbacks
|
---|
437 | PWSTR pwszDeviceName, // DeviceName - not used
|
---|
438 | HANDLE hDriver) // Handle to base driver
|
---|
439 | {
|
---|
440 | GDIINFO GdiInfo;
|
---|
441 | DEVINFO DevInfo;
|
---|
442 | PPDEV ppdev = (PPDEV) NULL;
|
---|
443 |
|
---|
444 | DISPDBG((0, "VBoxDisp::DrvEnablePDEV called\n"));
|
---|
445 |
|
---|
446 | UNREFERENCED_PARAMETER(pwszLogAddress);
|
---|
447 | UNREFERENCED_PARAMETER(pwszDeviceName);
|
---|
448 |
|
---|
449 | RtlZeroMemory(&DevInfo, sizeof (DEVINFO));
|
---|
450 | RtlZeroMemory(&GdiInfo, sizeof (GDIINFO));
|
---|
451 |
|
---|
452 | // Allocate a physical device structure.
|
---|
453 |
|
---|
454 | ppdev = (PPDEV) EngAllocMem(0, sizeof(PDEV), ALLOC_TAG);
|
---|
455 |
|
---|
456 | if (ppdev == (PPDEV) NULL)
|
---|
457 | {
|
---|
458 | DISPDBG((0, "DISP DrvEnablePDEV failed EngAllocMem\n"));
|
---|
459 | return((DHPDEV) 0);
|
---|
460 | }
|
---|
461 |
|
---|
462 | memset(ppdev, 0, sizeof(PDEV));
|
---|
463 |
|
---|
464 | // Save the screen handle in the PDEV.
|
---|
465 |
|
---|
466 | ppdev->hDriver = hDriver;
|
---|
467 |
|
---|
468 | // Get the current screen mode information. Set up device caps and devinfo.
|
---|
469 |
|
---|
470 | if (!bInitPDEV(ppdev, pDevmode, &GdiInfo, &DevInfo))
|
---|
471 | {
|
---|
472 | DISPDBG((0,"DISP DrvEnablePDEV failed\n"));
|
---|
473 | goto error_free;
|
---|
474 | }
|
---|
475 |
|
---|
476 | // Initialize the cursor information.
|
---|
477 |
|
---|
478 | if (!bInitPointer(ppdev, &DevInfo))
|
---|
479 | {
|
---|
480 | // Not a fatal error...
|
---|
481 | DISPDBG((0, "DrvEnablePDEV failed bInitPointer\n"));
|
---|
482 | }
|
---|
483 |
|
---|
484 | // Initialize palette information.
|
---|
485 |
|
---|
486 | if (!bInitPaletteInfo(ppdev, &DevInfo))
|
---|
487 | {
|
---|
488 | DISPDBG((0, "DrvEnablePDEV failed bInitPalette\n"));
|
---|
489 | goto error_free;
|
---|
490 | }
|
---|
491 |
|
---|
492 | // // Start a thread that will process notifications from VMMDev
|
---|
493 | // if (!bInitNotificationThread(ppdev))
|
---|
494 | // {
|
---|
495 | // DISPDBG((0, "DrvEnablePDEV failed bInitNotificationThread\n"));
|
---|
496 | // goto error_free;
|
---|
497 | // }
|
---|
498 |
|
---|
499 | // Copy the devinfo into the engine buffer.
|
---|
500 |
|
---|
501 | DISPDBG((0, "VBoxDisp::DrvEnablePDEV: sizeof(DEVINFO) = %d, cjDevInfo = %d, alpha = %d\n", sizeof(DEVINFO), cjDevInfo, DevInfo.flGraphicsCaps2 & GCAPS2_ALPHACURSOR));
|
---|
502 |
|
---|
503 | // @todo seems to be not necessary. these bits are initialized in screen.c DevInfo.flGraphicsCaps |= GCAPS_OPAQUERECT |
|
---|
504 | // GCAPS_DITHERONREALIZE |
|
---|
505 | // GCAPS_PALMANAGED |
|
---|
506 | // GCAPS_ALTERNATEFILL |
|
---|
507 | // GCAPS_WINDINGFILL |
|
---|
508 | // GCAPS_MONO_DITHER |
|
---|
509 | // GCAPS_COLOR_DITHER |
|
---|
510 | // GCAPS_ASYNCMOVE;
|
---|
511 | //
|
---|
512 | // DevInfo.flGraphicsCaps |= GCAPS_DITHERONREALIZE;
|
---|
513 |
|
---|
514 | DevInfo.flGraphicsCaps2 |= GCAPS2_RESERVED1; /* @todo figure out what is this. */
|
---|
515 |
|
---|
516 | memcpy(pDevInfo, &DevInfo, min(sizeof(DEVINFO), cjDevInfo));
|
---|
517 |
|
---|
518 | // Set the pdevCaps with GdiInfo we have prepared to the list of caps for this
|
---|
519 | // pdev.
|
---|
520 |
|
---|
521 | memcpy(pGdiInfo, &GdiInfo, min(cjGdiInfo, sizeof(GDIINFO)));
|
---|
522 |
|
---|
523 | DISPDBG((0, "VBoxDisp::DrvEnablePDEV completed %x\n", ppdev));
|
---|
524 |
|
---|
525 | return((DHPDEV) ppdev);
|
---|
526 |
|
---|
527 | // Error case for failure.
|
---|
528 | error_free:
|
---|
529 | EngFreeMem(ppdev);
|
---|
530 | return((DHPDEV) 0);
|
---|
531 | }
|
---|
532 |
|
---|
533 | /******************************Public*Routine******************************\
|
---|
534 | * DrvCompletePDEV
|
---|
535 | *
|
---|
536 | * Store the HPDEV, the engines handle for this PDEV, in the DHPDEV.
|
---|
537 | *
|
---|
538 | \**************************************************************************/
|
---|
539 |
|
---|
540 | VOID DrvCompletePDEV(DHPDEV dhpdev, HDEV hdev)
|
---|
541 | {
|
---|
542 | DISPDBG((0, "VBoxDisp::DrvCompletePDEV called %x\n", dhpdev));
|
---|
543 | ((PPDEV) dhpdev)->hdevEng = hdev;
|
---|
544 | }
|
---|
545 |
|
---|
546 | /******************************Public*Routine******************************\
|
---|
547 | * DrvDisablePDEV
|
---|
548 | *
|
---|
549 | * Release the resources allocated in DrvEnablePDEV. If a surface has been
|
---|
550 | * enabled DrvDisableSurface will have already been called.
|
---|
551 | *
|
---|
552 | \**************************************************************************/
|
---|
553 |
|
---|
554 | VOID DrvDisablePDEV(DHPDEV dhpdev)
|
---|
555 | {
|
---|
556 | DISPDBG((0, "VBoxDisp::DrvDisablePDEV called %x\n", dhpdev));
|
---|
557 | // vStopNotificationThread ((PPDEV) dhpdev);
|
---|
558 | vDisablePalette((PPDEV) dhpdev);
|
---|
559 |
|
---|
560 | EngFreeMem(dhpdev);
|
---|
561 | }
|
---|
562 |
|
---|
563 | /******************************Public*Routine******************************\
|
---|
564 | * VOID DrvOffset
|
---|
565 | *
|
---|
566 | * DescriptionText
|
---|
567 | *
|
---|
568 | \**************************************************************************/
|
---|
569 |
|
---|
570 | BOOL DrvOffset(SURFOBJ *pso, LONG x, LONG y, FLONG flReserved)
|
---|
571 | {
|
---|
572 | PDEV* ppdev = (PDEV*) pso->dhpdev;
|
---|
573 |
|
---|
574 | DISPDBG((0, "VBoxDisp::DrvOffset %x %x %x\n", x, y, flReserved));
|
---|
575 |
|
---|
576 | // Add back last offset that we subtracted. I could combine the next
|
---|
577 | // two statements, but I thought this was more clear. It's not
|
---|
578 | // performance critical anyway.
|
---|
579 |
|
---|
580 | ppdev->pjScreen += ((ppdev->ptlOrg.y * ppdev->lDeltaScreen) +
|
---|
581 | (ppdev->ptlOrg.x * ((ppdev->ulBitCount+1) >> 3)));
|
---|
582 |
|
---|
583 | // Subtract out new offset
|
---|
584 |
|
---|
585 | ppdev->pjScreen -= ((y * ppdev->lDeltaScreen) +
|
---|
586 | (x * ((ppdev->ulBitCount+1) >> 3)));
|
---|
587 |
|
---|
588 | ppdev->ptlOrg.x = x;
|
---|
589 | ppdev->ptlOrg.y = y;
|
---|
590 |
|
---|
591 | return(TRUE);
|
---|
592 | }
|
---|
593 |
|
---|
594 | /******************************Public*Routine******************************\
|
---|
595 | * DrvEnableSurface
|
---|
596 | *
|
---|
597 | * Enable the surface for the device. Hook the calls this driver supports.
|
---|
598 | *
|
---|
599 | * Return: Handle to the surface if successful, 0 for failure.
|
---|
600 | *
|
---|
601 | \**************************************************************************/
|
---|
602 |
|
---|
603 | HSURF DrvEnableSurface(DHPDEV dhpdev)
|
---|
604 | {
|
---|
605 | PPDEV ppdev;
|
---|
606 | HSURF hsurf;
|
---|
607 | SIZEL sizl;
|
---|
608 | ULONG ulBitmapType;
|
---|
609 | FLONG flHooks;
|
---|
610 | #ifdef VBOX_NEW_SURFACE_CODE
|
---|
611 | PVBOXSURF psurf;
|
---|
612 | #endif
|
---|
613 | DISPDBG((0, "DISP DrvEnableSurface called\n"));
|
---|
614 |
|
---|
615 | // Create engine bitmap around frame buffer.
|
---|
616 |
|
---|
617 | ppdev = (PPDEV) dhpdev;
|
---|
618 |
|
---|
619 | ppdev->ptlOrg.x = 0;
|
---|
620 | ppdev->ptlOrg.y = 0;
|
---|
621 |
|
---|
622 | if (!bInitSURF(ppdev, TRUE))
|
---|
623 | {
|
---|
624 | DISPDBG((0, "DISP DrvEnableSurface failed bInitSURF\n"));
|
---|
625 | return(FALSE);
|
---|
626 | }
|
---|
627 |
|
---|
628 | DISPDBG((0, "DISP DrvEnableSurface bInitSURF success\n"));
|
---|
629 |
|
---|
630 | sizl.cx = ppdev->cxScreen;
|
---|
631 | sizl.cy = ppdev->cyScreen;
|
---|
632 |
|
---|
633 | if (ppdev->ulBitCount == 8)
|
---|
634 | {
|
---|
635 | if (!bInit256ColorPalette(ppdev)) {
|
---|
636 | DISPDBG((0, "DISP DrvEnableSurface failed to init the 8bpp palette\n"));
|
---|
637 | return(FALSE);
|
---|
638 | }
|
---|
639 | ulBitmapType = BMF_8BPP;
|
---|
640 | flHooks = HOOKS_BMF8BPP;
|
---|
641 | }
|
---|
642 | else if (ppdev->ulBitCount == 16)
|
---|
643 | {
|
---|
644 | ulBitmapType = BMF_16BPP;
|
---|
645 | flHooks = HOOKS_BMF16BPP;
|
---|
646 | }
|
---|
647 | else if (ppdev->ulBitCount == 24)
|
---|
648 | {
|
---|
649 | ulBitmapType = BMF_24BPP;
|
---|
650 | flHooks = HOOKS_BMF24BPP;
|
---|
651 | }
|
---|
652 | else
|
---|
653 | {
|
---|
654 | ulBitmapType = BMF_32BPP;
|
---|
655 | flHooks = HOOKS_BMF32BPP;
|
---|
656 | }
|
---|
657 |
|
---|
658 | #ifdef VBOX_NEW_SURFACE_CODE
|
---|
659 | psurf = (PVBOXSURF)EngAllocMem(0, sizeof(VBOXSURF), ALLOC_TAG);
|
---|
660 | if (psurf == NULL)
|
---|
661 | {
|
---|
662 | DISPDBG((0, "DrvEnableSurface: failed pdsurf memory allocation\n"));
|
---|
663 | goto l_Failure;
|
---|
664 | }
|
---|
665 | ppdev->pdsurfScreen = psurf;
|
---|
666 | psurf->ppdev = ppdev;
|
---|
667 |
|
---|
668 | //
|
---|
669 | // On NT4.0 we create a GDI managed bitmap as the primay surface. But
|
---|
670 | // on NT5.0 we create a device managed primary.
|
---|
671 | //
|
---|
672 | // On NT4.0 we still use our driver's accleration capabilities by
|
---|
673 | // doing a trick with EngLockSurface on the GDI managed primary.
|
---|
674 | //
|
---|
675 |
|
---|
676 | if(g_bOnNT40)
|
---|
677 | {
|
---|
678 | hsurf = (HSURF) EngCreateBitmap(sizl,
|
---|
679 | ppdev->lDeltaScreen,
|
---|
680 | ulBitmapType,
|
---|
681 | (ppdev->lDeltaScreen > 0) ? BMF_TOPDOWN : 0,
|
---|
682 | (PVOID)(ppdev->pjScreen));
|
---|
683 | }
|
---|
684 | else
|
---|
685 | {
|
---|
686 | hsurf = (HSURF)EngCreateDeviceSurface((DHSURF)psurf, sizl,
|
---|
687 | ulBitmapType);
|
---|
688 | }
|
---|
689 |
|
---|
690 | if ( hsurf == 0 )
|
---|
691 | {
|
---|
692 | DISPDBG((0, "DrvEnableSurface: failed EngCreateDeviceBitmap\n"));
|
---|
693 | goto l_Failure;
|
---|
694 | }
|
---|
695 |
|
---|
696 | //
|
---|
697 | // On NT5.0 we call EngModifSurface to expose our device surface to
|
---|
698 | // GDI. We cant do this on NT4.0 hence we call EngAssociateSurface.
|
---|
699 | //
|
---|
700 |
|
---|
701 | if(g_bOnNT40)
|
---|
702 | {
|
---|
703 | //
|
---|
704 | // We have to associate the surface we just created with our physical
|
---|
705 | // device so that GDI can get information related to the PDEV when
|
---|
706 | // it's drawing to the surface (such as, for example, the length of
|
---|
707 | // styles on the device when simulating styled lines).
|
---|
708 | //
|
---|
709 |
|
---|
710 | //
|
---|
711 | // On NT4.0 we dont want to be called to Synchronize Access
|
---|
712 | //
|
---|
713 | LONG myflHooks = flHooks;
|
---|
714 | myflHooks &= ~HOOK_SYNCHRONIZE;
|
---|
715 |
|
---|
716 | if (!EngAssociateSurface(hsurf, ppdev->hdevEng, myflHooks))
|
---|
717 | {
|
---|
718 | DISPDBG((0, "DrvEnableSurface: failed EngAssociateSurface\n"));
|
---|
719 | goto l_Failure;
|
---|
720 | }
|
---|
721 |
|
---|
722 | //
|
---|
723 | // Jam in the value of dhsurf into screen SURFOBJ. We do this to
|
---|
724 | // make sure the driver acclerates Drv calls we hook and not
|
---|
725 | // punt them back to GDI as the SURFOBJ's dhsurf = 0.
|
---|
726 | //
|
---|
727 | ppdev->psoScreenBitmap = EngLockSurface(hsurf);
|
---|
728 | if(ppdev->psoScreenBitmap == 0)
|
---|
729 | {
|
---|
730 | DISPDBG((0, "DrvEnableSurface: failed EngLockSurface\n"));
|
---|
731 | goto l_Failure;
|
---|
732 | }
|
---|
733 |
|
---|
734 | ppdev->psoScreenBitmap->dhsurf = (DHSURF)hsurf;
|
---|
735 |
|
---|
736 | }
|
---|
737 | else
|
---|
738 | {
|
---|
739 | //
|
---|
740 | // Tell GDI about the screen surface. This will enable GDI to render
|
---|
741 | // directly to the screen.
|
---|
742 | //
|
---|
743 |
|
---|
744 | if ( !EngModifySurface(hsurf,
|
---|
745 | ppdev->hdevEng,
|
---|
746 | flHooks,
|
---|
747 | MS_NOTSYSTEMMEMORY,
|
---|
748 | (DHSURF)psurf,
|
---|
749 | ppdev->pjScreen,
|
---|
750 | ppdev->lDeltaScreen,
|
---|
751 | NULL))
|
---|
752 | {
|
---|
753 | DISPDBG((0, "DrvEnableSurface: failed EngModifySurface"));
|
---|
754 | goto l_Failure;
|
---|
755 | }
|
---|
756 | }
|
---|
757 | ppdev->hsurfScreen = hsurf;
|
---|
758 | ppdev->flHooks = flHooks;
|
---|
759 | ppdev->ulBitmapType = ulBitmapType;
|
---|
760 | #else
|
---|
761 | hsurf = (HSURF) EngCreateBitmap(sizl,
|
---|
762 | ppdev->lDeltaScreen,
|
---|
763 | ulBitmapType,
|
---|
764 | (ppdev->lDeltaScreen > 0) ? BMF_TOPDOWN : 0,
|
---|
765 | (PVOID) (ppdev->pjScreen));
|
---|
766 |
|
---|
767 | if (hsurf == (HSURF) 0)
|
---|
768 | {
|
---|
769 | DISPDBG((0, "DISP DrvEnableSurface failed EngCreateBitmap\n"));
|
---|
770 | goto l_Failure;
|
---|
771 | }
|
---|
772 | else
|
---|
773 | {
|
---|
774 | ppdev->hsurfScreenBitmap = hsurf;
|
---|
775 |
|
---|
776 | if (!EngAssociateSurface(hsurf, ppdev->hdevEng, 0))
|
---|
777 | {
|
---|
778 | DISPDBG((0, "DISP DrvEnableSurface failed EngAssociateSurface for ScreenBitmap.\n"));
|
---|
779 | goto l_Failure;
|
---|
780 | }
|
---|
781 | else
|
---|
782 | {
|
---|
783 | SURFOBJ *pso = EngLockSurface(hsurf);
|
---|
784 |
|
---|
785 | ppdev->psoScreenBitmap = pso;
|
---|
786 |
|
---|
787 | hsurf = (HSURF) EngCreateDeviceSurface((DHSURF)pso,
|
---|
788 | sizl,
|
---|
789 | ulBitmapType);
|
---|
790 |
|
---|
791 | if (hsurf == (HSURF) 0)
|
---|
792 | {
|
---|
793 | DISPDBG((0, "DISP DrvEnableSurface failed EngCreateDeviceSurface\n"));
|
---|
794 | goto l_Failure;
|
---|
795 | }
|
---|
796 | else
|
---|
797 | {
|
---|
798 | ppdev->hsurfScreen = hsurf;
|
---|
799 | /* Must set dhsurf to make sure GDI doesn't ignore our hooks */
|
---|
800 | ppdev->psoScreenBitmap->dhsurf = (DHSURF)hsurf;
|
---|
801 |
|
---|
802 | if (!EngAssociateSurface(hsurf, ppdev->hdevEng, flHooks))
|
---|
803 | {
|
---|
804 | DISPDBG((0, "DISP DrvEnableSurface failed EngAssociateSurface for Screen.\n"));
|
---|
805 | goto l_Failure;
|
---|
806 | }
|
---|
807 | else
|
---|
808 | {
|
---|
809 | ppdev->flHooks = flHooks;
|
---|
810 | ppdev->ulBitmapType = ulBitmapType;
|
---|
811 | }
|
---|
812 | }
|
---|
813 | }
|
---|
814 | }
|
---|
815 | #endif /* VBOX_NEW_SURFACE_CODE */
|
---|
816 | return ppdev->hsurfScreen;
|
---|
817 |
|
---|
818 | l_Failure:
|
---|
819 |
|
---|
820 | DrvDisableSurface(dhpdev);
|
---|
821 |
|
---|
822 | return((HSURF)0);
|
---|
823 | }
|
---|
824 |
|
---|
825 | /******************************Public*Routine******************************\
|
---|
826 | * DrvDisableSurface
|
---|
827 | *
|
---|
828 | * Free resources allocated by DrvEnableSurface. Release the surface.
|
---|
829 | *
|
---|
830 | \**************************************************************************/
|
---|
831 |
|
---|
832 | VOID DrvDisableSurface(DHPDEV dhpdev)
|
---|
833 | {
|
---|
834 | PPDEV ppdev = (PPDEV)dhpdev;
|
---|
835 |
|
---|
836 | DISPDBG((0, "VBoxDisp::DrvDisableSurface called\n"));
|
---|
837 | if (ppdev->psoScreenBitmap)
|
---|
838 | {
|
---|
839 | EngUnlockSurface (ppdev->psoScreenBitmap);
|
---|
840 | ppdev->psoScreenBitmap = NULL;
|
---|
841 | }
|
---|
842 |
|
---|
843 | if (ppdev->hsurfScreen)
|
---|
844 | {
|
---|
845 | EngDeleteSurface(ppdev->hsurfScreen);
|
---|
846 | ppdev->hsurfScreen = (HSURF)0;
|
---|
847 | }
|
---|
848 | #ifdef VBOX_NEW_SURFACE_CODE
|
---|
849 | if (ppdev->pdsurfScreen)
|
---|
850 | {
|
---|
851 | EngFreeMem(ppdev->pdsurfScreen);
|
---|
852 | ppdev->pdsurfScreen = NULL;
|
---|
853 | }
|
---|
854 | #else
|
---|
855 | if (ppdev->hsurfScreenBitmap)
|
---|
856 | {
|
---|
857 | EngDeleteSurface(ppdev->hsurfScreenBitmap);
|
---|
858 | ppdev->hsurfScreenBitmap = (HSURF)0;
|
---|
859 | }
|
---|
860 | #endif
|
---|
861 |
|
---|
862 | vDisableSURF(ppdev);
|
---|
863 | }
|
---|
864 |
|
---|
865 | /******************************Public*Routine******************************\
|
---|
866 | * DrvAssertMode
|
---|
867 | *
|
---|
868 | * This asks the device to reset itself to the mode of the pdev passed in.
|
---|
869 | *
|
---|
870 | \**************************************************************************/
|
---|
871 |
|
---|
872 | BOOL DrvAssertMode(DHPDEV dhpdev, BOOL bEnable)
|
---|
873 | {
|
---|
874 | PPDEV ppdev = (PPDEV) dhpdev;
|
---|
875 | ULONG ulReturn;
|
---|
876 | PBYTE pjScreen;
|
---|
877 |
|
---|
878 | DISPDBG((0, "DISP DrvAssertMode called bEnable = %d\n", bEnable));
|
---|
879 |
|
---|
880 | if (bEnable)
|
---|
881 | {
|
---|
882 | pjScreen = ppdev->pjScreen;
|
---|
883 |
|
---|
884 | if (!bInitSURF(ppdev, FALSE))
|
---|
885 | {
|
---|
886 | DISPDBG((0, "DISP DrvAssertMode failed bInitSURF\n"));
|
---|
887 | return (FALSE);
|
---|
888 | }
|
---|
889 |
|
---|
890 | #ifdef VBOX_NEW_SURFACE_CODE
|
---|
891 | todo
|
---|
892 | #endif
|
---|
893 | if (pjScreen != ppdev->pjScreen)
|
---|
894 | {
|
---|
895 | HSURF hsurf;
|
---|
896 | SIZEL sizl;
|
---|
897 | SURFOBJ *pso;
|
---|
898 |
|
---|
899 | DISPDBG((0, "DISP DrvAssertMode Screen pointer has changed!!!\n"));
|
---|
900 |
|
---|
901 | sizl.cx = ppdev->cxScreen;
|
---|
902 | sizl.cy = ppdev->cyScreen;
|
---|
903 |
|
---|
904 | hsurf = (HSURF) EngCreateBitmap(sizl,
|
---|
905 | ppdev->lDeltaScreen,
|
---|
906 | ppdev->ulBitmapType,
|
---|
907 | (ppdev->lDeltaScreen > 0) ? BMF_TOPDOWN : 0,
|
---|
908 | (PVOID) (ppdev->pjScreen));
|
---|
909 |
|
---|
910 | if (hsurf == (HSURF) 0)
|
---|
911 | {
|
---|
912 | DISPDBG((0, "DISP DrvAssertMode failed EngCreateBitmap\n"));
|
---|
913 | return FALSE;
|
---|
914 | }
|
---|
915 |
|
---|
916 | pso = EngLockSurface(hsurf);
|
---|
917 |
|
---|
918 | if (ppdev->psoScreenBitmap)
|
---|
919 | {
|
---|
920 | EngUnlockSurface (ppdev->psoScreenBitmap);
|
---|
921 | ppdev->psoScreenBitmap = NULL;
|
---|
922 | }
|
---|
923 |
|
---|
924 | if (ppdev->hsurfScreenBitmap)
|
---|
925 | {
|
---|
926 | EngDeleteSurface(ppdev->hsurfScreenBitmap);
|
---|
927 | ppdev->hsurfScreenBitmap = (HSURF)0;
|
---|
928 | }
|
---|
929 |
|
---|
930 | ppdev->hsurfScreenBitmap = hsurf;
|
---|
931 | ppdev->psoScreenBitmap = pso;
|
---|
932 | }
|
---|
933 |
|
---|
934 | if (!EngAssociateSurface(ppdev->hsurfScreenBitmap, ppdev->hdevEng, 0))
|
---|
935 | {
|
---|
936 | DISPDBG((0, "DISP DrvAssertMode failed EngAssociateSurface for ScreenBitmap.\n"));
|
---|
937 | return FALSE;
|
---|
938 | }
|
---|
939 |
|
---|
940 | if (!EngAssociateSurface(ppdev->hsurfScreen, ppdev->hdevEng, ppdev->flHooks))
|
---|
941 | {
|
---|
942 | DISPDBG((0, "DISP DrvAssertMode failed EngAssociateSurface for Screen.\n"));
|
---|
943 | return FALSE;
|
---|
944 | }
|
---|
945 |
|
---|
946 | return TRUE;
|
---|
947 | }
|
---|
948 | else
|
---|
949 | {
|
---|
950 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
951 | /* tells we can not process host commands any more and ensures we've completed processing of the host VHWA commands */
|
---|
952 | vboxVHWADisable(ppdev);
|
---|
953 | #endif
|
---|
954 |
|
---|
955 | #ifdef VBOX_WITH_HGSMI
|
---|
956 | /* Free the driver's VBVA resources. */
|
---|
957 | vboxVbvaDisable ((PPDEV) dhpdev);
|
---|
958 | #endif
|
---|
959 |
|
---|
960 | //
|
---|
961 | // We must give up the display.
|
---|
962 | // Call the kernel driver to reset the device to a known state.
|
---|
963 | //
|
---|
964 |
|
---|
965 | if (EngDeviceIoControl(ppdev->hDriver,
|
---|
966 | IOCTL_VIDEO_RESET_DEVICE,
|
---|
967 | NULL,
|
---|
968 | 0,
|
---|
969 | NULL,
|
---|
970 | 0,
|
---|
971 | &ulReturn))
|
---|
972 | {
|
---|
973 | DISPDBG((0, "DISP DrvAssertMode failed IOCTL\n"));
|
---|
974 | return FALSE;
|
---|
975 | }
|
---|
976 | else
|
---|
977 | {
|
---|
978 | return TRUE;
|
---|
979 | }
|
---|
980 | }
|
---|
981 | }
|
---|
982 |
|
---|
983 | #if 0
|
---|
984 | /******************************Public*Routine**********************************\
|
---|
985 | * HBITMAP DrvCreateDeviceBitmap
|
---|
986 | *
|
---|
987 | * Function called by GDI to create a device-format-bitmap (DFB). We will
|
---|
988 | * always try to allocate the bitmap in off-screen; if we can't, we simply
|
---|
989 | * fail the call and GDI will create and manage the bitmap itself.
|
---|
990 | *
|
---|
991 | * Note: We do not have to zero the bitmap bits. GDI will automatically
|
---|
992 | * call us via DrvBitBlt to zero the bits (which is a security
|
---|
993 | * consideration).
|
---|
994 | *
|
---|
995 | \******************************************************************************/
|
---|
996 |
|
---|
997 | HBITMAP
|
---|
998 | DrvCreateDeviceBitmap(
|
---|
999 | DHPDEV dhpdev,
|
---|
1000 | SIZEL sizl,
|
---|
1001 | ULONG iFormat)
|
---|
1002 | {
|
---|
1003 | DISPDBG((0, "DISP DrvCreateDeviceBitmap %x (%d,%d) %x\n", dhpdev, sizl.cx, sizl.cy, iFormat));
|
---|
1004 | /* Let GDI manage the bitmap */
|
---|
1005 | return (HBITMAP)0;
|
---|
1006 | }
|
---|
1007 |
|
---|
1008 | /******************************Public*Routine**********************************\
|
---|
1009 | * VOID DrvDeleteDeviceBitmap
|
---|
1010 | *
|
---|
1011 | * Deletes a DFB.
|
---|
1012 | *
|
---|
1013 | \******************************************************************************/
|
---|
1014 |
|
---|
1015 | VOID
|
---|
1016 | DrvDeleteDeviceBitmap(
|
---|
1017 | DHSURF dhsurf)
|
---|
1018 | {
|
---|
1019 | DISPDBG((0, "DISP DrvDeleteDeviceBitmap %x", dhsurf));
|
---|
1020 | }
|
---|
1021 | #endif /* 0 */
|
---|
1022 |
|
---|
1023 | /******************************Public*Routine******************************\
|
---|
1024 | * DrvGetModes
|
---|
1025 | *
|
---|
1026 | * Returns the list of available modes for the device.
|
---|
1027 | *
|
---|
1028 | \**************************************************************************/
|
---|
1029 |
|
---|
1030 | ULONG DrvGetModes(HANDLE hDriver, ULONG cjSize, DEVMODEW *pdm)
|
---|
1031 | {
|
---|
1032 |
|
---|
1033 | DWORD cModes;
|
---|
1034 | DWORD cbOutputSize;
|
---|
1035 | PVIDEO_MODE_INFORMATION pVideoModeInformation, pVideoTemp;
|
---|
1036 | DWORD cOutputModes = cjSize / (sizeof(DEVMODEW) + DRIVER_EXTRA_SIZE);
|
---|
1037 | DWORD cbModeSize;
|
---|
1038 |
|
---|
1039 | DISPDBG((3, "DrvGetModes\n"));
|
---|
1040 |
|
---|
1041 | cModes = getAvailableModes(hDriver,
|
---|
1042 | (PVIDEO_MODE_INFORMATION *) &pVideoModeInformation,
|
---|
1043 | &cbModeSize);
|
---|
1044 |
|
---|
1045 | if (cModes == 0)
|
---|
1046 | {
|
---|
1047 | DISPDBG((0, "DrvGetModes failed to get mode information"));
|
---|
1048 | return 0;
|
---|
1049 | }
|
---|
1050 |
|
---|
1051 | if (pdm == NULL)
|
---|
1052 | {
|
---|
1053 | cbOutputSize = cModes * (sizeof(DEVMODEW) + DRIVER_EXTRA_SIZE);
|
---|
1054 | }
|
---|
1055 | else
|
---|
1056 | {
|
---|
1057 | //
|
---|
1058 | // Now copy the information for the supported modes back into the output
|
---|
1059 | // buffer
|
---|
1060 | //
|
---|
1061 |
|
---|
1062 | cbOutputSize = 0;
|
---|
1063 |
|
---|
1064 | pVideoTemp = pVideoModeInformation;
|
---|
1065 |
|
---|
1066 | do
|
---|
1067 | {
|
---|
1068 | if (pVideoTemp->Length != 0)
|
---|
1069 | {
|
---|
1070 | if (cOutputModes == 0)
|
---|
1071 | {
|
---|
1072 | break;
|
---|
1073 | }
|
---|
1074 |
|
---|
1075 | //
|
---|
1076 | // Zero the entire structure to start off with.
|
---|
1077 | //
|
---|
1078 |
|
---|
1079 | memset(pdm, 0, sizeof(DEVMODEW));
|
---|
1080 |
|
---|
1081 | //
|
---|
1082 | // Set the name of the device to the name of the DLL.
|
---|
1083 | //
|
---|
1084 |
|
---|
1085 | memcpy(pdm->dmDeviceName, DLL_NAME, sizeof(DLL_NAME));
|
---|
1086 |
|
---|
1087 | pdm->dmSpecVersion = DM_SPECVERSION;
|
---|
1088 | pdm->dmDriverVersion = DM_SPECVERSION;
|
---|
1089 | pdm->dmSize = sizeof(DEVMODEW);
|
---|
1090 | pdm->dmDriverExtra = DRIVER_EXTRA_SIZE;
|
---|
1091 |
|
---|
1092 | pdm->dmBitsPerPel = pVideoTemp->NumberOfPlanes *
|
---|
1093 | pVideoTemp->BitsPerPlane;
|
---|
1094 | pdm->dmPelsWidth = pVideoTemp->VisScreenWidth;
|
---|
1095 | pdm->dmPelsHeight = pVideoTemp->VisScreenHeight;
|
---|
1096 | pdm->dmDisplayFrequency = pVideoTemp->Frequency;
|
---|
1097 | pdm->dmDisplayFlags = 0;
|
---|
1098 |
|
---|
1099 | pdm->dmFields = DM_BITSPERPEL |
|
---|
1100 | DM_PELSWIDTH |
|
---|
1101 | DM_PELSHEIGHT |
|
---|
1102 | DM_DISPLAYFREQUENCY |
|
---|
1103 | DM_DISPLAYFLAGS ;
|
---|
1104 |
|
---|
1105 | //
|
---|
1106 | // Go to the next DEVMODE entry in the buffer.
|
---|
1107 | //
|
---|
1108 |
|
---|
1109 | cOutputModes--;
|
---|
1110 |
|
---|
1111 | pdm = (LPDEVMODEW) ( ((ULONG_PTR)pdm) + sizeof(DEVMODEW)
|
---|
1112 | + DRIVER_EXTRA_SIZE);
|
---|
1113 |
|
---|
1114 | cbOutputSize += (sizeof(DEVMODEW) + DRIVER_EXTRA_SIZE);
|
---|
1115 |
|
---|
1116 | }
|
---|
1117 |
|
---|
1118 | pVideoTemp = (PVIDEO_MODE_INFORMATION)
|
---|
1119 | (((PUCHAR)pVideoTemp) + cbModeSize);
|
---|
1120 |
|
---|
1121 | } while (--cModes);
|
---|
1122 | }
|
---|
1123 |
|
---|
1124 | EngFreeMem(pVideoModeInformation);
|
---|
1125 |
|
---|
1126 | return cbOutputSize;
|
---|
1127 |
|
---|
1128 | }
|
---|
1129 |
|
---|
1130 | VOID DrvSynchronize(IN DHPDEV dhpdev,IN RECTL *prcl)
|
---|
1131 | {
|
---|
1132 | DISPDBG((0, "VBoxDisp::DrvSynchronize\n"));
|
---|
1133 | }
|
---|
1134 |
|
---|
1135 | /******************************Public*Routine******************************\
|
---|
1136 | * DrvNotify
|
---|
1137 | *
|
---|
1138 | * Called by GDI to notify us of certain "interesting" events
|
---|
1139 | *
|
---|
1140 | * DN_DEVICE_ORIGIN is used to communicate the X/Y offsets of individual monitors
|
---|
1141 | * when DualView is in effect.
|
---|
1142 | *
|
---|
1143 | \**************************************************************************/
|
---|
1144 |
|
---|
1145 | VOID DrvNotify(
|
---|
1146 | SURFOBJ *pso,
|
---|
1147 | ULONG iType,
|
---|
1148 | PVOID pvData)
|
---|
1149 | {
|
---|
1150 | PDEV* ppdev = (PDEV*) pso->dhpdev;
|
---|
1151 |
|
---|
1152 | DISPDBG((0, "VBoxDisp::DrvNotify called.\n"));
|
---|
1153 |
|
---|
1154 | switch(iType)
|
---|
1155 | {
|
---|
1156 | case DN_DEVICE_ORIGIN:
|
---|
1157 | ppdev->ptlDevOrg = *(PPOINTL)pvData;
|
---|
1158 | #ifndef VBOX_WITH_HGSMI
|
---|
1159 | DISPDBG((3, "DN_DEVICE_ORIGIN: %d, %d (PSO = %p, pInfo = %p)\n", ppdev->ptlDevOrg.x,
|
---|
1160 | ppdev->ptlDevOrg.y, pso, ppdev->pInfo));
|
---|
1161 | if (ppdev->pInfo)
|
---|
1162 | {
|
---|
1163 | ppdev->pInfo->screen.xOrigin = ppdev->ptlDevOrg.x;
|
---|
1164 | ppdev->pInfo->screen.yOrigin = ppdev->ptlDevOrg.y;
|
---|
1165 | VBoxProcessDisplayInfo(ppdev);
|
---|
1166 | }
|
---|
1167 | #else
|
---|
1168 | DISPDBG((3, "DN_DEVICE_ORIGIN: %d, %d (PSO = %p)\n", ppdev->ptlDevOrg.x,
|
---|
1169 | ppdev->ptlDevOrg.y, pso));
|
---|
1170 | VBoxProcessDisplayInfo(ppdev);
|
---|
1171 | #endif /* VBOX_WITH_HGSMI */
|
---|
1172 | break;
|
---|
1173 | case DN_DRAWING_BEGIN:
|
---|
1174 | DISPDBG((3, "DN_DRAWING_BEGIN (PSO = %p)\n", pso));
|
---|
1175 | break;
|
---|
1176 | }
|
---|
1177 | }
|
---|
1178 |
|
---|
1179 | #ifdef VBOX_WITH_DDRAW
|
---|
1180 | //--------------------------Public Routine-------------------------------------
|
---|
1181 | //
|
---|
1182 | // HBITMAP DrvDeriveSurface
|
---|
1183 | //
|
---|
1184 | // This function derives and creates a GDI surface from the specified
|
---|
1185 | // DirectDraw surface.
|
---|
1186 | //
|
---|
1187 | // Parameters
|
---|
1188 | // pDirectDraw-----Points to a DD_DIRECTDRAW_GLOBAL structure that describes
|
---|
1189 | // the DirectDraw object.
|
---|
1190 | // pSurface--------Points to a DD_SURFACE_LOCAL structure that describes the
|
---|
1191 | // DirectDraw surface around which to wrap a GDI surface.
|
---|
1192 | //
|
---|
1193 | // Return Value
|
---|
1194 | // DrvDeriveSurface returns a handle to the created GDI surface upon success.
|
---|
1195 | // It returns NULL if the call fails or if the driver cannot accelerate GDI
|
---|
1196 | // drawing to the specified DirectDraw surface.
|
---|
1197 | //
|
---|
1198 | // Comments
|
---|
1199 | // DrvDeriveSurface allows the driver to create a GDI surface around a
|
---|
1200 | // DirectDraw video memory or AGP surface object in order to allow accelerated
|
---|
1201 | // GDI drawing to the surface. If the driver does not hook this call, all GDI
|
---|
1202 | // drawing to DirectDraw surfaces is done in software using the DIB engine.
|
---|
1203 | //
|
---|
1204 | // GDI calls DrvDeriveSurface with RGB surfaces only.
|
---|
1205 | //
|
---|
1206 | // The driver should call DrvCreateDeviceBitmap to create a GDI surface of the
|
---|
1207 | // same size and format as that of the DirectDraw surface. Space for the
|
---|
1208 | // actual pixels need not be allocated since it already exists.
|
---|
1209 | //
|
---|
1210 | //-----------------------------------------------------------------------------
|
---|
1211 | HBITMAP DrvDeriveSurface(DD_DIRECTDRAW_GLOBAL* pDirectDraw, DD_SURFACE_LOCAL* pSurface)
|
---|
1212 | {
|
---|
1213 | PPDEV pDev = (PPDEV)pDirectDraw->dhpdev;
|
---|
1214 | HBITMAP hbmDevice;
|
---|
1215 | DD_SURFACE_GLOBAL* pSurfaceGlobal;
|
---|
1216 |
|
---|
1217 | DISPDBG((0, "%s: %p\n", __FUNCTION__, pDev));
|
---|
1218 |
|
---|
1219 | pSurfaceGlobal = pSurface->lpGbl;
|
---|
1220 |
|
---|
1221 | //
|
---|
1222 | // GDI should never call us for a non-RGB surface, but let's assert just
|
---|
1223 | // to make sure they're doing their job properly.
|
---|
1224 | //
|
---|
1225 | AssertMsg(!(pSurfaceGlobal->ddpfSurface.dwFlags & DDPF_FOURCC), ("GDI called us with a non-RGB surface!"));
|
---|
1226 |
|
---|
1227 | // The GDI driver does not accelerate surfaces in AGP memory,
|
---|
1228 | // thus we fail the call
|
---|
1229 |
|
---|
1230 | if (pSurface->ddsCaps.dwCaps & DDSCAPS_NONLOCALVIDMEM)
|
---|
1231 | {
|
---|
1232 | DISPDBG((0, "DrvDeriveSurface return NULL, surface in AGP memory\n"));
|
---|
1233 | return 0;
|
---|
1234 | }
|
---|
1235 |
|
---|
1236 | // The GDI driver does not accelerate managed surface,
|
---|
1237 | // thus we fail the call
|
---|
1238 | if (pSurface->lpSurfMore->ddsCapsEx.dwCaps2 & DDSCAPS2_TEXTUREMANAGE)
|
---|
1239 | {
|
---|
1240 | DISPDBG((0, "DrvDeriveSurface return NULL, surface is managed\n"));
|
---|
1241 | return 0;
|
---|
1242 | }
|
---|
1243 |
|
---|
1244 | //
|
---|
1245 | // The rest of our driver expects GDI calls to come in with the same
|
---|
1246 | // format as the primary surface. So we'd better not wrap a device
|
---|
1247 | // bitmap around an RGB format that the rest of our driver doesn't
|
---|
1248 | // understand. Also, we must check to see that it is not a surface
|
---|
1249 | // whose pitch does not match the primary surface.
|
---|
1250 | //
|
---|
1251 | // NOTE: Most surfaces created by this driver are allocated as 2D surfaces
|
---|
1252 | // whose lPitch's are equal to the screen pitch. However, overlay surfaces
|
---|
1253 | // are allocated such that there lPitch's are usually different then the
|
---|
1254 | // screen pitch. The hardware can not accelerate drawing operations to
|
---|
1255 | // these surfaces and thus we fail to derive these surfaces.
|
---|
1256 | //
|
---|
1257 | if ( (pSurfaceGlobal->ddpfSurface.dwRGBBitCount == pDev->ulBitCount) )
|
---|
1258 | {
|
---|
1259 | SIZEL sizel;
|
---|
1260 | DWORD ulBitmapType, flHooks;
|
---|
1261 |
|
---|
1262 | sizel.cx = pSurfaceGlobal->wWidth;
|
---|
1263 | sizel.cy = pSurfaceGlobal->wHeight;
|
---|
1264 |
|
---|
1265 | if (pDev->ulBitCount == 8)
|
---|
1266 | {
|
---|
1267 | ulBitmapType = BMF_8BPP;
|
---|
1268 | flHooks = HOOKS_BMF8BPP;
|
---|
1269 | }
|
---|
1270 | else if (pDev->ulBitCount == 16)
|
---|
1271 | {
|
---|
1272 | ulBitmapType = BMF_16BPP;
|
---|
1273 | flHooks = HOOKS_BMF16BPP;
|
---|
1274 | }
|
---|
1275 | else if (pDev->ulBitCount == 24)
|
---|
1276 | {
|
---|
1277 | ulBitmapType = BMF_24BPP;
|
---|
1278 | flHooks = HOOKS_BMF24BPP;
|
---|
1279 | }
|
---|
1280 | else
|
---|
1281 | {
|
---|
1282 | ulBitmapType = BMF_32BPP;
|
---|
1283 | flHooks = HOOKS_BMF32BPP;
|
---|
1284 | }
|
---|
1285 |
|
---|
1286 | /* Create a bitmap that represents the DDRAW bits.
|
---|
1287 | * Important is to calculate the address of the bitmap.
|
---|
1288 | */
|
---|
1289 | hbmDevice = EngCreateBitmap(sizel,
|
---|
1290 | pSurfaceGlobal->lPitch,
|
---|
1291 | ulBitmapType,
|
---|
1292 | (pDev->lDeltaScreen > 0) ? BMF_TOPDOWN : 0,
|
---|
1293 | (PVOID) (pDev->pjScreen + pSurfaceGlobal->fpVidMem));
|
---|
1294 | if (hbmDevice)
|
---|
1295 | {
|
---|
1296 | if (pSurfaceGlobal->fpVidMem == 0)
|
---|
1297 | {
|
---|
1298 | /* Screen surface, mark it so it will be recognized by the driver.
|
---|
1299 | * and so the driver will be called on any operations on the surface
|
---|
1300 | * (required for VBVA and VRDP).
|
---|
1301 | */
|
---|
1302 | if (EngAssociateSurface((HSURF)hbmDevice, pDev->hdevEng, flHooks))
|
---|
1303 | {
|
---|
1304 | SURFOBJ *surfobj = EngLockSurface ((HSURF)hbmDevice);
|
---|
1305 | DISPDBG((0, "DrvDeriveSurface surfobj %x, hsurf = %x\n", surfobj, surfobj->hsurf));
|
---|
1306 |
|
---|
1307 | surfobj->dhpdev = (DHPDEV)pDev;
|
---|
1308 |
|
---|
1309 | EngUnlockSurface(surfobj);
|
---|
1310 |
|
---|
1311 | DISPDBG((0, "DrvDeriveSurface return succeed %x at %x\n", hbmDevice, pSurfaceGlobal->fpVidMem));
|
---|
1312 | return(hbmDevice);
|
---|
1313 | }
|
---|
1314 | }
|
---|
1315 | else
|
---|
1316 | {
|
---|
1317 | DISPDBG((0, "DrvDeriveSurface return succeed %x at %x\n", hbmDevice, pSurfaceGlobal->fpVidMem));
|
---|
1318 | return(hbmDevice);
|
---|
1319 | }
|
---|
1320 |
|
---|
1321 | DISPDBG((0, "DrvDeriveSurface: EngAssociateSurface failed\n"));
|
---|
1322 | EngDeleteSurface((HSURF)hbmDevice);
|
---|
1323 | }
|
---|
1324 | }
|
---|
1325 |
|
---|
1326 | DISPDBG((0, "DrvDeriveSurface return NULL\n"));
|
---|
1327 | DISPDBG((0, "pSurfaceGlobal->ddpfSurface.dwRGBBitCount = %d, lPitch =%ld\n", pSurfaceGlobal->ddpfSurface.dwRGBBitCount,pSurfaceGlobal->lPitch));
|
---|
1328 |
|
---|
1329 | return(0);
|
---|
1330 | }
|
---|
1331 | #endif /* VBOX_WITH_DDRAW */
|
---|