VirtualBox

Changeset 50364 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Feb 7, 2014 2:11:50 PM (11 years ago)
Author:
vboxsync
Message:

crOpenGL: screenshot support; a bit of performance for video recording

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/DisplayImpl.h

    r50315 r50364  
    363363    static int  displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData, uint32_t *pu32Width, uint32_t *pu32Height);
    364364
     365#ifdef VBOX_WITH_CROGL
     366    static BOOL  displayCheckTakeScreenshotCrOgl(Display *pDisplay, ULONG aScreenId, uint8_t *pu8Data, uint32_t u32Width, uint32_t u32Height);
     367#endif
     368
    365369private:
    366370    static void InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpdateAll);
  • trunk/src/VBox/Main/src-client/DisplayImpl.cpp

    r50315 r50364  
    152152#ifdef VBOX_WITH_CROGL
    153153    RT_ZERO(mCrOglCallbacks);
     154    RT_ZERO(mCrOglScreenshotData);
    154155    mfCrOglVideoRecState = CRVREC_STATE_IDLE;
    155156    mCrOglScreenshotData.u32Screen = CRSCREEN_ALL;
     
    24152416}
    24162417
     2418#ifdef VBOX_WITH_CROGL
     2419BOOL Display::displayCheckTakeScreenshotCrOgl(Display *pDisplay, ULONG aScreenId, uint8_t *pu8Data, uint32_t u32Width, uint32_t u32Height)
     2420{
     2421    BOOL is3denabled;
     2422    pDisplay->mParent->machine()->COMGETTER(Accelerate3DEnabled)(&is3denabled);
     2423    if (is3denabled && pDisplay->mCrOglCallbacks.pfnHasData())
     2424    {
     2425        VMMDev *pVMMDev = pDisplay->mParent->getVMMDev();
     2426        if (pVMMDev)
     2427        {
     2428            CRVBOXHGCMTAKESCREENSHOT *pScreenshot = (CRVBOXHGCMTAKESCREENSHOT*)RTMemAlloc(sizeof (*pScreenshot));
     2429            if (pScreenshot)
     2430            {
     2431                /* screen id or CRSCREEN_ALL to specify all enabled */
     2432                pScreenshot->u32Screen = aScreenId;
     2433                pScreenshot->u32Width = u32Width;
     2434                pScreenshot->u32Height = u32Height;
     2435                pScreenshot->u32Pitch = u32Width * 4;
     2436                pScreenshot->pvBuffer = pu8Data;
     2437                pScreenshot->pvContext = NULL;
     2438                pScreenshot->pfnScreenshotBegin = NULL;
     2439                pScreenshot->pfnScreenshotPerform = NULL;
     2440                pScreenshot->pfnScreenshotEnd = NULL;
     2441
     2442                VBOXHGCMSVCPARM parm;
     2443
     2444                parm.type = VBOX_HGCM_SVC_PARM_PTR;
     2445                parm.u.pointer.addr = pScreenshot;
     2446                parm.u.pointer.size = sizeof (*pScreenshot);
     2447
     2448                int rc = pVMMDev->hgcmHostCall("VBoxSharedCrOpenGL", SHCRGL_HOST_FN_TAKE_SCREENSHOT, 1, &parm);
     2449
     2450                RTMemFree(pScreenshot);
     2451
     2452                if (RT_SUCCESS(rc))
     2453                    return TRUE;
     2454                else
     2455                {
     2456                    AssertMsgFailed(("failed to get screenshot data from crOgl %d\n", rc));
     2457                    /* fall back to the non-3d mechanism */
     2458                }
     2459            }
     2460        }
     2461    }
     2462    return FALSE;
     2463}
     2464#endif
     2465
    24172466int Display::displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData, uint32_t *pu32Width, uint32_t *pu32Height)
    24182467{
     
    25102559    uint32_t cy = 0;
    25112560    int vrc = VINF_SUCCESS;
     2561
     2562# if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
     2563    if (Display::displayCheckTakeScreenshotCrOgl(pDisplay, aScreenId, (uint8_t*)address, width, height))
     2564        return VINF_SUCCESS;
     2565#endif
    25122566
    25132567    int cRetries = 5;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette