VirtualBox

Ignore:
Timestamp:
Feb 27, 2014 12:39:15 PM (11 years ago)
Author:
vboxsync
Message:

wddm: misc bugfixes

Location:
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPMisc.cpp

    r49591 r50628  
    18951895NTSTATUS VBoxWddmSlEnableVSyncNotification(PVBOXMP_DEVEXT pDevExt, BOOLEAN fEnable)
    18961896{
     1897    if (!pDevExt->bVSyncTimerEnabled == !fEnable)
     1898        return STATUS_SUCCESS;
     1899
    18971900    if (!fEnable)
    18981901    {
     
    19011904    else
    19021905    {
     1906        KeQuerySystemTime(&pDevExt->VSyncTime);
     1907
    19031908        LARGE_INTEGER DueTime;
    19041909        DueTime.QuadPart = -166666LL; /* 60 Hz */
    19051910        KeSetTimerEx(&pDevExt->VSyncTimer, DueTime, 16, &pDevExt->VSyncDpc);
    19061911    }
     1912
     1913    pDevExt->bVSyncTimerEnabled = !!fEnable;
     1914
    19071915    return STATUS_SUCCESS;
    19081916}
     
    19151923    Assert(pTarget->HeightVisible);
    19161924    Assert(pTarget->HeightTotal >= pTarget->HeightVisible);
    1917     Assert(pTarget->ScanLineState < pTarget->HeightTotal);
    19181925    if (pTarget->HeightTotal)
    19191926    {
    1920         uint32_t curScanLine = pTarget->ScanLineState;
    1921         ++pTarget->ScanLineState;
    1922         if (pTarget->ScanLineState >= pTarget->HeightTotal)
    1923             pTarget->ScanLineState = 0;
    1924 
    1925 
    1926         BOOL bVBlank = (!curScanLine || curScanLine > pTarget->HeightVisible);
     1927        uint32_t curScanLine;
     1928        BOOL bVBlank;
     1929        LARGE_INTEGER DevVSyncTime;
     1930        DevVSyncTime.QuadPart =  ASMAtomicReadU64((volatile uint64_t*)&pDevExt->VSyncTime.QuadPart);
     1931        LARGE_INTEGER VSyncTime;
     1932        KeQuerySystemTime(&VSyncTime);
     1933
     1934        if (VSyncTime.QuadPart < DevVSyncTime.QuadPart)
     1935        {
     1936            WARN(("vsync time is less than the one stored in device"));
     1937            curScanLine = 0;
     1938        }
     1939        else
     1940        {
     1941            VSyncTime.QuadPart = VSyncTime.QuadPart - DevVSyncTime.QuadPart;
     1942            /* time is in 100ns, */
     1943            curScanLine = (uint32_t)((pTarget->HeightTotal * VSyncTime.QuadPart) / DevVSyncTime.QuadPart);
     1944            if (pDevExt->bVSyncTimerEnabled)
     1945            {
     1946                if (curScanLine >= pTarget->HeightTotal)
     1947                    curScanLine = 0;
     1948            }
     1949            else
     1950            {
     1951                curScanLine %= pTarget->HeightTotal;
     1952            }
     1953        }
     1954
     1955        bVBlank = (!curScanLine || curScanLine > pTarget->HeightVisible);
    19271956        pGetScanLine->ScanLine = curScanLine;
    19281957        pGetScanLine->InVerticalBlank = bVBlank;
     
    19341963    }
    19351964    return STATUS_SUCCESS;
     1965}
     1966
     1967static BOOLEAN vboxWddmSlVSyncIrqCb(PVOID pvContext)
     1968{
     1969    PVBOXMP_DEVEXT pDevExt = (PVBOXMP_DEVEXT)pvContext;
     1970    DXGKARGCB_NOTIFY_INTERRUPT_DATA notify;
     1971    BOOLEAN bNeedDpc = FALSE;
     1972    for (UINT i = 0; i < (UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i)
     1973    {
     1974        PVBOXWDDM_TARGET pTarget = &pDevExt->aTargets[i];
     1975        if (pTarget->fConnected)
     1976        {
     1977            memset(&notify, 0, sizeof(DXGKARGCB_NOTIFY_INTERRUPT_DATA));
     1978            notify.InterruptType = DXGK_INTERRUPT_CRTC_VSYNC;
     1979            notify.CrtcVsync.VidPnTargetId = i;
     1980            pDevExt->u.primary.DxgkInterface.DxgkCbNotifyInterrupt(pDevExt->u.primary.DxgkInterface.DeviceHandle, &notify);
     1981            bNeedDpc = TRUE;
     1982        }
     1983    }
     1984
     1985    if (bNeedDpc)
     1986    {
     1987        pDevExt->u.primary.DxgkInterface.DxgkCbQueueDpc(pDevExt->u.primary.DxgkInterface.DeviceHandle);
     1988    }
     1989
     1990    return FALSE;
    19361991}
    19371992
     
    19441999{
    19452000    PVBOXMP_DEVEXT pDevExt = (PVBOXMP_DEVEXT)DeferredContext;
    1946     DXGKARGCB_NOTIFY_INTERRUPT_DATA notify;
    1947     BOOLEAN bNeedDpc = FALSE;
    1948     for (UINT i = 0; i < (UINT)VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i)
    1949     {
    1950         PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[i];
    1951         PVBOXWDDM_ALLOCATION pPrimary = vboxWddmAquirePrimary(pDevExt, pSource, i);
    1952         if (pPrimary)
    1953         {
    1954             VBOXVIDEOOFFSET offVram = pPrimary->AllocData.Addr.offVram;
    1955             if (offVram != VBOXVIDEOOFFSET_VOID)
    1956             {
    1957                 memset(&notify, 0, sizeof(DXGKARGCB_NOTIFY_INTERRUPT_DATA));
    1958                 notify.InterruptType = DXGK_INTERRUPT_CRTC_VSYNC;
    1959                 /* @todo: !!!this is not correct in case we want source[i]->target[i!=j] mapping */
    1960                 notify.CrtcVsync.VidPnTargetId = i;
    1961                 notify.CrtcVsync.PhysicalAddress.QuadPart = offVram;
    1962                 /* yes, we can report VSync at dispatch */
    1963                 pDevExt->u.primary.DxgkInterface.DxgkCbNotifyInterrupt(pDevExt->u.primary.DxgkInterface.DeviceHandle, &notify);
    1964                 bNeedDpc = TRUE;
    1965             }
    1966 
    1967             vboxWddmAllocationRelease(pPrimary);
    1968         }
    1969     }
    1970 
    1971     if (bNeedDpc)
    1972     {
    1973         pDevExt->u.primary.DxgkInterface.DxgkCbQueueDpc(pDevExt->u.primary.DxgkInterface.DeviceHandle);
    1974     }
     2001    Assert(!pDevExt->fVSyncInVBlank);
     2002    ASMAtomicWriteU32(&pDevExt->fVSyncInVBlank, 1);
     2003
     2004    BOOLEAN bDummy;
     2005    NTSTATUS Status = pDevExt->u.primary.DxgkInterface.DxgkCbSynchronizeExecution(
     2006            pDevExt->u.primary.DxgkInterface.DeviceHandle,
     2007            vboxWddmSlVSyncIrqCb,
     2008            pDevExt,
     2009            0, /* IN ULONG MessageNumber */
     2010            &bDummy);
     2011    if (!NT_SUCCESS(Status))
     2012        WARN(("DxgkCbSynchronizeExecution failed Status %#x", Status));
     2013
     2014    LARGE_INTEGER VSyncTime;
     2015    KeQuerySystemTime(&VSyncTime);
     2016    ASMAtomicWriteU64((volatile uint64_t*)&pDevExt->VSyncTime.QuadPart, VSyncTime.QuadPart);
     2017
     2018    ASMAtomicWriteU32(&pDevExt->fVSyncInVBlank, 0);
    19752019}
    19762020
    19772021NTSTATUS VBoxWddmSlInit(PVBOXMP_DEVEXT pDevExt)
    19782022{
     2023    pDevExt->bVSyncTimerEnabled = FALSE;
     2024    pDevExt->fVSyncInVBlank = 0;
     2025    KeQuerySystemTime(&pDevExt->VSyncTime);
    19792026    KeInitializeTimer(&pDevExt->VSyncTimer);
    19802027    KeInitializeDpc(&pDevExt->VSyncDpc, vboxWddmSlVSyncDpc, pDevExt);
     
    20352082        if (pSource->AllocData.Addr.offVram != PhAddr.QuadPart
    20362083                || pSource->AllocData.Addr.SegmentId != 1)
    2037             pSource->fGhSynced = 0;
     2084            pSource->u8SyncState &= ~VBOXWDDM_HGSYNC_F_SYNCED_LOCATION;
    20382085        pSource->AllocData.Addr.SegmentId = 1;
    20392086        pSource->AllocData.Addr.offVram = PhAddr.QuadPart;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPTypes.h

    r49591 r50628  
    112112} VBOXWDDM_ALLOC_DATA, *PVBOXWDDM_ALLOC_DATA;
    113113
     114#define VBOXWDDM_HGSYNC_F_SYNCED_DIMENSIONS 0x01
     115#define VBOXWDDM_HGSYNC_F_SYNCED_LOCATION   0x02
     116#define VBOXWDDM_HGSYNC_F_SYNCED_ALL        (VBOXWDDM_HGSYNC_F_SYNCED_DIMENSIONS | VBOXWDDM_HGSYNC_F_SYNCED_LOCATION)
     117#define VBOXWDDM_HGSYNC_F_CHANGED_LOCATION_ONLY        (VBOXWDDM_HGSYNC_F_SYNCED_ALL & ~VBOXWDDM_HGSYNC_F_SYNCED_LOCATION)
     118
    114119typedef struct VBOXWDDM_SOURCE
    115120{
     
    119124#endif
    120125    VBOXWDDM_ALLOC_DATA AllocData;
     126    uint8_t u8SyncState;
    121127    BOOLEAN bVisible;
    122     char fGhSynced;
    123128    /* specifies whether the source has 3D overlay data visible */
    124129    BOOLEAN fHas3DVrs;
     
    140145typedef struct VBOXWDDM_TARGET
    141146{
    142     uint32_t ScanLineState;
    143147    uint32_t HeightVisible;
    144148    uint32_t HeightTotal;
    145149    /* since there coul be multiple state changes on auto-resize,
    146      * we pend notifying host to avoi flickering */
     150     * we pend notifying host to avoid flickering */
    147151    volatile bool fStateSyncPening;
    148152    bool fConnected;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVidPn.cpp

    r48070 r50628  
    20902090NTSTATUS vboxVidPnSetupSourceInfo(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, PVBOXWDDM_SOURCE pSource, CONST D3DKMDT_VIDPN_SOURCE_MODE* pVidPnSourceModeInfo, PVBOXWDDM_ALLOCATION pAllocation)
    20912091{
    2092     vboxWddmAssignPrimary(pDevExt, pSource, pAllocation, srcId);
    20932092    /* pVidPnSourceModeInfo could be null if STATUS_GRAPHICS_MODE_NOT_PINNED,
    20942093     * see vboxVidPnCommitSourceModeForSrcId */
     2094    uint8_t fChanges = 0;
    20952095    if (pVidPnSourceModeInfo)
    20962096    {
    2097         pSource->AllocData.SurfDesc.width = pVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx;
    2098         pSource->AllocData.SurfDesc.height = pVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy;
    2099         pSource->AllocData.SurfDesc.format = pVidPnSourceModeInfo->Format.Graphics.PixelFormat;
    2100         pSource->AllocData.SurfDesc.bpp = vboxWddmCalcBitsPerPixel(pVidPnSourceModeInfo->Format.Graphics.PixelFormat);
    2101         pSource->AllocData.SurfDesc.pitch = pVidPnSourceModeInfo->Format.Graphics.Stride;
     2097        if (pSource->AllocData.SurfDesc.width != pVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx)
     2098        {
     2099            fChanges |= VBOXWDDM_HGSYNC_F_SYNCED_DIMENSIONS;
     2100            pSource->AllocData.SurfDesc.width = pVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx;
     2101        }
     2102        if (pSource->AllocData.SurfDesc.height != pVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy)
     2103        {
     2104            fChanges |= VBOXWDDM_HGSYNC_F_SYNCED_DIMENSIONS;
     2105            pSource->AllocData.SurfDesc.height = pVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy;
     2106        }
     2107        if (pSource->AllocData.SurfDesc.format != pVidPnSourceModeInfo->Format.Graphics.PixelFormat)
     2108        {
     2109            fChanges |= VBOXWDDM_HGSYNC_F_SYNCED_DIMENSIONS;
     2110            pSource->AllocData.SurfDesc.format = pVidPnSourceModeInfo->Format.Graphics.PixelFormat;
     2111        }
     2112        if (pSource->AllocData.SurfDesc.bpp != vboxWddmCalcBitsPerPixel(pVidPnSourceModeInfo->Format.Graphics.PixelFormat))
     2113        {
     2114            fChanges |= VBOXWDDM_HGSYNC_F_SYNCED_DIMENSIONS;
     2115            pSource->AllocData.SurfDesc.bpp = vboxWddmCalcBitsPerPixel(pVidPnSourceModeInfo->Format.Graphics.PixelFormat);
     2116        }
     2117        if(pSource->AllocData.SurfDesc.pitch != pVidPnSourceModeInfo->Format.Graphics.Stride)
     2118        {
     2119            fChanges |= VBOXWDDM_HGSYNC_F_SYNCED_DIMENSIONS;
     2120            pSource->AllocData.SurfDesc.pitch = pVidPnSourceModeInfo->Format.Graphics.Stride;
     2121        }
    21022122        pSource->AllocData.SurfDesc.depth = 1;
    2103         pSource->AllocData.SurfDesc.slicePitch = pVidPnSourceModeInfo->Format.Graphics.Stride;
    2104         pSource->AllocData.SurfDesc.cbSize = pVidPnSourceModeInfo->Format.Graphics.Stride * pVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy;
     2123        if (pSource->AllocData.SurfDesc.slicePitch != pVidPnSourceModeInfo->Format.Graphics.Stride)
     2124        {
     2125            fChanges |= VBOXWDDM_HGSYNC_F_SYNCED_DIMENSIONS;
     2126            pSource->AllocData.SurfDesc.slicePitch = pVidPnSourceModeInfo->Format.Graphics.Stride;
     2127        }
     2128        if (pSource->AllocData.SurfDesc.cbSize != pVidPnSourceModeInfo->Format.Graphics.Stride * pVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy)
     2129        {
     2130            fChanges |= VBOXWDDM_HGSYNC_F_SYNCED_DIMENSIONS;
     2131            pSource->AllocData.SurfDesc.cbSize = pVidPnSourceModeInfo->Format.Graphics.Stride * pVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy;
     2132        }
    21052133#ifdef VBOX_WDDM_WIN8
    21062134        if (g_VBoxDisplayOnly)
     
    21132141    {
    21142142        Assert(!pAllocation);
    2115     }
     2143        fChanges |= VBOXWDDM_HGSYNC_F_SYNCED_ALL;
     2144    }
     2145
     2146    vboxWddmAssignPrimary(pDevExt, pSource, pAllocation, srcId);
     2147
    21162148    Assert(pSource->AllocData.SurfDesc.VidPnSourceId == srcId);
    2117     pSource->fGhSynced = 0;
     2149    pSource->u8SyncState &= ~fChanges;
    21182150    return STATUS_SUCCESS;
    21192151}
     
    21612193                pTarget->HeightVisible = pPinnedVidPnTargetModeInfo->VideoSignalInfo.ActiveSize.cy;
    21622194                pTarget->HeightTotal = pPinnedVidPnTargetModeInfo->VideoSignalInfo.TotalSize.cy;
    2163                 pTarget->ScanLineState = 0;
    21642195            }
    21652196            pVidPnTargetModeSetInterface->pfnReleaseModeInfo(hVidPnTargetModeSet, pPinnedVidPnTargetModeInfo);
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp

    r50313 r50628  
    242242NTSTATUS vboxWddmGhDisplayHideScreen(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId)
    243243{
    244     VBOXWDDM_SURFACE_DESC SurfDesc = {0};
     244    PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[VidPnTargetId];
     245    /* this will force update on re-activation */
     246    pSource->AllocData.SurfDesc.width = 0;
     247    pSource->AllocData.SurfDesc.height = 0;
    245248    POINT VScreenPos = {0};
    246     SurfDesc.VidPnSourceId = VidPnTargetId;
    247     NTSTATUS Status = vboxWddmGhDisplayPostInfoScreenBySDesc(pDevExt, &SurfDesc, &VScreenPos, VBVA_SCREEN_F_ACTIVE | VBVA_SCREEN_F_DISABLED);
     249
     250    NTSTATUS Status = vboxWddmGhDisplayPostInfoScreenBySDesc(pDevExt, &pSource->AllocData.SurfDesc, &VScreenPos, VBVA_SCREEN_F_ACTIVE | VBVA_SCREEN_F_DISABLED);
    248251    if (!NT_SUCCESS(Status))
    249252        WARN(("vboxWddmGhDisplayPostInfoScreenBySDesc failed Status 0x%x", Status));
     
    341344}
    342345
    343 NTSTATUS vboxWddmGhDisplaySetInfo(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOCATION pRealFbAlloc, const VBOXWDDM_ALLOC_DATA *pAllocData, const POINT * pVScreenPos)
    344 {
    345     NTSTATUS Status = vboxWddmGhDisplaySetMode(pDevExt, pAllocData);
     346NTSTATUS vboxWddmGhDisplaySetInfo(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOCATION pRealFbAlloc, const VBOXWDDM_ALLOC_DATA *pAllocData, const POINT * pVScreenPos, uint8_t u8CurCyncState)
     347{
     348    NTSTATUS Status;
     349
     350    if ((u8CurCyncState & VBOXWDDM_HGSYNC_F_CHANGED_LOCATION_ONLY) == VBOXWDDM_HGSYNC_F_CHANGED_LOCATION_ONLY
     351            && pRealFbAlloc->AllocData.hostID)
     352    {
     353        Status = vboxVdmaTexPresentSetAlloc(pDevExt, pRealFbAlloc);
     354        if (!NT_SUCCESS(Status))
     355            WARN(("vboxVdmaTexPresentSetAlloc failed, Status 0x%x", Status));
     356        return Status;
     357    }
     358
     359    Status = vboxWddmGhDisplaySetMode(pDevExt, pAllocData);
    346360    if (NT_SUCCESS(Status))
    347361    {
     
    378392    {
    379393        vboxWddmGhDisplayHideScreen(pDevExt, pSource->AllocData.SurfDesc.VidPnSourceId);
    380         pSource->fGhSynced = 1;
     394        pSource->u8SyncState = VBOXWDDM_HGSYNC_F_SYNCED_ALL;
    381395        return true;
    382396    }
    383397
    384     char fGhSynced = 1;
    385398    PVBOXWDDM_ALLOCATION pFbAlloc = VBOXWDDM_FB_ALLOCATION(pDevExt, pSource);
    386399    PVBOXWDDM_ALLOCATION pRealFbAlloc = pSource->pPrimaryAllocation;
     
    394407
    395408        if (!pFbAlloc)
    396         {
    397             pFbAlloc = VBOXWDDM_NONFB_ALLOCATION(pDevExt, pSource);
    398             fGhSynced = -1;
    399         }
     409            pFbAlloc = pRealFbAlloc;
    400410
    401411        if (!pFbAlloc || pFbAlloc->AllocData.Addr.offVram == VBOXVIDEOOFFSET_VOID)
     
    416426    Assert(!pFbAlloc || pFbAlloc->AllocData.Addr.SegmentId == pSource->AllocData.Addr.SegmentId);
    417427
    418     NTSTATUS Status = vboxWddmGhDisplaySetInfo(pDevExt, pRealFbAlloc, pFbAlloc ? &pFbAlloc->AllocData : &pSource->AllocData, &pSource->VScreenPos);
     428    NTSTATUS Status = vboxWddmGhDisplaySetInfo(pDevExt, pRealFbAlloc, pFbAlloc ? &pFbAlloc->AllocData : &pSource->AllocData, &pSource->VScreenPos, pSource->u8SyncState);
    419429    if (NT_SUCCESS(Status))
    420         pSource->fGhSynced = fGhSynced;
     430        pSource->u8SyncState = VBOXWDDM_HGSYNC_F_SYNCED_ALL;
    421431    else
    422432        WARN(("vboxWddmGhDisplaySetInfo failed, Status (0x%x)", Status));
     
    432442            || !pDevExt->aTargets[pSource->AllocData.SurfDesc.VidPnSourceId].HeightVisible);
    433443
    434     if (pSource->fGhSynced)
     444    if (pSource->u8SyncState == VBOXWDDM_HGSYNC_F_SYNCED_ALL)
    435445        return false;
    436446
     
    475485
    476486        /* ensure we issue resize command on next update */
    477         pSource->fGhSynced = 0;
     487        pSource->u8SyncState &= ~VBOXWDDM_HGSYNC_F_SYNCED_LOCATION;
    478488    }
    479489}
     
    517527    pContext->fRenderFromShadowDisabled = FALSE;
    518528}
    519 
    520 #ifdef VBOXWDDM_RENDER_FROM_SHADOW
    521 bool vboxWddmCheckUpdateFramebufferAddress(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SOURCE pSource)
    522 {
    523     if (pSource->pPrimaryAllocation->enmType == VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC
    524             || pSource->pPrimaryAllocation->AllocData.hostID)
    525     {
    526 //        Assert(pSource->fGhSynced == FALSE);
    527         return false;
    528     }
    529 
    530     return vboxWddmGhDisplayCheckSetInfoFromSource(pDevExt, pSource);
    531 }
    532 #endif
    533529
    534530PVBOXSHGSMI vboxWddmHgsmiGetHeapFromCmdOffset(PVBOXMP_DEVEXT pDevExt, HGSMIOFFSET offCmd)
     
    28712867    {
    28722868        /* this is a NOP, just return success */
    2873         WARN(("null data size, treating as NOP"));
     2869//        LOG(("null data size, treating as NOP"));
    28742870        return STATUS_SUCCESS;
    28752871    }
     
    30043000    else if (pSubmitCommand->DmaBufferPrivateDataSubmissionEndOffset == pSubmitCommand->DmaBufferPrivateDataSubmissionStartOffset)
    30053001    {
    3006         WARN(("null data size, treating as NOP"));
    30073002        enmCmd = VBOXVDMACMD_TYPE_DMA_NOP;
    30083003    }
     
    30293024            BOOLEAN fShadowChanged = vboxWddmAddrSetVram(&pSrcAlloc->AllocData.Addr, pS2P->Shadow2Primary.ShadowAlloc.segmentIdAlloc, pS2P->Shadow2Primary.ShadowAlloc.offAlloc);
    30303025            if (fShadowChanged)
    3031                 pSource->fGhSynced = 0;
     3026                pSource->u8SyncState &= ~VBOXWDDM_HGSYNC_F_SYNCED_LOCATION;
    30323027            vboxWddmAssignShadow(pDevExt, pSource, pSrcAlloc, pS2P->Shadow2Primary.VidPnSourceId);
    30333028            vboxWddmModeRenderFromShadowCheckOnSubmitCommand(pDevExt, NULL);
    3034             vboxWddmCheckUpdateFramebufferAddress(pDevExt, pSource);
     3029            vboxWddmGhDisplayCheckSetInfoFromSource(pDevExt, pSource);
    30353030            if (pSrcAlloc->bVisible)
    30363031            {
     
    30563051            PVBOXWDDM_ALLOCATION pSrcAlloc = pBlt->Blt.SrcAlloc.pAlloc;
    30573052            BOOLEAN fSrcChanged;
    3058 
    3059             vboxWddmAddrSetVram(&pDstAlloc->AllocData.Addr, pBlt->Blt.DstAlloc.segmentIdAlloc, pBlt->Blt.DstAlloc.offAlloc);
     3053            BOOLEAN fDstChanged;
     3054
     3055            fDstChanged = vboxWddmAddrSetVram(&pDstAlloc->AllocData.Addr, pBlt->Blt.DstAlloc.segmentIdAlloc, pBlt->Blt.DstAlloc.offAlloc);
    30603056            fSrcChanged = vboxWddmAddrSetVram(&pSrcAlloc->AllocData.Addr, pBlt->Blt.SrcAlloc.segmentIdAlloc, pBlt->Blt.SrcAlloc.offAlloc);
    30613057
     3058            vboxWddmModeRenderFromShadowCheckOnSubmitCommand(pDevExt, NULL);
     3059
    30623060            if (VBOXWDDM_IS_REAL_FB_ALLOCATION(pDevExt, pDstAlloc))
    30633061            {
    30643062                VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pDstAlloc->AllocData.SurfDesc.VidPnSourceId];
     3063
    30653064                Assert(pDstAlloc->AllocData.SurfDesc.VidPnSourceId < VBOX_VIDEO_MAX_SCREENS);
    3066 
    3067                 if (pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE)
     3065#if 0
     3066                if (VBOXWDDM_IS_FB_ALLOCATION(pDevExt, pDstAlloc) && pDstAlloc->AllocData.hostID)
     3067                {
     3068                    if (pSource->AllocData.hostID != pDstAlloc->AllocData.hostID)
     3069                    {
     3070                        pSource->AllocData.hostID = pDstAlloc->AllocData.hostID;
     3071                        fDstChanged = TRUE;
     3072                    }
     3073
     3074                    if (fDstChanged)
     3075                        pSource->u8SyncState &= ~VBOXWDDM_HGSYNC_F_SYNCED_LOCATION;
     3076                }
     3077                else
     3078#endif
     3079                    if (pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE)
    30683080                {
    30693081                    if (fSrcChanged)
    3070                         pSource->fGhSynced = 0;
     3082                        pSource->u8SyncState &= ~VBOXWDDM_HGSYNC_F_SYNCED_LOCATION;
    30713083
    30723084                    vboxWddmAssignShadow(pDevExt, pSource, pSrcAlloc, pDstAlloc->AllocData.SurfDesc.VidPnSourceId);
    3073                 }
    3074                 vboxWddmModeRenderFromShadowCheckOnSubmitCommand(pDevExt, NULL);
    3075                 if(pContext->enmType != VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D
    3076                         || pDstAlloc->enmType !=VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC)
    3077                     vboxWddmCheckUpdateFramebufferAddress(pDevExt, pSource);
    3078             }
    3079             else
    3080                 vboxWddmModeRenderFromShadowCheckOnSubmitCommand(pDevExt, NULL);
     3085                    vboxWddmGhDisplayCheckSetInfoFromSource(pDevExt, pSource);
     3086                }
     3087
     3088                Assert(pSource->u8SyncState == VBOXWDDM_HGSYNC_F_SYNCED_ALL);
     3089            }
    30813090
    30823091            Status = vboxVdmaProcessBltCmd(pDevExt, pContext, pBlt);
     
    30913100        {
    30923101            VBOXWDDM_DMA_PRIVATEDATA_FLIP *pFlip = (VBOXWDDM_DMA_PRIVATEDATA_FLIP*)pPrivateDataBase;
    3093             vboxWddmAddrSetVram(&pFlip->Flip.Alloc.pAlloc->AllocData.Addr, pFlip->Flip.Alloc.segmentIdAlloc, pFlip->Flip.Alloc.offAlloc);
    3094 
    3095             Status = vboxVdmaProcessFlipCmd(pDevExt, pContext, pFlip);
    3096             if (!NT_SUCCESS(Status))
    3097                 WARN(("vboxVdmaProcessFlipCmd failed, Status 0x%x", Status));
     3102            PVBOXWDDM_ALLOCATION pAlloc = pFlip->Flip.Alloc.pAlloc;
     3103            VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pAlloc->AllocData.SurfDesc.VidPnSourceId];
     3104            vboxWddmAddrSetVram(&pAlloc->AllocData.Addr, pFlip->Flip.Alloc.segmentIdAlloc, pFlip->Flip.Alloc.offAlloc);
     3105            vboxWddmAssignPrimary(pDevExt, pSource, pAlloc, pAlloc->AllocData.SurfDesc.VidPnSourceId);
     3106            vboxWddmGhDisplayCheckSetInfoFromSource(pDevExt, pSource);
    30983107
    30993108            Status = vboxVdmaDdiCmdFenceComplete(pDevExt, pContext->NodeOrdinal, pSubmitCommand->SubmissionFenceId,
     
    33063315            }
    33073316            /** @todo: add necessary bits */
     3317            WARN(("Impl!"));
    33083318            break;
    33093319        }
     
    33523362    LOGF(("ENTER, context(0x%x)", hAdapter));
    33533363
     3364    uint32_t cbCmdDma = 0;
     3365
    33543366    /* @todo: */
    33553367    switch (pBuildPagingBuffer->Operation)
     
    33573369        case DXGK_OPERATION_TRANSFER:
    33583370        {
     3371            cbCmdDma = VBOXWDDM_DUMMY_DMABUFFER_SIZE;
    33593372#ifdef VBOX_WITH_VDMA
    33603373#if 0
     
    35073520        case DXGK_OPERATION_FILL:
    35083521        {
     3522            cbCmdDma = VBOXWDDM_DUMMY_DMABUFFER_SIZE;
    35093523            Assert(pBuildPagingBuffer->Fill.FillPattern == 0);
    35103524            PVBOXWDDM_ALLOCATION pAlloc = (PVBOXWDDM_ALLOCATION)pBuildPagingBuffer->Fill.hAllocation;
     
    35193533        default:
    35203534        {
    3521             LOGREL(("unsupported op (%d)", pBuildPagingBuffer->Operation));
    3522             AssertBreakpoint();
     3535            WARN(("unsupported op (%d)", pBuildPagingBuffer->Operation));
    35233536            break;
    35243537        }
     3538    }
     3539
     3540    if (cbCmdDma)
     3541    {
     3542        pBuildPagingBuffer->pDmaBuffer = ((uint8_t*)pBuildPagingBuffer->pDmaBuffer) + cbCmdDma;
    35253543    }
    35263544
     
    48844902
    48854903    PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pSetVidPnSourceAddress->VidPnSourceId];
    4886     Status= vboxWddmDisplaySettingsQueryPos(pDevExt, pSetVidPnSourceAddress->VidPnSourceId, &pSource->VScreenPos);
     4904    POINT Pos;
     4905    Status= vboxWddmDisplaySettingsQueryPos(pDevExt, pSetVidPnSourceAddress->VidPnSourceId, &Pos);
    48874906    Assert(Status == STATUS_SUCCESS);
     4907    if (NT_SUCCESS(Status))
     4908    {
     4909        if (memcmp(&pSource->VScreenPos, &Pos, sizeof (Pos)))
     4910        {
     4911            pSource->VScreenPos = Pos;
     4912            pSource->u8SyncState &= ~VBOXWDDM_HGSYNC_F_SYNCED_DIMENSIONS;
     4913        }
     4914    }
     4915
    48884916    Status = STATUS_SUCCESS;
    48894917
     
    49304958    }
    49314959
    4932     pSource->fGhSynced = 0; /* force guest->host notification */
     4960    pSource->u8SyncState &= ~VBOXWDDM_HGSYNC_F_SYNCED_LOCATION;
    49334961
    49344962    if (pSource->bVisible)
     
    49614989
    49624990    PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pSetVidPnSourceVisibility->VidPnSourceId];
    4963     Status= vboxWddmDisplaySettingsQueryPos(pDevExt, pSetVidPnSourceVisibility->VidPnSourceId, &pSource->VScreenPos);
     4991    POINT Pos;
     4992    Status= vboxWddmDisplaySettingsQueryPos(pDevExt, pSetVidPnSourceVisibility->VidPnSourceId, &Pos);
    49644993    Assert(Status == STATUS_SUCCESS);
     4994    if (NT_SUCCESS(Status))
     4995    {
     4996        if (memcmp(&pSource->VScreenPos, &Pos, sizeof (Pos)))
     4997        {
     4998            pSource->VScreenPos = Pos;
     4999            pSource->u8SyncState &= ~VBOXWDDM_HGSYNC_F_SYNCED_DIMENSIONS;
     5000        }
     5001    }
    49655002    Status = STATUS_SUCCESS;
    49665003
     
    57135750    if (pRender->DmaBufferPrivateDataSize < sizeof (VBOXWDDM_DMA_PRIVATEDATA_BASEHDR))
    57145751    {
    5715         LOGREL(("Present->DmaBufferPrivateDataSize(%d) < sizeof VBOXWDDM_DMA_PRIVATEDATA_BASEHDR (%d)",
     5752        WARN(("Present->DmaBufferPrivateDataSize(%d) < sizeof VBOXWDDM_DMA_PRIVATEDATA_BASEHDR (%d)",
    57165753                pRender->DmaBufferPrivateDataSize , sizeof (VBOXWDDM_DMA_PRIVATEDATA_BASEHDR)));
    57175754        /* @todo: can this actually happen? what status to return? */
     
    57205757    if (pRender->CommandLength < sizeof (VBOXWDDM_DMA_PRIVATEDATA_BASEHDR))
    57215758    {
    5722         Assert(0);
    5723         LOGREL(("Present->DmaBufferPrivateDataSize(%d) < sizeof VBOXWDDM_DMA_PRIVATEDATA_BASEHDR (%d)",
     5759        WARN(("Present->DmaBufferPrivateDataSize(%d) < sizeof VBOXWDDM_DMA_PRIVATEDATA_BASEHDR (%d)",
    57245760                pRender->DmaBufferPrivateDataSize , sizeof (VBOXWDDM_DMA_PRIVATEDATA_BASEHDR)));
    57255761        /* @todo: can this actually happen? what status to return? */
     
    57375773
    57385774            pRender->pDmaBufferPrivateData = (uint8_t*)pRender->pDmaBufferPrivateData + sizeof (VBOXWDDM_DMA_PRIVATEDATA_BASEHDR);
     5775            memset(pRender->pDmaBuffer, 0, pRender->CommandLength);
    57395776            pRender->pDmaBuffer = ((uint8_t*)pRender->pDmaBuffer) + pRender->CommandLength;
    57405777            Assert(pRender->DmaSize >= pRender->CommandLength);
     
    59205957            }
    59215958
    5922             pBlt->Pos.x = pPresent->DstRect.left - pPresent->SrcRect.left;
    5923             pBlt->Pos.y = pPresent->DstRect.top - pPresent->SrcRect.top;
     5959            pBlt->Pos.x = (int16_t)(pPresent->DstRect.left - pPresent->SrcRect.left);
     5960            pBlt->Pos.y = (int16_t)(pPresent->DstRect.top - pPresent->SrcRect.top);
    59245961
    59255962            paRects = pBlt->aRects;
     
    59435980                u32DstPatch = RT_OFFSETOF(VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID, dst.offVRAM);
    59445981
    5945             pBlt->Pos.x = pPresent->DstRect.left - pPresent->SrcRect.left;
    5946             pBlt->Pos.y = pPresent->DstRect.top - pPresent->SrcRect.top;
     5982            pBlt->Pos.x = (int16_t)(pPresent->DstRect.left - pPresent->SrcRect.left);
     5983            pBlt->Pos.y = (int16_t)(pPresent->DstRect.top - pPresent->SrcRect.top);
    59475984
    59485985            paRects = pBlt->aRects;
     
    63796416            for (int i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i)
    63806417            {
    6381                 pDevExt->aSources[i].fGhSynced = 0;
     6418                pDevExt->aSources[i].u8SyncState = 0;
    63826419                NTSTATUS tmpStatus= vboxWddmDisplaySettingsQueryPos(pDevExt, i, &pDevExt->aSources[i].VScreenPos);
    63836420                Assert(tmpStatus == STATUS_SUCCESS);
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.h

    r49591 r50628  
    134134    }
    135135
    136     if (pSource->pShadowAllocation == pAllocation && pSource->fGhSynced > 0)
     136    if (pSource->pShadowAllocation == pAllocation)
    137137    {
    138138        Assert(pAllocation->bAssigned);
     
    162162
    163163        if(!vboxWddmAddrVramEqual(&pSource->AllocData.Addr, &pAllocation->AllocData.Addr))
    164             pSource->fGhSynced = 0; /* force guest->host notification */
    165         pSource->AllocData.Addr = pAllocation->AllocData.Addr;
    166     }
     164        {
     165            pSource->u8SyncState &= ~VBOXWDDM_HGSYNC_F_SYNCED_LOCATION; /* force guest->host notification */
     166            pSource->AllocData.Addr = pAllocation->AllocData.Addr;
     167        }
     168        if (pSource->AllocData.hostID != pAllocation->AllocData.hostID)
     169        {
     170            pSource->u8SyncState &= ~VBOXWDDM_HGSYNC_F_SYNCED_LOCATION; /* force guest->host notification */
     171            pSource->AllocData.hostID = pAllocation->AllocData.hostID;
     172        }
     173    }
     174    else
     175        pSource->u8SyncState &= ~VBOXWDDM_HGSYNC_F_SYNCED_LOCATION; /* force guest->host notification */
    167176
    168177    pSource->pShadowAllocation = pAllocation;
    169 
    170     Assert(!pSource->AllocData.pSwapchain);
    171     Assert(!pSource->AllocData.hostID);
    172178}
    173179#endif
     
    197203
    198204        if(!vboxWddmAddrVramEqual(&pSource->AllocData.Addr, &pAllocation->AllocData.Addr))
    199             pSource->fGhSynced = 0; /* force guest->host notification */
    200         pSource->AllocData.Addr = pAllocation->AllocData.Addr;
     205        {
     206            pSource->u8SyncState &= ~VBOXWDDM_HGSYNC_F_SYNCED_LOCATION; /* force guest->host notification */
     207            pSource->AllocData.Addr = pAllocation->AllocData.Addr;
     208        }
     209        if (pSource->AllocData.hostID != pAllocation->AllocData.hostID)
     210        {
     211            pSource->u8SyncState &= ~VBOXWDDM_HGSYNC_F_SYNCED_LOCATION; /* force guest->host notification */
     212            pSource->AllocData.hostID = pAllocation->AllocData.hostID;
     213        }
    201214
    202215        vboxWddmAllocationRetain(pAllocation);
    203216    }
     217    else
     218        pSource->u8SyncState &= ~VBOXWDDM_HGSYNC_F_SYNCED_LOCATION; /* force guest->host notification */
    204219
    205220    KIRQL OldIrql;
     
    207222    pSource->pPrimaryAllocation = pAllocation;
    208223    KeReleaseSpinLock(&pSource->AllocationLock, OldIrql);
    209 
    210     Assert(!pSource->AllocData.pSwapchain);
    211     Assert(!pSource->AllocData.hostID);
    212224}
    213225
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