Changeset 50313 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Feb 3, 2014 6:46:27 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 92022
- Location:
- trunk/src/VBox/Main/src-client
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r50260 r50313 52 52 # include <iprt/path.h> 53 53 # include "VideoRec.h" 54 #endif 55 56 #ifdef VBOX_WITH_CROGL 57 typedef enum 58 { 59 CRVREC_STATE_IDLE, 60 CRVREC_STATE_SUBMITTED 61 } CRVREC_STATE; 54 62 #endif 55 63 … … 137 145 for (unsigned i = 0; i < RT_ELEMENTS(maVideoRecEnabled); i++) 138 146 maVideoRecEnabled[i] = true; 147 #endif 148 149 #ifdef VBOX_WITH_CRHGSMI 150 mhCrOglSvc = NULL; 151 #endif 152 #ifdef VBOX_WITH_CROGL 153 RT_ZERO(mCrOglCallbacks); 154 mfCrOglVideoRecState = CRVREC_STATE_IDLE; 155 mCrOglScreenshotData.u32Screen = CRSCREEN_ALL; 156 mCrOglScreenshotData.pvContext = this; 157 mCrOglScreenshotData.pfnScreenshot = displayCrVRecScreenshot; 139 158 #endif 140 159 … … 3403 3422 Assert(mhCrOglSvc); 3404 3423 /* setup command completion callback */ 3405 VBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP_ COMPLETIONCompletion;3406 Completion.Hdr.enmType = VBOXVDMACMD_CHROMIUM_CTL_TYPE_CRHGSMI_SETUP_ COMPLETION;3424 VBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP_MAINCB Completion; 3425 Completion.Hdr.enmType = VBOXVDMACMD_CHROMIUM_CTL_TYPE_CRHGSMI_SETUP_MAINCB; 3407 3426 Completion.Hdr.cbCmd = sizeof (Completion); 3408 3427 Completion.hCompletion = mpDrv->pVBVACallbacks; … … 3428 3447 pFb->pendingViewportInfo.fPending = false; 3429 3448 } 3449 3450 mCrOglCallbacks = Completion.MainInterface; 3430 3451 3431 3452 return; … … 3654 3675 if (VideoRecIsEnabled(pDisplay->mpVideoRecCtx)) 3655 3676 { 3656 uint64_t u64Now = RTTimeProgramMilliTS(); 3657 for (uScreenId = 0; uScreenId < pDisplay->mcMonitors; uScreenId++) 3658 { 3659 if (!pDisplay->maVideoRecEnabled[uScreenId]) 3660 continue; 3661 3662 DISPLAYFBINFO *pFBInfo = &pDisplay->maFramebuffers[uScreenId]; 3663 3664 if ( !pFBInfo->pFramebuffer.isNull() 3665 && !pFBInfo->fDisabled 3666 && pFBInfo->u32ResizeStatus == ResizeStatus_Void) 3677 do { 3678 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL) 3679 BOOL is3denabled; 3680 pDisplay->mParent->machine()->COMGETTER(Accelerate3DEnabled)(&is3denabled); 3681 if (is3denabled) 3667 3682 { 3668 int rc; 3669 if ( pFBInfo->fVBVAEnabled 3670 && pFBInfo->pu8FramebufferVRAM) 3683 if (ASMAtomicCmpXchgU32(&pDisplay->mfCrOglVideoRecState, CRVREC_STATE_SUBMITTED, CRVREC_STATE_IDLE)) 3671 3684 { 3672 rc = VideoRecCopyToIntBuf(pDisplay->mpVideoRecCtx, uScreenId, 0, 0, 3673 FramebufferPixelFormat_FOURCC_RGB, 3674 pFBInfo->u16BitsPerPixel, 3675 pFBInfo->u32LineSize, pFBInfo->w, pFBInfo->h, 3676 pFBInfo->pu8FramebufferVRAM, u64Now); 3685 if (pDisplay->mCrOglCallbacks.pfnHasData()) 3686 { 3687 /* submit */ 3688 3689 VBOXHGCMSVCPARM parm; 3690 3691 parm.type = VBOX_HGCM_SVC_PARM_PTR; 3692 parm.u.pointer.addr = &pDisplay->mCrOglScreenshotData; 3693 parm.u.pointer.size = sizeof (pDisplay->mCrOglScreenshotData); 3694 3695 VMMDev *pVMMDev = pDisplay->mParent->getVMMDev(); 3696 if (pVMMDev) 3697 { 3698 int rc = pVMMDev->hgcmHostFastCallAsync(pDisplay->mhCrOglSvc, SHCRGL_HOST_FN_TAKE_SCREENSHOT, &parm, displayVRecCompletion, pDisplay); 3699 if (RT_SUCCESS(rc)) 3700 break; 3701 else 3702 AssertMsgFailed(("hgcmHostFastCallAsync failed %f\n", rc)); 3703 } 3704 else 3705 AssertMsgFailed(("no VMMDev\n")); 3706 } 3707 3708 /* no 3D data available, or error has occured, 3709 * go the straight way */ 3710 ASMAtomicWriteU32(&pDisplay->mfCrOglVideoRecState, CRVREC_STATE_IDLE); 3677 3711 } 3678 3712 else 3679 3713 { 3680 rc = VideoRecCopyToIntBuf(pDisplay->mpVideoRecCtx, uScreenId, 0, 0, 3681 FramebufferPixelFormat_FOURCC_RGB, 3682 pDrv->IConnector.cBits, 3683 pDrv->IConnector.cbScanline, pDrv->IConnector.cx, 3684 pDrv->IConnector.cy, pDrv->IConnector.pu8Data, u64Now); 3714 /* record request is still in progress, don't do anything */ 3715 break; 3685 3716 } 3686 if (rc == VINF_TRY_AGAIN)3687 break;3688 3717 } 3689 } 3718 #endif 3719 uint64_t u64Now = RTTimeProgramMilliTS(); 3720 for (uScreenId = 0; uScreenId < pDisplay->mcMonitors; uScreenId++) 3721 { 3722 if (!pDisplay->maVideoRecEnabled[uScreenId]) 3723 continue; 3724 3725 DISPLAYFBINFO *pFBInfo = &pDisplay->maFramebuffers[uScreenId]; 3726 3727 if ( !pFBInfo->pFramebuffer.isNull() 3728 && !pFBInfo->fDisabled 3729 && pFBInfo->u32ResizeStatus == ResizeStatus_Void) 3730 { 3731 int rc; 3732 if ( pFBInfo->fVBVAEnabled 3733 && pFBInfo->pu8FramebufferVRAM) 3734 { 3735 rc = VideoRecCopyToIntBuf(pDisplay->mpVideoRecCtx, uScreenId, 0, 0, 3736 FramebufferPixelFormat_FOURCC_RGB, 3737 pFBInfo->u16BitsPerPixel, 3738 pFBInfo->u32LineSize, pFBInfo->w, pFBInfo->h, 3739 pFBInfo->pu8FramebufferVRAM, u64Now); 3740 } 3741 else 3742 { 3743 rc = VideoRecCopyToIntBuf(pDisplay->mpVideoRecCtx, uScreenId, 0, 0, 3744 FramebufferPixelFormat_FOURCC_RGB, 3745 pDrv->IConnector.cBits, 3746 pDrv->IConnector.cbScanline, pDrv->IConnector.cx, 3747 pDrv->IConnector.cy, pDrv->IConnector.pu8Data, u64Now); 3748 } 3749 if (rc == VINF_TRY_AGAIN) 3750 break; 3751 } 3752 } 3753 } while (0); 3690 3754 } 3691 3755 #endif … … 4139 4203 if (pParam->type == VBOX_HGCM_SVC_PARM_PTR && pParam->u.pointer.addr) 4140 4204 RTMemFree(pParam->u.pointer.addr); 4205 } 4206 4207 4208 void Display::handleCrVRecScreenshot(uint32_t uScreen, 4209 uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBitsPerPixel, 4210 uint32_t uBytesPerLine, uint32_t uGuestWidth, uint32_t uGuestHeight, 4211 uint8_t *pu8BufferAddress, uint64_t u64TimeStamp) 4212 { 4213 Assert(mfCrOglVideoRecState == CRVREC_STATE_SUBMITTED); 4214 int rc = VideoRecCopyToIntBuf(mpVideoRecCtx, uScreen, x, y, 4215 uPixelFormat, 4216 uBitsPerPixel, uBytesPerLine, 4217 uGuestWidth, uGuestHeight, 4218 pu8BufferAddress, u64TimeStamp); 4219 Assert(rc == VINF_SUCCESS || rc == VERR_TRY_AGAIN || rc == VINF_TRY_AGAIN); 4220 } 4221 4222 void Display::handleVRecCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext) 4223 { 4224 Assert(mfCrOglVideoRecState == CRVREC_STATE_SUBMITTED); 4225 ASMAtomicWriteU32(&mfCrOglVideoRecState, CRVREC_STATE_IDLE); 4226 } 4227 4228 DECLCALLBACK(void) Display::displayCrVRecScreenshot(void *pvCtx, uint32_t uScreen, 4229 uint32_t x, uint32_t y, uint32_t uBitsPerPixel, 4230 uint32_t uBytesPerLine, uint32_t uGuestWidth, uint32_t uGuestHeight, 4231 uint8_t *pu8BufferAddress, uint64_t u64TimeStamp) 4232 { 4233 Display *pDisplay = (Display *)pvCtx; 4234 pDisplay->handleCrVRecScreenshot(uScreen, 4235 x, y, FramebufferPixelFormat_FOURCC_RGB, uBitsPerPixel, 4236 uBytesPerLine, uGuestWidth, uGuestHeight, 4237 pu8BufferAddress, u64TimeStamp); 4238 } 4239 4240 DECLCALLBACK(void) Display::displayVRecCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext) 4241 { 4242 Display *pDisplay = (Display *)pvContext; 4243 pDisplay->handleVRecCompletion(result, u32Function, pParam, pvContext); 4141 4244 } 4142 4245 -
trunk/src/VBox/Main/src-client/VideoRec.h
r50041 r50313 32 32 int VideoRecCopyToIntBuf(PVIDEORECCONTEXT pCtx, uint32_t uScreen, 33 33 uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBitsPerPixel, 34 uint32_t uBytesPerLine, uint32_t uGuest Height, uint32_t uGuestWidth,34 uint32_t uBytesPerLine, uint32_t uGuestWidth, uint32_t uGuestHeight, 35 35 uint8_t *pu8BufferAddress, uint64_t u64TimeStamp); 36 36
Note:
See TracChangeset
for help on using the changeset viewer.