VirtualBox

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

Last change on this file since 40897 was 38765, checked in by vboxsync, 14 years ago

more Windows 8 fixes

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