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