VirtualBox

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

Last change on this file since 1 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.1 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 void 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, ULONG width, ULONG height, ULONG shape)
83 {
84 return S_OK;
85 }
86
87 STDMETHOD(OnMouseCapabilityChange)(BOOL supportsAbsolute, BOOL needsHostCursor)
88 {
89 return S_OK;
90 }
91
92 STDMETHOD(OnStateChange)(MachineState_T machineState);
93
94 STDMETHOD(OnAdditionsStateChange)()
95 {
96 return S_OK;
97 }
98
99 STDMETHOD(OnKeyboardLedsChange)(BOOL fNumLock, BOOL fScrollLock, BOOL fCapsLock)
100 {
101 return S_OK;
102 }
103
104 // IDisplay properties
105 STDMETHOD(COMGETTER(Width)) (ULONG *width);
106 STDMETHOD(COMGETTER(Height)) (ULONG *height);
107 STDMETHOD(COMGETTER(ColorDepth)) (ULONG *colorDepth);
108
109 // IDisplay methods
110 STDMETHOD(SetupInternalFramebuffer)(ULONG depth);
111 STDMETHOD(LockFramebuffer)(ULONG *address);
112 STDMETHOD(UnlockFramebuffer)();
113 STDMETHOD(RegisterExternalFramebuffer)(IFramebuffer *frameBuf);
114 STDMETHOD(SetVideoModeHint)(ULONG width, ULONG height, ULONG colorDepth);
115 STDMETHOD(TakeScreenShot)(ULONG address, ULONG width, ULONG height);
116 STDMETHOD(DrawToScreen)(ULONG address, ULONG x, ULONG y, ULONG width, ULONG height);
117 STDMETHOD(InvalidateAndUpdate)();
118 STDMETHOD(ResizeCompleted)();
119 STDMETHOD(UpdateCompleted)();
120
121 // for VirtualBoxSupportErrorInfoImpl
122 static const wchar_t *getComponentName() { return L"Display"; }
123
124 static const PDMDRVREG DrvReg;
125
126private:
127
128 void updateDisplayData (bool aCheckParams = false);
129
130 static DECLCALLBACK(int) changeFramebuffer (Display *that, IFramebuffer *aFB,
131 bool aInternal);
132
133 static DECLCALLBACK(void*) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
134 static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
135 static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
136 static DECLCALLBACK(void) displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM, uint32_t cbLine, uint32_t cx, uint32_t cy);
137 static DECLCALLBACK(void) displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterface,
138 uint32_t x, uint32_t y, uint32_t cx, uint32_t cy);
139 static DECLCALLBACK(void) displayRefreshCallback(PPDMIDISPLAYCONNECTOR pInterface);
140 static DECLCALLBACK(void) displayResetCallback(PPDMIDISPLAYCONNECTOR pInterface);
141 static DECLCALLBACK(void) displayLFBModeChangeCallback(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled);
142
143 ComObjPtr <Console, ComWeakRef> mParent;
144 /** Pointer to the associated display driver. */
145 struct DRVMAINDISPLAY *mpDrv;
146 /** Pointer to the device instance for the VMM Device. */
147 PPDMDEVINS mpVMMDev;
148 /** Set after the first attempt to find the VMM Device. */
149 bool mfVMMDevInited;
150 bool mInternalFramebuffer;
151 ComPtr<IFramebuffer> mFramebuffer;
152 bool mFramebufferOpened;
153 /** bitmask of acceleration operations supported by current framebuffer */
154 ULONG mSupportedAccelOps;
155 RTSEMEVENTMULTI mResizeSem;
156 RTSEMEVENTMULTI mUpdateSem;
157
158 /* arguments of the last handleDisplayResize() call */
159 void *mLastAddress;
160 uint32_t mLastLineSize;
161 uint32_t mLastColorDepth;
162 int mLastWidth;
163 int mLastHeight;
164
165 VBVAMEMORY *mpVbvaMemory;
166 bool mfVideoAccelEnabled;
167 bool mfVideoAccelVRDP;
168 uint32_t mfu32SupportedOrders;
169
170 int32_t volatile mcVideoAccelVRDPRefs;
171
172 VBVAMEMORY *mpPendingVbvaMemory;
173 bool mfPendingVideoAccelEnable;
174 bool mfMachineRunning;
175
176 uint8_t *mpu8VbvaPartial;
177 uint32_t mcbVbvaPartial;
178
179 bool vbvaFetchCmd (VBVACMDHDR **ppHdr, uint32_t *pcbCmd);
180 void vbvaReleaseCmd (VBVACMDHDR *pHdr, int32_t cbCmd);
181
182 void callFramebufferResize (FramebufferPixelFormat_T pixelFormat, void *pvVRAM, uint32_t cbLine, int w, int h);
183};
184
185#endif // ____H_DISPLAYIMPL
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