VirtualBox

Changeset 34345 in vbox


Ignore:
Timestamp:
Nov 24, 2010 10:06:02 PM (14 years ago)
Author:
vboxsync
Message:

wddm/3d: propper hide host window on swapchain destruction

Location:
trunk/src/VBox/Additions
Files:
13 edited

Legend:

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

    r33929 r34345  
    224224            Assert(hr == S_OK || hr == S_FALSE);
    225225            if (hr == S_OK || hr != S_FALSE)
     226            {
    226227                return hr;
     228            }
    227229
    228230            pSession->bQueryMp = false;
     
    257259    return vboxDispCmSessionCmdGet(&g_pVBoxCmMgr.Session, pCmd, cbCmd, dwMilliseconds);
    258260}
     261
     262void vboxDispCmLog(LPCSTR pszMsg)
     263{
     264    PVBOXDISPCM_SESSION pSession = &g_pVBoxCmMgr.Session;
     265
     266    EnterCriticalSection(&pSession->CritSect);
     267    /* use any context for identifying the kernel CmSession. We're using the first one */
     268    PVBOXWDDMDISP_CONTEXT pContext = RTListNodeGetFirst(&pSession->CtxList, VBOXWDDMDISP_CONTEXT, ListNode);
     269    Assert(pContext);
     270    if (pContext)
     271    {
     272        PVBOXWDDMDISP_DEVICE pDevice = pContext->pDevice;
     273        Assert(pDevice);
     274        vboxVDbgMpPrint((pDevice, pszMsg));
     275    }
     276    LeaveCriticalSection(&pSession->CritSect);
     277}
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispCm.h

    r30465 r34345  
    2727HRESULT vboxDispCmCmdGet(PVBOXDISPIFESCAPE_GETVBOXVIDEOCMCMD pCmd, uint32_t cbCmd, DWORD dwMilliseconds);
    2828
     29void vboxDispCmLog(LPCSTR pszMsg);
     30
    2931#endif /* #ifdef ___VBoxDispCm_h___ */
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp

    r34014 r34345  
    35963596            Assert(hr == S_OK);
    35973597
    3598 //            vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitiveUP\n"));
     3598//            vboxVDbgMpPrintF((pDevice, __FUNCTION__": DrawPrimitiveUP\n"));
    35993599        }
    36003600        else
     
    36313631        Assert(hr == S_OK);
    36323632
    3633 //        vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitive\n"));
     3633//        vboxVDbgMpPrintF((pDevice, __FUNCTION__": DrawPrimitive\n"));
    36343634#if 0
    36353635        IDirect3DVertexDeclaration9* pDecl;
     
    39973997            if (pDevice->aStreamSource[stream]->LockInfo.cLocks)
    39983998            {
    3999 //                vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitiveUP\n"));
     3999//                vboxVDbgMpPrintF((pDevice, __FUNCTION__": DrawPrimitiveUP\n"));
    40004000
    40014001                Assert(pLock->fFlags.MightDrawFromLocked && (pLock->fFlags.Discard || pLock->fFlags.NoOverwrite));
     
    40094009            else
    40104010            {
    4011 //                vboxVDbgMpPrint((pDevice, __FUNCTION__": DrawPrimitive\n"));
     4011//                vboxVDbgMpPrintF((pDevice, __FUNCTION__": DrawPrimitive\n"));
    40124012
    40134013                hr = pDevice9If->DrawPrimitive(pData->PrimitiveType, pData->FirstVertexOffset/pDevice->StreamSourceInfo[stream].uiStride, pData->PrimitiveCount);
     
    81438143    if (pPrefix)
    81448144    {
    8145         vboxVDbgMpPrint((pDevice, "%s", pPrefix));
     8145        vboxVDbgMpPrintF((pDevice, "%s", pPrefix));
    81468146    }
    81478147
     
    81618161//        Assert(bpp == pAlloc->SurfDesc.bpp);
    81628162//        Assert(pAlloc->SurfDesc.pitch == Lr.Pitch);
    8163         vboxVDbgMpPrint((pDevice, "<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">surface info</exec>\n",
     8163        vboxVDbgMpPrintF((pDevice, "<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">surface info</exec>\n",
    81648164                Lr.pBits, pAlloc->D3DWidth, pAlloc->SurfDesc.height, bpp, Lr.Pitch));
    81658165        if (pRect)
    81668166        {
    8167             vboxVDbgMpPrint((pDevice, "<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">rect info</exec>\n",
     8167            vboxVDbgMpPrintF((pDevice, "<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">rect info</exec>\n",
    81688168                    ((uint8_t*)Lr.pBits) + (pRect->top * Lr.Pitch) + ((pRect->left * bpp) >> 3),
    81698169                    pRect->right - pRect->left, pRect->bottom - pRect->top, bpp, Lr.Pitch));
     
    81768176    if (pSuffix)
    81778177    {
    8178         vboxVDbgMpPrint((pDevice, "%s\n", pSuffix));
     8178        vboxVDbgMpPrintF((pDevice, "%s\n", pSuffix));
    81798179    }
    81808180}
     
    81848184    if (pPrefix)
    81858185    {
    8186         vboxVDbgMpPrint((pDevice, "%s", pPrefix));
     8186        vboxVDbgMpPrintF((pDevice, "%s", pPrefix));
    81878187    }
    81888188
     
    82138213//        Assert(bpp == pAlloc->SurfDesc.bpp);
    82148214//        Assert(pAlloc->SurfDesc.pitch == Lr.Pitch);
    8215         vboxVDbgMpPrint((pDevice, "<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">surface info</exec>\n",
     8215        vboxVDbgMpPrintF((pDevice, "<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">surface info</exec>\n",
    82168216                LockData.pData, pAlloc->D3DWidth, pAlloc->SurfDesc.height, bpp, pAlloc->SurfDesc.pitch));
    82178217        if (pRect)
    82188218        {
    8219             vboxVDbgMpPrint((pDevice, "<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">rect info</exec>\n",
     8219            vboxVDbgMpPrintF((pDevice, "<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">rect info</exec>\n",
    82208220                    ((uint8_t*)LockData.pData) + (pRect->top * pAlloc->SurfDesc.pitch) + ((pRect->left * bpp) >> 3),
    82218221                    pRect->right - pRect->left, pRect->bottom - pRect->top, bpp, pAlloc->SurfDesc.pitch));
     
    82338233    if (pSuffix)
    82348234    {
    8235         vboxVDbgMpPrint((pDevice, "%s\n", pSuffix));
     8235        vboxVDbgMpPrintF((pDevice, "%s\n", pSuffix));
    82368236    }
    82378237}
     
    82428242    if (pPrefix)
    82438243    {
    8244         vboxVDbgMpPrint((pDevice, "%s", pPrefix));
     8244        vboxVDbgMpPrintF((pDevice, "%s", pPrefix));
    82458245    }
    82468246
     
    82728272//        Assert(bpp == pAlloc->SurfDesc.bpp);
    82738273//        Assert(pAlloc->SurfDesc.pitch == Lr.Pitch);
    8274         vboxVDbgMpPrint((pDevice, "<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">surface info</exec>\n",
     8274        vboxVDbgMpPrintF((pDevice, "<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">surface info</exec>\n",
    82758275                Lr.pBits, pAlloc->D3DWidth, pAlloc->SurfDesc.height, bpp, Lr.Pitch));
    82768276        if (pRect)
    82778277        {
    8278             vboxVDbgMpPrint((pDevice, "<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">rect info</exec>\n",
     8278            vboxVDbgMpPrintF((pDevice, "<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">rect info</exec>\n",
    82798279                    ((uint8_t*)Lr.pBits) + (pRect->top * Lr.Pitch) + ((pRect->left * bpp) >> 3),
    82808280                    pRect->right - pRect->left, pRect->bottom - pRect->top, bpp, Lr.Pitch));
     
    82878287    if (pSuffix)
    82888288    {
    8289         vboxVDbgMpPrint((pDevice, "%s\n", pSuffix));
     8289        vboxVDbgMpPrintF((pDevice, "%s\n", pSuffix));
    82908290    }
    82918291
     
    83078307        {
    83088308            UINT bpp = vboxWddmCalcBitsPerPixel((D3DDDIFORMAT)Desc.Format);
    8309             vboxVDbgMpPrint((pDevice, "<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">surface info</exec>\n",
     8309            vboxVDbgMpPrintF((pDevice, "<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">surface info</exec>\n",
    83108310                    Lr.pBits, Desc.Width, Desc.Height, bpp, Lr.Pitch));
    83118311
     
    83288328        PVBOXWDDMDISP_SWAPCHAIN pSwapchain = vboxWddmSwapchainForAlloc(pAlloc);
    83298329        Assert(pSwapchain);
    8330         bFrontBuf = (vboxWddmSwapchainGetBb(pSwapchain)->pAlloc == pAlloc);
     8330        bFrontBuf = (vboxWddmSwapchainGetFb(pSwapchain)->pAlloc == pAlloc);
    83318331    }
    83328332    vboxVDbgDoMpPrintF(pDevice, "%s D3DWidth(%d), width(%d), height(%d), format(%d), usage(%s), %s", pPrefix,
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3DCmn.h

    r33416 r34345  
    7070#ifdef VBOXWDDMDISP_DEBUG_PRINT
    7171VOID vboxVDbgDoMpPrintF(const PVBOXWDDMDISP_DEVICE pDevice, LPCSTR szString, ...);
     72VOID vboxVDbgDoMpPrint(const PVBOXWDDMDISP_DEVICE pDevice, LPCSTR szString);
    7273VOID vboxVDbgDoPrint(LPCSTR szString, ...);
    7374#endif
     
    9596#define vboxVDbgPrintR vboxVDbgPrint
    9697#define vboxVDbgMpPrint(_m) \
     98    do { \
     99        vboxVDbgDoMpPrint _m ; \
     100    } while (0)
     101#define vboxVDbgMpPrintF(_m) \
    97102    do { \
    98103        vboxVDbgDoMpPrintF _m ; \
     
    129134#else
    130135#define vboxVDbgMpPrint(_m) do {} while (0)
     136#define vboxVDbgMpPrintF(_m) do {} while (0)
    131137#define vboxVDbgMpPrintRect(_m) do {} while (0)
    132138#define vboxVDbgMpPrintAlloc(_m) do {} while (0)
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispMp.cpp

    r33117 r34345  
    154154}
    155155
     156static DECLCALLBACK(void) vboxDispMpLog(LPCSTR pszMsg)
     157{
     158    vboxDispCmLog(pszMsg);
     159}
     160
    156161VBOXDISPMP_DECL(HRESULT) VBoxDispMpGetCallbacks(uint32_t u32Version, PVBOXDISPMP_CALLBACKS pCallbacks)
    157162{
     
    163168    pCallbacks->pfnDisableEvents = vboxDispMpDisableEvents;
    164169    pCallbacks->pfnGetRegions = vboxDispMpGetRegions;
     170    pCallbacks->pfnLog = vboxDispMpLog;
    165171    return S_OK;
    166172}
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispMp.h

    r30483 r34345  
    4040typedef FNVBOXDISPMP_GETREGIONS *PFNVBOXDISPMP_GETREGIONS;
    4141
     42typedef DECLCALLBACK(void) FNVBOXDISPMP_LOG(LPCSTR pszMsg);
     43typedef FNVBOXDISPMP_LOG *PFNVBOXDISPMP_LOG;
     44
     45
    4246typedef struct VBOXDISPMP_CALLBACKS
    4347{
     
    5054     */
    5155    PFNVBOXDISPMP_GETREGIONS pfnGetRegions;
     56
     57    PFNVBOXDISPMP_LOG pfnLog;
    5258} VBOXDISPMP_CALLBACKS, *PVBOXDISPMP_CALLBACKS;
    5359
     
    6369# endif
    6470
    65 #define VBOXDISPMP_IFVERSION 1
     71#define VBOXDISPMP_IFVERSION 2
    6672#define VBOXDISPMP_VERSION (VBOXVIDEOIF_VERSION | (VBOXDISPMP_IFVERSION < 16))
    6773/**
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxUhgsmiKmt.cpp

    r33931 r34345  
    419419            if (hr == S_OK)
    420420            {
    421                 hr = vboxDispKmtCreateContext(&pHgsmi->Device, &pHgsmi->Context, bD3D);
     421                hr = vboxDispKmtCreateContext(&pHgsmi->Device, &pHgsmi->Context,
     422                        bD3D ? VBOXWDDM_CONTEXT_TYPE_CUSTOM_UHGSMI_3D : VBOXWDDM_CONTEXT_TYPE_CUSTOM_UHGSMI_GL,
     423                                NULL, 0);
    422424                Assert(hr == S_OK);
    423425                if (hr == S_OK)
     
    696698}
    697699
    698 HRESULT vboxDispKmtCreateContext(PVBOXDISPKMT_DEVICE pDevice, PVBOXDISPKMT_CONTEXT pContext, BOOL bD3D)
     700HRESULT vboxDispKmtCreateContext(PVBOXDISPKMT_DEVICE pDevice, PVBOXDISPKMT_CONTEXT pContext,
     701                                    VBOXWDDM_CONTEXT_TYPE enmType, HANDLE hEvent, uint64_t u64UmInfo)
    699702{
    700703    VBOXWDDM_CREATECONTEXT_INFO Info = {0};
    701704    Info.u32IfVersion = 9;
    702     Info.enmType = bD3D ? VBOXWDDM_CONTEXT_TYPE_CUSTOM_UHGSMI_3D : VBOXWDDM_CONTEXT_TYPE_CUSTOM_UHGSMI_GL;
     705    Info.enmType = enmType;
     706    Info.hUmEvent = (uint64_t)hEvent;
     707    Info.u64UmInfo = u64UmInfo;
    703708    D3DKMT_CREATECONTEXT ContextData = {0};
    704709    ContextData.hDevice = pDevice->hDevice;
     
    707712    ContextData.pPrivateDriverData = &Info;
    708713    ContextData.PrivateDriverDataSize = sizeof (Info);
    709     ContextData.ClientHint = bD3D ? D3DKMT_CLIENTHINT_DX9 : D3DKMT_CLIENTHINT_OPENGL;
     714    ContextData.ClientHint = enmType == VBOXWDDM_CONTEXT_TYPE_CUSTOM_UHGSMI_GL ? D3DKMT_CLIENTHINT_OPENGL : D3DKMT_CLIENTHINT_DX9;
    710715    NTSTATUS Status = pDevice->pAdapter->pCallbacks->pfnD3DKMTCreateContext(&ContextData);
    711716    Assert(!Status);
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxUhgsmiKmt.h

    r33929 r34345  
    9696HRESULT vboxDispKmtCreateDevice(PVBOXDISPKMT_ADAPTER pAdapter, PVBOXDISPKMT_DEVICE pDevice);
    9797HRESULT vboxDispKmtDestroyDevice(PVBOXDISPKMT_DEVICE pDevice);
    98 HRESULT vboxDispKmtCreateContext(PVBOXDISPKMT_DEVICE pDevice, PVBOXDISPKMT_CONTEXT pContext, BOOL bD3D);
     98HRESULT vboxDispKmtCreateContext(PVBOXDISPKMT_DEVICE pDevice, PVBOXDISPKMT_CONTEXT pContext,
     99        VBOXWDDM_CONTEXT_TYPE enmType, HANDLE hEvent, uint64_t u64UmInfo);
    99100HRESULT vboxDispKmtDestroyContext(PVBOXDISPKMT_CONTEXT pContext);
    100101
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoIf.h

    r33530 r34345  
    3030
    3131/* One would increase this whenever definitions in this file are changed */
    32 #define VBOXVIDEOIF_VERSION 7
     32#define VBOXVIDEOIF_VERSION 8
    3333
    3434/* create allocation func */
     
    214214    VBOXWDDM_CONTEXT_TYPE_CUSTOM_2D,
    215215    VBOXWDDM_CONTEXT_TYPE_CUSTOM_UHGSMI_3D,
    216     VBOXWDDM_CONTEXT_TYPE_CUSTOM_UHGSMI_GL
     216    VBOXWDDM_CONTEXT_TYPE_CUSTOM_UHGSMI_GL,
     217    VBOXWDDM_CONTEXT_TYPE_CUSTOM_SESSION
    217218} VBOXWDDM_CONTEXT_TYPE;
    218219
     
    246247            /* adds hidden regions */
    247248            UINT bAddHiddenRects : 1;
    248             UINT Reserved : 29;
     249            /* hide entire window */
     250            UINT bHide : 1;
     251            /* reserved */
     252            UINT Reserved : 28;
    249253        };
    250254        uint32_t Value;
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoMisc.cpp

    r34130 r34345  
    204204    Assert(cRefs < UINT32_MAX/2);
    205205    if (!cRefs)
     206    {
     207        Assert(pSwapchain->pContext);
     208        if (pSwapchain->pContext)
     209        {
     210            NTSTATUS tmpStatus = vboxVdmaPostHideSwapchain(pSwapchain);
     211            Assert(tmpStatus == STATUS_SUCCESS);
     212        }
    206213        vboxWddmMemFree(pSwapchain);
     214    }
    207215}
    208216
     
    313321    Assert(pTst == pSwapchain);
    314322    RemoveEntryList(&pSwapchain->DevExtListEntry);
    315     pSwapchain->pContext = NULL;
     323//    pSwapchain->pContext = NULL;
    316324    pSwapchain->hSwapchainKm = NULL;
    317325    if (pSwapchain->pLastReportedRects)
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.cpp

    r34079 r34345  
    305305    }
    306306    return true;
     307}
     308
     309NTSTATUS vboxVdmaPostHideSwapchain(PVBOXWDDM_SWAPCHAIN pSwapchain)
     310{
     311    Assert(KeGetCurrentIrql() < DISPATCH_LEVEL);
     312    uint32_t cbCmdInternal = VBOXVIDEOCM_CMD_RECTS_INTERNAL_SIZE4CRECTS(0);
     313    PVBOXVIDEOCM_CMD_RECTS_INTERNAL pCmdInternal =
     314            (PVBOXVIDEOCM_CMD_RECTS_INTERNAL)vboxVideoCmCmdCreate(&pSwapchain->pContext->CmContext, cbCmdInternal);
     315    Assert(pCmdInternal);
     316    if (pCmdInternal)
     317    {
     318        pCmdInternal->hSwapchainUm = pSwapchain->hSwapchainUm;
     319        pCmdInternal->Cmd.fFlags.Value = 0;
     320        pCmdInternal->Cmd.fFlags.bAddHiddenRects = 1;
     321        pCmdInternal->Cmd.fFlags.bHide = 1;
     322        pCmdInternal->Cmd.RectsInfo.cRects = 0;
     323        vboxVideoCmCmdSubmit(pCmdInternal, VBOXVIDEOCM_SUBMITSIZE_DEFAULT);
     324        return STATUS_SUCCESS;
     325    }
     326    return STATUS_NO_MEMORY;
    307327}
    308328
     
    914934                            Assert(Status == STATUS_SUCCESS);
    915935                        } break;
     936                        case VBOXVDMAPIPE_CMD_TYPE_RECTSINFO:
     937                        {
     938                            PVBOXVDMAPIPE_CMD_RECTSINFO pRects = (PVBOXVDMAPIPE_CMD_RECTSINFO)pDr;
     939                            Status = vboxVdmaGgDirtyRectsProcess(pRects->pDevExt, pRects->pContext, pRects->pSwapchain, &pRects->ContextsRects);
     940                            Assert(Status == STATUS_SUCCESS);
     941                            vboxVdmaGgCmdDestroy(pDr);
     942                            break;
     943                        }
    916944                        default:
    917945                            AssertBreakpoint();
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.h

    r33530 r34345  
    178178{
    179179    VBOXVDMAPIPE_CMD_DR Hdr;
    180     VBOXVDMADDI_CMD DdiCmd;
     180    PDEVICE_EXTENSION pDevExt;
     181    PVBOXWDDM_CONTEXT pContext;
    181182    struct VBOXWDDM_SWAPCHAIN *pSwapchain;
    182183    VBOXVDMAPIPE_RECTS ContextsRects;
     
    302303void vboxVdmaGgCmdDestroy(PVBOXVDMAPIPE_CMD_DR pDr);
    303304
     305NTSTATUS vboxVdmaPostHideSwapchain(PVBOXWDDM_SWAPCHAIN pSwapchain);
     306
    304307#define VBOXVDMAPIPE_CMD_DR_FROM_DDI_CMD(_pCmd) ((PVBOXVDMAPIPE_CMD_DR)(((uint8_t*)(_pCmd)) - RT_OFFSETOF(VBOXVDMAPIPE_CMD_DR, DdiCmd)))
    305308DECLCALLBACK(VOID) vboxVdmaGgDdiCmdDestroy(PDEVICE_EXTENSION pDevExt, PVBOXVDMADDI_CMD pCmd, PVOID pvContext);
  • trunk/src/VBox/Additions/common/crOpenGL/load.c

    r34297 r34345  
    790790        }
    791791    }
     792    else if (!pRegions->pRegions->fFlags.bHide)
     793    {
     794        Assert(pRegions->pRegions->fFlags.bAddHiddenRects);
     795        hNewRgn = stubMakeRegionFromRects(pRegions->pRegions, 0);
     796    }
    792797    else
    793798    {
    794         hNewRgn = stubMakeRegionFromRects(pRegions->pRegions, 0);
     799        Assert(pRegions->pRegions->fFlags.bAddHiddenRects);
     800        hNewRgn = CreateRectRgn(pWindow->x, pWindow->y, pWindow->x + pWindow->width, pWindow->y + pWindow->height);
    795801    }
    796802
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