Changeset 51436 in vbox for trunk/src/VBox/Main
- Timestamp:
- May 28, 2014 9:12:15 AM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 93991
- Location:
- trunk/src/VBox/Main
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/Makefile.kmk
r51417 r51436 709 709 src-client/ConsoleVRDPServer.cpp \ 710 710 src-client/DisplayImpl.cpp \ 711 src-client/DisplaySourceBitmapImpl.cpp \ 711 712 src-client/EmulatedUSBImpl.cpp \ 712 713 src-client/GuestImpl.cpp \ -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r51426 r51436 15154 15154 15155 15155 <interface 15156 name="IDisplaySourceBitmap" extends="$unknown" wsmap="suppress" 15157 uuid="b00907f7-d85e-4dce-b1a6-16a2d91b0269" 15158 > 15159 <attribute name="screenId" type="unsigned long" readonly="yes"/> 15160 <method name="queryBitmapInfo"> 15161 <desc>Information about the screen bitmap.</desc> 15162 <param name="address" type="octet" mod="ptr" dir="out"/> 15163 <param name="width" type="unsigned long" dir="out"/> 15164 <param name="height" type="unsigned long" dir="out"/> 15165 <param name="bitsPerPixel" type="unsigned long" dir="out"/> 15166 <param name="bytesPerLine" type="unsigned long" dir="out"/> 15167 <param name="pixelFormat" type="unsigned long" dir="out"/> 15168 </method> 15169 15170 </interface> 15171 15172 <interface 15156 15173 name="IFramebuffer" extends="$unknown" 15157 uuid=" e3f122c0-adab-4fc9-a8dc-da112fb48428"15174 uuid="29e4a04d-03a7-4860-977b-a987c3e92c2b" 15158 15175 wsmap="managed" 15159 15176 > … … 15265 15282 </method> 15266 15283 15284 <!-- 15267 15285 <method name="requestResize" wsmap="suppress"> 15268 15286 <desc> … … 15298 15316 available or not. If @a pixelFormat is <link 15299 15317 to="FramebufferPixelFormat_Opaque"/> then direct access to the guest 15300 VRAM buffer is not available - -the @a VRAM, @a bitsPerPixel and15318 VRAM buffer is not available - the @a VRAM, @a bitsPerPixel and 15301 15319 @a bytesPerLine parameters must be ignored and the implementation must use 15302 15320 the indirect mode (where it provides its own buffer in one of the … … 15381 15399 <link to="IDisplay::resizeCompleted"/>. 15382 15400 </desc> 15401 </param> 15402 </method> 15403 --> 15404 15405 <method name="notifyChange"> 15406 <desc> 15407 Requests a size change. 15408 </desc> 15409 <param name="screenId" type="unsigned long" dir="in"> 15410 <desc> 15411 Logical guest screen number. 15412 </desc> 15413 </param> 15414 <param name="xOrigin" type="unsigned long" dir="in"> 15415 <desc>Location of the screen in the guest.</desc> 15416 </param> 15417 <param name="yOrigin" type="unsigned long" dir="in"> 15418 <desc>Location of the screen in the guest.</desc> 15419 </param> 15420 <param name="width" type="unsigned long" dir="in"> 15421 <desc>Width of the guest display, in pixels.</desc> 15422 </param> 15423 <param name="height" type="unsigned long" dir="in"> 15424 <desc>Height of the guest display, in pixels.</desc> 15383 15425 </param> 15384 15426 </method> … … 15542 15584 <interface 15543 15585 name="IDisplay" extends="$unknown" 15544 uuid=" 480b372c-c0b5-4c23-9bd7-dcbb85b1594c"15586 uuid="efd0567f-8697-4b4c-965a-7f3672d1909e" 15545 15587 wsmap="managed" 15546 15588 > … … 15556 15598 the host computer or an RDP session's display on a remote computer. 15557 15599 </desc> 15600 15558 15601 <method name="getScreenResolution"> 15559 15602 <desc>Queries display width, height and color depth for given screen.</desc> … … 15566 15609 </method> 15567 15610 15568 <method name=" setFramebuffer">15569 <desc> 15570 Sets the framebuffer for givenscreen.15611 <method name="attachFramebuffer"> 15612 <desc> 15613 Sets the graphics updates target for a screen. 15571 15614 </desc> 15572 15615 <param name="screenId" type="unsigned long" dir="in"/> … … 15574 15617 </method> 15575 15618 15576 <method name="getFramebuffer"> 15577 <desc> 15578 Queries the framebuffer for given screen. 15619 <method name="detachFramebuffer"> 15620 <desc> 15621 Removes the graphics updates target for a screen. 15622 </desc> 15623 <param name="screenId" type="unsigned long" dir="in"/> 15624 </method> 15625 15626 <method name="queryFramebuffer"> 15627 <desc> 15628 Queries the graphics updates targets for a screen. 15579 15629 </desc> 15580 15630 <param name="screenId" type="unsigned long" dir="in"/> 15581 15631 <param name="framebuffer" type="IFramebuffer" dir="out"/> 15582 <param name="xOrigin" type="long" dir="out"/>15583 <param name="yOrigin" type="long" dir="out"/>15584 15632 </method> 15585 15633 … … 15810 15858 </method> 15811 15859 15860 <!-- 15812 15861 <method name="resizeCompleted"> 15813 15862 <desc> … … 15821 15870 <param name="screenId" type="unsigned long" dir="in"/> 15822 15871 </method> 15872 --> 15823 15873 15824 15874 <method name="completeVHWACommand"> … … 15868 15918 </param> 15869 15919 </method> 15920 15921 <method name="querySourceBitmap" wsmap="suppress"> 15922 <desc> 15923 Obtains the guest screen bitmap parameters. 15924 </desc> 15925 <param name="screenId" type="unsigned long" dir="in"/> 15926 <param name="displaySourceBitmap" type="IDisplaySourceBitmap" dir="out"/> 15927 </method> 15928 15870 15929 </interface> 15871 15930 -
trunk/src/VBox/Main/include/ConsoleVRDPServer.h
r49120 r51436 197 197 int m_mousey; 198 198 199 IFramebuffer *maFramebuffers[SchemaDefs::MaxGuestMonitors];199 ComPtr<IDisplaySourceBitmap> maSourceBitmaps[SchemaDefs::MaxGuestMonitors]; 200 200 201 201 ComPtr<IEventListener> mConsoleListener; -
trunk/src/VBox/Main/include/DisplayImpl.h
r51141 r51436 32 32 #endif 33 33 34 #include "DisplaySourceBitmapWrap.h" 35 34 36 class Console; 35 37 struct VIDEORECCONTEXT; … … 49 51 50 52 ComPtr<IFramebuffer> pFramebuffer; 53 ComPtr<IDisplaySourceBitmap> pSourceBitmap; 51 54 bool fDisabled; 52 55 … … 219 222 STDMETHOD(GetScreenResolution)(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ULONG *aBitsPerPixel, LONG *aXOrigin, LONG *aYOrigin); 220 223 STDMETHOD(SetFramebuffer)(ULONG aScreenId, IFramebuffer *aFramebuffer); 224 STDMETHOD(AttachFramebuffer)(ULONG aScreenId, 225 IFramebuffer *aFramebuffer); 226 STDMETHOD(DetachFramebuffer)(ULONG aScreenId); 227 STDMETHOD(QueryFramebuffer)(ULONG aScreenId, 228 IFramebuffer **aFramebuffer); 221 229 STDMETHOD(GetFramebuffer)(ULONG aScreenId, IFramebuffer **aFramebuffer, LONG *aXOrigin, LONG *aYOrigin); 222 230 STDMETHOD(SetVideoModeHint)(ULONG aDisplay, BOOL aEnabled, BOOL aChangeOrigin, LONG aOriginX, LONG aOriginY, ULONG aWidth, ULONG aHeight, ULONG aBitsPerPixel); … … 232 240 233 241 STDMETHOD(ViewportChanged)(ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height); 242 STDMETHOD(QuerySourceBitmap)(ULONG aScreenId, 243 IDisplaySourceBitmap **aDisplaySourceBitmap); 234 244 235 245 static const PDMDRVREG DrvReg; … … 237 247 private: 238 248 249 HRESULT querySourceBitmap(ULONG aScreenId, 250 IDisplaySourceBitmap **ppDisplaySourceBitmap); 239 251 int updateDisplayData(void); 240 252 … … 423 435 uint8_t fLimitSize); 424 436 437 class ATL_NO_VTABLE DisplaySourceBitmap: 438 public DisplaySourceBitmapWrap 439 { 440 public: 441 442 DECLARE_EMPTY_CTOR_DTOR(DisplaySourceBitmap) 443 444 HRESULT FinalConstruct(); 445 void FinalRelease(); 446 447 /* Public initializer/uninitializer for internal purposes only. */ 448 HRESULT init(ComObjPtr<Display> pDisplay, unsigned uScreenId, DISPLAYFBINFO *pFBInfo); 449 void uninit(); 450 451 bool usesVRAM(void) { return m.pu8Allocated == NULL; } 452 453 private: 454 // wrapped IDisplaySourceBitmap properties 455 virtual HRESULT getScreenId(ULONG *aScreenId); 456 457 // wrapped IDisplaySourceBitmap methods 458 virtual HRESULT queryBitmapInfo(BYTE **aAddress, 459 ULONG *aWidth, 460 ULONG *aHeight, 461 ULONG *aBitsPerPixel, 462 ULONG *aBytesPerLine, 463 ULONG *aPixelFormat); 464 465 int initSourceBitmap(unsigned aScreenId, DISPLAYFBINFO *pFBInfo); 466 467 struct Data 468 { 469 ComObjPtr<Display> pDisplay; 470 unsigned uScreenId; 471 DISPLAYFBINFO *pFBInfo; 472 473 uint8_t *pu8Allocated; 474 475 uint8_t *pu8Address; 476 ULONG ulWidth; 477 ULONG ulHeight; 478 ULONG ulBitsPerPixel; 479 ULONG ulBytesPerLine; 480 ULONG ulPixelFormat; 481 }; 482 483 Data m; 484 }; 485 425 486 #endif // ____H_DISPLAYIMPL 426 487 /* vi: set tabstop=4 shiftwidth=4 expandtab: */ -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r51419 r51436 3406 3406 InsertConfigInteger(pCfg, "VMSVGAEnabled", true); 3407 3407 #ifdef VBOX_WITH_VMSVGA3D 3408 IFramebuffer *pFramebuffer = getDisplay()->getFramebuffer(); 3409 if (pFramebuffer) 3408 IFramebuffer *pFramebuffer = NULL; 3409 hrc = getDisplay()->QueryFramebuffer(0, &pFramebuffer); 3410 if (SUCCEEDED(hrc) && pFramebuffer) 3410 3411 { 3411 3412 LONG64 winId = 0; … … 3414 3415 hrc = pFramebuffer->COMGETTER(WinId)(&winId); 3415 3416 InsertConfigInteger(pCfg, "HostWindowId", winId); 3417 pFramebuffer->Release(); 3416 3418 } 3417 3419 BOOL f3DEnabled; … … 3438 3440 /* VESA height reduction */ 3439 3441 ULONG ulHeightReduction; 3440 IFramebuffer *pFramebuffer = getDisplay()->getFramebuffer(); 3441 if (pFramebuffer) 3442 IFramebuffer *pFramebuffer = NULL; 3443 hrc = getDisplay()->QueryFramebuffer(0, &pFramebuffer); 3444 if (SUCCEEDED(hrc) && pFramebuffer) 3442 3445 { 3443 3446 hrc = pFramebuffer->COMGETTER(HeightReduction)(&ulHeightReduction); H(); 3447 pFramebuffer->Release(); 3448 pFramebuffer = NULL; 3444 3449 } 3445 3450 else -
trunk/src/VBox/Main/src-client/ConsoleVRDPServer.cpp
r51092 r51436 1085 1085 bool fAvailable = false; 1086 1086 1087 IFramebuffer *pfb = NULL; 1088 LONG xOrigin = 0; 1089 LONG yOrigin = 0; 1090 1091 server->mConsole->getDisplay()->GetFramebuffer(uScreenId, &pfb, &xOrigin, &yOrigin); 1092 1093 if (pfb) 1094 { 1095 pfb->Lock (); 1096 1097 /* Query framebuffer parameters. */ 1098 ULONG lineSize = 0; 1099 pfb->COMGETTER(BytesPerLine)(&lineSize); 1100 1101 ULONG bitsPerPixel = 0; 1102 pfb->COMGETTER(BitsPerPixel)(&bitsPerPixel); 1103 1104 BYTE *address = NULL; 1105 pfb->COMGETTER(Address)(&address); 1106 1107 ULONG height = 0; 1108 pfb->COMGETTER(Height)(&height); 1109 1110 ULONG width = 0; 1111 pfb->COMGETTER(Width)(&width); 1112 1113 /* Now fill the information as requested by the caller. */ 1114 pInfo->pu8Bits = address; 1115 pInfo->xOrigin = xOrigin; 1116 pInfo->yOrigin = yOrigin; 1117 pInfo->cWidth = width; 1118 pInfo->cHeight = height; 1119 pInfo->cBitsPerPixel = bitsPerPixel; 1120 pInfo->cbLine = lineSize; 1121 1122 pfb->Unlock(); 1123 1124 fAvailable = true; 1125 } 1126 1127 if (server->maFramebuffers[uScreenId]) 1128 { 1129 server->maFramebuffers[uScreenId]->Release(); 1130 } 1131 server->maFramebuffers[uScreenId] = pfb; 1087 /* Obtain the new screen bitmap. */ 1088 HRESULT hr = server->mConsole->getDisplay()->QuerySourceBitmap(uScreenId, server->maSourceBitmaps[uScreenId].asOutParam()); 1089 if (SUCCEEDED(hr)) 1090 { 1091 LONG xOrigin = 0; 1092 LONG yOrigin = 0; 1093 BYTE *pAddress = NULL; 1094 ULONG ulWidth = 0; 1095 ULONG ulHeight = 0; 1096 ULONG ulBitsPerPixel = 0; 1097 ULONG ulBytesPerLine = 0; 1098 ULONG ulPixelFormat = 0; 1099 1100 hr = server->maSourceBitmaps[uScreenId]->QueryBitmapInfo(&pAddress, 1101 &ulWidth, 1102 &ulHeight, 1103 &ulBitsPerPixel, 1104 &ulBytesPerLine, 1105 &ulPixelFormat); 1106 1107 if (SUCCEEDED(hr)) 1108 { 1109 hr = server->mConsole->getDisplay()->GetScreenResolution(uScreenId, NULL, NULL, NULL, 1110 &xOrigin, &yOrigin); 1111 1112 if (SUCCEEDED(hr)) 1113 { 1114 /* Now fill the information as requested by the caller. */ 1115 pInfo->pu8Bits = pAddress; 1116 pInfo->xOrigin = xOrigin; 1117 pInfo->yOrigin = yOrigin; 1118 pInfo->cWidth = ulWidth; 1119 pInfo->cHeight = ulHeight; 1120 pInfo->cBitsPerPixel = ulBitsPerPixel; 1121 pInfo->cbLine = ulBytesPerLine; 1122 1123 fAvailable = true; 1124 } 1125 } 1126 } 1132 1127 1133 1128 return fAvailable; … … 1136 1131 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackFramebufferLock(void *pvCallback, unsigned uScreenId) 1137 1132 { 1138 ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); 1139 1140 if (server->maFramebuffers[uScreenId]) 1141 { 1142 server->maFramebuffers[uScreenId]->Lock(); 1143 } 1133 NOREF(pvCallback); 1134 NOREF(uScreenId); 1135 /* Do nothing */ 1144 1136 } 1145 1137 1146 1138 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackFramebufferUnlock(void *pvCallback, unsigned uScreenId) 1147 1139 { 1148 ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback); 1149 1150 if (server->maFramebuffers[uScreenId]) 1151 { 1152 server->maFramebuffers[uScreenId]->Unlock(); 1153 } 1140 NOREF(pvCallback); 1141 NOREF(uScreenId); 1142 /* Do nothing */ 1154 1143 } 1155 1144 … … 1408 1397 m_InputSynch.fClientScrollLock = false; 1409 1398 1410 RT_ZERO(maFramebuffers);1411 1412 1399 { 1413 1400 ComPtr<IEventSource> es; … … 1467 1454 1468 1455 unsigned i; 1469 for (i = 0; i < RT_ELEMENTS(maFramebuffers); i++) 1470 { 1471 if (maFramebuffers[i]) 1472 { 1473 maFramebuffers[i]->Release(); 1474 maFramebuffers[i] = NULL; 1475 } 1456 for (i = 0; i < RT_ELEMENTS(maSourceBitmaps); i++) 1457 { 1458 maSourceBitmaps[i].setNull(); 1476 1459 } 1477 1460 -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r51408 r51436 855 855 Assert (pFramebuffer); 856 856 857 NOREF(pixelFormat); 858 NOREF(pvVRAM); 859 NOREF(bpp); 860 NOREF(cbLine); 861 857 862 /* Call the framebuffer to try and set required pixelFormat. */ 858 BOOL finished = TRUE; 859 860 pFramebuffer->RequestResize (uScreenId, pixelFormat, (BYTE *) pvVRAM, 861 bpp, cbLine, w, h, &finished); 862 863 if (!finished) 864 { 865 LogRelFlowFunc(("External framebuffer wants us to wait!\n")); 866 return VINF_VGA_RESIZE_IN_PROGRESS; 867 } 863 HRESULT hr = pFramebuffer->NotifyChange(uScreenId, 0, 0, w, h); /* @todo origin */ 864 865 Log(("pFramebuffer->NotifyChange hr %08x\n", hr)); 868 866 869 867 return VINF_SUCCESS; … … 939 937 940 938 /* If there is no framebuffer, this call is not interesting. */ 941 if ( uScreenId >= mcMonitors 942 || maFramebuffers[uScreenId].pFramebuffer.isNull()) 939 if (uScreenId >= mcMonitors) 943 940 { 944 941 return VINF_SUCCESS; … … 953 950 mLastHeight = h; 954 951 mLastFlags = flags; 952 953 DISPLAYFBINFO *pFBInfo = &maFramebuffers[uScreenId]; 954 pFBInfo->w = w; 955 pFBInfo->h = h; 956 957 pFBInfo->u16BitsPerPixel = (uint16_t)bpp; 958 pFBInfo->pu8FramebufferVRAM = (uint8_t *)pvVRAM; 959 pFBInfo->u32LineSize = cbLine; 960 } 961 962 if (maFramebuffers[uScreenId].pFramebuffer.isNull()) 963 { 964 return VINF_SUCCESS; 955 965 } 956 966 … … 1001 1011 /* Framebuffer will be invalid during resize, make sure that it is not accessed. */ 1002 1012 if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN) 1003 mpDrv->pUpPort->pfnSetRenderVRAM (mpDrv->pUpPort, false); 1013 { 1014 mpDrv->pUpPort->pfnSetRenderVRAM(mpDrv->pUpPort, false); 1015 1016 mpDrv->IConnector.pu8Data = NULL; 1017 mpDrv->IConnector.cbScanline = 0; 1018 mpDrv->IConnector.cBits = 32; /* DevVGA does not work with cBits == 0. */ 1019 mpDrv->IConnector.cx = 0; 1020 mpDrv->IConnector.cy = 0; 1021 } 1022 1023 maFramebuffers[uScreenId].pSourceBitmap.setNull(); 1004 1024 1005 1025 int rc = callFramebufferResize (maFramebuffers[uScreenId].pFramebuffer, uScreenId, … … 1082 1102 if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN && !pFBInfo->pFramebuffer.isNull()) 1083 1103 { 1084 /* Primary framebuffer has completed the resize. Update the connector data for VGA device. */1085 int rc2 = updateDisplayData();1086 1087 /* Check the framebuffer pixel format to setup the rendering in VGA device. */1088 BOOL usesGuestVRAM = FALSE;1089 pFBInfo->pFramebuffer->COMGETTER(UsesGuestVRAM) (&usesGuestVRAM);1090 1091 pFBInfo->fDefaultFormat = (usesGuestVRAM == FALSE);1092 1093 /* If the primary framebuffer is disabled, tell the VGA device to not to copy1094 * pixels from VRAM to the framebuffer.1095 */1096 if (pFBInfo->fDisabled || RT_FAILURE(rc2))1097 mpDrv->pUpPort->pfnSetRenderVRAM (mpDrv->pUpPort, false);1098 else1099 mpDrv->pUpPort->pfnSetRenderVRAM (mpDrv->pUpPort,1100 pFBInfo->fDefaultFormat);1101 1102 1104 /* If the screen resize was because of disabling, tell framebuffer to repaint. 1103 1105 * The framebuffer if now in default format so it will not use guest VRAM … … 1109 1111 else if (!pFBInfo->pFramebuffer.isNull()) 1110 1112 { 1111 BOOL usesGuestVRAM = FALSE;1112 pFBInfo->pFramebuffer->COMGETTER(UsesGuestVRAM) (&usesGuestVRAM);1113 1114 pFBInfo->fDefaultFormat = (usesGuestVRAM == FALSE);1115 1116 1113 /* If the screen resize was because of disabling, tell framebuffer to repaint. 1117 1114 * The framebuffer if now in default format so it will not use guest VRAM … … 2386 2383 if (aScreenId == VBOX_VIDEO_PRIMARY_SCREEN) 2387 2384 { 2388 CHECK_CONSOLE_DRV(mpDrv); 2389 2390 u32Width = mpDrv->IConnector.cx; 2391 u32Height = mpDrv->IConnector.cy; 2392 int rc = mpDrv->pUpPort->pfnQueryColorDepth(mpDrv->pUpPort, &u32BitsPerPixel); 2393 AssertRC(rc); 2385 if (mpDrv) 2386 { 2387 u32Width = mpDrv->IConnector.cx; 2388 u32Height = mpDrv->IConnector.cy; 2389 int rc = mpDrv->pUpPort->pfnQueryColorDepth(mpDrv->pUpPort, &u32BitsPerPixel); 2390 AssertRC(rc); 2391 } 2394 2392 } 2395 2393 else if (aScreenId < mcMonitors) … … 2478 2476 ComAssertRCRet (vrc, E_FAIL); 2479 2477 } 2478 2479 return S_OK; 2480 } 2481 2482 STDMETHODIMP Display::AttachFramebuffer(ULONG aScreenId, 2483 IFramebuffer *aFramebuffer) 2484 { 2485 LogRelFlowFunc(("aScreenId = %d\n", aScreenId)); 2486 2487 CheckComArgPointerValid(aFramebuffer); 2488 2489 AutoCaller autoCaller(this); 2490 if (FAILED(autoCaller.rc())) 2491 return autoCaller.rc(); 2492 2493 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2494 2495 if (aScreenId >= mcMonitors) 2496 return setError(E_INVALIDARG, tr("AttachFramebuffer: Invalid screen %d (total %d)"), 2497 aScreenId, mcMonitors); 2498 2499 DISPLAYFBINFO *pFBInfo = &maFramebuffers[aScreenId]; 2500 if (!pFBInfo->pFramebuffer.isNull()) 2501 return setError(E_FAIL, tr("AttachFramebuffer: Framebuffer already attached to %d"), 2502 aScreenId); 2503 2504 pFBInfo->pFramebuffer = aFramebuffer; 2505 2506 /* The driver might not have been constructed yet */ 2507 if (mpDrv) 2508 { 2509 /* Setup the new framebuffer, the resize will lead to an updateDisplayData call. */ 2510 2511 #if defined(VBOX_WITH_CROGL) 2512 /* Release the lock, because SHCRGL_HOST_FN_SCREEN_CHANGED will read current framebuffer */ 2513 /* @todo investigate */ 2514 { 2515 BOOL is3denabled; 2516 mParent->machine()->COMGETTER(Accelerate3DEnabled)(&is3denabled); 2517 2518 if (is3denabled) 2519 { 2520 alock.release(); 2521 } 2522 } 2523 #endif 2524 2525 /* @todo generic code for all monitors. */ 2526 if (pFBInfo->fVBVAEnabled && pFBInfo->pu8FramebufferVRAM) 2527 { 2528 /* This display in VBVA mode. Resize it to the last guest resolution, 2529 * if it has been reported. 2530 */ 2531 handleDisplayResize(aScreenId, pFBInfo->u16BitsPerPixel, 2532 pFBInfo->pu8FramebufferVRAM, 2533 pFBInfo->u32LineSize, 2534 pFBInfo->w, 2535 pFBInfo->h, 2536 pFBInfo->flags); 2537 } 2538 else if (aScreenId == VBOX_VIDEO_PRIMARY_SCREEN) 2539 { 2540 /* VGA device mode, only for the primary screen. */ 2541 handleDisplayResize(VBOX_VIDEO_PRIMARY_SCREEN, mLastBitsPerPixel, 2542 mLastAddress, 2543 mLastBytesPerLine, 2544 mLastWidth, 2545 mLastHeight, 2546 mLastFlags); 2547 } 2548 } 2549 2550 LogRelFlowFunc(("Attached to %d\n", aScreenId)); 2551 return S_OK; 2552 } 2553 2554 STDMETHODIMP Display::DetachFramebuffer(ULONG aScreenId) 2555 { 2556 LogRelFlowFunc(("aScreenId = %d\n", aScreenId)); 2557 2558 AutoCaller autoCaller(this); 2559 if (FAILED(autoCaller.rc())) 2560 return autoCaller.rc(); 2561 2562 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2563 2564 if (aScreenId >= mcMonitors) 2565 return setError(E_INVALIDARG, tr("DetachFramebuffer: Invalid screen %d (total %d)"), 2566 aScreenId, mcMonitors); 2567 2568 DISPLAYFBINFO *pFBInfo = &maFramebuffers[aScreenId]; 2569 2570 pFBInfo->pFramebuffer.setNull(); 2571 2572 return S_OK; 2573 } 2574 2575 STDMETHODIMP Display::QueryFramebuffer(ULONG aScreenId, 2576 IFramebuffer **aFramebuffer) 2577 { 2578 LogRelFlowFunc(("aScreenId = %d\n", aScreenId)); 2579 2580 CheckComArgOutPointerValid(aFramebuffer); 2581 2582 AutoCaller autoCaller(this); 2583 if (FAILED(autoCaller.rc())) 2584 return autoCaller.rc(); 2585 2586 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2587 2588 if (aScreenId >= mcMonitors) 2589 return setError(E_INVALIDARG, tr("QueryFramebuffer: Invalid screen %d (total %d)"), 2590 aScreenId, mcMonitors); 2591 2592 DISPLAYFBINFO *pFBInfo = &maFramebuffers[aScreenId]; 2593 2594 *aFramebuffer = pFBInfo->pFramebuffer; 2595 if (!pFBInfo->pFramebuffer.isNull()) 2596 pFBInfo->pFramebuffer->AddRef(); 2480 2597 2481 2598 return S_OK; … … 3239 3356 && !pFBInfo->fDisabled) 3240 3357 { 3241 address = NULL; 3242 HRESULT hrc = pFBInfo->pFramebuffer->COMGETTER(Address) (&address); 3243 if (SUCCEEDED(hrc) && address != NULL) 3358 BYTE *pAddress = NULL; 3359 ULONG ulWidth = 0; 3360 ULONG ulHeight = 0; 3361 ULONG ulBitsPerPixel = 0; 3362 ULONG ulBytesPerLine = 0; 3363 ULONG ulPixelFormat = 0; 3364 3365 HRESULT hrc = pFBInfo->pSourceBitmap->QueryBitmapInfo(&pAddress, 3366 &ulWidth, 3367 &ulHeight, 3368 &ulBitsPerPixel, 3369 &ulBytesPerLine, 3370 &ulPixelFormat); 3371 if (SUCCEEDED(hrc)) 3244 3372 { 3245 3373 pu8Src = pFBInfo->pu8FramebufferVRAM; … … 3252 3380 3253 3381 /* Default format is 32 bpp. */ 3254 pu8Dst = address;3382 pu8Dst = pAddress; 3255 3383 xDst = xSrc; 3256 3384 yDst = ySrc; … … 3374 3502 * When framebuffer uses VRAM directly, just notify it to update. 3375 3503 */ 3376 if (pFBInfo->fDefaultFormat )3504 if (pFBInfo->fDefaultFormat && !pFBInfo->pSourceBitmap.isNull()) 3377 3505 { 3378 BYTE *address = NULL; 3379 ULONG uWidth = 0; 3380 ULONG uHeight = 0; 3381 pFBInfo->pFramebuffer->COMGETTER(Width) (&uWidth); 3382 pFBInfo->pFramebuffer->COMGETTER(Height) (&uHeight); 3383 HRESULT hrc = pFBInfo->pFramebuffer->COMGETTER(Address) (&address); 3384 if (SUCCEEDED(hrc) && address != NULL) 3506 BYTE *pAddress = NULL; 3507 ULONG ulWidth = 0; 3508 ULONG ulHeight = 0; 3509 ULONG ulBitsPerPixel = 0; 3510 ULONG ulBytesPerLine = 0; 3511 ULONG ulPixelFormat = 0; 3512 3513 HRESULT hrc = pFBInfo->pSourceBitmap->QueryBitmapInfo(&pAddress, 3514 &ulWidth, 3515 &ulHeight, 3516 &ulBitsPerPixel, 3517 &ulBytesPerLine, 3518 &ulPixelFormat); 3519 if (SUCCEEDED(hrc)) 3385 3520 { 3386 3521 uint32_t width = pFBInfo->w; … … 3396 3531 3397 3532 /* Default format is 32 bpp. */ 3398 uint8_t *pu8Dst = address;3533 uint8_t *pu8Dst = pAddress; 3399 3534 int32_t xDst = xSrc; 3400 3535 int32_t yDst = ySrc; … … 3408 3543 * copyrect should not be called. 3409 3544 */ 3410 if (u Width == pFBInfo->w && uHeight == pFBInfo->h)3545 if (ulWidth == pFBInfo->w && ulHeight == pFBInfo->h) 3411 3546 { 3412 3547 … … 3549 3684 } 3550 3685 3686 STDMETHODIMP Display::QuerySourceBitmap(ULONG aScreenId, 3687 IDisplaySourceBitmap **aDisplaySourceBitmap) 3688 { 3689 LogRelFlowFunc(("aScreenId = %d\n", aScreenId)); 3690 3691 AutoCaller autoCaller(this); 3692 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3693 3694 Console::SafeVMPtr ptrVM(mParent); 3695 if (!ptrVM.isOk()) 3696 return ptrVM.rc(); 3697 3698 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3699 3700 if (aScreenId >= mcMonitors) 3701 return setError(E_INVALIDARG, tr("QuerySourceBitmap: Invalid screen %d (total %d)"), 3702 aScreenId, mcMonitors); 3703 3704 HRESULT hr = querySourceBitmap(aScreenId, aDisplaySourceBitmap); 3705 3706 alock.release(); 3707 3708 LogRelFlowFunc(("%Rhrc\n", hr)); 3709 return hr; 3710 } 3711 3551 3712 // private methods 3552 3713 ///////////////////////////////////////////////////////////////////////////// 3714 3715 HRESULT Display::querySourceBitmap(ULONG aScreenId, 3716 IDisplaySourceBitmap **ppDisplaySourceBitmap) 3717 { 3718 HRESULT hr = S_OK; 3719 3720 DISPLAYFBINFO *pFBInfo = &maFramebuffers[aScreenId]; 3721 if (pFBInfo->pSourceBitmap.isNull()) 3722 { 3723 /* Create a new object. */ 3724 ComObjPtr<DisplaySourceBitmap> obj; 3725 hr = obj.createObject(); 3726 if (SUCCEEDED(hr)) 3727 { 3728 hr = obj->init(this, aScreenId, pFBInfo); 3729 } 3730 3731 if (SUCCEEDED(hr)) 3732 { 3733 pFBInfo->pSourceBitmap = obj; 3734 3735 /* Whether VRAM must be copied to the internal buffer. */ 3736 pFBInfo->fDefaultFormat = !obj->usesVRAM(); 3737 3738 if (aScreenId == VBOX_VIDEO_PRIMARY_SCREEN) 3739 { 3740 /* Start buffer updates. */ 3741 BYTE *pAddress = NULL; 3742 ULONG ulWidth = 0; 3743 ULONG ulHeight = 0; 3744 ULONG ulBitsPerPixel = 0; 3745 ULONG ulBytesPerLine = 0; 3746 ULONG ulPixelFormat = 0; 3747 3748 obj->QueryBitmapInfo(&pAddress, 3749 &ulWidth, 3750 &ulHeight, 3751 &ulBitsPerPixel, 3752 &ulBytesPerLine, 3753 &ulPixelFormat); 3754 3755 mpDrv->IConnector.pu8Data = pAddress; 3756 mpDrv->IConnector.cbScanline = ulBytesPerLine; 3757 mpDrv->IConnector.cBits = ulBitsPerPixel; 3758 mpDrv->IConnector.cx = ulWidth; 3759 mpDrv->IConnector.cy = ulHeight; 3760 3761 if (pFBInfo->fDefaultFormat) 3762 mpDrv->pUpPort->pfnSetRenderVRAM(mpDrv->pUpPort, true); 3763 } 3764 3765 if (pFBInfo->fDefaultFormat) 3766 { 3767 /* @todo make sure that the bitmap contains the latest image? */ 3768 } 3769 } 3770 } 3771 3772 if (SUCCEEDED(hr)) 3773 { 3774 pFBInfo->pSourceBitmap->AddRef(); 3775 *ppDisplaySourceBitmap = pFBInfo->pSourceBitmap; 3776 } 3777 3778 return hr; 3779 } 3553 3780 3554 3781 /** … … 3848 4075 unsigned uScreenId; 3849 4076 3850 Log2(("DisplayRefreshCallback\n"));3851 4077 for (uScreenId = 0; uScreenId < pDisplay->mcMonitors; uScreenId++) 3852 4078 { … … 3895 4121 if (!pFBInfo->pFramebuffer.isNull() && pFBInfo->u32ResizeStatus == ResizeStatus_Void) 3896 4122 { 3897 Assert(pDrv->IConnector.pu8Data);3898 4123 pDisplay->vbvaLock(); 3899 4124 pDrv->pUpPort->pfnUpdateDisplay(pDrv->pUpPort); … … 4742 4967 { 4743 4968 /* Render VRAM content to the framebuffer. */ 4744 BYTE *address = NULL; 4745 HRESULT hrc = pFBInfo->pFramebuffer->COMGETTER(Address) (&address); 4746 if (SUCCEEDED(hrc) && address != NULL) 4969 BYTE *pAddress = NULL; 4970 ULONG ulWidth = 0; 4971 ULONG ulHeight = 0; 4972 ULONG ulBitsPerPixel = 0; 4973 ULONG ulBytesPerLine = 0; 4974 ULONG ulPixelFormat = 0; 4975 4976 HRESULT hrc = pFBInfo->pSourceBitmap->QueryBitmapInfo(&pAddress, 4977 &ulWidth, 4978 &ulHeight, 4979 &ulBitsPerPixel, 4980 &ulBytesPerLine, 4981 &ulPixelFormat); 4982 if (SUCCEEDED(hrc)) 4747 4983 { 4748 4984 uint32_t width = pCmd->w; … … 4757 4993 uint32_t u32SrcBitsPerPixel = pFBInfo->u16BitsPerPixel; 4758 4994 4759 uint8_t *pu8Dst = address;4995 uint8_t *pu8Dst = pAddress; 4760 4996 int32_t xDst = xSrc; 4761 4997 int32_t yDst = ySrc; … … 5218 5454 pThis->pDisplay = pDisplay; 5219 5455 pThis->pDisplay->mpDrv = pThis; 5220 /* 5221 * Update our display information according to the framebuffer5222 */5223 p Display->updateDisplayData();5456 5457 /* Disable VRAM to a buffer copy initially. */ 5458 pThis->pUpPort->pfnSetRenderVRAM (pThis->pUpPort, false); 5459 pThis->IConnector.cBits = 32; /* DevVGA does nothing otherwise. */ 5224 5460 5225 5461 /* -
trunk/src/VBox/Main/src-client/VMMDevInterface.cpp
r51096 r51436 400 400 #endif 401 401 IFramebuffer *framebuffer = NULL; 402 LONG xOrigin = 0; 403 LONG yOrigin = 0; 404 HRESULT hrc = pConsole->getDisplay()->GetFramebuffer(display, &framebuffer, &xOrigin, &yOrigin); 402 HRESULT hrc = pConsole->getDisplay()->QueryFramebuffer(display, &framebuffer); 405 403 if (SUCCEEDED(hrc) && framebuffer) 406 404 { … … 425 423 if (!heightReduction) 426 424 return VERR_INVALID_PARAMETER; 427 IFramebuffer *framebuffer = pConsole->getDisplay()->getFramebuffer(); 428 if (framebuffer) 425 IFramebuffer *framebuffer = NULL; 426 HRESULT hrc = pConsole->getDisplay()->QueryFramebuffer(0, &framebuffer); 427 if (SUCCEEDED(hrc) && framebuffer) 428 { 429 429 framebuffer->COMGETTER(HeightReduction)((ULONG*)heightReduction); 430 framebuffer->Release(); 431 } 430 432 else 431 433 *heightReduction = 0;
Note:
See TracChangeset
for help on using the changeset viewer.