VirtualBox

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

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

Additions: Use GA_INCLUDED_ and variations_ as header guard prefixes with scm.

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