VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Display/drv.c@ 34079

Last change on this file since 34079 was 33540, checked in by vboxsync, 14 years ago

*: spelling fixes, thanks Timeless!

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 25.5 KB
Line 
1/** @file
2 *
3 * VirtualBox Windows NT/2000/XP guest video driver
4 *
5 * Display driver screen draw entry points.
6 *
7 * Copyright (C) 2006-2007 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18/* The driver operates in 3 modes:
19 * 1) BASE : Driver does not report to host about any operations.
20 * All Drv* are immediately routed to Eng*.
21 * 2) VBVA : Driver reports dirty rectangles to host.
22 * 3) VBVA + VRDP : Driver also creates orders pipeline from which VRDP
23 * can reconstruct all drawing operations, including
24 * bitmap updates.
25 *
26 * These modes affect only Drv* functions in this file.
27 *
28 * VBVA mode is enabled by a registry key for the miniport driver
29 * (as it is implemented now).
30 *
31 * VRDP mode is enabled when a VRDP client connects and VBVA is enabled.
32 * The host sets a bit flag in VBVAMemory when VRDP client is connected.
33 *
34 * The VRDP mode pipeline consists of 3 types of commands:
35 *
36 * 1) RDP orders: BitBlt, RectFill, Text.
37 * These are the simplest ones.
38 *
39 * 2) Caching: Bitmap, glyph, brush.
40 * The driver maintains a bitmap (or other objects) cache.
41 * All source bitmaps are cached. The driver verifies
42 * iUniq and also computes CRC for these bitmaps
43 * for searching. The driver will use SURFOBJ::dhsurf
44 * field to save a pointer to in driver structure, even
45 * for Engine managed bitmaps (hope that will work).
46 *
47 *
48 * 3) Bitmap updates, when given draw operation can not be done
49 * using orders.
50 *
51 */
52
53#include "driver.h"
54
55#ifdef STAT_sunlover
56void dumpsurf (SURFOBJ *pso, char *s)
57{
58 DISPDBG((1, "Surface %s: %p\n", s, pso));
59 if (pso)
60 {
61 DISPDBG((1, " DHSURF dhsurf = %p\n", pso->dhsurf));
62 DISPDBG((1, " HSURF hsurf = %p\n", pso->hsurf));
63 DISPDBG((1, " DHPDEV dhpdev = %p\n", pso->dhpdev));
64 DISPDBG((1, " HDEV hdev = %p\n", pso->hdev));
65 DISPDBG((1, " SIZEL sizlBitmap = %dx%d\n", pso->sizlBitmap.cx, pso->sizlBitmap.cy));
66 DISPDBG((1, " ULONG cjBits = %p\n", pso->cjBits));
67 DISPDBG((1, " PVOID pvBits = %p\n", pso->pvBits));
68 DISPDBG((1, " PVOID pvScan0 = %p\n", pso->pvScan0));
69 DISPDBG((1, " LONG lDelta = %p\n", pso->lDelta));
70 DISPDBG((1, " ULONG iUniq = %p\n", pso->iUniq));
71 DISPDBG((1, " ULONG iBitmapFormat = %p\n", pso->iBitmapFormat));
72 DISPDBG((1, " USHORT iType = %p\n", pso->iType));
73 DISPDBG((1, " USHORT fjBitmap = %p\n", pso->fjBitmap));
74 }
75}
76#else
77#define dumpsurf(a, b)
78#endif /* STAT_sunlover */
79
80BOOL bIsScreenSurface (SURFOBJ *pso)
81{
82 if (pso)
83 {
84 PPDEV ppdev = (PPDEV)pso->dhpdev;
85
86 /* The screen surface has the 'pso->dhpdev' field,
87 * and is either the screen device surface with handle = hsurfScreen,
88 * or a surface derived from DDRAW with address equal to the framebuffer.
89 */
90 if ( ppdev
91 && ( pso->hsurf == ppdev->hsurfScreen
92 || pso->pvBits == ppdev->pjScreen
93 )
94 )
95 {
96 return TRUE;
97 }
98 }
99
100 return FALSE;
101}
102
103#define VBVA_OPERATION(__psoDest, __fn, __a) do { \
104 if (bIsScreenSurface(__psoDest)) \
105 { \
106 PPDEV ppdev = (PPDEV)__psoDest->dhpdev; \
107 \
108 if (ppdev->bHGSMISupported && vboxHwBufferBeginUpdate (ppdev)) \
109 { \
110 vbva##__fn __a; \
111 \
112 if ( ppdev->pVBVA->hostFlags.u32HostEvents \
113 & VBOX_VIDEO_INFO_HOST_EVENTS_F_VRDP_RESET) \
114 { \
115 vrdpReset (ppdev); \
116 \
117 ppdev->pVBVA->hostFlags.u32HostEvents &= \
118 ~VBOX_VIDEO_INFO_HOST_EVENTS_F_VRDP_RESET; \
119 } \
120 \
121 if (ppdev->pVBVA->hostFlags.u32HostEvents \
122 & VBVA_F_MODE_VRDP) \
123 { \
124 vrdp##__fn __a; \
125 } \
126 \
127 vboxHwBufferEndUpdate (ppdev); \
128 } \
129 } \
130} while (0)
131
132//#undef VBVA_OPERATION
133//#define VBVA_OPERATION(_psoDest, __fn, __a) do { } while (0)
134
135
136#if 0
137typedef struct _SURFOBJ {
138+00 DHSURF dhsurf;
139+04 HSURF hsurf;
140+08 DHPDEV dhpdev;
141+0c HDEV hdev;
142+10 SIZEL sizlBitmap;
143+18 ULONG cjBits;
144+1c PVOID pvBits;
145+20 PVOID pvScan0;
146+24 LONG lDelta;
147+28 ULONG iUniq;
148+2c ULONG iBitmapFormat;
149+30 USHORT iType;
150+32 USHORT fjBitmap;
151} SURFOBJ;
152#endif
153
154BOOL APIENTRY DrvBitBlt(
155 SURFOBJ *psoTrg,
156 SURFOBJ *psoSrc,
157 SURFOBJ *psoMask,
158 CLIPOBJ *pco,
159 XLATEOBJ *pxlo,
160 RECTL *prclTrg,
161 POINTL *pptlSrc,
162 POINTL *pptlMask,
163 BRUSHOBJ *pbo,
164 POINTL *pptlBrush,
165 ROP4 rop4
166 )
167{
168 BOOL bRc;
169
170 DISPDBG((1, "%s\n", __FUNCTION__));
171
172 DISPDBG((1, "psoTrg = %p, psoSrc = %p, psoMask = %p, pco = %p, pxlo = %p, prclTrg = %p, pptlSrc = %p, pptlMask = %p, pbo = %p, pptlBrush = %p, rop4 = %08X\n",
173 psoTrg, psoSrc, psoMask, pco, pxlo, prclTrg, pptlSrc, pptlMask, pbo, pptlBrush, rop4));
174
175 STATDRVENTRY(BitBlt, psoTrg);
176
177 bRc = EngBitBlt(CONV_SURF(psoTrg), CONV_SURF(psoSrc), psoMask, pco, pxlo, prclTrg, pptlSrc, pptlMask, pbo, pptlBrush, rop4);
178
179 VBVA_OPERATION(psoTrg,
180 BitBlt,
181 (psoTrg, psoSrc, psoMask, pco, pxlo, prclTrg, pptlSrc, pptlMask, pbo, pptlBrush, rop4));
182
183 return bRc;
184}
185
186BOOL APIENTRY DrvTextOut(
187 SURFOBJ *pso,
188 STROBJ *pstro,
189 FONTOBJ *pfo,
190 CLIPOBJ *pco,
191 RECTL *prclExtra, // Obsolete, always NULL
192 RECTL *prclOpaque,
193 BRUSHOBJ *pboFore,
194 BRUSHOBJ *pboOpaque,
195 POINTL *pptlOrg,
196 MIX mix
197 )
198{
199 BOOL bRc;
200
201 DISPDBG((1, "%s\n", __FUNCTION__));
202
203 STATDRVENTRY(TextOut, pso);
204
205 bRc = EngTextOut(CONV_SURF(pso), pstro, pfo, pco, prclExtra, prclOpaque, pboFore, pboOpaque, pptlOrg, mix);
206
207 VBVA_OPERATION(pso,
208 TextOut,
209 (pso, pstro, pfo, pco, prclExtra, prclOpaque, pboFore, pboOpaque, pptlOrg, mix));
210
211 return bRc;
212}
213
214
215BOOL APIENTRY DrvLineTo(
216 SURFOBJ *pso,
217 CLIPOBJ *pco,
218 BRUSHOBJ *pbo,
219 LONG x1,
220 LONG y1,
221 LONG x2,
222 LONG y2,
223 RECTL *prclBounds,
224 MIX mix
225 )
226{
227 BOOL bRc;
228
229 DISPDBG((1, "%s\n", __FUNCTION__));
230
231 STATDRVENTRY(LineTo, pso);
232
233 bRc = EngLineTo(CONV_SURF(pso), pco, pbo, x1, y1, x2, y2, prclBounds, mix);
234
235 VBVA_OPERATION(pso,
236 LineTo,
237 (pso, pco, pbo, x1, y1, x2, y2, prclBounds, mix));
238
239 return bRc;
240}
241
242BOOL APIENTRY DrvStretchBlt(
243 SURFOBJ *psoDest,
244 SURFOBJ *psoSrc,
245 SURFOBJ *psoMask,
246 CLIPOBJ *pco,
247 XLATEOBJ *pxlo,
248 COLORADJUSTMENT *pca,
249 POINTL *pptlHTOrg,
250 RECTL *prclDest,
251 RECTL *prclSrc,
252 POINTL *pptlMask,
253 ULONG iMode
254 )
255{
256 BOOL bRc;
257
258 DISPDBG((1, "%s\n", __FUNCTION__));
259
260 STATDRVENTRY(StretchBlt, psoDest);
261
262 bRc = EngStretchBlt(CONV_SURF(psoDest), CONV_SURF(psoSrc), psoMask, pco, pxlo, pca, pptlHTOrg,
263 prclDest, prclSrc, pptlMask, iMode);
264
265 VBVA_OPERATION(psoDest,
266 StretchBlt,
267 (psoDest, psoSrc, psoMask, pco, pxlo, pca, pptlHTOrg,
268 prclDest, prclSrc, pptlMask, iMode));
269
270 return bRc;
271}
272
273
274BOOL APIENTRY DrvCopyBits(
275 SURFOBJ *psoDest,
276 SURFOBJ *psoSrc,
277 CLIPOBJ *pco,
278 XLATEOBJ *pxlo,
279 RECTL *prclDest,
280 POINTL *pptlSrc
281 )
282{
283 RECTL rclDest = *prclDest;
284 POINTL ptlSrc = *pptlSrc;
285
286 BOOL bRc;
287 BOOL bDo = TRUE;
288
289 DISPDBG((1, "%s\n", __FUNCTION__));
290
291 DISPDBG((1, "psoDest = %p, psoSrc = %p, pco = %p, pxlo = %p, prclDest = %p, pptlSrc = %p\n",
292 psoDest, psoSrc, pco, pxlo, prclDest, pptlSrc));
293
294 STATDRVENTRY(CopyBits, psoDest);
295
296 dumpsurf(psoSrc, "psoSrc");
297 dumpsurf(psoDest, "psoDest");
298
299 STATPRINT;
300
301#ifdef VBOX_VBVA_ADJUST_RECT
302 /* Experimental fix for too large bitmap updates.
303 *
304 * Some application do a large bitmap update event if only
305 * a small part of the bitmap is actually changed.
306 *
307 * The driver will find the changed rectangle by comparing
308 * the current framebuffer content with the source bitmap.
309 *
310 * The optimization is only active when:
311 * - the VBVA extension is enabled;
312 * - the source bitmap is not cacheable;
313 * - the bitmap formats of both the source and the screen surfaces are equal.
314 *
315 */
316 if ( psoSrc
317 && !bIsScreenSurface(psoSrc)
318 && bIsScreenSurface(psoDest))
319 {
320 PPDEV ppdev = (PPDEV)psoDest->dhpdev;
321
322 DISPDBG((1, "offscreen->screen\n"));
323
324 if ( ppdev->pVBVA
325 && (ppdev->pVBVA->hostFlags.u32HostEvents & VBVA_F_MODE_ENABLED))
326 {
327 if ( (psoSrc->fjBitmap & BMF_DONTCACHE) != 0
328 || psoSrc->iUniq == 0)
329 {
330 DISPDBG((1, "non-cacheable %d->%d (ppdev %p)\n", psoSrc->iBitmapFormat, psoDest->iBitmapFormat, ppdev));
331
332 /* It is possible to apply the fix. */
333 bDo = vbvaFindChangedRect (CONV_SURF(psoDest), CONV_SURF(psoSrc), &rclDest, &ptlSrc);
334 }
335 }
336 }
337
338 if (!bDo)
339 {
340 /* The operation is a NOP. Just return success. */
341 return TRUE;
342 }
343#endif /* VBOX_VBVA_ADJUST_RECT */
344
345 bRc = EngCopyBits(CONV_SURF(psoDest), CONV_SURF(psoSrc), pco, pxlo, &rclDest, &ptlSrc);
346
347 VBVA_OPERATION(psoDest,
348 CopyBits,
349 (psoDest, psoSrc, pco, pxlo, &rclDest, &ptlSrc));
350
351 return bRc;
352}
353
354BOOL APIENTRY DrvPaint(
355 SURFOBJ *pso,
356 CLIPOBJ *pco,
357 BRUSHOBJ *pbo,
358 POINTL *pptlBrushOrg,
359 MIX mix
360 )
361{
362 BOOL bRc;
363
364 DISPDBG((1, "%s\n", __FUNCTION__));
365
366 STATDRVENTRY(Paint, pso);
367
368 bRc = EngPaint (CONV_SURF(pso), pco, pbo, pptlBrushOrg, mix);
369
370 VBVA_OPERATION(pso,
371 Paint,
372 (pso, pco, pbo, pptlBrushOrg, mix));
373
374 return bRc;
375}
376
377BOOL APIENTRY DrvFillPath(
378 SURFOBJ *pso,
379 PATHOBJ *ppo,
380 CLIPOBJ *pco,
381 BRUSHOBJ *pbo,
382 POINTL *pptlBrushOrg,
383 MIX mix,
384 FLONG flOptions
385 )
386{
387 BOOL bRc;
388
389 DISPDBG((1, "%s\n", __FUNCTION__));
390
391 STATDRVENTRY(FillPath, pso);
392
393 bRc = EngFillPath(CONV_SURF(pso), ppo, pco, pbo, pptlBrushOrg, mix, flOptions);
394
395 VBVA_OPERATION(pso,
396 FillPath,
397 (pso, ppo, pco, pbo, pptlBrushOrg, mix, flOptions));
398
399 return bRc;
400}
401
402
403
404BOOL APIENTRY DrvStrokePath(
405 SURFOBJ *pso,
406 PATHOBJ *ppo,
407 CLIPOBJ *pco,
408 XFORMOBJ *pxo,
409 BRUSHOBJ *pbo,
410 POINTL *pptlBrushOrg,
411 LINEATTRS *plineattrs,
412 MIX mix
413 )
414{
415 BOOL bRc;
416
417 DISPDBG((1, "%s\n", __FUNCTION__));
418
419 STATDRVENTRY(StrokePath, pso);
420
421 bRc = EngStrokePath(CONV_SURF(pso), ppo, pco, pxo, pbo, pptlBrushOrg, plineattrs, mix);
422
423 VBVA_OPERATION(pso,
424 StrokePath,
425 (pso, ppo, pco, pxo, pbo, pptlBrushOrg, plineattrs, mix));
426
427 return bRc;
428}
429
430BOOL APIENTRY DrvStrokeAndFillPath(
431 SURFOBJ *pso,
432 PATHOBJ *ppo,
433 CLIPOBJ *pco,
434 XFORMOBJ *pxo,
435 BRUSHOBJ *pboStroke,
436 LINEATTRS *plineattrs,
437 BRUSHOBJ *pboFill,
438 POINTL *pptlBrushOrg,
439 MIX mixFill,
440 FLONG flOptions
441 )
442{
443 BOOL bRc;
444
445 DISPDBG((1, "%s\n", __FUNCTION__));
446
447 STATDRVENTRY(StrokeAndFillPath, pso);
448
449 bRc = EngStrokeAndFillPath(CONV_SURF(pso), ppo, pco, pxo, pboStroke, plineattrs, pboFill, pptlBrushOrg, mixFill, flOptions);
450
451 VBVA_OPERATION(pso,
452 StrokeAndFillPath,
453 (pso, ppo, pco, pxo, pboStroke, plineattrs, pboFill, pptlBrushOrg, mixFill, flOptions));
454
455 return bRc;
456}
457
458static void ssbDiscardTopSlot (PPDEV ppdev)
459{
460 SSB *pSSB = &ppdev->aSSB[--ppdev->cSSB];
461
462 if (pSSB->pBuffer)
463 {
464 EngFreeMem (pSSB->pBuffer);
465 pSSB->pBuffer = NULL;
466 }
467
468 pSSB->ident = 0;
469}
470
471static void ssbDiscardUpperSlots (PPDEV ppdev, ULONG_PTR ident)
472{
473 while (ppdev->cSSB > ident)
474 {
475 ssbDiscardTopSlot (ppdev);
476 }
477}
478
479static BOOL ssbCopy (SSB *pSSB, SURFOBJ *pso, RECTL *prcl, BOOL bToScreen)
480{
481 BYTE *pSrc;
482 BYTE *pDst;
483
484 LONG lDeltaSrc;
485 LONG lDeltaDst;
486
487 ULONG cWidth;
488 ULONG cHeight;
489
490 int cbPixel = format2BytesPerPixel(pso);
491
492 DISPDBG((1, "ssbCopy: pSSB = %p, pso = %p, prcl = %p, bToScreen = %d\n", pSSB, pso, prcl, bToScreen));
493
494 if (cbPixel == 0)
495 {
496 DISPDBG((1, "ssbCopy: unsupported pixel format!!!\n"));
497 return FALSE;
498 }
499
500 cWidth = prcl->right - prcl->left;
501 cHeight = prcl->bottom - prcl->top;
502
503 if (bToScreen)
504 {
505 if (pSSB->pBuffer == NULL)
506 {
507 DISPDBG((1, "ssbCopy: source buffer is NULL!!!\n"));
508 return FALSE;
509 }
510
511 pSrc = pSSB->pBuffer;
512 lDeltaSrc = cWidth * cbPixel;
513
514 pDst = (BYTE *)pso->pvScan0 +
515 pso->lDelta * prcl->top +
516 cbPixel * prcl->left;
517 lDeltaDst = pso->lDelta;
518 }
519 else
520 {
521 if (pSSB->pBuffer != NULL)
522 {
523 DISPDBG((1, "ssbCopy: source buffer is not NULL!!!\n"));
524 return FALSE;
525 }
526
527 pSSB->pBuffer = (BYTE *)EngAllocMem (0, cWidth * cHeight * cbPixel, ALLOC_TAG);
528
529 if (pSSB->pBuffer == NULL)
530 {
531 DISPDBG((1, "ssbCopy: Failed to allocate buffer!!!\n"));
532 return FALSE;
533 }
534
535 pDst = pSSB->pBuffer;
536 lDeltaDst = cWidth * cbPixel;
537
538 pSrc = (BYTE *)pso->pvScan0 +
539 pso->lDelta * prcl->top +
540 cbPixel * prcl->left;
541 lDeltaSrc = pso->lDelta;
542 }
543
544 DISPDBG((1, "ssbCopy: cHeight = %d, pDst = %p, pSrc = %p, lDeltaSrc = %d, lDeltaDst = %d\n",
545 cHeight, pDst, pSrc, lDeltaSrc, lDeltaDst));
546
547 while (cHeight--)
548 {
549 memcpy (pDst, pSrc, cWidth * cbPixel);
550
551 pDst += lDeltaDst;
552 pSrc += lDeltaSrc;
553 }
554
555 DISPDBG((1, "ssbCopy: completed.\n"));
556 return TRUE;
557}
558
559
560ULONG_PTR APIENTRY DrvSaveScreenBits(
561 SURFOBJ *pso,
562 ULONG iMode,
563 ULONG_PTR ident,
564 RECTL *prcl
565 )
566{
567 ULONG_PTR rc = 0; /* 0 means the function failure for every iMode. */
568
569 RECTL rcl;
570 SSB *pSSB;
571
572 SURFOBJ *psoOrg = pso;
573
574 BOOL bCallVBVA = FALSE;
575
576 PPDEV ppdev = (PPDEV)pso->dhpdev;
577
578 DISPDBG((1, "%s: %p, %d, %d, %d,%d %d,%d\n",
579 __FUNCTION__, pso, iMode, ident, prcl->left, prcl->top, prcl->right, prcl->bottom));
580
581 if (!ppdev)
582 {
583 return rc;
584 }
585
586 pso = CONV_SURF(pso);
587
588 /* Order the rectangle. */
589 if (prcl->left <= prcl->right)
590 {
591 rcl.left = prcl->left;
592 rcl.right = prcl->right;
593 }
594 else
595 {
596 rcl.left = prcl->right;
597 rcl.right = prcl->left;
598 }
599
600 if (prcl->top <= prcl->bottom)
601 {
602 rcl.top = prcl->top;
603 rcl.bottom = prcl->bottom;
604 }
605 else
606 {
607 rcl.top = prcl->bottom;
608 rcl.bottom = prcl->top;
609 }
610
611 /* Implementation of the save/restore is a bit complicated because RDP
612 * requires "the sequencing of saves and restores is such that they
613 * behave as a last-in, first-out stack.".
614 */
615 switch (iMode)
616 {
617 case SS_SAVE:
618 {
619 DISPDBG((1, "DrvSaveScreenBits: SS_SAVE %d\n", ppdev->cSSB));
620
621 if (ppdev->cSSB >= RT_ELEMENTS(ppdev->aSSB))
622 {
623 /* All slots are already in use. Fail. */
624 DISPDBG((1, "DrvSaveScreenBits: no more slots %d!!!\n", ppdev->cSSB));
625 break;
626 }
627
628 /* Get pointer to the slot where bits will be saved. */
629 pSSB = &ppdev->aSSB[ppdev->cSSB];
630
631 /* Allocate memory for screen bits and copy them to the buffer. */
632 if (ssbCopy (pSSB, pso, &rcl, FALSE /* bToScreen */))
633 {
634 /* Bits where successfully copied. Increase the active slot number
635 * and call VBVA levels, 'ident' is also assigned, the VBVA level
636 * will use it even for the SS_SAVE.
637 */
638 ident = rc = pSSB->ident = ++ppdev->cSSB;
639 bCallVBVA = TRUE;
640 }
641 } break;
642
643 case SS_RESTORE:
644 {
645 DISPDBG((1, "DrvSaveScreenBits: SS_RESTORE\n"));
646
647 if ( ppdev->cSSB == 0
648 || ident == 0
649 || ident > ppdev->cSSB)
650 {
651 DISPDBG((1, "DrvSaveScreenBits: no slot: ppdev->cSSB = %d!!!\n", ppdev->cSSB));
652 break;
653 }
654
655 if (ident < ppdev->cSSB)
656 {
657 ssbDiscardUpperSlots (ppdev, ident);
658 }
659
660 VBVA_ASSERT(ident == ppdev->cSSB);
661 VBVA_ASSERT(ident != 0);
662
663 pSSB = &ppdev->aSSB[ident - 1];
664
665 ssbCopy (pSSB, pso, &rcl, TRUE /* bToScreen */);
666
667 /* Bits must be discarded. */
668 ssbDiscardTopSlot (ppdev);
669
670 rc = TRUE;
671 bCallVBVA = TRUE;
672 } break;
673
674 case SS_FREE:
675 {
676 DISPDBG((1, "DrvSaveScreenBits: SS_FREE\n"));
677
678 if ( ppdev->cSSB == 0
679 || ident == 0
680 || ident > ppdev->cSSB)
681 {
682 DISPDBG((1, "DrvSaveScreenBits: no slot: ppdev->cSSB = %d!!!\n", ppdev->cSSB));
683 break;
684 }
685
686 if (ident < ppdev->cSSB)
687 {
688 ssbDiscardUpperSlots (ppdev, ident);
689 }
690
691 VBVA_ASSERT(ident == ppdev->cSSB);
692 VBVA_ASSERT(ident != 0);
693
694 /* Bits must be discarded. */
695 ssbDiscardTopSlot (ppdev);
696
697 rc = TRUE;
698 } break;
699 }
700
701 /* Now call the VBVA/VRDP levels. */
702 if (bCallVBVA)
703 {
704 DISPDBG((1, "DrvSaveScreenBits: calling VBVA\n"));
705 VBVA_OPERATION(psoOrg,
706 SaveScreenBits,
707 (psoOrg, iMode, ident, &rcl));
708 }
709
710 DISPDBG((1, "DrvSaveScreenBits: return %d\n", rc));
711 return rc;
712}
713
714BOOL APIENTRY DrvRealizeBrush(
715 BRUSHOBJ *pbo,
716 SURFOBJ *psoTarget,
717 SURFOBJ *psoPattern,
718 SURFOBJ *psoMask,
719 XLATEOBJ *pxlo,
720 ULONG iHatch
721 )
722{
723 BOOL bRc = FALSE;
724
725 DISPDBG((1, "%s\n", __FUNCTION__));
726
727 if (bIsScreenSurface(psoTarget))
728 {
729 PPDEV ppdev = (PPDEV)psoTarget->dhpdev;
730
731 if ( ppdev->pVBVA
732 && (ppdev->pVBVA->hostFlags.u32HostEvents & VBVA_F_MODE_ENABLED))
733 {
734 if (ppdev->pVBVA->hostFlags.u32HostEvents
735 & VBOX_VIDEO_INFO_HOST_EVENTS_F_VRDP_RESET)
736 {
737 vrdpReset (ppdev);
738
739 ppdev->pVBVA->hostFlags.u32HostEvents &=
740 ~VBOX_VIDEO_INFO_HOST_EVENTS_F_VRDP_RESET;
741 }
742
743 if (ppdev->pVBVA->hostFlags.u32HostEvents
744 & VBVA_F_MODE_VRDP)
745 {
746 bRc = vrdpRealizeBrush (pbo, psoTarget, psoPattern, psoMask, pxlo, iHatch);
747 }
748 }
749 }
750
751 return bRc;
752}
753
754#ifdef STAT_sunlover
755ULONG gStatCopyBitsOffscreenToScreen = 0;
756ULONG gStatCopyBitsScreenToScreen = 0;
757ULONG gStatBitBltOffscreenToScreen = 0;
758ULONG gStatBitBltScreenToScreen = 0;
759ULONG gStatUnchangedOffscreenToScreen = 0;
760ULONG gStatUnchangedOffscreenToScreenCRC = 0;
761ULONG gStatNonTransientEngineBitmaps = 0;
762ULONG gStatTransientEngineBitmaps = 0;
763ULONG gStatUnchangedBitmapsCRC = 0;
764ULONG gStatUnchangedBitmapsDeviceCRC = 0;
765ULONG gStatBitmapsCRC = 0;
766ULONG gStatBitBltScreenPattern = 0;
767ULONG gStatBitBltScreenSquare = 0;
768ULONG gStatBitBltScreenPatternReported = 0;
769ULONG gStatBitBltScreenSquareReported = 0;
770ULONG gStatCopyBitsScreenSquare = 0;
771
772ULONG gStatEnablePDEV = 0;
773ULONG gStatCompletePDEV = 0;
774ULONG gStatDisablePDEV = 0;
775ULONG gStatEnableSurface = 0;
776ULONG gStatDisableSurface = 0;
777ULONG gStatAssertMode = 0;
778ULONG gStatDisableDriver = 0;
779ULONG gStatCreateDeviceBitmap = 0;
780ULONG gStatDeleteDeviceBitmap = 0;
781ULONG gStatDitherColor = 0;
782ULONG gStatStrokePath = 0;
783ULONG gStatFillPath = 0;
784ULONG gStatStrokeAndFillPath = 0;
785ULONG gStatPaint = 0;
786ULONG gStatBitBlt = 0;
787ULONG gStatCopyBits = 0;
788ULONG gStatStretchBlt = 0;
789ULONG gStatSetPalette = 0;
790ULONG gStatTextOut = 0;
791ULONG gStatSetPointerShape = 0;
792ULONG gStatMovePointer = 0;
793ULONG gStatLineTo = 0;
794ULONG gStatSynchronize = 0;
795ULONG gStatGetModes = 0;
796ULONG gStatGradientFill = 0;
797ULONG gStatStretchBltROP = 0;
798ULONG gStatPlgBlt = 0;
799ULONG gStatAlphaBlend = 0;
800ULONG gStatTransparentBlt = 0;
801
802void statPrint (void)
803{
804 DISPDBG((0,
805 "BMPSTAT:\n"
806 " gStatCopyBitsOffscreenToScreen = %u\n"
807 " gStatCopyBitsScreenToScreen = %u\n"
808 " gStatBitBltOffscreenToScreen = %u\n"
809 " gStatBitBltScreenToScreen = %u\n"
810 " gStatUnchangedOffscreenToScreen = %u\n"
811 " gStatUnchangedOffscreenToScreenCRC = %u\n"
812 " gStatNonTransientEngineBitmaps = %u\n"
813 " gStatTransientEngineBitmaps = %u\n"
814 " gStatUnchangedBitmapsCRC = %u\n"
815 " gStatUnchangedBitmapsDeviceCRC = %u\n"
816 " gStatBitmapsCRC = %u\n"
817 " gStatBitBltScreenPattern = %u\n"
818 " gStatBitBltScreenSquare = %u\n"
819 " gStatBitBltScreenPatternReported = %u\n"
820 " gStatBitBltScreenSquareReported = %u\n"
821 " gStatCopyBitsScreenSquare = %u\n"
822 "\n"
823 " gStatEnablePDEV = %u\n"
824 " gStatCompletePDEV = %u\n"
825 " gStatDisablePDEV = %u\n"
826 " gStatEnableSurface = %u\n"
827 " gStatDisableSurface = %u\n"
828 " gStatAssertMode = %u\n"
829 " gStatDisableDriver = %u\n"
830 " gStatCreateDeviceBitmap = %u\n"
831 " gStatDeleteDeviceBitmap = %u\n"
832 " gStatDitherColor = %u\n"
833 " gStatStrokePath = %u\n"
834 " gStatFillPath = %u\n"
835 " gStatStrokeAndFillPath = %u\n"
836 " gStatPaint = %u\n"
837 " gStatBitBlt = %u\n"
838 " gStatCopyBits = %u\n"
839 " gStatStretchBlt = %u\n"
840 " gStatSetPalette = %u\n"
841 " gStatTextOut = %u\n"
842 " gStatSetPointerShape = %u\n"
843 " gStatMovePointer = %u\n"
844 " gStatLineTo = %u\n"
845 " gStatSynchronize = %u\n"
846 " gStatGetModes = %u\n"
847 " gStatGradientFill = %u\n"
848 " gStatStretchBltROP = %u\n"
849 " gStatPlgBlt = %u\n"
850 " gStatAlphaBlend = %u\n"
851 " gStatTransparentBlt = %u\n",
852 gStatCopyBitsOffscreenToScreen,
853 gStatCopyBitsScreenToScreen,
854 gStatBitBltOffscreenToScreen,
855 gStatBitBltScreenToScreen,
856 gStatUnchangedOffscreenToScreen,
857 gStatUnchangedOffscreenToScreenCRC,
858 gStatNonTransientEngineBitmaps,
859 gStatTransientEngineBitmaps,
860 gStatUnchangedBitmapsCRC,
861 gStatUnchangedBitmapsDeviceCRC,
862 gStatBitmapsCRC,
863 gStatBitBltScreenPattern,
864 gStatBitBltScreenSquare,
865 gStatBitBltScreenPatternReported,
866 gStatBitBltScreenSquareReported,
867 gStatCopyBitsScreenSquare,
868 gStatEnablePDEV,
869 gStatCompletePDEV,
870 gStatDisablePDEV,
871 gStatEnableSurface,
872 gStatDisableSurface,
873 gStatAssertMode,
874 gStatDisableDriver,
875 gStatCreateDeviceBitmap,
876 gStatDeleteDeviceBitmap,
877 gStatDitherColor,
878 gStatStrokePath,
879 gStatFillPath,
880 gStatStrokeAndFillPath,
881 gStatPaint,
882 gStatBitBlt,
883 gStatCopyBits,
884 gStatStretchBlt,
885 gStatSetPalette,
886 gStatTextOut,
887 gStatSetPointerShape,
888 gStatMovePointer,
889 gStatLineTo,
890 gStatSynchronize,
891 gStatGetModes,
892 gStatGradientFill,
893 gStatStretchBltROP,
894 gStatPlgBlt,
895 gStatAlphaBlend,
896 gStatTransparentBlt
897 ));
898}
899#endif /* STAT_sunlover */
900
Note: See TracBrowser for help on using the repository browser.

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