- Timestamp:
- Jun 11, 2014 2:54:11 PM (10 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxSDL/Framebuffer.cpp
r51605 r51606 18 18 19 19 #include <VBox/com/com.h> 20 #include <VBox/com/array.h> 20 21 #include <VBox/com/string.h> 21 22 #include <VBox/com/Guid.h> … … 419 420 } 420 421 422 STDMETHODIMP VBoxSDLFB::NotifyUpdateImage(ULONG aX, 423 ULONG aY, 424 ULONG aWidth, 425 ULONG aHeight, 426 ComSafeArrayIn(BYTE, aImage)) 427 { 428 LogFlow(("NotifyUpdateImage: %d,%d %dx%d\n", aX, aY, aWidth, aHeight)); 429 430 com::SafeArray<BYTE> image(ComSafeArrayInArg(aImage)); 431 432 /* Copy to mSurfVRAM. */ 433 SDL_Rect srcRect; 434 SDL_Rect dstRect; 435 srcRect.x = 0; 436 srcRect.y = 0; 437 srcRect.w = (uint16_t)aWidth; 438 srcRect.h = (uint16_t)aHeight; 439 dstRect.x = (int16_t)aX; 440 dstRect.y = (int16_t)aY; 441 dstRect.w = (uint16_t)aWidth; 442 dstRect.h = (uint16_t)aHeight; 443 444 const uint32_t Rmask = 0x00FF0000, Gmask = 0x0000FF00, Bmask = 0x000000FF, Amask = 0; 445 SDL_Surface *surfSrc = SDL_CreateRGBSurfaceFrom(image.raw(), aWidth, aHeight, 32, aWidth * 4, 446 Rmask, Gmask, Bmask, Amask); 447 if (surfSrc) 448 { 449 SDL_BlitSurface(surfSrc, &srcRect, mSurfVRAM, &dstRect); 450 SDL_FreeSurface(surfSrc); 451 } 452 453 return NotifyUpdate(aX, aY, aWidth, aHeight); 454 } 455 421 456 extern ComPtr<IDisplay> gpDisplay; 422 457 … … 434 469 /* Disable screen updates. */ 435 470 mfUpdates = false; 471 472 // gpDisplay->COMSETTER(FramebufferUpdateMode)(FramebufferUpdateMode_NotifyUpdateImage); 436 473 437 474 /* Save the new bitmap. */ -
trunk/src/VBox/Frontends/VBoxSDL/Framebuffer.h
r51605 r51606 82 82 83 83 STDMETHOD(NotifyUpdate)(ULONG x, ULONG y, ULONG w, ULONG h); 84 STDMETHOD(NotifyUpdateImage)(ULONG x, ULONG y, ULONG w, ULONG h, ComSafeArrayIn(BYTE, aImage)); 84 85 STDMETHOD(NotifyChange)(ULONG aScreenId, 85 86 ULONG aXOrigin, -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
r51605 r51606 263 263 } 264 264 265 STDMETHODIMP UIFrameBuffer::NotifyUpdateImage(ULONG aX, 266 ULONG aY, 267 ULONG aWidth, 268 ULONG aHeight, 269 ComSafeArrayIn(BYTE, aImage)) 270 { 271 return E_NOTIMPL; 272 } 273 265 274 STDMETHODIMP UIFrameBuffer::VideoModeSupported(ULONG uWidth, ULONG uHeight, ULONG uBPP, BOOL *pfSupported) 266 275 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h
r51605 r51606 127 127 * @note Calls to this and #setMarkAsUnused method are synchronized (from GUI side). */ 128 128 STDMETHOD(NotifyUpdate)(ULONG uX, ULONG uY, ULONG uWidth, ULONG uHeight); 129 STDMETHOD(NotifyUpdateImage)(ULONG x, ULONG y, ULONG w, ULONG h, ComSafeArrayIn(BYTE, aImage)); 129 130 130 131 /** EMT callback: Returns whether the frame-buffer implementation is willing to support a given video-mode. -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r51605 r51606 15234 15234 </enum> 15235 15235 15236 <enum 15237 name="FramebufferUpdateMode" 15238 uuid="1268d8ab-dd2f-443c-bc56-d93d3ced5cde" 15239 > 15240 <desc> 15241 How a framebuffer is notified about screen updates. 15242 </desc> 15243 15244 <const name="NotifyUpdate" value="0"> 15245 <desc> 15246 IFramebuffer::NotifyUpdate is called. 15247 </desc> 15248 </const> 15249 <const name="NotifyUpdateImage" value="1"> 15250 <desc> 15251 IFramebuffer::NotifyUpdateImage is called. 15252 </desc> 15253 </const> 15254 </enum> 15255 15236 15256 <interface 15237 15257 name="IDisplaySourceBitmap" extends="$unknown" wsmap="suppress" … … 15253 15273 <interface 15254 15274 name="IFramebuffer" extends="$unknown" 15255 uuid=" 929e4228-f7cf-436d-99a0-dcf6596473b2"15275 uuid="c42d2714-6263-473f-a6c4-3d3b38983e74" 15256 15276 wsmap="managed" 15257 15277 > … … 15334 15354 <param name="width" type="unsigned long" dir="in"/> 15335 15355 <param name="height" type="unsigned long" dir="in"/> 15356 </method> 15357 15358 <method name="notifyUpdateImage"> 15359 <desc> 15360 Informs about an update and provides 32bpp bitmap. 15361 </desc> 15362 <param name="x" type="unsigned long" dir="in"/> 15363 <param name="y" type="unsigned long" dir="in"/> 15364 <param name="width" type="unsigned long" dir="in"/> 15365 <param name="height" type="unsigned long" dir="in"/> 15366 <param name="image" type="octet" dir="in" safearray="yes"> 15367 <desc> 15368 Array with 32BPP image data. 15369 </desc> 15370 </param> 15336 15371 </method> 15337 15372 … … 15517 15552 <interface 15518 15553 name="IDisplay" extends="$unknown" 15519 uuid=" efd0567f-8697-4b4c-965a-7f3672d1909e"15554 uuid="a2bb2e85-f797-4c5e-884c-2efd897af4f4" 15520 15555 wsmap="managed" 15521 15556 > … … 15852 15887 <param name="displaySourceBitmap" type="IDisplaySourceBitmap" dir="out"/> 15853 15888 </method> 15889 15890 <attribute name="framebufferUpdateMode" type="FramebufferUpdateMode"> 15891 <desc>How the Framebuffer is informed aboput screen updates.</desc> 15892 </attribute> 15854 15893 15855 15894 </interface> -
trunk/src/VBox/Main/include/DisplayImpl.h
r51604 r51606 47 47 bool fDisabled; 48 48 49 struct 50 { 51 ComPtr<IDisplaySourceBitmap> pSourceBitmap; 52 uint8_t *pu8Address; 53 uint32_t cbLine; 54 } updateImage; 55 49 56 LONG xOrigin; 50 57 LONG yOrigin; … … 183 190 // IEventListener methods 184 191 STDMETHOD(HandleEvent)(IEvent * aEvent); 192 193 // IDisplay properties 194 STDMETHOD(COMGETTER(FramebufferUpdateMode))(FramebufferUpdateMode_T *aFramebufferUpdateMode); 195 STDMETHOD(COMSETTER(FramebufferUpdateMode))(FramebufferUpdateMode_T aFramebufferUpdateMode); 185 196 186 197 // IDisplay methods … … 293 304 bool volatile fVGAResizing; 294 305 306 FramebufferUpdateMode_T mFramebufferUpdateMode; 307 295 308 VBVAMEMORY *mpVbvaMemory; 296 309 bool mfVideoAccelEnabled; -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r51605 r51606 586 586 fVGAResizing = false; 587 587 588 mFramebufferUpdateMode = FramebufferUpdateMode_NotifyUpdate; 589 588 590 ULONG ul; 589 591 mParent->machine()->COMGETTER(MonitorCount)(&ul); … … 599 601 /* All secondary monitors are disabled at startup. */ 600 602 maFramebuffers[ul].fDisabled = ul > 0; 603 604 maFramebuffers[ul].updateImage.pu8Address = NULL; 605 maFramebuffers[ul].updateImage.cbLine = 0; 601 606 602 607 maFramebuffers[ul].xOrigin = 0; … … 660 665 { 661 666 maFramebuffers[uScreenId].pSourceBitmap.setNull(); 667 maFramebuffers[uScreenId].updateImage.pSourceBitmap.setNull(); 668 maFramebuffers[uScreenId].updateImage.pu8Address = NULL; 669 maFramebuffers[uScreenId].updateImage.cbLine = 0; 662 670 maFramebuffers[uScreenId].pFramebuffer.setNull(); 663 671 } … … 896 904 return VINF_SUCCESS; 897 905 } 906 907 COMSETTER(FramebufferUpdateMode)(FramebufferUpdateMode_NotifyUpdate); 898 908 899 909 if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN) … … 1124 1134 { 1125 1135 if (w != 0 && h != 0) 1126 pFramebuffer->NotifyUpdate(x, y, w, h); 1136 { 1137 if (RT_LIKELY(mFramebufferUpdateMode == FramebufferUpdateMode_NotifyUpdate)) 1138 { 1139 pFramebuffer->NotifyUpdate(x, y, w, h); 1140 } 1141 else if (mFramebufferUpdateMode == FramebufferUpdateMode_NotifyUpdateImage) 1142 { 1143 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1144 1145 DISPLAYFBINFO *pFBInfo = &maFramebuffers[uScreenId]; 1146 1147 if (!pFBInfo->updateImage.pSourceBitmap.isNull()) 1148 { 1149 Assert(pFBInfo->updateImage.pu8Address); 1150 1151 size_t cbData = w * h * 4; 1152 com::SafeArray<BYTE> image(cbData); 1153 1154 uint8_t *pu8Dst = image.raw(); 1155 const uint8_t *pu8Src = pFBInfo->updateImage.pu8Address + pFBInfo->updateImage.cbLine * y + x * 4; 1156 1157 int i; 1158 for (i = y; i < y + h; ++i) 1159 { 1160 memcpy(pu8Dst, pu8Src, w * 4); 1161 pu8Dst += w * 4; 1162 pu8Src += pFBInfo->updateImage.cbLine; 1163 } 1164 1165 pFramebuffer->NotifyUpdateImage(x, y, w, h, ComSafeArrayAsInParam(image)); 1166 } 1167 } 1168 } 1127 1169 } 1128 1170 … … 2182 2224 } 2183 2225 } 2226 } 2227 2228 2229 /* 2230 * IDisplay properties 2231 */ 2232 2233 STDMETHODIMP Display::COMGETTER(FramebufferUpdateMode)(FramebufferUpdateMode_T *aFramebufferUpdateMode) 2234 { 2235 LogRelFlowFunc(("\n")); 2236 2237 CheckComArgPointerValid(aFramebufferUpdateMode); 2238 2239 AutoCaller autoCaller(this); 2240 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2241 2242 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2243 2244 *aFramebufferUpdateMode = mFramebufferUpdateMode; 2245 2246 return S_OK; 2247 } 2248 2249 STDMETHODIMP Display::COMSETTER(FramebufferUpdateMode)(FramebufferUpdateMode_T aFramebufferUpdateMode) 2250 { 2251 LogRelFlowFunc(("aFramebufferUpdateMode %d\n", aFramebufferUpdateMode)); 2252 2253 AutoCaller autoCaller(this); 2254 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2255 2256 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2257 2258 /* Reset the update mode. */ 2259 unsigned uScreenId; 2260 for (uScreenId = 0; uScreenId < mcMonitors; ++uScreenId) 2261 { 2262 DISPLAYFBINFO *pFBInfo = &maFramebuffers[uScreenId]; 2263 pFBInfo->updateImage.pu8Address = NULL; 2264 pFBInfo->updateImage.cbLine = 0; 2265 pFBInfo->updateImage.pSourceBitmap.setNull(); 2266 } 2267 2268 if (aFramebufferUpdateMode == FramebufferUpdateMode_NotifyUpdateImage) 2269 { 2270 /* Query source bitmaps. */ 2271 for (uScreenId = 0; uScreenId < mcMonitors; ++uScreenId) 2272 { 2273 DISPLAYFBINFO *pFBInfo = &maFramebuffers[uScreenId]; 2274 HRESULT hr = querySourceBitmap(uScreenId, pFBInfo->updateImage.pSourceBitmap.asOutParam()); 2275 if (SUCCEEDED(hr)) 2276 { 2277 BYTE *pAddress = NULL; 2278 ULONG ulWidth = 0; 2279 ULONG ulHeight = 0; 2280 ULONG ulBitsPerPixel = 0; 2281 ULONG ulBytesPerLine = 0; 2282 ULONG ulPixelFormat = 0; 2283 2284 hr = pFBInfo->updateImage.pSourceBitmap->QueryBitmapInfo(&pAddress, 2285 &ulWidth, 2286 &ulHeight, 2287 &ulBitsPerPixel, 2288 &ulBytesPerLine, 2289 &ulPixelFormat); 2290 if (SUCCEEDED(hr)) 2291 { 2292 pFBInfo->updateImage.pu8Address = pAddress; 2293 pFBInfo->updateImage.cbLine = ulBytesPerLine; 2294 } 2295 } 2296 2297 if (FAILED(hr)) 2298 { 2299 pFBInfo->updateImage.pSourceBitmap.setNull(); 2300 } 2301 } 2302 } 2303 2304 mFramebufferUpdateMode = aFramebufferUpdateMode; 2305 2306 return S_OK; 2184 2307 } 2185 2308
Note:
See TracChangeset
for help on using the changeset viewer.