VirtualBox

Ignore:
Timestamp:
Jul 10, 2009 5:29:38 PM (15 years ago)
Author:
vboxsync
Message:

video hw accel: overlay support (not debugged yet), better colorkey & flip support impl in guest driver & QGLFramebuffer (not debugged yet)

Location:
trunk/src/VBox/Additions/WINNT/Graphics/Display
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/dd.c

    r21253 r21490  
    13861386DWORD APIENTRY DdSetColorKey(PDD_SETCOLORKEYDATA  lpSetColorKey)
    13871387{
     1388    PPDEV pDev = (PPDEV)lpSetColorKey->lpDD->dhpdev;
     1389    DD_SURFACE_LOCAL*   lpSurfaceLocal = lpSetColorKey->lpDDSurface;
     1390    DD_SURFACE_GLOBAL*  lpSurfaceGlobal = lpSurfaceLocal->lpGbl;
     1391    VBOXVHWACMD* pCmd;
     1392
    13881393    DISPDBG((0, "%s\n", __FUNCTION__));
    1389     lpSetColorKey->ddRVal = DD_OK;
     1394
     1395    pCmd = vboxVHWACommandCreate (pDev, VBOXVHWACMD_TYPE_SURF_COLORKEY_SET, sizeof(VBOXVHWACMD_SURF_COLORKEY_SET));
     1396    //    int rc = VERR_GENERAL_FAILURE;
     1397    if(pCmd)
     1398    {
     1399        VBOXVHWACMD_SURF_COLORKEY_SET * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_COLORKEY_SET);
     1400        PVBOXVHWASURFDESC pDesc = (PVBOXVHWASURFDESC)lpSurfaceGlobal->dwReserved1;
     1401        memset(pBody, 0, sizeof(VBOXVHWACMD_SURF_COLORKEY_SET));
     1402
     1403        pBody->u.in.offSurface = (uint64_t)lpSurfaceGlobal->fpVidMem;
     1404        pBody->u.in.hSurf = pDesc->hHostHandle;
     1405        pBody->u.in.flags = vboxVHWAFromDDCKEYs(lpSetColorKey->dwFlags);
     1406        vboxVHWAFromDDCOLORKEY(&pBody->u.in.CKey, &lpSetColorKey->ckNew);
     1407
     1408        vboxVHWACommandSubmitAsynch(pDev, pCmd, vboxVHWAFreeCmdCompletion, NULL);
     1409        lpSetColorKey->ddRVal = DD_OK;
     1410    }
    13901411    return DDHAL_DRIVER_HANDLED;
    13911412}
     
    14001421DWORD APIENTRY DdBlt(PDD_BLTDATA  lpBlt)
    14011422{
    1402 #ifdef VBOX_WITH_VIDEOHWACCEL
    14031423    PPDEV pDev = (PPDEV)lpBlt->lpDD->dhpdev;
    14041424    DISPDBG((0, "%s\n", __FUNCTION__));
     
    14571477
    14581478    return DDHAL_DRIVER_HANDLED;
    1459 #else
    1460     lpBlt->ddRVal = DDERR_GENERIC;
    1461     return DDHAL_DRIVER_NOTHANDLED;
    1462 #endif
    14631479}
    14641480
     
    14721488DWORD APIENTRY DdFlip(PDD_FLIPDATA  lpFlip)
    14731489{
    1474 #ifdef VBOX_WITH_VIDEOHWACCEL
    14751490    PPDEV pDev = (PPDEV)lpFlip->lpDD->dhpdev;
    14761491    DD_SURFACE_LOCAL*   lpTargSurfaceLocal = lpFlip->lpSurfTarg;
     
    15241539        ASMAtomicIncU32(&pTargDesc->cPendingFlipsTarg);
    15251540
    1526 //            if(VBOXDD_CHECKFLAG(lpBlt->dwFlags, DDBLT_ASYNC))
    1527 //            {
    1528                 vboxVHWACommandSubmitAsynch(pDev, pCmd, vboxVHWASurfFlipCompletion, NULL);
    1529 //            }
    1530 //            else
    1531 //            {
    1532 //                vboxVHWACommandSubmit(pDev, pCmd);
    1533 //            }
     1541        vboxVHWACommandSubmitAsynch(pDev, pCmd, vboxVHWASurfFlipCompletion, NULL);
     1542
    15341543        lpFlip->ddRVal = DD_OK;
    15351544    }
     
    15391548    }
    15401549    return DDHAL_DRIVER_HANDLED;
    1541 #else
    1542     DISPDBG((0, "%s\n", __FUNCTION__));
    1543     lpFlip->ddRVal = DDERR_GENERIC;
    1544     return DDHAL_DRIVER_NOTHANDLED;
    1545 #endif
    15461550}
    15471551
     
    16241628DWORD APIENTRY DdSetOverlayPosition(PDD_SETOVERLAYPOSITIONDATA  lpSetOverlayPosition)
    16251629{
     1630    PPDEV pDev = (PPDEV)lpSetOverlayPosition->lpDD->dhpdev;
     1631    DD_SURFACE_LOCAL*   lpDestSurfaceLocal = lpSetOverlayPosition->lpDDDestSurface;
     1632    DD_SURFACE_GLOBAL*  lpDestSurfaceGlobal = lpDestSurfaceLocal->lpGbl;
     1633    DD_SURFACE_LOCAL*   lpSrcSurfaceLocal = lpSetOverlayPosition->lpDDSrcSurface;
     1634    DD_SURFACE_GLOBAL*  lpSrcSurfaceGlobal = lpSrcSurfaceLocal->lpGbl;
     1635    VBOXVHWACMD* pCmd;
     1636    PVBOXVHWASURFDESC pSrcDesc = (PVBOXVHWASURFDESC)lpSrcSurfaceGlobal->dwReserved1;
     1637    PVBOXVHWASURFDESC pDestDesc = (PVBOXVHWASURFDESC)lpDestSurfaceGlobal->dwReserved1;
     1638
    16261639    DISPDBG((0, "%s\n", __FUNCTION__));
    16271640
    1628     lpSetOverlayPosition->ddRVal = DD_OK;
     1641    if(pSrcDesc->bHidden)
     1642    {
     1643        lpSetOverlayPosition->ddRVal = DDERR_GENERIC;
     1644        return DDHAL_DRIVER_HANDLED;
     1645    }
     1646
     1647    pCmd = vboxVHWACommandCreate (pDev, VBOXVHWACMD_TYPE_SURF_OVERLAY_SETPOSITION, sizeof(VBOXVHWACMD_SURF_OVERLAY_SETPOSITION));
     1648    //    int rc = VERR_GENERAL_FAILURE;
     1649    if(pCmd)
     1650    {
     1651        VBOXVHWACMD_SURF_OVERLAY_SETPOSITION * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_OVERLAY_SETPOSITION);
     1652
     1653        memset(pBody, 0, sizeof(VBOXVHWACMD_SURF_OVERLAY_SETPOSITION));
     1654
     1655        pBody->u.in.offSrcSurface = (uint64_t)lpSrcSurfaceGlobal->fpVidMem;
     1656        pBody->u.in.offDstSurface = (uint64_t)lpDestSurfaceGlobal->fpVidMem;
     1657
     1658        pBody->u.in.hDstSurf = pDestDesc->hHostHandle;
     1659        pBody->u.in.hSrcSurf = pSrcDesc->hHostHandle;
     1660
     1661        pBody->u.in.xPos = lpSetOverlayPosition->lXPos;
     1662        pBody->u.in.yPos = lpSetOverlayPosition->lYPos;
     1663
     1664        vboxVHWACommandSubmitAsynch(pDev, pCmd, vboxVHWAFreeCmdCompletion, NULL);
     1665        lpSetOverlayPosition->ddRVal = DD_OK;
     1666    }
     1667
    16291668    return DDHAL_DRIVER_HANDLED;
    16301669}
     
    16321671DWORD APIENTRY DdUpdateOverlay(PDD_UPDATEOVERLAYDATA  lpUpdateOverlay)
    16331672{
     1673    PPDEV pDev = (PPDEV)lpUpdateOverlay->lpDD->dhpdev;
     1674    DD_SURFACE_LOCAL*   lpDestSurfaceLocal = lpUpdateOverlay->lpDDDestSurface;
     1675    DD_SURFACE_GLOBAL*  lpDestSurfaceGlobal = lpDestSurfaceLocal->lpGbl;
     1676    DD_SURFACE_LOCAL*   lpSrcSurfaceLocal = lpUpdateOverlay->lpDDSrcSurface;
     1677    DD_SURFACE_GLOBAL*  lpSrcSurfaceGlobal = lpSrcSurfaceLocal->lpGbl;
     1678    VBOXVHWACMD* pCmd;
     1679    PVBOXVHWASURFDESC pSrcDesc = (PVBOXVHWASURFDESC)lpSrcSurfaceGlobal->dwReserved1;
     1680    PVBOXVHWASURFDESC pDestDesc = (PVBOXVHWASURFDESC)lpDestSurfaceGlobal->dwReserved1;
     1681
    16341682    DISPDBG((0, "%s\n", __FUNCTION__));
    16351683
    1636     lpUpdateOverlay->ddRVal = DD_OK;
     1684    if(pSrcDesc->bHidden)
     1685    {
     1686        lpUpdateOverlay->ddRVal = DDERR_GENERIC;
     1687        return DDHAL_DRIVER_HANDLED;
     1688    }
     1689
     1690    pCmd = vboxVHWACommandCreate (pDev, VBOXVHWACMD_TYPE_SURF_OVERLAY_UPDATE, sizeof(VBOXVHWACMD_SURF_OVERLAY_UPDATE));
     1691    //    int rc = VERR_GENERAL_FAILURE;
     1692    if(pCmd)
     1693    {
     1694        VBOXVHWACMD_SURF_OVERLAY_UPDATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_OVERLAY_UPDATE);
     1695
     1696        memset(pBody, 0, sizeof(VBOXVHWACMD_SURF_OVERLAY_UPDATE));
     1697
     1698        pBody->u.in.offSrcSurface = (uint64_t)lpSrcSurfaceGlobal->fpVidMem;
     1699        pBody->u.in.offDstSurface = (uint64_t)lpDestSurfaceGlobal->fpVidMem;
     1700
     1701        pBody->u.in.hDstSurf = pDestDesc->hHostHandle;
     1702        pBody->u.in.hSrcSurf = pSrcDesc->hHostHandle;
     1703
     1704        vboxVHWAFromRECTL(&pBody->u.in.dstRect, &lpUpdateOverlay->rDest);
     1705        vboxVHWAFromRECTL(&pBody->u.in.srcRect, &lpUpdateOverlay->rSrc);
     1706
     1707        pBody->u.in.flags = vboxVHWAFromDDOVERs(lpUpdateOverlay->dwFlags);
     1708        vboxVHWAFromDDOVERLAYFX(&pBody->u.in.desc, &lpUpdateOverlay->overlayFX);
     1709
     1710        vboxVHWACommandSubmitAsynch(pDev, pCmd, vboxVHWAFreeCmdCompletion, NULL);
     1711        lpUpdateOverlay->ddRVal = DD_OK;
     1712    }
     1713
    16371714    return DDHAL_DRIVER_HANDLED;
    16381715}
     
    17801857    // 3. Mirroring in X and Y
    17811858    // 4. ColorKeying from a source color and a source color space
    1782     if((VBOXVHWA_CAP(pDev, VBOXVHWA_CAPS_BLT) || VBOXVHWA_CAP(pDev, VBOXVHWA_CAPS_OVERLAY))
     1859    if(VBOXVHWA_CAP(pDev, VBOXVHWA_CAPS_BLT)
    17831860            && VBOXVHWA_CAP(pDev, VBOXVHWA_CAPS_BLTSTRETCH))
    17841861    {
     
    17941871                                    DDFXCAPS_BLTSHRINKXN;
    17951872
    1796 
    1797         //mirroring with blitting
    1798         pHALInfo->ddCaps.dwFXCaps |= DDFXCAPS_BLTMIRRORUPDOWN
    1799                                      | DDFXCAPS_BLTMIRRORLEFTRIGHT;
     1873        //        DDFXCAPS_BLTARITHSTRETCHY
     1874        //        DDFXCAPS_BLTARITHSTRETCHYN
     1875        //        DDFXCAPS_BLTMIRRORLEFTRIGHT
     1876        //        DDFXCAPS_BLTMIRRORUPDOWN
     1877        //        DDFXCAPS_BLTROTATION90
     1878    }
     1879
     1880    if(VBOXVHWA_CAP(pDev, VBOXVHWA_CAPS_OVERLAY)
     1881            && VBOXVHWA_CAP(pDev, VBOXVHWA_CAPS_OVERLAYSTRETCH))
     1882    {
     1883        // Special effects caps
     1884        //TODO: filter them out
     1885        pHALInfo->ddCaps.dwFXCaps |= DDFXCAPS_OVERLAYSTRETCHY  |
     1886                                    DDFXCAPS_OVERLAYSTRETCHX  |
     1887                                    DDFXCAPS_OVERLAYSTRETCHYN |
     1888                                    DDFXCAPS_OVERLAYSTRETCHXN |
     1889                                    DDFXCAPS_OVERLAYSHRINKY   |
     1890                                    DDFXCAPS_OVERLAYSHRINKX   |
     1891                                    DDFXCAPS_OVERLAYSHRINKYN  |
     1892                                    DDFXCAPS_OVERLAYSHRINKXN;
     1893
     1894        //        DDFXCAPS_OVERLAYARITHSTRETCHY
     1895        //        DDFXCAPS_OVERLAYARITHSTRETCHYN
     1896        //        DDFXCAPS_OVERLAYMIRRORLEFTRIGHT
     1897        //        DDFXCAPS_OVERLAYMIRRORUPDOWN
    18001898
    18011899    }
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/driver.h

    r21253 r21490  
    109109    volatile uint32_t cPendingFlipsTarg;
    110110    uint32_t cBitsPerPixel;
     111    bool bHidden;
     112    VBOXVHWAREGION DirtyRegion;
    111113}VBOXVHWASURFDESC, *PVBOXVHWASURFDESC;
    112114
     
    326328
    327329void vboxVHWAFromDDCOLORKEY(VBOXVHWA_COLORKEY *pVHWACKey, DDCOLORKEY  *pDdCKey);
     330
     331uint32_t vboxVHWAFromDDOVERs(uint32_t caps);
     332uint32_t vboxVHWAToDDOVERs(uint32_t caps);
     333uint32_t vboxVHWAFromDDCKEYs(uint32_t caps);
     334uint32_t vboxVHWAToDDCKEYs(uint32_t caps);
     335
     336void vboxVHWAFromDDOVERLAYFX(VBOXVHWA_OVERLAYFX *pVHWAOverlay, DDOVERLAYFX *pDdOverlay);
    328337
    329338uint32_t vboxVHWAFromDDCAPS(uint32_t caps);
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