VirtualBox

source: vbox/trunk/src/VBox/Main/include/DisplayImpl.h@ 2463

Last change on this file since 2463 was 2463, checked in by vboxsync, 18 years ago

Main & All Frontends: Prototyped a bunch of Main API changes (IVirtualBoxErrorInfo extension for cascading errors; IMachine/IConsoleCallback extension to properly activate the console window; IVirtualBoxCallback::onExtraDataCanChange() support for error messages; minor IHost::createUSBDeviceFilter/removeUSBDeviceFilter corrections).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.5 KB
Line 
1/** @file
2 *
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006 InnoTek Systemberatung GmbH
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 as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * If you received this file as part of a commercial VirtualBox
18 * distribution, then only the terms of your commercial VirtualBox
19 * license agreement apply instead of the previous paragraph.
20 */
21
22#ifndef ____H_DISPLAYIMPL
23#define ____H_DISPLAYIMPL
24
25#include "VirtualBoxBase.h"
26#include <iprt/semaphore.h>
27#include <VBox/pdm.h>
28#include <VBox/VBoxGuest.h>
29
30class Console;
31
32class ATL_NO_VTABLE Display :
33 public IConsoleCallback,
34 public VirtualBoxSupportErrorInfoImpl <Display, IDisplay>,
35 public VirtualBoxSupportTranslation <Display>,
36 public VirtualBoxBase,
37 public IDisplay
38{
39
40public:
41
42 DECLARE_NOT_AGGREGATABLE(Display)
43
44 DECLARE_PROTECT_FINAL_CONSTRUCT()
45
46 BEGIN_COM_MAP(Display)
47 COM_INTERFACE_ENTRY(ISupportErrorInfo)
48 COM_INTERFACE_ENTRY(IDisplay)
49 END_COM_MAP()
50
51 NS_DECL_ISUPPORTS
52
53 HRESULT FinalConstruct();
54 void FinalRelease();
55
56 // public initializer/uninitializer for internal purposes only
57 HRESULT init (Console *parent);
58 void uninit();
59
60 // public methods only for internal purposes
61 int handleDisplayResize (uint32_t bpp, void *pvVRAM, uint32_t cbLine, int w, int h);
62 void handleDisplayUpdate (int x, int y, int cx, int cy);
63 IFramebuffer *getFramebuffer()
64 {
65 return mFramebuffer;
66 }
67
68 int VideoAccelEnable (bool fEnable, VBVAMEMORY *pVbvaMemory);
69 void VideoAccelFlush (void);
70
71 bool VideoAccelAllowed (void);
72
73#ifdef VBOX_VRDP
74#ifdef VRDP_MC
75 void VideoAccelVRDP (bool fEnable);
76#else
77 void VideoAccelVRDP (bool fEnable, uint32_t fu32SupportedOrders);
78#endif /* VRDP_MC */
79#endif /* VBOX_VRDP */
80
81 // IConsoleCallback methods
82 STDMETHOD(OnMousePointerShapeChange)(BOOL visible, BOOL alpha, ULONG xHot, ULONG yHot,
83 ULONG width, ULONG height, BYTE *shape)
84 {
85 return S_OK;
86 }
87
88 STDMETHOD(OnMouseCapabilityChange)(BOOL supportsAbsolute, BOOL needsHostCursor)
89 {
90 return S_OK;
91 }
92
93 STDMETHOD(OnStateChange)(MachineState_T machineState);
94
95 STDMETHOD(OnAdditionsStateChange)()
96 {
97 return S_OK;
98 }
99
100 STDMETHOD(OnKeyboardLedsChange)(BOOL fNumLock, BOOL fCapsLock, BOOL fScrollLock)
101 {
102 return S_OK;
103 }
104
105 STDMETHOD(OnRuntimeError)(BOOL fatal, INPTR BSTR id, INPTR BSTR message)
106 {
107 return S_OK;
108 }
109
110 STDMETHOD(OnCanShowWindow)(BOOL *canShow)
111 {
112 if (canShow)
113 *canShow = TRUE;
114 return S_OK;
115 }
116
117 STDMETHOD(OnShowWindow)()
118 {
119 return S_OK;
120 }
121
122 // IDisplay properties
123 STDMETHOD(COMGETTER(Width)) (ULONG *width);
124 STDMETHOD(COMGETTER(Height)) (ULONG *height);
125 STDMETHOD(COMGETTER(ColorDepth)) (ULONG *colorDepth);
126
127 // IDisplay methods
128 STDMETHOD(SetupInternalFramebuffer)(ULONG depth);
129 STDMETHOD(LockFramebuffer)(BYTE **address);
130 STDMETHOD(UnlockFramebuffer)();
131 STDMETHOD(RegisterExternalFramebuffer)(IFramebuffer *frameBuf);
132 STDMETHOD(SetVideoModeHint)(ULONG width, ULONG height, ULONG colorDepth);
133 STDMETHOD(TakeScreenShot)(BYTE *address, ULONG width, ULONG height);
134 STDMETHOD(DrawToScreen)(BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
135 STDMETHOD(InvalidateAndUpdate)();
136 STDMETHOD(ResizeCompleted)();
137 STDMETHOD(UpdateCompleted)();
138
139 // for VirtualBoxSupportErrorInfoImpl
140 static const wchar_t *getComponentName() { return L"Display"; }
141
142 static const PDMDRVREG DrvReg;
143
144private:
145
146 void updateDisplayData (bool aCheckParams = false);
147
148 static DECLCALLBACK(int) changeFramebuffer (Display *that, IFramebuffer *aFB,
149 bool aInternal);
150
151 static DECLCALLBACK(void*) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
152 static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
153 static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
154 static DECLCALLBACK(int) displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM, uint32_t cbLine, uint32_t cx, uint32_t cy);
155 static DECLCALLBACK(void) displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterface,
156 uint32_t x, uint32_t y, uint32_t cx, uint32_t cy);
157 static DECLCALLBACK(void) displayRefreshCallback(PPDMIDISPLAYCONNECTOR pInterface);
158 static DECLCALLBACK(void) displayResetCallback(PPDMIDISPLAYCONNECTOR pInterface);
159 static DECLCALLBACK(void) displayLFBModeChangeCallback(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled);
160
161 ComObjPtr <Console, ComWeakRef> mParent;
162 /** Pointer to the associated display driver. */
163 struct DRVMAINDISPLAY *mpDrv;
164 /** Pointer to the device instance for the VMM Device. */
165 PPDMDEVINS mpVMMDev;
166 /** Set after the first attempt to find the VMM Device. */
167 bool mfVMMDevInited;
168 bool mInternalFramebuffer;
169 ComPtr<IFramebuffer> mFramebuffer;
170 bool mFramebufferOpened;
171 /** bitmask of acceleration operations supported by current framebuffer */
172 ULONG mSupportedAccelOps;
173 RTSEMEVENTMULTI mUpdateSem;
174
175 /* arguments of the last handleDisplayResize() call */
176 void *mLastAddress;
177 uint32_t mLastLineSize;
178 uint32_t mLastColorDepth;
179 int mLastWidth;
180 int mLastHeight;
181
182 VBVAMEMORY *mpVbvaMemory;
183 bool mfVideoAccelEnabled;
184 bool mfVideoAccelVRDP;
185 uint32_t mfu32SupportedOrders;
186
187 int32_t volatile mcVideoAccelVRDPRefs;
188
189 VBVAMEMORY *mpPendingVbvaMemory;
190 bool mfPendingVideoAccelEnable;
191 bool mfMachineRunning;
192
193 uint8_t *mpu8VbvaPartial;
194 uint32_t mcbVbvaPartial;
195
196 bool vbvaFetchCmd (VBVACMDHDR **ppHdr, uint32_t *pcbCmd);
197 void vbvaReleaseCmd (VBVACMDHDR *pHdr, int32_t cbCmd);
198
199 void handleResizeCompletedEMT (void);
200 volatile uint32_t mu32ResizeStatus;
201
202 enum {
203 ResizeStatus_Void,
204 ResizeStatus_InProgress,
205 ResizeStatus_UpdateDisplayData
206 };
207};
208
209#endif // ____H_DISPLAYIMPL
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette