VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPUtils.h@ 46876

Last change on this file since 46876 was 46876, checked in by vboxsync, 12 years ago

added Win8.1 OS type

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.6 KB
Line 
1/* $Id: VBoxMPUtils.h 46876 2013-07-01 10:09:35Z vboxsync $ */
2/** @file
3 * VBox Miniport common utils header
4 */
5
6/*
7 * Copyright (C) 2011-2012 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 VBOXMPUTILS_H
19#define VBOXMPUTILS_H
20
21/*Sanity check*/
22#if defined(VBOX_XPDM_MINIPORT)==defined(VBOX_WDDM_MINIPORT)
23#error One of the VBOX_XPDM_MINIPORT or VBOX_WDDM_MINIPORT should be defined!
24#endif
25
26#include <iprt/cdefs.h>
27#define LOG_GROUP LOG_GROUP_DRV_MINIPORT
28#include <VBox/log.h>
29#define VBOX_VIDEO_LOG_NAME "VBoxMP"
30#ifdef VBOX_WDDM_MINIPORT
31# ifndef VBOX_WDDM_MINIPORT_WITH_FLOW_LOGGING
32# define VBOX_VIDEO_LOGFLOW_LOGGER(_m) do {} while (0)
33# endif
34#endif
35#include "common/VBoxVideoLog.h"
36#include <iprt/err.h>
37#include <iprt/assert.h>
38
39RT_C_DECLS_BEGIN
40#ifdef VBOX_XPDM_MINIPORT
41# include <dderror.h>
42# include <devioctl.h>
43#else
44# ifdef PAGE_SIZE
45# undef PAGE_SIZE
46# endif
47# ifdef PAGE_SHIFT
48# undef PAGE_SHIFT
49# endif
50# define VBOX_WITH_WORKAROUND_MISSING_PACK
51# if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK)
52# define _InterlockedExchange _InterlockedExchange_StupidDDKVsCompilerCrap
53# define _InterlockedExchangeAdd _InterlockedExchangeAdd_StupidDDKVsCompilerCrap
54# define _InterlockedCompareExchange _InterlockedCompareExchange_StupidDDKVsCompilerCrap
55# define _InterlockedAddLargeStatistic _InterlockedAddLargeStatistic_StupidDDKVsCompilerCrap
56# define _interlockedbittestandset _interlockedbittestandset_StupidDDKVsCompilerCrap
57# define _interlockedbittestandreset _interlockedbittestandreset_StupidDDKVsCompilerCrap
58# define _interlockedbittestandset64 _interlockedbittestandset64_StupidDDKVsCompilerCrap
59# define _interlockedbittestandreset64 _interlockedbittestandreset64_StupidDDKVsCompilerCrap
60# pragma warning(disable : 4163)
61# ifdef VBOX_WITH_WORKAROUND_MISSING_PACK
62# pragma warning(disable : 4103)
63# endif
64# include <ntddk.h>
65# pragma warning(default : 4163)
66# ifdef VBOX_WITH_WORKAROUND_MISSING_PACK
67# pragma pack()
68# pragma warning(default : 4103)
69# endif
70# undef _InterlockedExchange
71# undef _InterlockedExchangeAdd
72# undef _InterlockedCompareExchange
73# undef _InterlockedAddLargeStatistic
74# undef _interlockedbittestandset
75# undef _interlockedbittestandreset
76# undef _interlockedbittestandset64
77# undef _interlockedbittestandreset64
78# else
79# include <ntddk.h>
80# endif
81# include <dispmprt.h>
82# include <ntddvdeo.h>
83# include <dderror.h>
84#endif
85RT_C_DECLS_END
86
87/*Windows version identifier*/
88typedef enum
89{
90 UNKNOWN_WINVERSION = 0,
91 WINNT4 = 1,
92 WIN2K = 2,
93 WINXP = 3,
94 WINVISTA = 4,
95 WIN7 = 5,
96 WIN8 = 6,
97 WIN81 = 7
98} vboxWinVersion_t;
99
100RT_C_DECLS_BEGIN
101vboxWinVersion_t VBoxQueryWinVersion();
102uint32_t VBoxGetHeightReduction();
103bool VBoxLikesVideoMode(uint32_t display, uint32_t width, uint32_t height, uint32_t bpp);
104bool VBoxQueryDisplayRequest(uint32_t *xres, uint32_t *yres, uint32_t *bpp, uint32_t *pDisplayId);
105bool VBoxQueryHostWantsAbsolute();
106bool VBoxQueryPointerPos(uint16_t *pPosX, uint16_t *pPosY);
107RT_C_DECLS_END
108
109#define VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES 4*_1M
110
111#define VBOXMP_WARN_VPS_NOBP(_vps) \
112if ((_vps) != NO_ERROR) \
113{ \
114 WARN_NOBP(("vps(%#x)!=NO_ERROR", _vps)); \
115}
116
117#define VBOXMP_WARN_VPS(_vps) \
118if ((_vps) != NO_ERROR) \
119{ \
120 WARN(("vps(%#x)!=NO_ERROR", _vps)); \
121}
122
123
124#define VBOXMP_CHECK_VPS_BREAK(_vps) \
125if ((_vps) != NO_ERROR) \
126{ \
127 break; \
128}
129
130#ifdef DEBUG_misha
131/* specifies whether the vboxVDbgBreakF should break in the debugger
132 * windbg seems to have some issues when there is a lot ( >~50) of sw breakpoints defined
133 * to simplify things we just insert breaks for the case of intensive debugging WDDM driver*/
134extern int g_bVBoxVDbgBreakF;
135extern int g_bVBoxVDbgBreakFv;
136#define vboxVDbgBreakF() do { if (g_bVBoxVDbgBreakF) AssertBreakpoint(); } while (0)
137#define vboxVDbgBreakFv() do { if (g_bVBoxVDbgBreakFv) AssertBreakpoint(); } while (0)
138#else
139#define vboxVDbgBreakF() do { } while (0)
140#define vboxVDbgBreakFv() do { } while (0)
141#endif
142
143#endif /*VBOXMPUTILS_H*/
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette