VirtualBox

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

Last change on this file since 69500 was 69500, checked in by vboxsync, 7 years ago

*: scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 KB
Line 
1/* $Id: VBoxDispIf.h 69500 2017-10-28 15:14:05Z 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
84typedef struct VBOXDISPIF_SEAMLESS
85{
86 PCVBOXDISPIF pIf;
87
88 union
89 {
90#ifdef VBOX_WITH_WDDM
91 struct
92 {
93 VBOXDISPKMT_ADAPTER Adapter;
94# ifdef VBOX_DISPIF_WITH_OPCONTEXT
95 VBOXDISPKMT_DEVICE Device;
96 VBOXDISPKMT_CONTEXT Context;
97# endif
98 } wddm;
99#endif
100 } modeData;
101} VBOXDISPIF_SEAMLESS;
102
103DECLINLINE(bool) VBoxDispIfSeamlesIsValid(VBOXDISPIF_SEAMLESS *pSeamless)
104{
105 return !!pSeamless->pIf;
106}
107
108DWORD VBoxDispIfSeamlessCreate(PCVBOXDISPIF const pIf, VBOXDISPIF_SEAMLESS *pSeamless, HANDLE hEvent);
109DWORD VBoxDispIfSeamlessTerm(VBOXDISPIF_SEAMLESS *pSeamless);
110DWORD VBoxDispIfSeamlessSubmit(VBOXDISPIF_SEAMLESS *pSeamless, VBOXDISPIFESCAPE *pData, int cbData);
111
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