VirtualBox

source: vbox/trunk/src/VBox/Main/FramebufferImpl.cpp@ 13538

Last change on this file since 13538 was 12449, checked in by vboxsync, 16 years ago

+changed IFramebuffer interface to report id of associated window if there's one
+changed sdl/qt3/qt4 frontends's interface implementations to report this id
+added VBoxSharedCrOpenGL hgcm service
(VBoxManage.exe setextradata lvm_winxp_sp2 VBoxInternal/Devices/VMMDev/0/LUN#0/Config/crOpenGLEnabled 1)
+changed crserver to be launched from vmmdev by guest request
+added hgcm call to supply desired window id to render spu
+changed guest icd driver to initialize hgcm and cause tcpip listener startup on host
+fixed spu finalization
+fixed q3 startup, again :)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.4 KB
RevLine 
[1]1/** @file
2 *
3 * VirtualBox COM class implementation
4 */
5
6/*
[8155]7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
[1]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
[5999]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.
[8155]16 *
17 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
[1]20 */
21
22#include "FramebufferImpl.h"
23#include <iprt/semaphore.h>
24
25// constructor / destructor
26/////////////////////////////////////////////////////////////////////////////
27
28InternalFramebuffer::InternalFramebuffer()
29{
30 mData = NULL;
31 RTSemMutexCreate(&mMutex);
32}
33
34InternalFramebuffer::~InternalFramebuffer()
35{
36 RTSemMutexDestroy(mMutex);
37 if (mData)
38 delete mData;
39}
40
41// public methods only for internal purposes
42/////////////////////////////////////////////////////////////////////////////
43
44HRESULT InternalFramebuffer::init(ULONG width, ULONG height, ULONG depth)
45{
46 mWidth = width;
47 mHeight = height;
[3761]48 mBitsPerPixel = depth;
49 mBytesPerLine = ((width * depth + 31) / 32) * 4;
50 mData = new uint8_t [mBytesPerLine * height];
51 memset (mData, 0, mBytesPerLine * height);
[3571]52
[1]53 return S_OK;
54}
55
56// IFramebuffer properties
57/////////////////////////////////////////////////////////////////////////////
58
[470]59STDMETHODIMP InternalFramebuffer::COMGETTER(Address) (BYTE **address)
[1]60{
61 if (!address)
62 return E_POINTER;
[470]63 *address = mData;
[1]64 return S_OK;
65}
66
67STDMETHODIMP InternalFramebuffer::COMGETTER(Width) (ULONG *width)
68{
69 if (!width)
70 return E_POINTER;
71 *width = mWidth;
72 return S_OK;
73}
74
75STDMETHODIMP InternalFramebuffer::COMGETTER(Height) (ULONG *height)
76{
77 if (!height)
78 return E_POINTER;
79 *height = mHeight;
80 return S_OK;
81}
82
[3761]83STDMETHODIMP InternalFramebuffer::COMGETTER(BitsPerPixel) (ULONG *bitsPerPixel)
[1]84{
[3761]85 if (!bitsPerPixel)
[1]86 return E_POINTER;
[3761]87 *bitsPerPixel = mBitsPerPixel;
[1]88 return S_OK;
89}
90
[3761]91STDMETHODIMP InternalFramebuffer::COMGETTER(BytesPerLine) (ULONG *bytesPerLine)
[1]92{
[3761]93 if (!bytesPerLine)
[1]94 return E_POINTER;
[3761]95 *bytesPerLine = mBytesPerLine;
[1]96 return S_OK;
97}
98
[3761]99STDMETHODIMP InternalFramebuffer::COMGETTER(PixelFormat) (ULONG *pixelFormat)
[1]100{
101 if (!pixelFormat)
102 return E_POINTER;
[3761]103 *pixelFormat = FramebufferPixelFormat_FOURCC_RGB;
[1]104 return S_OK;
105}
106
[3761]107STDMETHODIMP InternalFramebuffer::COMGETTER(UsesGuestVRAM) (BOOL *usesGuestVRAM)
108{
109 if (!usesGuestVRAM)
110 return E_POINTER;
111 *usesGuestVRAM = FALSE;
112 return S_OK;
113}
114
[1]115STDMETHODIMP InternalFramebuffer::COMGETTER(HeightReduction) (ULONG *heightReduction)
116{
117 if (!heightReduction)
118 return E_POINTER;
119 /* no reduction */
120 *heightReduction = 0;
121 return S_OK;
122}
123
124STDMETHODIMP InternalFramebuffer::COMGETTER(Overlay) (IFramebufferOverlay **aOverlay)
125{
126 if (!aOverlay)
127 return E_POINTER;
128 /* no overlay */
129 *aOverlay = 0;
130 return S_OK;
131}
132
[12449]133STDMETHODIMP InternalFramebuffer::COMGETTER(WinId) (ULONG64 *winId)
134{
135 if (!winId)
136 return E_POINTER;
137 *winId = 0;
138 return S_OK;
139}
[3571]140
[1]141// IFramebuffer methods
142/////////////////////////////////////////////////////////////////////////////
143
144STDMETHODIMP InternalFramebuffer::Lock()
145{
146 RTSemMutexRequest(mMutex, RT_INDEFINITE_WAIT);
147 return S_OK;
148}
149
150STDMETHODIMP InternalFramebuffer::Unlock()
151{
152 RTSemMutexRelease(mMutex);
153 return S_OK;
154}
155
156STDMETHODIMP InternalFramebuffer::NotifyUpdate(ULONG x, ULONG y,
157 ULONG w, ULONG h,
158 BOOL *finished)
159{
160 if (!finished)
161 return E_POINTER;
162 // no need for the caller to wait
163 *finished = true;
164 return S_OK;
165}
166
[470]167STDMETHODIMP
[3761]168InternalFramebuffer::RequestResize(ULONG iScreenId, ULONG pixelFormat, BYTE *vram,
169 ULONG bpp, ULONG bpl, ULONG w, ULONG h,
[470]170 BOOL *finished)
[1]171{
[3761]172 NOREF (bpp);
173 NOREF (bpl);
174
[1]175 if (!finished)
176 return E_POINTER;
177 // no need for the caller to wait
178 *finished = true;
179
180 // allocate a new buffer
181 delete mData;
182 mWidth = w;
183 mHeight = h;
[3761]184 mBytesPerLine = ((w * mBitsPerPixel + 31) / 32) * 4;
185 mData = new uint8_t [mBytesPerLine * h];
186 memset (mData, 0, mBytesPerLine * h);
[1]187
188 return S_OK;
189}
190
191STDMETHODIMP InternalFramebuffer::OperationSupported(FramebufferAccelerationOperation_T operation,
192 BOOL *supported)
193{
194 if (!supported)
195 return E_POINTER;
196 /* no acceleration please, we're a slow fallback implementation! */
197 *supported = false;
198 return S_OK;
199}
200
201STDMETHODIMP InternalFramebuffer::VideoModeSupported(ULONG width, ULONG height, ULONG bpp,
202 BOOL *supported)
203{
204 if (!supported)
205 return E_POINTER;
206 /* whatever you want! */
207 *supported = true;
208 return S_OK;
209}
210
211STDMETHODIMP InternalFramebuffer::SolidFill(ULONG x, ULONG y, ULONG width, ULONG height,
212 ULONG color, BOOL *handled)
213{
214 if (!handled)
215 return E_POINTER;
216 /* eek, what do you expect from us?! */
217 *handled = false;
218 return S_OK;
219}
220
221STDMETHODIMP InternalFramebuffer::CopyScreenBits(ULONG xDst, ULONG yDst, ULONG xSrc, ULONG ySrc,
222 ULONG width, ULONG height, BOOL *handled)
223{
224 if (!handled)
225 return E_POINTER;
226 /* eek, what do you expect from us?! */
227 *handled = false;
228 return S_OK;
229}
[3532]230
[3576]231STDMETHODIMP InternalFramebuffer::GetVisibleRegion(BYTE *aRectangles, ULONG aCount,
232 ULONG *aCountCopied)
[3532]233{
[3576]234 PRTRECT rects = (PRTRECT)aRectangles;
[3532]235
[3576]236 if (!rects)
[3532]237 return E_POINTER;
238
[3576]239 /// @todo
240
241 NOREF(rects);
242 NOREF(aCount);
243 NOREF(aCountCopied);
244
[3532]245 return S_OK;
246}
247
[3576]248STDMETHODIMP InternalFramebuffer::SetVisibleRegion(BYTE *aRectangles, ULONG aCount)
[3532]249{
[3576]250 PRTRECT rects = (PRTRECT)aRectangles;
[3532]251
[3576]252 if (!rects)
[3532]253 return E_POINTER;
254
[3576]255 /// @todo
256
257 NOREF(rects);
258 NOREF(aCount);
259
[3532]260 return S_OK;
261}
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use