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->hostFlags.u32HostEvents & VBVA_F_MODE_VRDP)
|
---|
149 | {
|
---|
150 | ret = 1;
|
---|
151 | }
|
---|
152 | DISPDBG((0, "VBOXESC_ISVRDPACTIVE -> %d (%x)\n", ret, ppdev->pVBVA->hostFlags.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 | /* Create a GDI bitmap which will be used to draw with Eng* functions. */
|
---|
762 | ppdev->hsurfScreenBitmap = (HSURF)EngCreateBitmap(sizl,
|
---|
763 | ppdev->lDeltaScreen,
|
---|
764 | ulBitmapType,
|
---|
765 | (ppdev->lDeltaScreen > 0) ? BMF_TOPDOWN : 0,
|
---|
766 | (PVOID) (ppdev->pjScreen));
|
---|
767 |
|
---|
768 | if (ppdev->hsurfScreenBitmap == (HSURF) 0)
|
---|
769 | {
|
---|
770 | DISPDBG((0, "DISP DrvEnableSurface failed EngCreateBitmap ppdev->hsurfScreenBitmap\n"));
|
---|
771 | goto l_Failure;
|
---|
772 | }
|
---|
773 | else
|
---|
774 | {
|
---|
775 | /* Get the GDI bitmap SURFOBJ, which will be passed to Eng*. */
|
---|
776 | ppdev->psoScreenBitmap = EngLockSurface(ppdev->hsurfScreenBitmap);
|
---|
777 |
|
---|
778 | /* Create device managed surface, which will represent screen for GDI. */
|
---|
779 | ppdev->hsurfScreen = (HSURF)EngCreateDeviceSurface((DHSURF)ppdev, /* Handle assigned by the device. */
|
---|
780 | sizl,
|
---|
781 | ulBitmapType);
|
---|
782 |
|
---|
783 | if (ppdev->hsurfScreen == (HSURF) 0)
|
---|
784 | {
|
---|
785 | DISPDBG((0, "DISP DrvEnableSurface failed EngCreateDeviceSurface ppdev->hsurfScreen\n"));
|
---|
786 | goto l_Failure;
|
---|
787 | }
|
---|
788 | else
|
---|
789 | {
|
---|
790 | /* Tell GDI that the driver will handle drawing operations on the screen surface. */
|
---|
791 | if (!EngAssociateSurface(ppdev->hsurfScreen, ppdev->hdevEng, flHooks))
|
---|
792 | {
|
---|
793 | DISPDBG((0, "DISP DrvEnableSurface failed EngAssociateSurface for Screen.\n"));
|
---|
794 | goto l_Failure;
|
---|
795 | }
|
---|
796 | else
|
---|
797 | {
|
---|
798 | ppdev->flHooks = flHooks;
|
---|
799 | ppdev->ulBitmapType = ulBitmapType;
|
---|
800 |
|
---|
801 | DISPDBG((0, "DISP DrvEnableSurface success ppdev %p, ppdev->hsurfScreen %p\n", ppdev, ppdev->hsurfScreen));
|
---|
802 | }
|
---|
803 | }
|
---|
804 | }
|
---|
805 | #endif /* VBOX_NEW_SURFACE_CODE */
|
---|
806 | return ppdev->hsurfScreen;
|
---|
807 |
|
---|
808 | l_Failure:
|
---|
809 |
|
---|
810 | DrvDisableSurface(dhpdev);
|
---|
811 |
|
---|
812 | return((HSURF)0);
|
---|
813 | }
|
---|
814 |
|
---|
815 | /******************************Public*Routine******************************\
|
---|
816 | * DrvDisableSurface
|
---|
817 | *
|
---|
818 | * Free resources allocated by DrvEnableSurface. Release the surface.
|
---|
819 | *
|
---|
820 | \**************************************************************************/
|
---|
821 |
|
---|
822 | VOID DrvDisableSurface(DHPDEV dhpdev)
|
---|
823 | {
|
---|
824 | PPDEV ppdev = (PPDEV)dhpdev;
|
---|
825 |
|
---|
826 | DISPDBG((0, "VBoxDisp::DrvDisableSurface called\n"));
|
---|
827 | if (ppdev->psoScreenBitmap)
|
---|
828 | {
|
---|
829 | EngUnlockSurface (ppdev->psoScreenBitmap);
|
---|
830 | ppdev->psoScreenBitmap = NULL;
|
---|
831 | }
|
---|
832 |
|
---|
833 | if (ppdev->hsurfScreen)
|
---|
834 | {
|
---|
835 | EngDeleteSurface(ppdev->hsurfScreen);
|
---|
836 | ppdev->hsurfScreen = (HSURF)0;
|
---|
837 | }
|
---|
838 | #ifdef VBOX_NEW_SURFACE_CODE
|
---|
839 | if (ppdev->pdsurfScreen)
|
---|
840 | {
|
---|
841 | EngFreeMem(ppdev->pdsurfScreen);
|
---|
842 | ppdev->pdsurfScreen = NULL;
|
---|
843 | }
|
---|
844 | #else
|
---|
845 | if (ppdev->hsurfScreenBitmap)
|
---|
846 | {
|
---|
847 | EngDeleteSurface(ppdev->hsurfScreenBitmap);
|
---|
848 | ppdev->hsurfScreenBitmap = (HSURF)0;
|
---|
849 | }
|
---|
850 | #endif
|
---|
851 |
|
---|
852 | vDisableSURF(ppdev);
|
---|
853 | }
|
---|
854 |
|
---|
855 | /******************************Public*Routine******************************\
|
---|
856 | * DrvAssertMode
|
---|
857 | *
|
---|
858 | * This asks the device to reset itself to the mode of the pdev passed in.
|
---|
859 | *
|
---|
860 | \**************************************************************************/
|
---|
861 |
|
---|
862 | BOOL DrvAssertMode(DHPDEV dhpdev, BOOL bEnable)
|
---|
863 | {
|
---|
864 | PPDEV ppdev = (PPDEV) dhpdev;
|
---|
865 | ULONG ulReturn;
|
---|
866 | PBYTE pjScreen;
|
---|
867 |
|
---|
868 | DISPDBG((0, "DISP DrvAssertMode called bEnable = %d\n", bEnable));
|
---|
869 |
|
---|
870 | if (bEnable)
|
---|
871 | {
|
---|
872 | pjScreen = ppdev->pjScreen;
|
---|
873 |
|
---|
874 | if (!bInitSURF(ppdev, FALSE))
|
---|
875 | {
|
---|
876 | DISPDBG((0, "DISP DrvAssertMode failed bInitSURF\n"));
|
---|
877 | return (FALSE);
|
---|
878 | }
|
---|
879 |
|
---|
880 | #ifdef VBOX_NEW_SURFACE_CODE
|
---|
881 | todo
|
---|
882 | #endif
|
---|
883 | if (pjScreen != ppdev->pjScreen)
|
---|
884 | {
|
---|
885 | HSURF hsurf;
|
---|
886 | SIZEL sizl;
|
---|
887 | SURFOBJ *pso;
|
---|
888 |
|
---|
889 | DISPDBG((0, "DISP DrvAssertMode Screen pointer has changed!!!\n"));
|
---|
890 |
|
---|
891 | sizl.cx = ppdev->cxScreen;
|
---|
892 | sizl.cy = ppdev->cyScreen;
|
---|
893 |
|
---|
894 | hsurf = (HSURF) EngCreateBitmap(sizl,
|
---|
895 | ppdev->lDeltaScreen,
|
---|
896 | ppdev->ulBitmapType,
|
---|
897 | (ppdev->lDeltaScreen > 0) ? BMF_TOPDOWN : 0,
|
---|
898 | (PVOID) (ppdev->pjScreen));
|
---|
899 |
|
---|
900 | if (hsurf == (HSURF) 0)
|
---|
901 | {
|
---|
902 | DISPDBG((0, "DISP DrvAssertMode failed EngCreateBitmap\n"));
|
---|
903 | return FALSE;
|
---|
904 | }
|
---|
905 |
|
---|
906 | pso = EngLockSurface(hsurf);
|
---|
907 |
|
---|
908 | if (ppdev->psoScreenBitmap)
|
---|
909 | {
|
---|
910 | EngUnlockSurface (ppdev->psoScreenBitmap);
|
---|
911 | ppdev->psoScreenBitmap = NULL;
|
---|
912 | }
|
---|
913 |
|
---|
914 | if (ppdev->hsurfScreenBitmap)
|
---|
915 | {
|
---|
916 | EngDeleteSurface(ppdev->hsurfScreenBitmap);
|
---|
917 | ppdev->hsurfScreenBitmap = (HSURF)0;
|
---|
918 | }
|
---|
919 |
|
---|
920 | ppdev->hsurfScreenBitmap = hsurf;
|
---|
921 | ppdev->psoScreenBitmap = pso;
|
---|
922 | }
|
---|
923 |
|
---|
924 | if (!EngAssociateSurface(ppdev->hsurfScreenBitmap, ppdev->hdevEng, 0))
|
---|
925 | {
|
---|
926 | DISPDBG((0, "DISP DrvAssertMode failed EngAssociateSurface for ScreenBitmap.\n"));
|
---|
927 | return FALSE;
|
---|
928 | }
|
---|
929 |
|
---|
930 | if (!EngAssociateSurface(ppdev->hsurfScreen, ppdev->hdevEng, ppdev->flHooks))
|
---|
931 | {
|
---|
932 | DISPDBG((0, "DISP DrvAssertMode failed EngAssociateSurface for Screen.\n"));
|
---|
933 | return FALSE;
|
---|
934 | }
|
---|
935 |
|
---|
936 | return TRUE;
|
---|
937 | }
|
---|
938 | else
|
---|
939 | {
|
---|
940 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
941 | /* tells we can not process host commands any more and ensures we've completed processing of the host VHWA commands */
|
---|
942 | vboxVHWADisable(ppdev);
|
---|
943 | #endif
|
---|
944 |
|
---|
945 | #ifdef VBOX_WITH_HGSMI
|
---|
946 | /* Free the driver's VBVA resources. */
|
---|
947 | vboxVbvaDisable ((PPDEV) dhpdev);
|
---|
948 | #endif
|
---|
949 |
|
---|
950 | //
|
---|
951 | // We must give up the display.
|
---|
952 | // Call the kernel driver to reset the device to a known state.
|
---|
953 | //
|
---|
954 |
|
---|
955 | if (EngDeviceIoControl(ppdev->hDriver,
|
---|
956 | IOCTL_VIDEO_RESET_DEVICE,
|
---|
957 | NULL,
|
---|
958 | 0,
|
---|
959 | NULL,
|
---|
960 | 0,
|
---|
961 | &ulReturn))
|
---|
962 | {
|
---|
963 | DISPDBG((0, "DISP DrvAssertMode failed IOCTL\n"));
|
---|
964 | return FALSE;
|
---|
965 | }
|
---|
966 | else
|
---|
967 | {
|
---|
968 | return TRUE;
|
---|
969 | }
|
---|
970 | }
|
---|
971 | }
|
---|
972 |
|
---|
973 | #if 0
|
---|
974 | /******************************Public*Routine**********************************\
|
---|
975 | * HBITMAP DrvCreateDeviceBitmap
|
---|
976 | *
|
---|
977 | * Function called by GDI to create a device-format-bitmap (DFB). We will
|
---|
978 | * always try to allocate the bitmap in off-screen; if we can't, we simply
|
---|
979 | * fail the call and GDI will create and manage the bitmap itself.
|
---|
980 | *
|
---|
981 | * Note: We do not have to zero the bitmap bits. GDI will automatically
|
---|
982 | * call us via DrvBitBlt to zero the bits (which is a security
|
---|
983 | * consideration).
|
---|
984 | *
|
---|
985 | \******************************************************************************/
|
---|
986 |
|
---|
987 | HBITMAP
|
---|
988 | DrvCreateDeviceBitmap(
|
---|
989 | DHPDEV dhpdev,
|
---|
990 | SIZEL sizl,
|
---|
991 | ULONG iFormat)
|
---|
992 | {
|
---|
993 | DISPDBG((0, "DISP DrvCreateDeviceBitmap %x (%d,%d) %x\n", dhpdev, sizl.cx, sizl.cy, iFormat));
|
---|
994 | /* Let GDI manage the bitmap */
|
---|
995 | return (HBITMAP)0;
|
---|
996 | }
|
---|
997 |
|
---|
998 | /******************************Public*Routine**********************************\
|
---|
999 | * VOID DrvDeleteDeviceBitmap
|
---|
1000 | *
|
---|
1001 | * Deletes a DFB.
|
---|
1002 | *
|
---|
1003 | \******************************************************************************/
|
---|
1004 |
|
---|
1005 | VOID
|
---|
1006 | DrvDeleteDeviceBitmap(
|
---|
1007 | DHSURF dhsurf)
|
---|
1008 | {
|
---|
1009 | DISPDBG((0, "DISP DrvDeleteDeviceBitmap %x", dhsurf));
|
---|
1010 | }
|
---|
1011 | #endif /* 0 */
|
---|
1012 |
|
---|
1013 | /******************************Public*Routine******************************\
|
---|
1014 | * DrvGetModes
|
---|
1015 | *
|
---|
1016 | * Returns the list of available modes for the device.
|
---|
1017 | *
|
---|
1018 | \**************************************************************************/
|
---|
1019 |
|
---|
1020 | ULONG DrvGetModes(HANDLE hDriver, ULONG cjSize, DEVMODEW *pdm)
|
---|
1021 | {
|
---|
1022 |
|
---|
1023 | DWORD cModes;
|
---|
1024 | DWORD cbOutputSize;
|
---|
1025 | PVIDEO_MODE_INFORMATION pVideoModeInformation, pVideoTemp;
|
---|
1026 | DWORD cOutputModes = cjSize / (sizeof(DEVMODEW) + DRIVER_EXTRA_SIZE);
|
---|
1027 | DWORD cbModeSize;
|
---|
1028 |
|
---|
1029 | DISPDBG((3, "DrvGetModes\n"));
|
---|
1030 |
|
---|
1031 | cModes = getAvailableModes(hDriver,
|
---|
1032 | (PVIDEO_MODE_INFORMATION *) &pVideoModeInformation,
|
---|
1033 | &cbModeSize);
|
---|
1034 |
|
---|
1035 | if (cModes == 0)
|
---|
1036 | {
|
---|
1037 | DISPDBG((0, "DrvGetModes failed to get mode information"));
|
---|
1038 | return 0;
|
---|
1039 | }
|
---|
1040 |
|
---|
1041 | if (pdm == NULL)
|
---|
1042 | {
|
---|
1043 | cbOutputSize = cModes * (sizeof(DEVMODEW) + DRIVER_EXTRA_SIZE);
|
---|
1044 | }
|
---|
1045 | else
|
---|
1046 | {
|
---|
1047 | //
|
---|
1048 | // Now copy the information for the supported modes back into the output
|
---|
1049 | // buffer
|
---|
1050 | //
|
---|
1051 |
|
---|
1052 | cbOutputSize = 0;
|
---|
1053 |
|
---|
1054 | pVideoTemp = pVideoModeInformation;
|
---|
1055 |
|
---|
1056 | do
|
---|
1057 | {
|
---|
1058 | if (pVideoTemp->Length != 0)
|
---|
1059 | {
|
---|
1060 | if (cOutputModes == 0)
|
---|
1061 | {
|
---|
1062 | break;
|
---|
1063 | }
|
---|
1064 |
|
---|
1065 | //
|
---|
1066 | // Zero the entire structure to start off with.
|
---|
1067 | //
|
---|
1068 |
|
---|
1069 | memset(pdm, 0, sizeof(DEVMODEW));
|
---|
1070 |
|
---|
1071 | //
|
---|
1072 | // Set the name of the device to the name of the DLL.
|
---|
1073 | //
|
---|
1074 |
|
---|
1075 | memcpy(pdm->dmDeviceName, DLL_NAME, sizeof(DLL_NAME));
|
---|
1076 |
|
---|
1077 | pdm->dmSpecVersion = DM_SPECVERSION;
|
---|
1078 | pdm->dmDriverVersion = DM_SPECVERSION;
|
---|
1079 | pdm->dmSize = sizeof(DEVMODEW);
|
---|
1080 | pdm->dmDriverExtra = DRIVER_EXTRA_SIZE;
|
---|
1081 |
|
---|
1082 | pdm->dmBitsPerPel = pVideoTemp->NumberOfPlanes *
|
---|
1083 | pVideoTemp->BitsPerPlane;
|
---|
1084 | pdm->dmPelsWidth = pVideoTemp->VisScreenWidth;
|
---|
1085 | pdm->dmPelsHeight = pVideoTemp->VisScreenHeight;
|
---|
1086 | pdm->dmDisplayFrequency = pVideoTemp->Frequency;
|
---|
1087 | pdm->dmDisplayFlags = 0;
|
---|
1088 |
|
---|
1089 | pdm->dmFields = DM_BITSPERPEL |
|
---|
1090 | DM_PELSWIDTH |
|
---|
1091 | DM_PELSHEIGHT |
|
---|
1092 | DM_DISPLAYFREQUENCY |
|
---|
1093 | DM_DISPLAYFLAGS ;
|
---|
1094 |
|
---|
1095 | //
|
---|
1096 | // Go to the next DEVMODE entry in the buffer.
|
---|
1097 | //
|
---|
1098 |
|
---|
1099 | cOutputModes--;
|
---|
1100 |
|
---|
1101 | pdm = (LPDEVMODEW) ( ((ULONG_PTR)pdm) + sizeof(DEVMODEW)
|
---|
1102 | + DRIVER_EXTRA_SIZE);
|
---|
1103 |
|
---|
1104 | cbOutputSize += (sizeof(DEVMODEW) + DRIVER_EXTRA_SIZE);
|
---|
1105 |
|
---|
1106 | }
|
---|
1107 |
|
---|
1108 | pVideoTemp = (PVIDEO_MODE_INFORMATION)
|
---|
1109 | (((PUCHAR)pVideoTemp) + cbModeSize);
|
---|
1110 |
|
---|
1111 | } while (--cModes);
|
---|
1112 | }
|
---|
1113 |
|
---|
1114 | EngFreeMem(pVideoModeInformation);
|
---|
1115 |
|
---|
1116 | return cbOutputSize;
|
---|
1117 |
|
---|
1118 | }
|
---|
1119 |
|
---|
1120 | VOID DrvSynchronize(IN DHPDEV dhpdev,IN RECTL *prcl)
|
---|
1121 | {
|
---|
1122 | DISPDBG((0, "VBoxDisp::DrvSynchronize\n"));
|
---|
1123 | }
|
---|
1124 |
|
---|
1125 | /******************************Public*Routine******************************\
|
---|
1126 | * DrvNotify
|
---|
1127 | *
|
---|
1128 | * Called by GDI to notify us of certain "interesting" events
|
---|
1129 | *
|
---|
1130 | * DN_DEVICE_ORIGIN is used to communicate the X/Y offsets of individual monitors
|
---|
1131 | * when DualView is in effect.
|
---|
1132 | *
|
---|
1133 | \**************************************************************************/
|
---|
1134 |
|
---|
1135 | VOID DrvNotify(
|
---|
1136 | SURFOBJ *pso,
|
---|
1137 | ULONG iType,
|
---|
1138 | PVOID pvData)
|
---|
1139 | {
|
---|
1140 | PDEV* ppdev = (PDEV*) pso->dhpdev;
|
---|
1141 |
|
---|
1142 | DISPDBG((0, "VBoxDisp::DrvNotify called.\n"));
|
---|
1143 |
|
---|
1144 | switch(iType)
|
---|
1145 | {
|
---|
1146 | case DN_DEVICE_ORIGIN:
|
---|
1147 | #ifndef VBOX_WITH_HGSMI
|
---|
1148 | ppdev->ptlDevOrg = *(PPOINTL)pvData;
|
---|
1149 | DISPDBG((3, "DN_DEVICE_ORIGIN: %d, %d (PSO = %p, pInfo = %p)\n", ppdev->ptlDevOrg.x,
|
---|
1150 | ppdev->ptlDevOrg.y, pso, ppdev->pInfo));
|
---|
1151 | if (ppdev->pInfo)
|
---|
1152 | {
|
---|
1153 | ppdev->pInfo->screen.xOrigin = ppdev->ptlDevOrg.x;
|
---|
1154 | ppdev->pInfo->screen.yOrigin = ppdev->ptlDevOrg.y;
|
---|
1155 | VBoxProcessDisplayInfo(ppdev);
|
---|
1156 | }
|
---|
1157 | break;
|
---|
1158 | #else
|
---|
1159 | {
|
---|
1160 | POINTL ptlDevOrg = *(PPOINTL)pvData;
|
---|
1161 | DISPDBG((3, "DN_DEVICE_ORIGIN: current @%d,%d, new @%d,%d, (PSO = %p)\n", ppdev->ptlDevOrg.x,
|
---|
1162 | ppdev->ptlDevOrg.y, ptlDevOrg.x, ptlDevOrg.y, pso));
|
---|
1163 | if (ppdev->ptlDevOrg.x != ptlDevOrg.x || ppdev->ptlDevOrg.y != ptlDevOrg.y)
|
---|
1164 | {
|
---|
1165 | ppdev->ptlDevOrg = ptlDevOrg;
|
---|
1166 | VBoxProcessDisplayInfo(ppdev);
|
---|
1167 | }
|
---|
1168 | } break;
|
---|
1169 | #endif /* VBOX_WITH_HGSMI */
|
---|
1170 | case DN_DRAWING_BEGIN:
|
---|
1171 | DISPDBG((3, "DN_DRAWING_BEGIN (PSO = %p)\n", pso));
|
---|
1172 | break;
|
---|
1173 | }
|
---|
1174 | }
|
---|
1175 |
|
---|
1176 | #ifdef VBOX_WITH_DDRAW
|
---|
1177 | //--------------------------Public Routine-------------------------------------
|
---|
1178 | //
|
---|
1179 | // HBITMAP DrvDeriveSurface
|
---|
1180 | //
|
---|
1181 | // This function derives and creates a GDI surface from the specified
|
---|
1182 | // DirectDraw surface.
|
---|
1183 | //
|
---|
1184 | // Parameters
|
---|
1185 | // pDirectDraw-----Points to a DD_DIRECTDRAW_GLOBAL structure that describes
|
---|
1186 | // the DirectDraw object.
|
---|
1187 | // pSurface--------Points to a DD_SURFACE_LOCAL structure that describes the
|
---|
1188 | // DirectDraw surface around which to wrap a GDI surface.
|
---|
1189 | //
|
---|
1190 | // Return Value
|
---|
1191 | // DrvDeriveSurface returns a handle to the created GDI surface upon success.
|
---|
1192 | // It returns NULL if the call fails or if the driver cannot accelerate GDI
|
---|
1193 | // drawing to the specified DirectDraw surface.
|
---|
1194 | //
|
---|
1195 | // Comments
|
---|
1196 | // DrvDeriveSurface allows the driver to create a GDI surface around a
|
---|
1197 | // DirectDraw video memory or AGP surface object in order to allow accelerated
|
---|
1198 | // GDI drawing to the surface. If the driver does not hook this call, all GDI
|
---|
1199 | // drawing to DirectDraw surfaces is done in software using the DIB engine.
|
---|
1200 | //
|
---|
1201 | // GDI calls DrvDeriveSurface with RGB surfaces only.
|
---|
1202 | //
|
---|
1203 | // The driver should call DrvCreateDeviceBitmap to create a GDI surface of the
|
---|
1204 | // same size and format as that of the DirectDraw surface. Space for the
|
---|
1205 | // actual pixels need not be allocated since it already exists.
|
---|
1206 | //
|
---|
1207 | //-----------------------------------------------------------------------------
|
---|
1208 | HBITMAP DrvDeriveSurface(DD_DIRECTDRAW_GLOBAL* pDirectDraw, DD_SURFACE_LOCAL* pSurface)
|
---|
1209 | {
|
---|
1210 | PPDEV pDev = (PPDEV)pDirectDraw->dhpdev;
|
---|
1211 | HBITMAP hbmDevice;
|
---|
1212 | DD_SURFACE_GLOBAL* pSurfaceGlobal;
|
---|
1213 |
|
---|
1214 | DISPDBG((0, "%s: %p\n", __FUNCTION__, pDev));
|
---|
1215 |
|
---|
1216 | pSurfaceGlobal = pSurface->lpGbl;
|
---|
1217 |
|
---|
1218 | //
|
---|
1219 | // GDI should never call us for a non-RGB surface, but let's assert just
|
---|
1220 | // to make sure they're doing their job properly.
|
---|
1221 | //
|
---|
1222 | AssertMsg(!(pSurfaceGlobal->ddpfSurface.dwFlags & DDPF_FOURCC), ("GDI called us with a non-RGB surface!"));
|
---|
1223 |
|
---|
1224 | // The GDI driver does not accelerate surfaces in AGP memory,
|
---|
1225 | // thus we fail the call
|
---|
1226 |
|
---|
1227 | if (pSurface->ddsCaps.dwCaps & DDSCAPS_NONLOCALVIDMEM)
|
---|
1228 | {
|
---|
1229 | DISPDBG((0, "DrvDeriveSurface return NULL, surface in AGP memory\n"));
|
---|
1230 | return 0;
|
---|
1231 | }
|
---|
1232 |
|
---|
1233 | // The GDI driver does not accelerate managed surface,
|
---|
1234 | // thus we fail the call
|
---|
1235 | if (pSurface->lpSurfMore->ddsCapsEx.dwCaps2 & DDSCAPS2_TEXTUREMANAGE)
|
---|
1236 | {
|
---|
1237 | DISPDBG((0, "DrvDeriveSurface return NULL, surface is managed\n"));
|
---|
1238 | return 0;
|
---|
1239 | }
|
---|
1240 |
|
---|
1241 | //
|
---|
1242 | // The rest of our driver expects GDI calls to come in with the same
|
---|
1243 | // format as the primary surface. So we'd better not wrap a device
|
---|
1244 | // bitmap around an RGB format that the rest of our driver doesn't
|
---|
1245 | // understand. Also, we must check to see that it is not a surface
|
---|
1246 | // whose pitch does not match the primary surface.
|
---|
1247 | //
|
---|
1248 | // NOTE: Most surfaces created by this driver are allocated as 2D surfaces
|
---|
1249 | // whose lPitch's are equal to the screen pitch. However, overlay surfaces
|
---|
1250 | // are allocated such that there lPitch's are usually different then the
|
---|
1251 | // screen pitch. The hardware can not accelerate drawing operations to
|
---|
1252 | // these surfaces and thus we fail to derive these surfaces.
|
---|
1253 | //
|
---|
1254 | if ( (pSurfaceGlobal->ddpfSurface.dwRGBBitCount == pDev->ulBitCount) )
|
---|
1255 | {
|
---|
1256 | SIZEL sizel;
|
---|
1257 | DWORD ulBitmapType, flHooks;
|
---|
1258 |
|
---|
1259 | sizel.cx = pSurfaceGlobal->wWidth;
|
---|
1260 | sizel.cy = pSurfaceGlobal->wHeight;
|
---|
1261 |
|
---|
1262 | if (pDev->ulBitCount == 8)
|
---|
1263 | {
|
---|
1264 | ulBitmapType = BMF_8BPP;
|
---|
1265 | flHooks = HOOKS_BMF8BPP;
|
---|
1266 | }
|
---|
1267 | else if (pDev->ulBitCount == 16)
|
---|
1268 | {
|
---|
1269 | ulBitmapType = BMF_16BPP;
|
---|
1270 | flHooks = HOOKS_BMF16BPP;
|
---|
1271 | }
|
---|
1272 | else if (pDev->ulBitCount == 24)
|
---|
1273 | {
|
---|
1274 | ulBitmapType = BMF_24BPP;
|
---|
1275 | flHooks = HOOKS_BMF24BPP;
|
---|
1276 | }
|
---|
1277 | else
|
---|
1278 | {
|
---|
1279 | ulBitmapType = BMF_32BPP;
|
---|
1280 | flHooks = HOOKS_BMF32BPP;
|
---|
1281 | }
|
---|
1282 |
|
---|
1283 | /* Create a bitmap that represents the DDRAW bits.
|
---|
1284 | * Important is to calculate the address of the bitmap.
|
---|
1285 | */
|
---|
1286 | hbmDevice = EngCreateBitmap(sizel,
|
---|
1287 | pSurfaceGlobal->lPitch,
|
---|
1288 | ulBitmapType,
|
---|
1289 | (pDev->lDeltaScreen > 0) ? BMF_TOPDOWN : 0,
|
---|
1290 | (PVOID) (pDev->pjScreen + pSurfaceGlobal->fpVidMem));
|
---|
1291 | if (hbmDevice)
|
---|
1292 | {
|
---|
1293 | if (pSurfaceGlobal->fpVidMem == 0)
|
---|
1294 | {
|
---|
1295 | /* Screen surface, mark it so it will be recognized by the driver.
|
---|
1296 | * and so the driver will be called on any operations on the surface
|
---|
1297 | * (required for VBVA and VRDP).
|
---|
1298 | */
|
---|
1299 | if (EngAssociateSurface((HSURF)hbmDevice, pDev->hdevEng, flHooks))
|
---|
1300 | {
|
---|
1301 | SURFOBJ *surfobj = EngLockSurface ((HSURF)hbmDevice);
|
---|
1302 | DISPDBG((0, "DrvDeriveSurface surfobj %x, hsurf = %x\n", surfobj, surfobj->hsurf));
|
---|
1303 |
|
---|
1304 | surfobj->dhpdev = (DHPDEV)pDev;
|
---|
1305 |
|
---|
1306 | EngUnlockSurface(surfobj);
|
---|
1307 |
|
---|
1308 | DISPDBG((0, "DrvDeriveSurface return succeed %x at %x\n", hbmDevice, pSurfaceGlobal->fpVidMem));
|
---|
1309 | return(hbmDevice);
|
---|
1310 | }
|
---|
1311 | }
|
---|
1312 | else
|
---|
1313 | {
|
---|
1314 | DISPDBG((0, "DrvDeriveSurface return succeed %x at %x\n", hbmDevice, pSurfaceGlobal->fpVidMem));
|
---|
1315 | return(hbmDevice);
|
---|
1316 | }
|
---|
1317 |
|
---|
1318 | DISPDBG((0, "DrvDeriveSurface: EngAssociateSurface failed\n"));
|
---|
1319 | EngDeleteSurface((HSURF)hbmDevice);
|
---|
1320 | }
|
---|
1321 | }
|
---|
1322 |
|
---|
1323 | DISPDBG((0, "DrvDeriveSurface return NULL\n"));
|
---|
1324 | DISPDBG((0, "pSurfaceGlobal->ddpfSurface.dwRGBBitCount = %d, lPitch =%ld\n", pSurfaceGlobal->ddpfSurface.dwRGBBitCount,pSurfaceGlobal->lPitch));
|
---|
1325 |
|
---|
1326 | return(0);
|
---|
1327 | }
|
---|
1328 | #endif /* VBOX_WITH_DDRAW */
|
---|