Changeset 51553 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Jun 5, 2014 1:17:41 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r51552 r51553 2440 2440 } 2441 2441 2442 STDMETHODIMP Display::SetFramebuffer(ULONG aScreenId, IFramebuffer *aFramebuffer)2443 {2444 LogRelFlowFunc(("\n"));2445 2446 if (aFramebuffer != NULL)2447 CheckComArgOutPointerValid(aFramebuffer);2448 2449 AutoCaller autoCaller(this);2450 if (FAILED(autoCaller.rc()))2451 return autoCaller.rc();2452 2453 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);2454 2455 Console::SafeVMPtrQuiet ptrVM(mParent);2456 if (ptrVM.isOk())2457 {2458 /* Must release the lock here because the changeFramebuffer will2459 * also obtain it. */2460 alock.release();2461 2462 /* send request to the EMT thread */2463 int vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY,2464 (PFNRT)changeFramebuffer, 3, this, aFramebuffer, aScreenId);2465 2466 ComAssertRCRet(vrc, E_FAIL);2467 alock.acquire();2468 2469 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)2470 BOOL fIs3DEnabled;2471 HRESULT hr = mParent->machine()->COMGETTER(Accelerate3DEnabled)(&fIs3DEnabled);2472 ComAssertComRC(hr);2473 if (fIs3DEnabled)2474 {2475 VBOXCRCMDCTL_HGCM data;2476 RT_ZERO(data);2477 data.Hdr.enmType = VBOXCRCMDCTL_TYPE_HGCM;2478 data.Hdr.u32Function = SHCRGL_HOST_FN_SCREEN_CHANGED;2479 2480 data.aParms[0].type = VBOX_HGCM_SVC_PARM_32BIT;2481 data.aParms[0].u.uint32 = aScreenId;2482 2483 alock.release();2484 2485 vrc = crCtlSubmitSync(&data.Hdr, sizeof(data));2486 AssertRC(vrc);2487 2488 alock.acquire();2489 }2490 #endif /* #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL) */2491 }2492 else2493 {2494 /* No VM is created (VM is powered off), do a direct call */2495 int vrc = changeFramebuffer(this, aFramebuffer, aScreenId);2496 ComAssertRCRet(vrc, E_FAIL);2497 }2498 2499 return S_OK;2500 }2501 2502 2442 STDMETHODIMP Display::AttachFramebuffer(ULONG aScreenId, 2503 2443 IFramebuffer *aFramebuffer) … … 2528 2468 { 2529 2469 /* Setup the new framebuffer. */ 2530 2531 #if defined(VBOX_WITH_CROGL)2532 /* Release the lock, because SHCRGL_HOST_FN_SCREEN_CHANGED will read current framebuffer */2533 /* @todo investigate */2534 {2535 BOOL is3denabled;2536 mParent->machine()->COMGETTER(Accelerate3DEnabled)(&is3denabled);2537 2538 if (is3denabled)2539 {2540 alock.release();2541 }2542 }2543 #endif2544 2470 2545 2471 /* @todo generic code for all monitors. */ … … 2566 2492 mLastFlags); 2567 2493 } 2568 2569 alock.release(); 2570 2571 Console::SafeVMPtrQuiet ptrVM(mParent); 2572 if (ptrVM.isOk()) 2573 { 2574 VMR3ReqCallNoWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::InvalidateAndUpdateEMT, 2575 3, this, aScreenId, false); 2576 } 2494 } 2495 2496 alock.release(); 2497 2498 Console::SafeVMPtrQuiet ptrVM(mParent); 2499 if (ptrVM.isOk()) 2500 { 2501 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL) 2502 BOOL fIs3DEnabled = FALSE; 2503 mParent->machine()->COMGETTER(Accelerate3DEnabled)(&fIs3DEnabled); 2504 2505 if (fIs3DEnabled) 2506 { 2507 VBOXCRCMDCTL_HGCM data; 2508 RT_ZERO(data); 2509 data.Hdr.enmType = VBOXCRCMDCTL_TYPE_HGCM; 2510 data.Hdr.u32Function = SHCRGL_HOST_FN_SCREEN_CHANGED; 2511 2512 data.aParms[0].type = VBOX_HGCM_SVC_PARM_32BIT; 2513 data.aParms[0].u.uint32 = aScreenId; 2514 2515 int vrc = crCtlSubmitSync(&data.Hdr, sizeof(data)); 2516 AssertRC(vrc); 2517 } 2518 #endif /* defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL) */ 2519 2520 VMR3ReqCallNoWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::InvalidateAndUpdateEMT, 2521 3, this, aScreenId, false); 2577 2522 } 2578 2523 … … 3830 3775 } 3831 3776 #endif 3832 3833 /**3834 * Changes the current frame buffer. Called on EMT to avoid both3835 * race conditions and excessive locking.3836 *3837 * @note locks this object for writing3838 * @thread EMT3839 */3840 /* static */3841 DECLCALLBACK(int) Display::changeFramebuffer (Display *that, IFramebuffer *aFB,3842 unsigned uScreenId)3843 {3844 LogRelFlowFunc(("uScreenId = %d\n", uScreenId));3845 3846 AssertReturn(that, VERR_INVALID_PARAMETER);3847 AssertReturn(uScreenId < that->mcMonitors, VERR_INVALID_PARAMETER);3848 3849 AutoCaller autoCaller(that);3850 if (FAILED(autoCaller.rc())) return autoCaller.rc();3851 3852 AutoWriteLock alock(that COMMA_LOCKVAL_SRC_POS);3853 3854 DISPLAYFBINFO *pDisplayFBInfo = &that->maFramebuffers[uScreenId];3855 pDisplayFBInfo->pFramebuffer = aFB;3856 3857 that->mParent->consoleVRDPServer()->SendResize ();3858 3859 /* The driver might not have been constructed yet */3860 if (that->mpDrv)3861 {3862 /* Setup the new framebuffer. */3863 DISPLAYFBINFO *pFBInfo = &that->maFramebuffers[uScreenId];3864 3865 #if defined(VBOX_WITH_CROGL)3866 /* Release the lock, because SHCRGL_HOST_FN_SCREEN_CHANGED will read current framebuffer */3867 {3868 BOOL is3denabled;3869 that->mParent->machine()->COMGETTER(Accelerate3DEnabled)(&is3denabled);3870 3871 if (is3denabled)3872 {3873 alock.release();3874 }3875 }3876 #endif3877 3878 if (pFBInfo->fVBVAEnabled && pFBInfo->pu8FramebufferVRAM)3879 {3880 /* This display in VBVA mode. Resize it to the last guest resolution,3881 * if it has been reported.3882 */3883 that->handleDisplayResize(uScreenId, pFBInfo->u16BitsPerPixel,3884 pFBInfo->pu8FramebufferVRAM,3885 pFBInfo->u32LineSize,3886 pFBInfo->w,3887 pFBInfo->h,3888 pFBInfo->flags);3889 }3890 else if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN)3891 {3892 /* VGA device mode, only for the primary screen. */3893 that->handleDisplayResize(VBOX_VIDEO_PRIMARY_SCREEN, that->mLastBitsPerPixel,3894 that->mLastAddress,3895 that->mLastBytesPerLine,3896 that->mLastWidth,3897 that->mLastHeight,3898 that->mLastFlags);3899 }3900 }3901 3902 LogRelFlowFunc(("leave\n"));3903 return VINF_SUCCESS;3904 }3905 3777 3906 3778 /**
Note:
See TracChangeset
for help on using the changeset viewer.