VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/xpdm/VBoxDispInternal.h@ 100010

Last change on this file since 100010 was 99828, checked in by vboxsync, 21 months ago

*: A bunch of adjustments that allows using /permissive- with Visual C++ (qt 6.x necessity).

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