1 | /* $Id: VBoxMPUtils.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Miniport common utils 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_mp_common_VBoxMPUtils_h
|
---|
29 | #define GA_INCLUDED_SRC_WINNT_Graphics_Video_mp_common_VBoxMPUtils_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /*Sanity check*/
|
---|
35 | #if defined(VBOX_XPDM_MINIPORT) == defined(VBOX_WDDM_MINIPORT)
|
---|
36 | # error One of the VBOX_XPDM_MINIPORT or VBOX_WDDM_MINIPORT should be defined!
|
---|
37 | #endif
|
---|
38 |
|
---|
39 | #include <iprt/cdefs.h>
|
---|
40 | #define LOG_GROUP LOG_GROUP_DRV_MINIPORT
|
---|
41 | #include <VBox/log.h>
|
---|
42 |
|
---|
43 | #define VBOX_VIDEO_LOG_NAME "VBoxMP"
|
---|
44 | #ifdef VBOX_WDDM_MINIPORT
|
---|
45 | # ifndef VBOX_WDDM_MINIPORT_WITH_FLOW_LOGGING
|
---|
46 | # define VBOX_VIDEO_LOGFLOW_LOGGER(_m) do {} while (0)
|
---|
47 | # endif
|
---|
48 | #endif
|
---|
49 | #include "common/VBoxVideoLog.h"
|
---|
50 |
|
---|
51 | #include <iprt/err.h>
|
---|
52 | #include <iprt/assert.h>
|
---|
53 |
|
---|
54 | #ifdef VBOX_XPDM_MINIPORT
|
---|
55 | # include <dderror.h>
|
---|
56 | # include <devioctl.h>
|
---|
57 | #else
|
---|
58 | # undef PAGE_SIZE
|
---|
59 | # undef PAGE_SHIFT
|
---|
60 | # include <iprt/nt/ntddk.h>
|
---|
61 | # include <iprt/nt/dispmprt.h>
|
---|
62 | # include <ntddvdeo.h>
|
---|
63 | # include <dderror.h>
|
---|
64 | #endif
|
---|
65 |
|
---|
66 |
|
---|
67 |
|
---|
68 | /*Windows version identifier*/
|
---|
69 | typedef enum
|
---|
70 | {
|
---|
71 | WINVERSION_UNKNOWN = 0,
|
---|
72 | WINVERSION_NT4 = 1,
|
---|
73 | WINVERSION_2K = 2,
|
---|
74 | WINVERSION_XP = 3,
|
---|
75 | WINVERSION_VISTA = 4,
|
---|
76 | WINVERSION_7 = 5,
|
---|
77 | WINVERSION_8 = 6,
|
---|
78 | WINVERSION_81 = 7,
|
---|
79 | WINVERSION_10 = 8
|
---|
80 | } vboxWinVersion_t;
|
---|
81 |
|
---|
82 | RT_C_DECLS_BEGIN
|
---|
83 | vboxWinVersion_t VBoxQueryWinVersion(uint32_t *pbuild);
|
---|
84 | uint32_t VBoxGetHeightReduction(void);
|
---|
85 | bool VBoxLikesVideoMode(uint32_t display, uint32_t width, uint32_t height, uint32_t bpp);
|
---|
86 | bool VBoxQueryDisplayRequest(uint32_t *xres, uint32_t *yres, uint32_t *bpp, uint32_t *pDisplayId);
|
---|
87 | bool VBoxQueryHostWantsAbsolute(void);
|
---|
88 | bool VBoxQueryPointerPos(uint16_t *pPosX, uint16_t *pPosY);
|
---|
89 | RT_C_DECLS_END
|
---|
90 |
|
---|
91 |
|
---|
92 | #define VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES (4*_1M)
|
---|
93 |
|
---|
94 | #define VBOXMP_WARN_VPS_NOBP(_vps) \
|
---|
95 | if ((_vps) != NO_ERROR) \
|
---|
96 | { \
|
---|
97 | WARN_NOBP(("vps(%#x)!=NO_ERROR", _vps)); \
|
---|
98 | } else do { } while (0)
|
---|
99 |
|
---|
100 | #define VBOXMP_WARN_VPS(_vps) \
|
---|
101 | if ((_vps) != NO_ERROR) \
|
---|
102 | { \
|
---|
103 | WARN(("vps(%#x)!=NO_ERROR", _vps)); \
|
---|
104 | } else do { } while (0)
|
---|
105 |
|
---|
106 |
|
---|
107 | #define VBOXMP_CHECK_VPS_BREAK(_vps) \
|
---|
108 | if ((_vps) != NO_ERROR) \
|
---|
109 | { \
|
---|
110 | break; \
|
---|
111 | } else do { } while (0)
|
---|
112 |
|
---|
113 |
|
---|
114 | #ifdef DEBUG_misha
|
---|
115 | /* specifies whether the vboxVDbgBreakF should break in the debugger
|
---|
116 | * windbg seems to have some issues when there is a lot ( >~50) of sw breakpoints defined
|
---|
117 | * to simplify things we just insert breaks for the case of intensive debugging WDDM driver*/
|
---|
118 | extern int g_bVBoxVDbgBreakF;
|
---|
119 | extern int g_bVBoxVDbgBreakFv;
|
---|
120 | # define vboxVDbgBreakF() do { if (g_bVBoxVDbgBreakF) AssertBreakpoint(); } while (0)
|
---|
121 | # define vboxVDbgBreakFv() do { if (g_bVBoxVDbgBreakFv) AssertBreakpoint(); } while (0)
|
---|
122 | #else
|
---|
123 | # define vboxVDbgBreakF() do { } while (0)
|
---|
124 | # define vboxVDbgBreakFv() do { } while (0)
|
---|
125 | #endif
|
---|
126 |
|
---|
127 | #endif /* !GA_INCLUDED_SRC_WINNT_Graphics_Video_mp_common_VBoxMPUtils_h */
|
---|
128 |
|
---|