VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDispIf.h@ 42154

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

VS2010 preps.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1/** @file
2 * VBoxTray - Display Settings Interface abstraction for XPDM & WDDM
3 */
4
5/*
6 * Copyright (C) 2006-2010 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 */
16#include <iprt/cdefs.h>
17
18#include <windows.h>
19#ifdef VBOX_WITH_WDDM
20# define D3DKMDT_SPECIAL_MULTIPLATFORM_TOOL
21# include <d3dkmthk.h>
22#endif
23
24#include <VBoxDisplay.h>
25
26typedef enum
27{
28 VBOXDISPIF_MODE_UNKNOWN = 0,
29 VBOXDISPIF_MODE_XPDM_NT4 = 1,
30 VBOXDISPIF_MODE_XPDM
31#ifdef VBOX_WITH_WDDM
32 , VBOXDISPIF_MODE_WDDM
33#endif
34} VBOXDISPIF_MODE;
35/* display driver interface abstraction for XPDM & WDDM
36 * with WDDM we can not use ExtEscape to communicate with our driver
37 * because we do not have XPDM display driver any more, i.e. escape requests are handled by cdd
38 * that knows nothing about us
39 * NOTE: DispIf makes no checks whether the display driver is actually a VBox driver,
40 * it just switches between using different backend OS API based on the VBoxDispIfSwitchMode call
41 * It's caller's responsibility to initiate it to work in the correct mode */
42typedef struct VBOXDISPIF
43{
44 VBOXDISPIF_MODE enmMode;
45 /* with WDDM the approach is to call into WDDM miniport driver via PFND3DKMT API provided by the GDI,
46 * The PFND3DKMT is supposed to be used by the OpenGL ICD according to MSDN, so this approach is a bit hacky */
47 union
48 {
49 struct
50 {
51 LONG (WINAPI * pfnChangeDisplaySettingsEx)(LPCSTR lpszDeviceName, LPDEVMODE lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam);
52 } xpdm;
53#ifdef VBOX_WITH_WDDM
54 struct
55 {
56 /* ChangeDisplaySettingsEx does not exist in NT. ResizeDisplayDevice uses the function. */
57 LONG (WINAPI * pfnChangeDisplaySettingsEx)(LPCTSTR lpszDeviceName, LPDEVMODE lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam);
58
59 /* EnumDisplayDevices does not exist in NT. isVBoxDisplayDriverActive et al. are using these functions. */
60 BOOL (WINAPI * pfnEnumDisplayDevices)(IN LPCSTR lpDevice, IN DWORD iDevNum, OUT PDISPLAY_DEVICEA lpDisplayDevice, IN DWORD dwFlags);
61
62 /* open adapter */
63 PFND3DKMT_OPENADAPTERFROMHDC pfnD3DKMTOpenAdapterFromHdc;
64 PFND3DKMT_OPENADAPTERFROMGDIDISPLAYNAME pfnD3DKMTOpenAdapterFromGdiDisplayName;
65 /* close adapter */
66 PFND3DKMT_CLOSEADAPTER pfnD3DKMTCloseAdapter;
67 /* escape */
68 PFND3DKMT_ESCAPE pfnD3DKMTEscape;
69 /* auto resize support */
70 PFND3DKMT_INVALIDATEACTIVEVIDPN pfnD3DKMTInvalidateActiveVidPn;
71 } wddm;
72#endif
73 } modeData;
74} VBOXDISPIF, *PVBOXDISPIF;
75typedef const struct VBOXDISPIF *PCVBOXDISPIF;
76
77/* initializes the DispIf
78 * Initially the DispIf is configured to work in XPDM mode
79 * call VBoxDispIfSwitchMode to switch the mode to WDDM */
80DWORD VBoxDispIfInit(PVBOXDISPIF pIf);
81DWORD VBoxDispIfSwitchMode(PVBOXDISPIF pIf, VBOXDISPIF_MODE enmMode, VBOXDISPIF_MODE *penmOldMode);
82DECLINLINE(VBOXDISPIF_MODE) VBoxDispGetMode(PVBOXDISPIF pIf) { return pIf->enmMode; }
83DWORD VBoxDispIfTerm(PVBOXDISPIF pIf);
84DWORD VBoxDispIfEscape(PCVBOXDISPIF const pIf, PVBOXDISPIFESCAPE pEscape, int cbData);
85DWORD VBoxDispIfResize(PCVBOXDISPIF const pIf, ULONG Id, DWORD Width, DWORD Height, DWORD BitsPerPixel);
86DWORD VBoxDispIfResizeModes(PCVBOXDISPIF const pIf, DISPLAY_DEVICE *paDisplayDevices, DEVMODE *paDeviceModes, UINT cDevModes);
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