VirtualBox

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

Last change on this file since 35319 was 34439, checked in by vboxsync, 14 years ago

Additions/WINNT/Graphics: white space adjustments

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