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