VirtualBox

Ignore:
Timestamp:
Jun 11, 2010 6:24:42 PM (15 years ago)
Author:
vboxsync
Message:

wddm: scanline info support basics, some tooling for complex vidpn topology handling

Location:
trunk/src/VBox/Additions/WINNT/Graphics/Miniport
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp

    r29883 r30169  
    942942        if (DeviceExtension->CurrentMode == 0)
    943943#else
    944         if (!DeviceExtension->cSources || !DeviceExtension->aSources[0].pPrimaryAllocation)
     944        if (!DeviceExtension->u.primary.cDisplays || !DeviceExtension->aSources[0].pPrimaryAllocation)
    945945#endif
    946946        {
     
    982982        }
    983983#else
    984         if (DeviceExtension->cSources && DeviceExtension->aSources[0].pPrimaryAllocation)
     984        if (DeviceExtension->u.primary.cDisplays && DeviceExtension->aSources[0].pPrimaryAllocation)
    985985        {
    986986            if (!xres)
     
    10411041                if (DeviceExtension->CurrentMode != 0)
    10421042#else
    1043                 if (DeviceExtension->cSources && DeviceExtension->aSources[0].pPrimaryAllocation)
     1043                if (DeviceExtension->u.primary.cDisplays && DeviceExtension->aSources[0].pPrimaryAllocation)
    10441044#endif
    10451045#ifndef VBOX_WITH_MULTIMONITOR_FIX
     
    11471147                if (DeviceExtension->CurrentMode == 0)
    11481148#else
    1149                 if (!DeviceExtension->cSources || !DeviceExtension->aSources[0].pPrimaryAllocation)
     1149                if (!DeviceExtension->u.primary.cDisplays || !DeviceExtension->aSources[0].pPrimaryAllocation)
    11501150#endif
    11511151                {
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h

    r29922 r30169  
    178178} VBOXWDDM_SOURCE, *PVBOXWDDM_SOURCE;
    179179
     180typedef struct VBOXWDDM_TARGET
     181{
     182    uint32_t ScanLineState;
     183    uint32_t HeightVisible;
     184    uint32_t HeightTotal;
     185} VBOXWDDM_TARGET, *PVBOXWDDM_TARGET;
     186
    180187#endif
    181188
     
    211218
    212219           BOOLEAN bVBoxVideoSupported;        /* TRUE if VBoxVideo extensions, including DualView, are supported by the host. */
    213 #ifndef VBOXWDDM
     220
    214221           int cDisplays;                      /* Number of displays. */
    215 #endif
     222
    216223           ULONG cbVRAM;                       /* The VRAM size. */
    217224
     
    268275           VBOXVIDEOPORTPROCS VideoPortProcs;
    269276# else
     277           /* committed VidPn handle */
     278           D3DKMDT_HVIDPN hCommittedVidPn;
    270279           /* Display Port handle and callbacks */
    271280           DXGKRNL_INTERFACE DxgkInterface;
     
    295304   BOOL bNotifyDxDpc;
    296305
    297    ULONG cSources;
    298    /* currently we define the array for the max possible size since we do not know
    299     * the monitor count at the DxgkDdiAddDevice,
    300     * i.e. we obtain the monitor count in DxgkDdiStartDevice due to implementation of the currently re-used XPDM functionality
    301     *
    302     * @todo: use the dynamic array size calculated at DxgkDdiAddDevice
    303     * */
    304306   VBOXWDDM_SOURCE aSources[VBOX_VIDEO_MAX_SCREENS];
     307   VBOXWDDM_TARGET aTargets[VBOX_VIDEO_MAX_SCREENS];
    305308#endif
    306309} DEVICE_EXTENSION, *PDEVICE_EXTENSION;
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideoHGSMI.cpp

    r29883 r30169  
    923923#else
    924924            /* simply store the number of monitors, we will deal with VidPN stuff later */
    925             PrimaryExtension->cSources = cDisplays;
     925            PrimaryExtension->u.primary.cDisplays = cDisplays;
    926926#endif
    927927        }
     
    984984            ulAvailable = offset;
    985985            ulSize = ulAvailable / 2;
    986             ulSize /= PrimaryExtension->cSources;
     986            ulSize /= PrimaryExtension->u.primary.cDisplays;
    987987            Assert(ulSize > VBVA_MIN_BUFFER_SIZE);
    988988            if (ulSize > VBVA_MIN_BUFFER_SIZE)
     
    10031003            Assert(ulSize);
    10041004
    1005             Assert(ulSize * PrimaryExtension->cSources < ulAvailable);
    1006 
    1007             for (int i = PrimaryExtension->cSources-1; i >= 0; --i)
     1005            Assert(ulSize * PrimaryExtension->u.primary.cDisplays < ulAvailable);
     1006
     1007            for (int i = PrimaryExtension->u.primary.cDisplays-1; i >= 0; --i)
    10081008            {
    10091009                offset -= ulSize;
     
    10491049{
    10501050    int rc = VINF_SUCCESS;
    1051     for (int i = PrimaryExtension->cSources-1; i >= 0; --i)
     1051    for (int i = PrimaryExtension->u.primary.cDisplays-1; i >= 0; --i)
    10521052    {
    10531053        rc = vboxVbvaDisable(PrimaryExtension, &PrimaryExtension->aSources[i].Vbva);
     
    13001300    uint32_t cDisplays = (uint32_t)PrimaryExtension->u.primary.cDisplays;
    13011301#else
    1302     uint32_t cDisplays = (uint32_t)PrimaryExtension->cSources;
     1302    uint32_t cDisplays = (uint32_t)PrimaryExtension->u.primary.cDisplays;
    13031303#endif
    13041304    const size_t size = RT_OFFSETOF(VBVA_CHANNELCONTEXTS, aContexts[cDisplays]);
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVhwa.cpp

    r29966 r30169  
    335335static void vboxVHWAInitSrc(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId)
    336336{
    337     Assert(srcId < pDevExt->cSources);
     337    Assert(srcId < pDevExt->u.primary.cDisplays);
    338338    VBOXVHWA_INFO *pSettings = &pDevExt->aSources[srcId].Vhwa.Settings;
    339339    memset (pSettings, 0, sizeof (VBOXVHWA_INFO));
     
    398398void vboxVHWAInit(PDEVICE_EXTENSION pDevExt)
    399399{
    400     for (uint32_t i = 0; i < pDevExt->cSources; ++i)
    401     {
    402         vboxVHWAInitSrc(pDevExt, i);
     400    for (int i = 0; i < pDevExt->u.primary.cDisplays; ++i)
     401    {
     402        vboxVHWAInitSrc(pDevExt, (D3DDDI_VIDEO_PRESENT_SOURCE_ID)i);
    403403    }
    404404}
     
    408408    /* we do not allocate/map anything, just issue a Disable command
    409409     * to ensure all pending commands are flushed */
    410     for (uint32_t i = 0; i < pDevExt->cSources; ++i)
     410    for (uint32_t i = 0; i < pDevExt->u.primary.cDisplays; ++i)
    411411    {
    412412        vboxVHWADisable(pDevExt, i);
     
    660660int vboxVhwaHlpGetSurfInfo(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pSurf)
    661661{
    662     for (uint32_t i = 0; i < pDevExt->cSources; ++i)
     662    for (uint32_t i = 0; i < pDevExt->u.primary.cDisplays; ++i)
    663663    {
    664664        PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[i];
     
    708708int vboxVhwaHlpCheckInit(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId)
    709709{
    710     Assert(VidPnSourceId < pDevExt->cSources);
    711     if (VidPnSourceId >= pDevExt->cSources)
     710    Assert(VidPnSourceId < pDevExt->u.primary.cDisplays);
     711    if (VidPnSourceId >= pDevExt->u.primary.cDisplays)
    712712        return VERR_INVALID_PARAMETER;
    713713
     
    748748int vboxVhwaHlpCheckTerm(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId)
    749749{
    750     Assert(VidPnSourceId < pDevExt->cSources);
    751     if (VidPnSourceId >= pDevExt->cSources)
     750    Assert(VidPnSourceId < pDevExt->u.primary.cDisplays);
     751    if (VidPnSourceId >= pDevExt->u.primary.cDisplays)
    752752        return VERR_INVALID_PARAMETER;
    753753
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVidPn.cpp

    r28800 r30169  
    14661466}
    14671467
     1468NTSTATUS vboxVidPnEnumTargetsForSource(PDEVICE_EXTENSION pDevExt, D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
     1469        CONST D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId,
     1470        PFNVBOXVIDPNENUMTARGETSFORSOURCE pfnCallback, PVOID pContext)
     1471{
     1472    SIZE_T cTgtPaths;
     1473    NTSTATUS Status = pVidPnTopologyInterface->pfnGetNumPathsFromSource(hVidPnTopology, VidPnSourceId, &cTgtPaths);
     1474    Assert(Status == STATUS_SUCCESS);
     1475    if (Status == STATUS_SUCCESS)
     1476    {
     1477        for (SIZE_T i = 0; i < cTgtPaths; ++i)
     1478        {
     1479            D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId;
     1480            Status = pVidPnTopologyInterface->pfnEnumPathTargetsFromSource(hVidPnTopology, VidPnSourceId, i, &VidPnTargetId);
     1481            Assert(Status == STATUS_SUCCESS);
     1482            if (Status == STATUS_SUCCESS)
     1483            {
     1484                if (!pfnCallback(pDevExt, hVidPnTopology, pVidPnTopologyInterface, VidPnSourceId, VidPnTargetId, cTgtPaths, pContext))
     1485                    break;
     1486            }
     1487            else
     1488            {
     1489                drprintf((__FUNCTION__": pfnEnumPathTargetsFromSource failed Status(0x%x)\n", Status));
     1490                break;
     1491            }
     1492        }
     1493    }
     1494    else
     1495        drprintf((__FUNCTION__": pfnGetNumPathsFromSource failed Status(0x%x)\n", Status));
     1496
     1497    return Status;
     1498}
    14681499
    14691500NTSTATUS vboxVidPnEnumPaths(PDEVICE_EXTENSION pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
     
    15271558NTSTATUS vboxVidPnCommitSourceMode(struct _DEVICE_EXTENSION* pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, CONST D3DKMDT_VIDPN_SOURCE_MODE* pVidPnSourceModeInfo, PVBOXWDDM_ALLOCATION pAllocation)
    15281559{
    1529     Assert(srcId < pDevExt->cSources);
    1530     if (srcId < pDevExt->cSources)
     1560    Assert(srcId < (UINT)pDevExt->u.primary.cDisplays);
     1561    if (srcId < (UINT)pDevExt->u.primary.cDisplays)
    15311562    {
    15321563        PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[srcId];
     
    15341565    }
    15351566
    1536     drprintf((__FUNCTION__": invalid srcId (%d), cSources(%d)\n", srcId, pDevExt->cSources));
     1567    drprintf((__FUNCTION__": invalid srcId (%d), cSources(%d)\n", srcId, pDevExt->u.primary.cDisplays));
    15371568    return STATUS_INVALID_PARAMETER;
     1569}
     1570
     1571typedef struct VBOXVIDPNCOMMITTARGETMODE
     1572{
     1573    NTSTATUS Status;
     1574    D3DKMDT_HVIDPN hVidPn;
     1575    const DXGK_VIDPN_INTERFACE* pVidPnInterface;
     1576} VBOXVIDPNCOMMITTARGETMODE;
     1577
     1578DECLCALLBACK(BOOLEAN) vboxVidPnCommitTargetModeEnum(PDEVICE_EXTENSION pDevExt, D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
     1579        CONST D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId, SIZE_T cTgtPaths, PVOID pContext)
     1580{
     1581    VBOXVIDPNCOMMITTARGETMODE *pInfo = (VBOXVIDPNCOMMITTARGETMODE*)pContext;
     1582    Assert(cTgtPaths <= (SIZE_T)pDevExt->u.primary.cDisplays);
     1583    D3DKMDT_HVIDPNTARGETMODESET hVidPnTargetModeSet;
     1584    CONST DXGK_VIDPNTARGETMODESET_INTERFACE* pVidPnTargetModeSetInterface;
     1585    NTSTATUS Status = pInfo->pVidPnInterface->pfnAcquireTargetModeSet(pInfo->hVidPn, VidPnTargetId, &hVidPnTargetModeSet, &pVidPnTargetModeSetInterface);
     1586    Assert(Status == STATUS_SUCCESS);
     1587    if (Status == STATUS_SUCCESS)
     1588    {
     1589        CONST D3DKMDT_VIDPN_TARGET_MODE* pPinnedVidPnTargetModeInfo;
     1590        Status = pVidPnTargetModeSetInterface->pfnAcquirePinnedModeInfo(hVidPnTargetModeSet, &pPinnedVidPnTargetModeInfo);
     1591        Assert(Status == STATUS_SUCCESS);
     1592        if (Status == STATUS_SUCCESS)
     1593        {
     1594            VBOXWDDM_TARGET *pTarget = &pDevExt->aTargets[VidPnTargetId];
     1595            if (pTarget->HeightVisible != pPinnedVidPnTargetModeInfo->VideoSignalInfo.ActiveSize.cy
     1596                    || pTarget->HeightTotal != pPinnedVidPnTargetModeInfo->VideoSignalInfo.TotalSize.cy)
     1597            {
     1598                pTarget->HeightVisible = pPinnedVidPnTargetModeInfo->VideoSignalInfo.ActiveSize.cy;
     1599                pTarget->HeightTotal = pPinnedVidPnTargetModeInfo->VideoSignalInfo.TotalSize.cy;
     1600                pTarget->ScanLineState = 0;
     1601            }
     1602            pVidPnTargetModeSetInterface->pfnReleaseModeInfo(hVidPnTargetModeSet, pPinnedVidPnTargetModeInfo);
     1603        }
     1604
     1605        pInfo->pVidPnInterface->pfnReleaseTargetModeSet(pInfo->hVidPn, hVidPnTargetModeSet);
     1606    }
     1607    else
     1608        drprintf((__FUNCTION__": pfnAcquireTargetModeSet failed Status(0x%x)\n", Status));
     1609
     1610    pInfo->Status = Status;
     1611    return Status == STATUS_SUCCESS;
    15381612}
    15391613
     
    15581632            Status = vboxVidPnCommitSourceMode(pDevExt, srcId, pPinnedVidPnSourceModeInfo, pAllocation);
    15591633            Assert(Status == STATUS_SUCCESS);
    1560             if (Status != STATUS_SUCCESS)
     1634            if (Status == STATUS_SUCCESS)
     1635            {
     1636                D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology;
     1637                CONST DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface;
     1638                Status = pVidPnInterface->pfnGetTopology(hDesiredVidPn, &hVidPnTopology, &pVidPnTopologyInterface);
     1639                Assert(Status == STATUS_SUCCESS);
     1640                if (Status == STATUS_SUCCESS)
     1641                {
     1642                    VBOXVIDPNCOMMITTARGETMODE TgtModeInfo = {0};
     1643                    TgtModeInfo.Status = STATUS_SUCCESS; /* <- to ensure we're succeeded if no targets are set */
     1644                    TgtModeInfo.hVidPn = hDesiredVidPn;
     1645                    TgtModeInfo.pVidPnInterface = pVidPnInterface;
     1646                    Status = vboxVidPnEnumTargetsForSource(pDevExt, hVidPnTopology, pVidPnTopologyInterface,
     1647                            srcId,
     1648                            vboxVidPnCommitTargetModeEnum, &TgtModeInfo);
     1649                    Assert(Status == STATUS_SUCCESS);
     1650                    if (Status == STATUS_SUCCESS)
     1651                    {
     1652                        Status = TgtModeInfo.Status;
     1653                        Assert(Status == STATUS_SUCCESS);
     1654                    }
     1655                    else
     1656                        drprintf((__FUNCTION__": vboxVidPnEnumTargetsForSource failed Status(0x%x)\n", Status));
     1657                }
     1658                else
     1659                    drprintf((__FUNCTION__": pfnGetTopology failed Status(0x%x)\n", Status));
     1660            }
     1661            else
    15611662                drprintf((__FUNCTION__": vboxVidPnCommitSourceMode failed Status(0x%x)\n", Status));
    15621663            /* release */
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVidPn.h

    r28800 r30169  
    7979typedef FNVBOXVIDPNENUMMONITORSOURCEMODES *PFNVBOXVIDPNENUMMONITORSOURCEMODES;
    8080
     81typedef DECLCALLBACK(BOOLEAN) FNVBOXVIDPNENUMTARGETSFORSOURCE(PDEVICE_EXTENSION pDevExt, D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
     82        CONST D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId, SIZE_T cTgtPaths, PVOID pContext);
     83typedef FNVBOXVIDPNENUMTARGETSFORSOURCE *PFNVBOXVIDPNENUMTARGETSFORSOURCE;
    8184
    8285DECLCALLBACK(BOOLEAN) vboxVidPnCofuncModalityPathEnum(struct _DEVICE_EXTENSION* pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
     
    113116        PFNVBOXVIDPNENUMMONITORSOURCEMODES pfnCallback, PVOID pContext);
    114117
     118NTSTATUS vboxVidPnEnumTargetsForSource(PDEVICE_EXTENSION pDevExt, D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
     119        CONST D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId,
     120        PFNVBOXVIDPNENUMTARGETSFORSOURCE pfnCallback, PVOID pContext);
     121
    115122NTSTATUS vboxVidPnPopulateMonitorSourceModeInfoFromLegacy(struct _DEVICE_EXTENSION* pDevExt,
    116123        D3DKMDT_MONITOR_SOURCE_MODE *pMonitorSourceMode,
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp

    r30057 r30169  
    139139        pView->u32ViewIndex     = pAllocation->SurfDesc.VidPnSourceId;
    140140        pView->u32ViewOffset    = (uint32_t)offVram; /* we pretend the view is located at the start of each framebuffer */
    141         pView->u32ViewSize      = vboxWddmVramCpuVisibleSegmentSize(pDevExt)/pDevExt->cSources;
     141        pView->u32ViewSize      = vboxWddmVramCpuVisibleSegmentSize(pDevExt)/pDevExt->u.primary.cDisplays;
    142142
    143143        pView->u32MaxScreenSize = pView->u32ViewSize;
     
    645645                {
    646646                    drprintf(("VBoxVideoWddm: using HGSMI\n"));
    647                     *NumberOfVideoPresentSources = pContext->cSources;
    648                     *NumberOfChildren = pContext->cSources;
     647                    *NumberOfVideoPresentSources = pContext->u.primary.cDisplays;
     648                    *NumberOfChildren = pContext->u.primary.cDisplays;
    649649                    dprintf(("VBoxVideoWddm: sources(%d), children(%d)\n", *NumberOfVideoPresentSources, *NumberOfChildren));
    650650#ifdef VBOX_WITH_VIDEOHWACCEL
     
    10411041
    10421042    dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", MiniportDeviceContext));
    1043     Assert(ChildRelationsSize == (pDevExt->cSources + 1)*sizeof(DXGK_CHILD_DESCRIPTOR));
    1044     for (UINT i = 0; i < pDevExt->cSources; ++i)
     1043    Assert(ChildRelationsSize == (pDevExt->u.primary.cDisplays + 1)*sizeof(DXGK_CHILD_DESCRIPTOR));
     1044    for (UINT i = 0; i < pDevExt->u.primary.cDisplays; ++i)
    10451045    {
    10461046        ChildRelations[i].ChildDeviceType = TypeVideoOutput;
     
    12321232            pCaps->MaxOverlays = 0;
    12331233#ifdef VBOX_WITH_VIDEOHWACCEL
    1234             for (uint32_t i = 0; i < pContext->cSources; ++i)
     1234            for (uint32_t i = 0; i < pContext->u.primary.cDisplays; ++i)
    12351235            {
    12361236                if ( pContext->aSources[i].Vhwa.Settings.fFlags & VBOXVHWA_F_ENABLED)
     
    13211321                memset (pQi, 0, sizeof (VBOXWDDM_QI));
    13221322                pQi->u32Version = VBOXVIDEOIF_VERSION;
    1323                 pQi->cInfos = pContext->cSources;
     1323                pQi->cInfos = pContext->u.primary.cDisplays;
    13241324#ifdef VBOX_WITH_VIDEOHWACCEL
    1325                 for (uint32_t i = 0; i < pContext->cSources; ++i)
     1325                for (uint32_t i = 0; i < pContext->u.primary.cDisplays; ++i)
    13261326                {
    13271327                    pQi->aInfos[i] = pContext->aSources[i].Vhwa.Settings;
     
    15971597        {
    15981598            PVBOXWDDM_RCINFO pRcInfo = (PVBOXWDDM_RCINFO)pCreateAllocation->pPrivateDriverData;
    1599 //            Assert(pRcInfo->RcDesc.VidPnSourceId < pDevExt->cSources);
     1599//            Assert(pRcInfo->RcDesc.VidPnSourceId < pDevExt->u.primary.cDisplays);
    16001600            Assert(pRcInfo->cAllocInfos == pCreateAllocation->NumAllocations);
    16011601            pResource = (PVBOXWDDM_RESOURCE)vboxWddmMemAllocZero(RT_OFFSETOF(VBOXWDDM_RESOURCE, aAllocations[pRcInfo->cAllocInfos]));
     
    26442644            if (Status == STATUS_SUCCESS && bSupported)
    26452645            {
    2646                 for (UINT id = 0; id < pContext->cSources; ++id)
     2646                for (UINT id = 0; id < pContext->u.primary.cDisplays; ++id)
    26472647                {
    26482648                    D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet;
     
    26752675                if (Status == STATUS_SUCCESS && bSupported)
    26762676                {
    2677                     for (UINT id = 0; id < pContext->cSources; ++id)
     2677                    for (UINT id = 0; id < pContext->u.primary.cDisplays; ++id)
    26782678                    {
    26792679                        D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet;
     
    27852785    if (Status == STATUS_SUCCESS)
    27862786    {
    2787         for (uint32_t i = 0; i < pDevExt->cSources; ++i)
     2787        for (uint32_t i = 0; i < pDevExt->u.primary.cDisplays; ++i)
    27882788        {
    27892789            Status = vboxVidPnCheckAddMonitorModes(pDevExt, i, D3DKMDT_MCO_DRIVER, &Resolution, 1, 0);
     
    29022902    NTSTATUS Status = STATUS_SUCCESS;
    29032903    PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)hAdapter;
    2904     Assert(pDevExt->cSources > pSetVidPnSourceAddress->VidPnSourceId);
    2905     if (pDevExt->cSources > pSetVidPnSourceAddress->VidPnSourceId)
     2904    Assert(pDevExt->u.primary.cDisplays > pSetVidPnSourceAddress->VidPnSourceId);
     2905    if (pDevExt->u.primary.cDisplays > pSetVidPnSourceAddress->VidPnSourceId)
    29062906    {
    29072907        PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pSetVidPnSourceAddress->VidPnSourceId];
     
    29452945    else
    29462946    {
    2947         drprintf((__FUNCTION__": invalid VidPnSourceId (%d), should be smaller than (%d)\n", pSetVidPnSourceAddress->VidPnSourceId, pDevExt->cSources));
     2947        drprintf((__FUNCTION__": invalid VidPnSourceId (%d), should be smaller than (%d)\n", pSetVidPnSourceAddress->VidPnSourceId, pDevExt->u.primary.cDisplays));
    29482948        Status = STATUS_INVALID_PARAMETER;
    29492949    }
     
    29702970    NTSTATUS Status = STATUS_SUCCESS;
    29712971    PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)hAdapter;
    2972     Assert(pDevExt->cSources > pSetVidPnSourceVisibility->VidPnSourceId);
    2973     if (pDevExt->cSources > pSetVidPnSourceVisibility->VidPnSourceId)
     2972    Assert(pDevExt->u.primary.cDisplays > pSetVidPnSourceVisibility->VidPnSourceId);
     2973    if (pDevExt->u.primary.cDisplays > pSetVidPnSourceVisibility->VidPnSourceId)
    29742974    {
    29752975        PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pSetVidPnSourceVisibility->VidPnSourceId];
     
    29972997    else
    29982998    {
    2999         drprintf((__FUNCTION__": invalid VidPnSourceId (%d), should be smaller than (%d)\n", pSetVidPnSourceVisibility->VidPnSourceId, pDevExt->cSources));
     2999        drprintf((__FUNCTION__": invalid VidPnSourceId (%d), should be smaller than (%d)\n", pSetVidPnSourceVisibility->VidPnSourceId, pDevExt->u.primary.cDisplays));
    30003000        Status = STATUS_INVALID_PARAMETER;
    30013001    }
     
    30363036        {
    30373037            /* clear all current primaries */
    3038             for (UINT i = 0; i < pDevExt->cSources; ++i)
     3038            for (UINT i = 0; i < pDevExt->u.primary.cDisplays; ++i)
    30393039            {
    30403040                vboxWddmAssignPrimary(pDevExt, &pDevExt->aSources[i], NULL, i);
     
    30663066                drprintf((__FUNCTION__ ": pfnGetTopology failed Status(0x%x)\n", Status));
    30673067        }
     3068
     3069        if (Status == STATUS_SUCCESS)
     3070        {
     3071            pDevExt->u.primary.hCommittedVidPn = pCommitVidPnArg->hFunctionalVidPn;
     3072        }
    30683073    }
    30693074    else
     
    31763181    dfprintf(("==> "__FUNCTION__ ", hAdapter(0x%x)\n", hAdapter));
    31773182
    3178     AssertBreakpoint();
    3179 
    3180     pGetScanLine->InVerticalBlank = FALSE;
    3181     pGetScanLine->ScanLine = 0;
     3183    PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)hAdapter;
     3184
     3185    Assert(pDevExt->u.primary.cDisplays > pGetScanLine->VidPnTargetId);
     3186    VBOXWDDM_TARGET *pTarget = &pDevExt->aTargets[pGetScanLine->VidPnTargetId];
     3187    Assert(pTarget->HeightTotal);
     3188    Assert(pTarget->HeightVisible);
     3189    Assert(pTarget->HeightTotal > pTarget->HeightVisible);
     3190    Assert(pTarget->ScanLineState < pTarget->HeightTotal);
     3191    if (pTarget->HeightTotal)
     3192    {
     3193        uint32_t curScanLine = pTarget->ScanLineState;
     3194        BOOLEAN bVBlanck;
     3195        ++pTarget->ScanLineState;
     3196        if (pTarget->ScanLineState >= pTarget->HeightTotal)
     3197            pTarget->ScanLineState = 0;
     3198
     3199
     3200        BOOL bVBlank = (!curScanLine || curScanLine > pTarget->HeightVisible);
     3201        pGetScanLine->ScanLine = curScanLine;
     3202        pGetScanLine->InVerticalBlank = bVBlank;
     3203    }
     3204    else
     3205    {
     3206        pGetScanLine->InVerticalBlank = TRUE;
     3207        pGetScanLine->ScanLine = 0;
     3208    }
    31823209
    31833210    dfprintf(("<== "__FUNCTION__ ", hAdapter(0x%x)\n", hAdapter));
     
    34313458
    34323459    D3DDDI_VIDEO_PRESENT_SOURCE_ID id = pAllocation->SurfDesc.VidPnSourceId;
    3433     if (id >=  pDevExt->cSources)
     3460    if (id >=  pDevExt->u.primary.cDisplays)
    34343461        return false;
    34353462
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