- Timestamp:
- Jun 17, 2014 10:33:46 AM (11 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxSDL/Framebuffer.cpp
r51610 r51627 419 419 } 420 420 421 STDMETHODIMP VBoxSDLFB::NotifyUpdateImage(ULONG aX, 422 ULONG aY, 423 ULONG aWidth, 424 ULONG aHeight, 425 ComSafeArrayIn(BYTE, aImage)) 426 { 427 return E_NOTIMPL; 428 } 429 421 430 extern ComPtr<IDisplay> gpDisplay; 422 431 -
trunk/src/VBox/Frontends/VBoxSDL/Framebuffer.h
r51610 r51627 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
r51610 r51627 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
r51610 r51627 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
r51610 r51627 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="0d85a960-bfa7-4f26-9637-fdd521b7f3c1" 15520 15555 wsmap="managed" 15521 15556 > … … 15851 15886 <param name="screenId" type="unsigned long" dir="in"/> 15852 15887 <param name="displaySourceBitmap" type="IDisplaySourceBitmap" dir="out"/> 15888 </method> 15889 15890 <method name="setFramebufferUpdateMode"> 15891 <desc>Select how the framebuffer is informed about screen updates.</desc> 15892 <param name="screenId" type="unsigned long" dir="in"/> 15893 <param name="framebufferUpdateMode" type="FramebufferUpdateMode" dir="in"/> 15853 15894 </method> 15854 15895 -
trunk/src/VBox/Main/include/DisplayImpl.h
r51610 r51627 46 46 ComPtr<IDisplaySourceBitmap> pSourceBitmap; 47 47 bool fDisabled; 48 49 FramebufferUpdateMode_T enmFramebufferUpdateMode; 50 51 struct 52 { 53 ComPtr<IDisplaySourceBitmap> pSourceBitmap; 54 uint8_t *pu8Address; 55 uint32_t cbLine; 56 } updateImage; 48 57 49 58 LONG xOrigin; … … 204 213 STDMETHOD(QuerySourceBitmap)(ULONG aScreenId, 205 214 IDisplaySourceBitmap **aDisplaySourceBitmap); 215 STDMETHOD(SetFramebufferUpdateMode)(ULONG aScreenId, 216 FramebufferUpdateMode_T aFramebufferUpdateMode); 206 217 207 218 static const PDMDRVREG DrvReg; 208 219 209 220 private: 210 211 HRESULT querySourceBitmap(ULONG aScreenId,212 IDisplaySourceBitmap **ppDisplaySourceBitmap);213 221 214 222 #ifdef VBOX_WITH_CRHGSMI -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r51612 r51627 600 600 maFramebuffers[ul].fDisabled = ul > 0; 601 601 602 maFramebuffers[ul].enmFramebufferUpdateMode = FramebufferUpdateMode_NotifyUpdate; 603 604 maFramebuffers[ul].updateImage.pu8Address = NULL; 605 maFramebuffers[ul].updateImage.cbLine = 0; 606 602 607 maFramebuffers[ul].xOrigin = 0; 603 608 maFramebuffers[ul].yOrigin = 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 SetFramebufferUpdateMode(uScreenId, 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(maFramebuffers[uScreenId].enmFramebufferUpdateMode == FramebufferUpdateMode_NotifyUpdate)) 1138 { 1139 pFramebuffer->NotifyUpdate(x, y, w, h); 1140 } 1141 else if (maFramebuffers[uScreenId].enmFramebufferUpdateMode == 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 … … 3383 3425 return ptrVM.rc(); 3384 3426 3427 bool fSetRenderVRAM = false; 3428 bool fInvalidate = false; 3429 3385 3430 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3386 3431 … … 3389 3434 aScreenId, mcMonitors); 3390 3435 3391 HRESULT hr = querySourceBitmap(aScreenId, aDisplaySourceBitmap); 3392 3393 alock.release(); 3394 3395 LogRelFlowFunc(("%Rhrc\n", hr)); 3396 return hr; 3397 } 3398 3399 // private methods 3400 ///////////////////////////////////////////////////////////////////////////// 3401 3402 HRESULT Display::querySourceBitmap(ULONG aScreenId, 3403 IDisplaySourceBitmap **ppDisplaySourceBitmap) 3404 { 3436 if (!mfSourceBitmapEnabled) 3437 { 3438 *aDisplaySourceBitmap = NULL; 3439 return E_FAIL; 3440 } 3441 3405 3442 HRESULT hr = S_OK; 3406 3407 if (!mfSourceBitmapEnabled)3408 {3409 *ppDisplaySourceBitmap = NULL;3410 return E_FAIL;3411 }3412 3443 3413 3444 DISPLAYFBINFO *pFBInfo = &maFramebuffers[aScreenId]; … … 3424 3455 if (SUCCEEDED(hr)) 3425 3456 { 3426 pFBInfo->pSourceBitmap = obj; 3427 3428 /* Whether VRAM must be copied to the internal buffer. */ 3429 pFBInfo->fDefaultFormat = !obj->usesVRAM(); 3457 bool fDefaultFormat = !obj->usesVRAM(); 3430 3458 3431 3459 if (aScreenId == VBOX_VIDEO_PRIMARY_SCREEN) … … 3452 3480 mpDrv->IConnector.cy = ulHeight; 3453 3481 3454 if (pFBInfo->fDefaultFormat) 3455 mpDrv->pUpPort->pfnSetRenderVRAM(mpDrv->pUpPort, true); 3482 fSetRenderVRAM = fDefaultFormat; 3456 3483 } 3457 3484 3458 if (pFBInfo->fDefaultFormat) 3459 { 3460 /* @todo make sure that the bitmap contains the latest image? */ 3461 Console::SafeVMPtrQuiet ptrVM(mParent); 3462 if (ptrVM.isOk()) 3463 { 3464 // VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::InvalidateAndUpdateEMT, 3465 // 3, this, aScreenId, false); 3466 } 3467 } 3485 /* Make sure that the bitmap contains the latest image. */ 3486 fInvalidate = fDefaultFormat; 3487 3488 pFBInfo->pSourceBitmap = obj; 3489 pFBInfo->fDefaultFormat = fDefaultFormat; 3468 3490 } 3469 3491 } … … 3472 3494 { 3473 3495 pFBInfo->pSourceBitmap->AddRef(); 3474 *ppDisplaySourceBitmap = pFBInfo->pSourceBitmap; 3475 } 3476 3496 *aDisplaySourceBitmap = pFBInfo->pSourceBitmap; 3497 } 3498 3499 /* Leave the IDisplay lock because the VGA device must not be called under it. */ 3500 alock.release(); 3501 3502 if (SUCCEEDED(hr)) 3503 { 3504 if (fSetRenderVRAM) 3505 mpDrv->pUpPort->pfnSetRenderVRAM(mpDrv->pUpPort, true); 3506 3507 if (fInvalidate) 3508 VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::InvalidateAndUpdateEMT, 3509 3, this, aScreenId, false); 3510 } 3511 3512 LogRelFlowFunc(("%Rhrc\n", hr)); 3477 3513 return hr; 3478 3514 } 3515 3516 STDMETHODIMP Display::SetFramebufferUpdateMode(ULONG aScreenId, 3517 FramebufferUpdateMode_T aFramebufferUpdateMode) 3518 { 3519 LogRelFlowFunc(("aScreenId %d, aFramebufferUpdateMode %d\n", aScreenId, aFramebufferUpdateMode)); 3520 3521 AutoCaller autoCaller(this); 3522 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3523 3524 HRESULT hr = S_OK; 3525 3526 /* Prepare without taking a lock. API has it's own locking. */ 3527 ComPtr<IDisplaySourceBitmap> pSourceBitmap; 3528 if (aFramebufferUpdateMode == FramebufferUpdateMode_NotifyUpdateImage) 3529 { 3530 /* A source bitmap will be needed. */ 3531 hr = QuerySourceBitmap(aScreenId, pSourceBitmap.asOutParam()); 3532 } 3533 3534 if (FAILED(hr)) 3535 return hr; 3536 3537 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3538 3539 if (aScreenId >= mcMonitors) 3540 return setError(E_INVALIDARG, tr("SetFramebufferUpdateMode: Invalid screen %d (total %d)"), 3541 aScreenId, mcMonitors); 3542 3543 DISPLAYFBINFO *pFBInfo = &maFramebuffers[aScreenId]; 3544 3545 /* Reset the update mode. */ 3546 pFBInfo->updateImage.pSourceBitmap.setNull(); 3547 pFBInfo->updateImage.pu8Address = NULL; 3548 pFBInfo->updateImage.cbLine = 0; 3549 3550 if (aFramebufferUpdateMode == FramebufferUpdateMode_NotifyUpdateImage) 3551 { 3552 BYTE *pAddress = NULL; 3553 ULONG ulWidth = 0; 3554 ULONG ulHeight = 0; 3555 ULONG ulBitsPerPixel = 0; 3556 ULONG ulBytesPerLine = 0; 3557 ULONG ulPixelFormat = 0; 3558 3559 hr = pSourceBitmap->QueryBitmapInfo(&pAddress, 3560 &ulWidth, 3561 &ulHeight, 3562 &ulBitsPerPixel, 3563 &ulBytesPerLine, 3564 &ulPixelFormat); 3565 if (SUCCEEDED(hr)) 3566 { 3567 pFBInfo->updateImage.pSourceBitmap = pSourceBitmap; 3568 pFBInfo->updateImage.pu8Address = pAddress; 3569 pFBInfo->updateImage.cbLine = ulBytesPerLine; 3570 } 3571 } 3572 3573 pFBInfo->enmFramebufferUpdateMode = aFramebufferUpdateMode; 3574 3575 return S_OK; 3576 } 3577 3578 3579 // private methods 3580 ///////////////////////////////////////////////////////////////////////////// 3479 3581 3480 3582 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
Note:
See TracChangeset
for help on using the changeset viewer.