VirtualBox

Ignore:
Timestamp:
Jun 18, 2010 9:51:03 PM (15 years ago)
Author:
vboxsync
Message:

wddm/2d: bugfixing + more impl

Location:
trunk/src/VBox/Additions/WINNT/Graphics
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp

    r30308 r30317  
    3636
    3737#define VBOXWDDMDISP_WITH_TMPWORKAROUND 1
     38
     39#define VBOXWDDMOVERLAY_TEST
    3840
    3941static FORMATOP gVBoxFormatOps3D[] = {
     
    30113013                    pAllocInfo->SurfDesc.height = pSurf->Height;
    30123014                    pAllocInfo->SurfDesc.format = pResource->Format;
    3013                     pAllocInfo->SurfDesc.bpp = vboxWddmCalcBitsPerPixel(pResource->Format);
     3015                    if (!vboxWddmFormatToFourcc(pResource->Format))
     3016                        pAllocInfo->SurfDesc.bpp = vboxWddmCalcBitsPerPixel(pResource->Format);
     3017                    else
     3018                        pAllocInfo->SurfDesc.bpp = 0;
    30143019
    30153020                    if (pSurf->SysMemPitch)
     
    31393144    PVBOXWDDMDISP_DEVICE pDevice = (PVBOXWDDMDISP_DEVICE)hDevice;
    31403145    Assert(pDevice);
    3141     Assert(pDevice->pDevice9If);
     3146    HRESULT hr = S_OK;
     3147    if (VBOXDISPMODE_IS_3D(pDevice->pAdapter))
     3148    {
     3149        Assert(pDevice->pDevice9If);
    31423150#if 0
    3143     HRESULT hr = pDevice->pDevice9If->Present(NULL, /* CONST RECT * pSourceRect */
    3144             NULL, /* CONST RECT * pDestRect */
    3145             NULL, /* HWND hDestWindowOverride */
    3146             NULL /*CONST RGNDATA * pDirtyRegion */
    3147             );
    3148     Assert(hr == S_OK);
    3149 #else
    3150     HRESULT hr = S_OK;
     3151        hr = pDevice->pDevice9If->Present(NULL, /* CONST RECT * pSourceRect */
     3152                NULL, /* CONST RECT * pDestRect */
     3153                NULL, /* HWND hDestWindowOverride */
     3154                NULL /*CONST RGNDATA * pDirtyRegion */
     3155                );
     3156        Assert(hr == S_OK);
    31513157#endif
     3158    }
     3159    else
     3160    {
     3161        D3DDDICB_PRESENT DdiPresent = {0};
     3162        if (pData->hSrcResource)
     3163        {
     3164            PVBOXWDDMDISP_RESOURCE pRc = (PVBOXWDDMDISP_RESOURCE)pData->hSrcResource;
     3165            Assert(pRc->cAllocations > pData->SrcSubResourceIndex);
     3166            PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[pData->SrcSubResourceIndex];
     3167            Assert(pAlloc->hAllocation);
     3168            DdiPresent.hSrcAllocation = pAlloc->hAllocation;
     3169        }
     3170        if (pData->hDstResource)
     3171        {
     3172            PVBOXWDDMDISP_RESOURCE pRc = (PVBOXWDDMDISP_RESOURCE)pData->hDstResource;
     3173            Assert(pRc->cAllocations > pData->DstSubResourceIndex);
     3174            PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[pData->DstSubResourceIndex];
     3175            Assert(pAlloc->hAllocation);
     3176            DdiPresent.hDstAllocation = pAlloc->hAllocation;
     3177        }
     3178        DdiPresent.hContext = pDevice->DefaultContext.ContextInfo.hContext;
     3179//        DdiPresent.BroadcastContextCount;
     3180//        DdiPresent.BroadcastContext[D3DDDI_MAX_BROADCAST_CONTEXT];
     3181
     3182        hr = pDevice->RtCallbacks.pfnPresentCb(pDevice->hDevice, &DdiPresent);
     3183        Assert(hr == S_OK);
     3184    }
    31523185    vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr));
    31533186    return hr;
     
    36553688        OverInfo.OverlayInfo.PrivateDriverDataSize = sizeof (OurInfo);
    36563689        OverInfo.hKernelOverlay = NULL; /* <-- out */
     3690#ifndef VBOXWDDMOVERLAY_TEST
    36573691        hr = pDevice->RtCallbacks.pfnCreateOverlayCb(pDevice->hDevice, &OverInfo);
    36583692        Assert(hr == S_OK);
     
    36763710            RTMemFree(pOverlay);
    36773711        }
     3712#else
     3713        pData->hOverlay = pOverlay;
     3714#endif
    36783715    }
    36793716    else
     
    37093746    OverInfo.OverlayInfo.pPrivateDriverData = &OurInfo;
    37103747    OverInfo.OverlayInfo.PrivateDriverDataSize = sizeof (OurInfo);
     3748#ifndef VBOXWDDMOVERLAY_TEST
    37113749    hr = pDevice->RtCallbacks.pfnUpdateOverlayCb(pDevice->hDevice, &OverInfo);
    37123750    Assert(hr == S_OK);
    37133751    if (hr == S_OK)
     3752#endif
    37143753    {
    37153754        Assert(!pAlloc->LockInfo.cLocks);
     
    37433782    OverInfo.pPrivateDriverData = &OurInfo;
    37443783    OverInfo.PrivateDriverDataSize = sizeof (OurInfo);
     3784#ifndef VBOXWDDMOVERLAY_TEST
    37453785    hr = pDevice->RtCallbacks.pfnFlipOverlayCb(pDevice->hDevice, &OverInfo);
    37463786    Assert(hr == S_OK);
    37473787    if (hr == S_OK)
     3788#endif
    37483789    {
    37493790        Assert(!pAlloc->LockInfo.cLocks);
     
    37793820    D3DDDICB_DESTROYOVERLAY OverInfo;
    37803821    OverInfo.hKernelOverlay = pOverlay->hOverlay;
     3822#ifndef VBOXWDDMOVERLAY_TEST
    37813823    HRESULT hr = pDevice->RtCallbacks.pfnDestroyOverlayCb(pDevice->hDevice, &OverInfo);
    37823824    Assert(hr == S_OK);
    37833825    if (hr == S_OK)
     3826#else
     3827    HRESULT hr = S_OK;
     3828#endif
    37843829    {
    37853830        RTMemFree(pOverlay);
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVhwa.cpp

    r30308 r30317  
    201201}
    202202
    203 void vboxVHWAFreeHostInfo1(PDEVICE_EXTENSION pDevExt, VBOXVHWACMD_QUERYINFO1* pInfo)
     203void vboxVhwaFreeHostInfo1(PDEVICE_EXTENSION pDevExt, VBOXVHWACMD_QUERYINFO1* pInfo)
    204204{
    205205    VBOXVHWACMD* pCmd = VBOXVHWACMD_HEAD(pInfo);
     
    207207}
    208208
    209 void vboxVHWAFreeHostInfo2(PDEVICE_EXTENSION pDevExt, VBOXVHWACMD_QUERYINFO2* pInfo)
     209void vboxVhwaFreeHostInfo2(PDEVICE_EXTENSION pDevExt, VBOXVHWACMD_QUERYINFO2* pInfo)
    210210{
    211211    VBOXVHWACMD* pCmd = VBOXVHWACMD_HEAD(pInfo);
     
    213213}
    214214
    215 VBOXVHWACMD_QUERYINFO1* vboxVHWAQueryHostInfo1(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId)
     215VBOXVHWACMD_QUERYINFO1* vboxVhwaQueryHostInfo1(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId)
    216216{
    217217    VBOXVHWACMD* pCmd = vboxVhwaCommandCreate(pDevExt, srcId, VBOXVHWACMD_TYPE_QUERY_INFO1, sizeof(VBOXVHWACMD_QUERYINFO1));
     
    221221    if (!pCmd)
    222222    {
    223         drprintf((0, "VBoxDISP::vboxVHWAQueryHostInfo1: vboxVHWACommandCreate failed\n"));
     223        drprintf((0, "VBoxDISP::vboxVhwaQueryHostInfo1: vboxVhwaCommandCreate failed\n"));
    224224        return NULL;
    225225    }
     
    245245}
    246246
    247 VBOXVHWACMD_QUERYINFO2* vboxVHWAQueryHostInfo2(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, uint32_t numFourCC)
     247VBOXVHWACMD_QUERYINFO2* vboxVhwaQueryHostInfo2(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, uint32_t numFourCC)
    248248{
    249249    VBOXVHWACMD* pCmd = vboxVhwaCommandCreate(pDevExt, srcId, VBOXVHWACMD_TYPE_QUERY_INFO2, VBOXVHWAINFO2_SIZE(numFourCC));
     
    252252    if (!pCmd)
    253253    {
    254         drprintf((0, "VBoxDISP::vboxVHWAQueryHostInfo2: vboxVHWACommandCreate failed\n"));
     254        drprintf((0, "VBoxDISP::vboxVhwaQueryHostInfo2: vboxVhwaCommandCreate failed\n"));
    255255        return NULL;
    256256    }
     
    277277}
    278278
    279 int vboxVHWAEnable(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId)
     279int vboxVhwaEnable(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId)
    280280{
    281281    int rc = VERR_GENERAL_FAILURE;
     
    286286    if (!pCmd)
    287287    {
    288         drprintf((0, "VBoxDISP::vboxVHWAEnable: vboxVHWACommandCreate failed\n"));
     288        drprintf((0, "VBoxDISP::vboxVhwaEnable: vboxVhwaCommandCreate failed\n"));
    289289        return rc;
    290290    }
     
    305305}
    306306
    307 int vboxVHWADisable(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId)
     307int vboxVhwaDisable(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId)
    308308{
    309309    int rc = VERR_GENERAL_FAILURE;
     
    314314    if (!pCmd)
    315315    {
    316         drprintf((0, "VBoxDISP::vboxVHWADisable: vboxVHWACommandCreate failed\n"));
     316        drprintf((0, "VBoxDISP::vboxVhwaDisable: vboxVhwaCommandCreate failed\n"));
    317317        return rc;
    318318    }
     
    333333}
    334334
    335 static void vboxVHWAInitSrc(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId)
     335static void vboxVhwaInitSrc(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId)
    336336{
    337337    Assert(srcId < (D3DDDI_VIDEO_PRESENT_SOURCE_ID)pDevExt->u.primary.cDisplays);
     
    339339    memset (pSettings, 0, sizeof (VBOXVHWA_INFO));
    340340
    341     VBOXVHWACMD_QUERYINFO1* pInfo1 = vboxVHWAQueryHostInfo1(pDevExt, srcId);
     341    VBOXVHWACMD_QUERYINFO1* pInfo1 = vboxVhwaQueryHostInfo1(pDevExt, srcId);
    342342    if (pInfo1)
    343343    {
     
    379379                        && (pInfo1->u.out.caps & VBOXVHWA_CAPS_OVERLAYFOURCC))
    380380                {
    381                     VBOXVHWACMD_QUERYINFO2* pInfo2 = vboxVHWAQueryHostInfo2(pDevExt, srcId, pInfo1->u.out.numFourCC);
     381                    VBOXVHWACMD_QUERYINFO2* pInfo2 = vboxVhwaQueryHostInfo2(pDevExt, srcId, pInfo1->u.out.numFourCC);
    382382                    if (pInfo2)
    383383                    {
     
    387387                            ++pSettings->cFormats;
    388388                        }
    389                         vboxVHWAFreeHostInfo2(pDevExt, pInfo2);
     389                        vboxVhwaFreeHostInfo2(pDevExt, pInfo2);
    390390                    }
    391391                }
    392392            }
    393393        }
    394         vboxVHWAFreeHostInfo1(pDevExt, pInfo1);
    395     }
    396 }
    397 
    398 void vboxVHWAInit(PDEVICE_EXTENSION pDevExt)
     394        vboxVhwaFreeHostInfo1(pDevExt, pInfo1);
     395    }
     396}
     397
     398void vboxVhwaInit(PDEVICE_EXTENSION pDevExt)
    399399{
    400400    for (int i = 0; i < pDevExt->u.primary.cDisplays; ++i)
    401401    {
    402         vboxVHWAInitSrc(pDevExt, (D3DDDI_VIDEO_PRESENT_SOURCE_ID)i);
    403     }
    404 }
    405 
    406 void vboxVHWAFree(PDEVICE_EXTENSION pDevExt)
     402        vboxVhwaInitSrc(pDevExt, (D3DDDI_VIDEO_PRESENT_SOURCE_ID)i);
     403    }
     404}
     405
     406void vboxVhwaFree(PDEVICE_EXTENSION pDevExt)
    407407{
    408408    /* we do not allocate/map anything, just issue a Disable command
     
    410410    for (int i = 0; i < pDevExt->u.primary.cDisplays; ++i)
    411411    {
    412         vboxVHWADisable(pDevExt, i);
     412        vboxVhwaDisable(pDevExt, i);
    413413    }
    414414}
     
    715715    if (cNew == 1)
    716716    {
    717         rc = vboxVhwaHlpCreatePrimary(pDevExt, pSource, VidPnSourceId);
     717        rc = vboxVhwaEnable(pDevExt, VidPnSourceId);
    718718        AssertRC(rc);
     719        if (RT_SUCCESS(rc))
     720        {
     721            rc = vboxVhwaHlpCreatePrimary(pDevExt, pSource, VidPnSourceId);
     722            AssertRC(rc);
     723            if (RT_FAILURE(rc))
     724            {
     725                int tmpRc = vboxVhwaDisable(pDevExt, VidPnSourceId);
     726                AssertRC(tmpRc);
     727            }
     728        }
    719729    }
    720730    else
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVhwa.h

    r30239 r30317  
    4545#endif
    4646
    47 void vboxVHWAFreeHostInfo1(PDEVICE_EXTENSION pDevExt, VBOXVHWACMD_QUERYINFO1* pInfo);
    48 void vboxVHWAFreeHostInfo2(PDEVICE_EXTENSION pDevExt, VBOXVHWACMD_QUERYINFO2* pInfo);
    49 VBOXVHWACMD_QUERYINFO1* vboxVHWAQueryHostInfo1(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId);
    50 VBOXVHWACMD_QUERYINFO2* vboxVHWAQueryHostInfo2(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, uint32_t numFourCC);
    51 int vboxVHWAEnable(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId);
    52 int vboxVHWADisable(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId);
    53 void vboxVHWAInit(PDEVICE_EXTENSION pDevExt);
    54 void vboxVHWAFree(PDEVICE_EXTENSION pDevExt);
     47void vboxVhwaFreeHostInfo1(PDEVICE_EXTENSION pDevExt, VBOXVHWACMD_QUERYINFO1* pInfo);
     48void vboxVhwaFreeHostInfo2(PDEVICE_EXTENSION pDevExt, VBOXVHWACMD_QUERYINFO2* pInfo);
     49VBOXVHWACMD_QUERYINFO1* vboxVhwaQueryHostInfo1(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId);
     50VBOXVHWACMD_QUERYINFO2* vboxVhwaQueryHostInfo2(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, uint32_t numFourCC);
     51int vboxVhwaEnable(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId);
     52int vboxVhwaDisable(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId);
     53void vboxVhwaInit(PDEVICE_EXTENSION pDevExt);
     54void vboxVhwaFree(PDEVICE_EXTENSION pDevExt);
    5555
    5656int vboxVhwaHlpOverlayFlip(PVBOXWDDM_OVERLAY pOverlay, const DXGKARG_FLIPOVERLAY *pFlipInfo);
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp

    r30308 r30317  
    649649                    dprintf(("VBoxVideoWddm: sources(%d), children(%d)\n", *NumberOfVideoPresentSources, *NumberOfChildren));
    650650#ifdef VBOX_WITH_VIDEOHWACCEL
    651                     vboxVHWAInit(pContext);
     651                    vboxVhwaInit(pContext);
    652652#endif
    653653                }
     
    699699    /* do everything we did on DxgkDdiStartDevice in the reverse order */
    700700#ifdef VBOX_WITH_VIDEOHWACCEL
    701     vboxVHWAFree(pDevExt);
     701    vboxVhwaFree(pDevExt);
    702702#endif
    703703
     
    15111511                    pAllocationInfo->SupportedWriteSegmentSet = 2;
    15121512#endif
    1513 //#ifndef VBOXWDDM_RENDER_FROM_SHADOW
     1513#ifndef VBOXWDDM_RENDER_FROM_SHADOW
    15141514                    pAllocationInfo->Flags.CpuVisible = 1;
    1515 //#endif
     1515#endif
    15161516                    break;
    15171517                case VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC:
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