VirtualBox

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

Last change on this file since 51556 was 48732, checked in by vboxsync, 11 years ago

fix seamless for wddm display only case

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.3 KB
Line 
1/** @file
2 * VBoxTray - Display Settings Interface abstraction for XPDM & WDDM
3 */
4
5/*
6 * Copyright (C) 2006-2012 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#ifdef VBOX_WITH_WDDM
19# define D3DKMDT_SPECIAL_MULTIPLATFORM_TOOL
20# include <d3dkmthk.h>
21# include "../Graphics/Video/disp/wddm/VBoxDispKmt.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 , VBOXDISPIF_MODE_WDDM_W7
34#endif
35} VBOXDISPIF_MODE;
36/* display driver interface abstraction for XPDM & WDDM
37 * with WDDM we can not use ExtEscape to communicate with our driver
38 * because we do not have XPDM display driver any more, i.e. escape requests are handled by cdd
39 * that knows nothing about us
40 * NOTE: DispIf makes no checks whether the display driver is actually a VBox driver,
41 * it just switches between using different backend OS API based on the VBoxDispIfSwitchMode call
42 * It's caller's responsibility to initiate it to work in the correct mode */
43typedef struct VBOXDISPIF
44{
45 VBOXDISPIF_MODE enmMode;
46 /* with WDDM the approach is to call into WDDM miniport driver via PFND3DKMT API provided by the GDI,
47 * The PFND3DKMT is supposed to be used by the OpenGL ICD according to MSDN, so this approach is a bit hacky */
48 union
49 {
50 struct
51 {
52 LONG (WINAPI * pfnChangeDisplaySettingsEx)(LPCSTR lpszDeviceName, LPDEVMODE lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam);
53 } xpdm;
54#ifdef VBOX_WITH_WDDM
55 struct
56 {
57 /* ChangeDisplaySettingsEx does not exist in NT. ResizeDisplayDevice uses the function. */
58 LONG (WINAPI * pfnChangeDisplaySettingsEx)(LPCTSTR lpszDeviceName, LPDEVMODE lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam);
59
60 /* EnumDisplayDevices does not exist in NT. isVBoxDisplayDriverActive et al. are using these functions. */
61 BOOL (WINAPI * pfnEnumDisplayDevices)(IN LPCSTR lpDevice, IN DWORD iDevNum, OUT PDISPLAY_DEVICEA lpDisplayDevice, IN DWORD dwFlags);
62
63 VBOXDISPKMT_CALLBACKS KmtCallbacks;
64 } wddm;
65#endif
66 } modeData;
67} VBOXDISPIF, *PVBOXDISPIF;
68typedef const struct VBOXDISPIF *PCVBOXDISPIF;
69
70/* initializes the DispIf
71 * Initially the DispIf is configured to work in XPDM mode
72 * call VBoxDispIfSwitchMode to switch the mode to WDDM */
73DWORD VBoxDispIfInit(PVBOXDISPIF pIf);
74DWORD VBoxDispIfSwitchMode(PVBOXDISPIF pIf, VBOXDISPIF_MODE enmMode, VBOXDISPIF_MODE *penmOldMode);
75DECLINLINE(VBOXDISPIF_MODE) VBoxDispGetMode(PVBOXDISPIF pIf) { return pIf->enmMode; }
76DWORD VBoxDispIfTerm(PVBOXDISPIF pIf);
77DWORD VBoxDispIfEscape(PCVBOXDISPIF const pIf, PVBOXDISPIFESCAPE pEscape, int cbData);
78DWORD VBoxDispIfEscapeInOut(PCVBOXDISPIF const pIf, PVBOXDISPIFESCAPE pEscape, int cbData);
79DWORD VBoxDispIfResizeModes(PCVBOXDISPIF const pIf, UINT iChangedMode, BOOL fEnable, BOOL fExtDispSup, DISPLAY_DEVICE *paDisplayDevices, DEVMODE *paDeviceModes, UINT cDevModes);
80DWORD VBoxDispIfCancelPendingResize(PCVBOXDISPIF const pIf);
81
82DWORD VBoxDispIfResizeStarted(PCVBOXDISPIF const pIf);
83
84
85typedef struct VBOXDISPIF_SEAMLESS
86{
87 PCVBOXDISPIF pIf;
88
89 union
90 {
91#ifdef VBOX_WITH_WDDM
92 struct
93 {
94 VBOXDISPKMT_ADAPTER Adapter;
95# ifdef VBOX_DISPIF_WITH_OPCONTEXT
96 VBOXDISPKMT_DEVICE Device;
97 VBOXDISPKMT_CONTEXT Context;
98# endif
99 } wddm;
100#endif
101 } modeData;
102} VBOXDISPIF_SEAMLESS;
103
104DECLINLINE(bool) VBoxDispIfSeamlesIsValid(VBOXDISPIF_SEAMLESS *pSeamless)
105{
106 return !!pSeamless->pIf;
107}
108
109DWORD VBoxDispIfSeamlesCreate(PCVBOXDISPIF const pIf, VBOXDISPIF_SEAMLESS *pSeamless, HANDLE hEvent);
110DWORD VBoxDispIfSeamlesTerm(VBOXDISPIF_SEAMLESS *pSeamless);
111DWORD VBoxDispIfSeamlesSubmit(VBOXDISPIF_SEAMLESS *pSeamless, VBOXDISPIFESCAPE *pData, int cbData);
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