1 | /* $Id: VBoxDispInternal.h 36867 2011-04-28 07:27:03Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | * VBox XPDM Display driver, internal header
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2011 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef VBOXDISPINTERNAL_H
|
---|
20 | #define VBOXDISPINTERNAL_H
|
---|
21 |
|
---|
22 | #include <iprt/cdefs.h>
|
---|
23 | #define LOG_GROUP LOG_GROUP_DRV_DISPLAY
|
---|
24 | #include <VBox/log.h>
|
---|
25 | #include <iprt/err.h>
|
---|
26 | #include <iprt/assert.h>
|
---|
27 | #include <windef.h>
|
---|
28 | #include <wingdi.h>
|
---|
29 | #include <winddi.h>
|
---|
30 | #include <ntddvdeo.h>
|
---|
31 | #undef CO_E_NOTINITIALIZED
|
---|
32 | #include <winerror.h>
|
---|
33 | #include <devioctl.h>
|
---|
34 | #define VBOX_VIDEO_LOG_NAME "VBoxDisp"
|
---|
35 | #include "common/VBoxVideoLog.h"
|
---|
36 | #include "common/xpdm/VBoxVideoPortAPI.h"
|
---|
37 | #include "common/xpdm/VBoxVideoIOCTL.h"
|
---|
38 | #include <VBox/HGSMI/HGSMI.h>
|
---|
39 | #include <VBox/VBoxVideo.h>
|
---|
40 | #include <VBox/VBoxVideoGuest.h>
|
---|
41 | #include <VBoxDisplay.h>
|
---|
42 |
|
---|
43 | typedef struct _VBOXDISPDEV *PVBOXDISPDEV;
|
---|
44 |
|
---|
45 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
46 | # include "VBoxDispVHWA.h"
|
---|
47 | #endif
|
---|
48 |
|
---|
49 | /* 4bytes tag passed to EngAllocMem.
|
---|
50 | * Note: chars are reverse order.
|
---|
51 | */
|
---|
52 | #define MEM_ALLOC_TAG 'bvDD'
|
---|
53 |
|
---|
54 | /* Helper macros */
|
---|
55 | #define VBOX_WARN_WINERR(_winerr) \
|
---|
56 | do { \
|
---|
57 | if ((_winerr) != NO_ERROR) \
|
---|
58 | { \
|
---|
59 | WARN(("winerr(%#x)!=NO_ERROR", _winerr)); \
|
---|
60 | } \
|
---|
61 | } while (0)
|
---|
62 |
|
---|
63 | #define VBOX_CHECK_WINERR_RETRC(_winerr, _rc) \
|
---|
64 | do { \
|
---|
65 | if ((_winerr) != NO_ERROR) \
|
---|
66 | { \
|
---|
67 | WARN(("winerr(%#x)!=NO_ERROR", _winerr)); \
|
---|
68 | return (_rc); \
|
---|
69 | } \
|
---|
70 | } while (0)
|
---|
71 |
|
---|
72 | #define VBOX_WARNRC_RETV(_rc, _ret) \
|
---|
73 | do { \
|
---|
74 | if (RT_FAILURE(_rc)) \
|
---|
75 | { \
|
---|
76 | WARN(("RT_FAILURE rc(%#x)", _rc)); \
|
---|
77 | return (_ret); \
|
---|
78 | } \
|
---|
79 | } while (0)
|
---|
80 |
|
---|
81 | #define VBOX_WARNRC_RETRC(_rc) VBOX_WARNRC_RETV(_rc, _rc)
|
---|
82 |
|
---|
83 | #define VBOX_WARNRC(_rc) \
|
---|
84 | do { \
|
---|
85 | if (RT_FAILURE(_rc)) \
|
---|
86 | { \
|
---|
87 | WARN(("RT_FAILURE rc(%#x)", _rc)); \
|
---|
88 | } \
|
---|
89 | } while (0)
|
---|
90 |
|
---|
91 | #define VBOX_WARN_IOCTLCB_RETRC(_ioctl, _cbreturned, _cbexpected, _rc) \
|
---|
92 | do { \
|
---|
93 | if ((_cbreturned)!=(_cbexpected)) \
|
---|
94 | { \
|
---|
95 | WARN((_ioctl " returned %d, expected %d bytes!", _cbreturned, _cbexpected)); \
|
---|
96 | return (_rc); \
|
---|
97 | } \
|
---|
98 | } while (0)
|
---|
99 |
|
---|
100 | #define abs(_v) ( ((_v)>0) ? (_v) : (-(_v)) )
|
---|
101 |
|
---|
102 | typedef struct _CLIPRECTS {
|
---|
103 | ULONG c;
|
---|
104 | RECTL arcl[64];
|
---|
105 | } CLIPRECTS;
|
---|
106 |
|
---|
107 | typedef struct _VRDPCLIPRECTS
|
---|
108 | {
|
---|
109 | RECTL rclDstOrig; /* Original bounding rectangle. */
|
---|
110 | RECTL rclDst; /* Bounding rectangle of all rects. */
|
---|
111 | CLIPRECTS rects; /* Rectangles to update. */
|
---|
112 | } VRDPCLIPRECTS;
|
---|
113 |
|
---|
114 | /* Mouse pointer related functions */
|
---|
115 | int VBoxDispInitPointerCaps(PVBOXDISPDEV pDev, DEVINFO *pDevInfo);
|
---|
116 | int VBoxDispInitPointerAttrs(PVBOXDISPDEV pDev);
|
---|
117 |
|
---|
118 | /* Palette related functions */
|
---|
119 | int VBoxDispInitPalette(PVBOXDISPDEV pDev, DEVINFO *pDevInfo);
|
---|
120 | void VBoxDispDestroyPalette(PVBOXDISPDEV pDev);
|
---|
121 | int VBoxDispSetPalette8BPP(PVBOXDISPDEV pDev);
|
---|
122 |
|
---|
123 | /* VBVA related */
|
---|
124 | int VBoxDispVBVAInit(PVBOXDISPDEV pDev);
|
---|
125 | void VBoxDispVBVAHostCommandComplete(PVBOXDISPDEV pDev, VBVAHOSTCMD *pCmd);
|
---|
126 |
|
---|
127 | void vrdpReportDirtyRect(PVBOXDISPDEV pDev, RECTL *prcl);
|
---|
128 | void vbvaReportDirtyRect(PVBOXDISPDEV pDev, RECTL *prcl);
|
---|
129 |
|
---|
130 | #ifdef VBOX_VBVA_ADJUST_RECT
|
---|
131 | void vrdpAdjustRect (SURFOBJ *pso, RECTL *prcl);
|
---|
132 | BOOL vbvaFindChangedRect(SURFOBJ *psoDest, SURFOBJ *psoSrc, RECTL *prclDest, POINTL *pptlSrc);
|
---|
133 | #endif /* VBOX_VBVA_ADJUST_RECT */
|
---|
134 |
|
---|
135 | #define VRDP_TEXT_MAX_GLYPH_SIZE 0x100
|
---|
136 | #define VRDP_TEXT_MAX_GLYPHS 0xfe
|
---|
137 | BOOL vrdpReportText(PVBOXDISPDEV pDev, VRDPCLIPRECTS *pClipRects, STROBJ *pstro, FONTOBJ *pfo,
|
---|
138 | RECTL *prclOpaque, ULONG ulForeRGB, ULONG ulBackRGB);
|
---|
139 |
|
---|
140 | BOOL vrdpReportOrderGeneric(PVBOXDISPDEV pDev, const VRDPCLIPRECTS *pClipRects,
|
---|
141 | const void *pvOrder, unsigned cbOrder, unsigned code);
|
---|
142 |
|
---|
143 | BOOL VBoxDispIsScreenSurface(SURFOBJ *pso);
|
---|
144 | void VBoxDispDumpPSO(SURFOBJ *pso, char *s);
|
---|
145 |
|
---|
146 | BOOL vrdpDrvRealizeBrush(BRUSHOBJ *pbo, SURFOBJ *psoTarget, SURFOBJ *psoPattern, SURFOBJ *psoMask,
|
---|
147 | XLATEOBJ *pxlo, ULONG iHatch);
|
---|
148 | void vrdpReset(PVBOXDISPDEV pDev);
|
---|
149 |
|
---|
150 | DECLINLINE(int) format2BytesPerPixel(const SURFOBJ *pso)
|
---|
151 | {
|
---|
152 | switch (pso->iBitmapFormat)
|
---|
153 | {
|
---|
154 | case BMF_16BPP: return 2;
|
---|
155 | case BMF_24BPP: return 3;
|
---|
156 | case BMF_32BPP: return 4;
|
---|
157 | }
|
---|
158 |
|
---|
159 | return 0;
|
---|
160 | }
|
---|
161 |
|
---|
162 | #endif /*VBOXDISPINTERNAL_H*/
|
---|