VirtualBox

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

Last change on this file since 75495 was 72611, checked in by vboxsync, 6 years ago

WDDM/VBoxTray: bugref:8444, applying mode hints to all displays at once, Vista version

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