VirtualBox

Ignore:
Timestamp:
Oct 20, 2010 10:25:22 AM (14 years ago)
Author:
vboxsync
Message:

Additions/WINNT/Graphics: more refactoring and some re-ordering

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

Legend:

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

    r33226 r33252  
    895895     */
    896896    int iCustomMode;
    897     for (iCustomMode = 0; iCustomMode < DeviceExtension->pPrimary->u.primary.cDisplays; iCustomMode++)
     897    for (iCustomMode = 0; iCustomMode < commonFromDeviceExt(DeviceExtension)->cDisplays; iCustomMode++)
    898898    {
    899899        if (fDisplayChangeRequest && iCustomMode == display)
     
    952952        if (DeviceExtension->CurrentMode == 0)
    953953#else
    954         if (!DeviceExtension->u.primary.cDisplays || !DeviceExtension->aSources[0].pPrimaryAllocation)
     954        if (!commonFromDeviceExt(DeviceExtension)->cDisplays || !DeviceExtension->aSources[0].pPrimaryAllocation)
    955955#endif
    956956        {
     
    992992        }
    993993#else
    994         if (DeviceExtension->u.primary.cDisplays && DeviceExtension->aSources[0].pPrimaryAllocation)
     994        if (commonFromDeviceExt(DeviceExtension)->cDisplays && DeviceExtension->aSources[0].pPrimaryAllocation)
    995995        {
    996996            if (!xres)
     
    10511051                if (DeviceExtension->CurrentMode != 0)
    10521052#else
    1053                 if (DeviceExtension->u.primary.cDisplays && DeviceExtension->aSources[0].pPrimaryAllocation)
     1053                if (commonFromDeviceExt(DeviceExtension)->cDisplays && DeviceExtension->aSources[0].pPrimaryAllocation)
    10541054#endif
    10551055#ifndef VBOX_WITH_MULTIMONITOR_FIX
     
    11571157                if (DeviceExtension->CurrentMode == 0)
    11581158#else
    1159                 if (!DeviceExtension->u.primary.cDisplays || !DeviceExtension->aSources[0].pPrimaryAllocation)
     1159                if (!commonFromDeviceExt(DeviceExtension)->cDisplays || !DeviceExtension->aSources[0].pPrimaryAllocation)
    11601160#endif
    11611161                {
     
    13471347    /* Size of a framebuffer. */
    13481348
    1349     ULONG ulSize = ulAvailable / PrimaryExtension->u.primary.cDisplays;
     1349    ULONG ulSize = ulAvailable / commonFromDeviceExt(PrimaryExtension)->cDisplays;
    13501350
    13511351    /* Align down to 4096 bytes. */
     
    13531353
    13541354    dprintf(("VBoxVideo::VBoxComputeFrameBufferSizes: cbVRAM = 0x%08X, cDisplays = %d, ulSize = 0x%08X, ulSize * cDisplays = 0x%08X, slack = 0x%08X\n",
    1355              commonFromDeviceExt(PrimaryExtension)->cbVRAM, PrimaryExtension->u.primary.cDisplays,
    1356              ulSize, ulSize * PrimaryExtension->u.primary.cDisplays,
    1357              ulAvailable - ulSize * PrimaryExtension->u.primary.cDisplays));
     1355             commonFromDeviceExt(PrimaryExtension)->cbVRAM, commonFromDeviceExt(PrimaryExtension)->cDisplays,
     1356             ulSize, ulSize * commonFromDeviceExt(PrimaryExtension)->cDisplays,
     1357             ulAvailable - ulSize * commonFromDeviceExt(PrimaryExtension)->cDisplays));
    13581358
    13591359
     
    15231523    for (iCustomMode = 0;
    15241524#ifdef VBOX_WITH_WDDM
    1525             iCustomMode < pDevExt->u.primary.cDisplays;
     1525            iCustomMode < commonFromDeviceExt(pDevExt)->cDisplays;
    15261526#else
    1527             iCustomMode < pDevExt->pPrimary->u.primary.cDisplays;
     1527            iCustomMode < commonFromDeviceExt(pDevExt)->cDisplays;
    15281528#endif
    15291529            iCustomMode++)
     
    17001700      ((PDEVICE_EXTENSION)HwDeviceExtension)->ulFrameBufferSize       = 0;
    17011701      ((PDEVICE_EXTENSION)HwDeviceExtension)->u.primary.ulVbvaEnabled = 0;
    1702       ((PDEVICE_EXTENSION)HwDeviceExtension)->u.primary.cDisplays     = 1;
    17031702      VBoxVideoCmnMemZero(&((PDEVICE_EXTENSION)HwDeviceExtension)->areaDisplay, sizeof(HGSMIAREA));
    17041703      /* Guest supports only HGSMI, the old VBVA via VMMDev is not supported. Old
     
    28572856    if (ChildEnumInfo->ChildIndex > 0)
    28582857    {
    2859         if ((int)ChildEnumInfo->ChildIndex <= pDevExt->pPrimary->u.primary.cDisplays)
     2858        if ((int)ChildEnumInfo->ChildIndex <= commonFromDeviceExt(pDevExt)->cDisplays)
    28602859        {
    28612860            *VideoChildType = Monitor;
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h

    r33226 r33252  
    203203typedef struct VBOXVIDEO_COMMON
    204204{
     205    int cDisplays;                      /* Number of displays. */
     206
    205207    ULONG cbVRAM;                       /* The VRAM size. */
    206208
     
    214216    volatile HGSMIHOSTFLAGS * pHostFlags; /* HGSMI host flags */
    215217    volatile bool bHostCmdProcessing;
    216     VBOXVCMNSPIN_LOCK pSynchLock;
    217218
    218219    PVOID pvAdapterInformation;         /* The pointer to the last 4K of VRAM.
     
    268269           ULONG ulVbvaEnabled;                /* Indicates that VBVA mode is enabled. */
    269270
    270            int cDisplays;                      /* Number of displays. */
    271 
    272271#ifdef VBOX_WITH_WDDM
    273272           VBOXVDMAINFO Vdma;
     
    276275# endif
    277276#endif
     277
     278           VBOXVCMNSPIN_LOCK pSynchLock;
    278279
    279280           ULONG ulMaxFrameBufferSize;         /* The size of the VRAM allocated for the a single framebuffer. */
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideoHGSMI.cpp

    r33226 r33252  
    126126                break;
    127127            }
    128             VBOX_HGSMI_LOCK(PrimaryExtension, &commonFromDeviceExt(PrimaryExtension)->pSynchLock, flags, &OldIrql);
     128            VBOX_HGSMI_LOCK(PrimaryExtension, &PrimaryExtension->u.primary.pSynchLock, flags, &OldIrql);
    129129            if(!(commonFromDeviceExt(PrimaryExtension)->pHostFlags->u32HostFlags & HGSMIHOSTFLAGS_COMMANDS_PENDING))
    130130            {
    131131                Assert(commonFromDeviceExt(PrimaryExtension)->bHostCmdProcessing);
    132132                commonFromDeviceExt(PrimaryExtension)->bHostCmdProcessing = false;
    133                 VBOX_HGSMI_UNLOCK(PrimaryExtension, &commonFromDeviceExt(PrimaryExtension)->pSynchLock, flags, OldIrql);
     133                VBOX_HGSMI_UNLOCK(PrimaryExtension, &PrimaryExtension->u.primary.pSynchLock, flags, OldIrql);
    134134                break;
    135135            }
    136             VBOX_HGSMI_UNLOCK(PrimaryExtension, &commonFromDeviceExt(PrimaryExtension)->pSynchLock, flags, OldIrql);
     136            VBOX_HGSMI_UNLOCK(PrimaryExtension, &PrimaryExtension->u.primary.pSynchLock, flags, OldIrql);
    137137        }
    138138        else
     
    140140            if(!bProcessing)
    141141            {
    142                 VBOX_HGSMI_LOCK(PrimaryExtension, &commonFromDeviceExt(PrimaryExtension)->pSynchLock, flags, &OldIrql);
     142                VBOX_HGSMI_LOCK(PrimaryExtension, &PrimaryExtension->u.primary.pSynchLock, flags, &OldIrql);
    143143                if(!(commonFromDeviceExt(PrimaryExtension)->pHostFlags->u32HostFlags & HGSMIHOSTFLAGS_COMMANDS_PENDING)
    144144                        || commonFromDeviceExt(PrimaryExtension)->bHostCmdProcessing)
    145145                {
    146                     VBOX_HGSMI_UNLOCK(PrimaryExtension, &commonFromDeviceExt(PrimaryExtension)->pSynchLock, flags, OldIrql);
     146                    VBOX_HGSMI_UNLOCK(PrimaryExtension, &PrimaryExtension->u.primary.pSynchLock, flags, OldIrql);
    147147                    break;
    148148                }
    149149                Assert(!commonFromDeviceExt(PrimaryExtension)->bHostCmdProcessing);
    150150                commonFromDeviceExt(PrimaryExtension)->bHostCmdProcessing = true;
    151                 VBOX_HGSMI_UNLOCK(PrimaryExtension, &commonFromDeviceExt(PrimaryExtension)->pSynchLock, flags, OldIrql);
     151                VBOX_HGSMI_UNLOCK(PrimaryExtension, &PrimaryExtension->u.primary.pSynchLock, flags, OldIrql);
    152152                bProcessing = true;
    153153            }
     
    366366
    367367    for (i = 0, Extension = PrimaryExtension;
    368          i < PrimaryExtension->u.primary.cDisplays && Extension;
     368         i < commonFromDeviceExt(PrimaryExtension)->cDisplays && Extension;
    369369         i++, Extension = Extension->pNext)
    370370    {
     
    381381    }
    382382
    383     if (i == PrimaryExtension->u.primary.cDisplays && Extension == NULL)
     383    if (i == commonFromDeviceExt(PrimaryExtension)->cDisplays && Extension == NULL)
    384384    {
    385385        return VINF_SUCCESS;
     
    431431
    432432
    433 static int vboxSetupAdapterInfoHGSMI (PDEVICE_EXTENSION PrimaryExtension)
     433static int vboxSetupAdapterInfoHGSMI (PVBOXVIDEO_COMMON pCommon)
    434434{
    435435    dprintf(("VBoxVideo::vboxSetupAdapterInfo\n"));
    436436
    437437    /* setup the flags first to ensure they are initialized by the time the host heap is ready */
    438     int rc = vboxCallChannel(commonFromDeviceExt(PrimaryExtension),
     438    int rc = vboxCallChannel(pCommon,
    439439            HGSMI_CH_HGSMI,
    440440            HGSMI_CC_HOST_FLAGS_LOCATION,
     
    444444                       NULL);
    445445    AssertRC(rc);
    446 #ifndef VBOX_WITH_WDDM
    447     if (RT_SUCCESS(rc))
    448     {
    449         rc = VBoxHGSMISendViewInfo (commonFromDeviceExt(PrimaryExtension),
    450                                PrimaryExtension->u.primary.cDisplays,
    451                                vbvaInitInfoDisplay,
    452                                (void *) PrimaryExtension);
    453         AssertRC(rc);
    454     }
    455     /* in case of WDDM we do not control the framebuffer location,
    456      * i.e. it is assigned by Video Memory Manager,
    457      * The FB information should be passed to guest from our
    458      * DxgkDdiSetVidPnSourceAddress callback */
    459 #endif
    460     if (RT_SUCCESS(rc) && commonFromDeviceExt(PrimaryExtension)->fCaps)
     446    if (RT_SUCCESS(rc) && pCommon->fCaps)
    461447    {
    462448        /* Inform about caps */
    463         rc = vboxCallVBVA (commonFromDeviceExt(PrimaryExtension),
     449        rc = vboxCallVBVA (pCommon,
    464450                               VBVA_INFO_CAPS,
    465451                               sizeof (VBVACAPS),
     
    472458    {
    473459        /* Report the host heap location. */
    474         rc = vboxCallVBVA (commonFromDeviceExt(PrimaryExtension),
     460        rc = vboxCallVBVA (pCommon,
    475461                           VBVA_INFO_HEAP,
    476462                           sizeof (VBVAINFOHEAP),
     
    730716    memset(commonFromDeviceExt(PrimaryExtension), 0,
    731717           sizeof(*commonFromDeviceExt(PrimaryExtension)));
    732     commonFromDeviceExt(PrimaryExtension)->cbVRAM = AdapterMemorySize;
    733     commonFromDeviceExt(PrimaryExtension)->fCaps  = fCaps;
    734     commonFromDeviceExt(PrimaryExtension)->bHGSMI = VBoxHGSMIIsSupported ();
     718    commonFromDeviceExt(PrimaryExtension)->cbVRAM    = AdapterMemorySize;
     719    commonFromDeviceExt(PrimaryExtension)->fCaps     = fCaps;
     720    commonFromDeviceExt(PrimaryExtension)->cDisplays = 1;
     721    commonFromDeviceExt(PrimaryExtension)->bHGSMI    = VBoxHGSMIIsSupported ();
    735722    /* Why does this use VBoxVideoCmnMemZero?  The MSDN docs say that it should
    736723     * only be used on mapped display adapter memory.  Done with memset above. */
     
    851838    if (commonFromDeviceExt(PrimaryExtension)->bHGSMI)
    852839    {
     840        /* Query the configured number of displays. */
     841        ULONG cDisplays = 0;
     842        vboxQueryConfHGSMI (commonFromDeviceExt(PrimaryExtension), VBOX_VBVA_CONF32_MONITOR_COUNT, &cDisplays);
     843
     844        dprintf(("VBoxVideo::VBoxSetupDisplays: cDisplays = %d\n",
     845                 cDisplays));
     846
     847        if (cDisplays == 0 || cDisplays > VBOX_VIDEO_MAX_SCREENS)
     848        {
     849            /* Host reported some bad value. Continue in the 1 screen mode. */
     850            cDisplays = 1;
     851        }
     852        commonFromDeviceExt(PrimaryExtension)->cDisplays = cDisplays;
     853    }
     854
     855    if (commonFromDeviceExt(PrimaryExtension)->bHGSMI)
     856    {
     857        /* Setup the information for the host. */
     858        rc = vboxSetupAdapterInfoHGSMI (commonFromDeviceExt(PrimaryExtension));
     859
     860        if (RT_FAILURE (rc))
     861        {
     862            commonFromDeviceExt(PrimaryExtension)->bHGSMI = FALSE;
     863        }
     864    }
     865
    853866#ifndef VBOX_WITH_WDDM
     867    /* For WDDM, we simply store the number of monitors as we will deal with
     868     * VidPN stuff later */
     869    if (commonFromDeviceExt(PrimaryExtension)->bHGSMI)
     870    {
    854871        typedef VP_STATUS (*PFNCREATESECONDARYDISPLAY)(PVOID, PVOID *, ULONG);
    855872        PFNCREATESECONDARYDISPLAY pfnCreateSecondaryDisplay = NULL;
     
    864881        }
    865882
    866         if (pfnCreateSecondaryDisplay != NULL)
    867 #endif
    868         {
    869             /* Query the configured number of displays. */
    870             ULONG cDisplays = 0;
    871             vboxQueryConfHGSMI (commonFromDeviceExt(PrimaryExtension), VBOX_VBVA_CONF32_MONITOR_COUNT, &cDisplays);
    872 
    873             dprintf(("VBoxVideo::VBoxSetupDisplays: cDisplays = %d\n",
    874                      cDisplays));
    875 
    876             if (cDisplays == 0 || cDisplays > VBOX_VIDEO_MAX_SCREENS)
    877             {
    878                 /* Host reported some bad value. Continue in the 1 screen mode. */
    879                 cDisplays = 1;
    880             }
    881 
    882 #ifndef VBOX_WITH_WDDM
     883        if (!pfnCreateSecondaryDisplay)
     884            commonFromDeviceExt(PrimaryExtension)->cDisplays = 1;
     885        else
     886        {
    883887            PDEVICE_EXTENSION pPrev = PrimaryExtension;
    884888
    885889            ULONG iDisplay;
     890            ULONG cDisplays = commonFromDeviceExt(PrimaryExtension)->cDisplays;
     891            commonFromDeviceExt(PrimaryExtension)->cDisplays = 1;
    886892            for (iDisplay = 1; iDisplay < cDisplays; iDisplay++)
    887893            {
     
    909915
    910916               /* Take the successfully created display into account. */
    911                PrimaryExtension->u.primary.cDisplays++;
    912             }
    913 #else
    914             /* simply store the number of monitors, we will deal with VidPN stuff later */
    915             PrimaryExtension->u.primary.cDisplays = cDisplays;
    916 #endif
     917               commonFromDeviceExt(PrimaryExtension)->cDisplays++;
     918            }
    917919        }
    918920
     
    921923    }
    922924
    923 #ifndef VBOX_WITH_WDDM
    924925    /* Now when the number of monitors is known and extensions are created,
    925926     * calculate the layout of framebuffers.
    926927     */
    927928    VBoxComputeFrameBufferSizes (PrimaryExtension);
    928 #endif
     929    /* in case of WDDM we do not control the framebuffer location,
     930     * i.e. it is assigned by Video Memory Manager,
     931     * The FB information should be passed to guest from our
     932     * DxgkDdiSetVidPnSourceAddress callback */
    929933
    930934    if (commonFromDeviceExt(PrimaryExtension)->bHGSMI)
    931935    {
    932         /* Setup the information for the host. */
    933         rc = vboxSetupAdapterInfoHGSMI (PrimaryExtension);
     936        if (RT_SUCCESS(rc))
     937        {
     938            rc = VBoxHGSMISendViewInfo (commonFromDeviceExt(PrimaryExtension),
     939                                   commonFromDeviceExt(PrimaryExtension)->cDisplays,
     940                                   vbvaInitInfoDisplay,
     941                                   (void *) PrimaryExtension);
     942            AssertRC(rc);
     943        }
    934944
    935945        if (RT_FAILURE (rc))
     
    938948        }
    939949    }
     950#endif
    940951
    941952#ifdef VBOX_WITH_WDDM
     
    982993            ulAvailable = offset;
    983994            ulSize = ulAvailable / 2;
    984             ulSize /= PrimaryExtension->u.primary.cDisplays;
     995            ulSize /= commonFromDeviceExt(PrimaryExtension)->cDisplays;
    985996            Assert(ulSize > VBVA_MIN_BUFFER_SIZE);
    986997            if (ulSize > VBVA_MIN_BUFFER_SIZE)
     
    10011012            Assert(ulSize);
    10021013
    1003             Assert(ulSize * PrimaryExtension->u.primary.cDisplays < ulAvailable);
    1004 
    1005             for (int i = PrimaryExtension->u.primary.cDisplays-1; i >= 0; --i)
     1014            Assert(ulSize * commonFromDeviceExt(PrimaryExtension)->cDisplays < ulAvailable);
     1015
     1016            for (int i = commonFromDeviceExt(PrimaryExtension)->cDisplays-1; i >= 0; --i)
    10061017            {
    10071018                offset -= ulSize;
     
    10441055    if (commonFromDeviceExt(PrimaryExtension)->bHGSMI)
    10451056    {
    1046         VBoxVideoCmnSpinLockCreate(PrimaryExtension, &commonFromDeviceExt(PrimaryExtension)->pSynchLock);
     1057        VBoxVideoCmnSpinLockCreate(PrimaryExtension, &PrimaryExtension->u.primary.pSynchLock);
    10471058    }
    10481059
     
    10591070        VBoxUnmapAdapterMemory(PrimaryExtension, (void**)&PrimaryExtension->pvVisibleVram, vboxWddmVramCpuVisibleSize(PrimaryExtension));
    10601071
    1061     for (int i = PrimaryExtension->u.primary.cDisplays-1; i >= 0; --i)
     1072    for (int i = commonFromDeviceExt(PrimaryExtension)->cDisplays-1; i >= 0; --i)
    10621073    {
    10631074        rc = vboxVbvaDisable(PrimaryExtension, &PrimaryExtension->aSources[i].Vbva);
     
    13041315static int vboxVBVACreateChannelContexts(PDEVICE_EXTENSION PrimaryExtension, VBVA_CHANNELCONTEXTS ** ppContext)
    13051316{
    1306 #ifndef VBOX_WITH_WDDM
    1307     uint32_t cDisplays = (uint32_t)PrimaryExtension->u.primary.cDisplays;
    1308 #else
    1309     uint32_t cDisplays = (uint32_t)PrimaryExtension->u.primary.cDisplays;
    1310 #endif
     1317    uint32_t cDisplays = (uint32_t)commonFromDeviceExt(PrimaryExtension)->cDisplays;
    13111318    const size_t size = RT_OFFSETOF(VBVA_CHANNELCONTEXTS, aContexts[cDisplays]);
    13121319    VBVA_CHANNELCONTEXTS * pContext = (VBVA_CHANNELCONTEXTS*)VBoxVideoCmnMemAllocNonPaged(PrimaryExtension, size, MEM_TAG);
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVhwa.cpp

    r32989 r33252  
    353353static void vboxVhwaInitSrc(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId)
    354354{
    355     Assert(srcId < (D3DDDI_VIDEO_PRESENT_SOURCE_ID)pDevExt->u.primary.cDisplays);
     355    Assert(srcId < (D3DDDI_VIDEO_PRESENT_SOURCE_ID)commonFromDeviceExt(pDevExt)->cDisplays);
    356356    VBOXVHWA_INFO *pSettings = &pDevExt->aSources[srcId].Vhwa.Settings;
    357357    memset (pSettings, 0, sizeof (VBOXVHWA_INFO));
     
    418418void vboxVhwaInit(PDEVICE_EXTENSION pDevExt)
    419419{
    420     for (int i = 0; i < pDevExt->u.primary.cDisplays; ++i)
     420    for (int i = 0; i < commonFromDeviceExt(pDevExt)->cDisplays; ++i)
    421421    {
    422422        vboxVhwaInitSrc(pDevExt, (D3DDDI_VIDEO_PRESENT_SOURCE_ID)i);
     
    428428    /* we do not allocate/map anything, just issue a Disable command
    429429     * to ensure all pending commands are flushed */
    430     for (int i = 0; i < pDevExt->u.primary.cDisplays; ++i)
     430    for (int i = 0; i < commonFromDeviceExt(pDevExt)->cDisplays; ++i)
    431431    {
    432432        vboxVhwaDisable(pDevExt, i);
     
    680680int vboxVhwaHlpGetSurfInfo(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pSurf)
    681681{
    682     for (int i = 0; i < pDevExt->u.primary.cDisplays; ++i)
     682    for (int i = 0; i < commonFromDeviceExt(pDevExt)->cDisplays; ++i)
    683683    {
    684684        PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[i];
     
    720720int vboxVhwaHlpCheckInit(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId)
    721721{
    722     Assert(VidPnSourceId < (D3DDDI_VIDEO_PRESENT_SOURCE_ID)pDevExt->u.primary.cDisplays);
    723     if (VidPnSourceId >= (D3DDDI_VIDEO_PRESENT_SOURCE_ID)pDevExt->u.primary.cDisplays)
     722    Assert(VidPnSourceId < (D3DDDI_VIDEO_PRESENT_SOURCE_ID)commonFromDeviceExt(pDevExt)->cDisplays);
     723    if (VidPnSourceId >= (D3DDDI_VIDEO_PRESENT_SOURCE_ID)commonFromDeviceExt(pDevExt)->cDisplays)
    724724        return VERR_INVALID_PARAMETER;
    725725
     
    766766int vboxVhwaHlpCheckTerm(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId)
    767767{
    768     Assert(VidPnSourceId < (D3DDDI_VIDEO_PRESENT_SOURCE_ID)pDevExt->u.primary.cDisplays);
    769     if (VidPnSourceId >= (D3DDDI_VIDEO_PRESENT_SOURCE_ID)pDevExt->u.primary.cDisplays)
     768    Assert(VidPnSourceId < (D3DDDI_VIDEO_PRESENT_SOURCE_ID)commonFromDeviceExt(pDevExt)->cDisplays);
     769    if (VidPnSourceId >= (D3DDDI_VIDEO_PRESENT_SOURCE_ID)commonFromDeviceExt(pDevExt)->cDisplays)
    770770        return VERR_INVALID_PARAMETER;
    771771
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVidPn.cpp

    r32699 r33252  
    15581558NTSTATUS vboxVidPnCommitSourceMode(struct _DEVICE_EXTENSION* pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, CONST D3DKMDT_VIDPN_SOURCE_MODE* pVidPnSourceModeInfo, PVBOXWDDM_ALLOCATION pAllocation)
    15591559{
    1560     Assert(srcId < (UINT)pDevExt->u.primary.cDisplays);
    1561     if (srcId < (UINT)pDevExt->u.primary.cDisplays)
     1560    Assert(srcId < (UINT)commonFromDeviceExt(pDevExt)->cDisplays);
     1561    if (srcId < (UINT)commonFromDeviceExt(pDevExt)->cDisplays)
    15621562    {
    15631563        PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[srcId];
     
    15651565    }
    15661566
    1567     drprintf((__FUNCTION__": invalid srcId (%d), cSources(%d)\n", srcId, pDevExt->u.primary.cDisplays));
     1567    drprintf((__FUNCTION__": invalid srcId (%d), cSources(%d)\n", srcId, commonFromDeviceExt(pDevExt)->cDisplays));
    15681568    return STATUS_INVALID_PARAMETER;
    15691569}
     
    15801580{
    15811581    VBOXVIDPNCOMMITTARGETMODE *pInfo = (VBOXVIDPNCOMMITTARGETMODE*)pContext;
    1582     Assert(cTgtPaths <= (SIZE_T)pDevExt->u.primary.cDisplays);
     1582    Assert(cTgtPaths <= (SIZE_T)commonFromDeviceExt(pDevExt)->cDisplays);
    15831583    D3DKMDT_HVIDPNTARGETMODESET hVidPnTargetModeSet;
    15841584    CONST DXGK_VIDPNTARGETMODESET_INTERFACE* pVidPnTargetModeSetInterface;
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp

    r33226 r33252  
    174174        pView->u32ViewIndex     = pAllocation->SurfDesc.VidPnSourceId;
    175175        pView->u32ViewOffset    = (uint32_t)offVram; /* we pretend the view is located at the start of each framebuffer */
    176         pView->u32ViewSize      = vboxWddmVramCpuVisibleSegmentSize(pDevExt)/pDevExt->u.primary.cDisplays;
     176        pView->u32ViewSize      = vboxWddmVramCpuVisibleSegmentSize(pDevExt)/commonFromDeviceExt(pDevExt)->cDisplays;
    177177
    178178        pView->u32MaxScreenSize = pView->u32ViewSize;
     
    594594                {
    595595                    drprintf(("VBoxVideoWddm: using HGSMI\n"));
    596                     *NumberOfVideoPresentSources = pContext->u.primary.cDisplays;
    597                     *NumberOfChildren = pContext->u.primary.cDisplays;
     596                    *NumberOfVideoPresentSources = commonFromDeviceExt(pContext)->cDisplays;
     597                    *NumberOfChildren = commonFromDeviceExt(pContext)->cDisplays;
    598598                    dprintf(("VBoxVideoWddm: sources(%d), children(%d)\n", *NumberOfVideoPresentSources, *NumberOfChildren));
    599599
     
    10241024
    10251025    dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", MiniportDeviceContext));
    1026     Assert(ChildRelationsSize == (pDevExt->u.primary.cDisplays + 1)*sizeof(DXGK_CHILD_DESCRIPTOR));
    1027     for (int i = 0; i < pDevExt->u.primary.cDisplays; ++i)
     1026    Assert(ChildRelationsSize == (commonFromDeviceExt(pDevExt)->cDisplays + 1)*sizeof(DXGK_CHILD_DESCRIPTOR));
     1027    for (int i = 0; i < commonFromDeviceExt(pDevExt)->cDisplays; ++i)
    10281028    {
    10291029        ChildRelations[i].ChildDeviceType = TypeVideoOutput;
     
    12171217            pCaps->MaxOverlays = 0;
    12181218#ifdef VBOX_WITH_VIDEOHWACCEL
    1219             for (int i = 0; i < pContext->u.primary.cDisplays; ++i)
     1219            for (int i = 0; i < commonFromDeviceExt(pContext)->cDisplays; ++i)
    12201220            {
    12211221                if ( pContext->aSources[i].Vhwa.Settings.fFlags & VBOXVHWA_F_ENABLED)
     
    13061306                memset (pQi, 0, sizeof (VBOXWDDM_QI));
    13071307                pQi->u32Version = VBOXVIDEOIF_VERSION;
    1308                 pQi->cInfos = pContext->u.primary.cDisplays;
     1308                pQi->cInfos = commonFromDeviceExt(pContext)->cDisplays;
    13091309#ifdef VBOX_WITH_VIDEOHWACCEL
    1310                 for (int i = 0; i < pContext->u.primary.cDisplays; ++i)
     1310                for (int i = 0; i < commonFromDeviceExt(pContext)->cDisplays; ++i)
    13111311                {
    13121312                    pQi->aInfos[i] = pContext->aSources[i].Vhwa.Settings;
     
    16681668        {
    16691669            PVBOXWDDM_RCINFO pRcInfo = (PVBOXWDDM_RCINFO)pCreateAllocation->pPrivateDriverData;
    1670 //            Assert(pRcInfo->RcDesc.VidPnSourceId < pDevExt->u.primary.cDisplays);
     1670//            Assert(pRcInfo->RcDesc.VidPnSourceId < commonFromDeviceExt(pDevExt)->cDisplays);
    16711671            Assert(pRcInfo->cAllocInfos == pCreateAllocation->NumAllocations);
    16721672            pResource = (PVBOXWDDM_RESOURCE)vboxWddmMemAllocZero(RT_OFFSETOF(VBOXWDDM_RESOURCE, aAllocations[pRcInfo->cAllocInfos]));
     
    32943294                {
    32953295                    PVBOXDISPIFESCAPE_SCREENLAYOUT pLo = (PVBOXDISPIFESCAPE_SCREENLAYOUT)pEscapeHdr;
    3296                     Assert(pLo->ScreenLayout.cScreens <= (UINT)pDevExt->u.primary.cDisplays);
     3296                    Assert(pLo->ScreenLayout.cScreens <= (UINT)commonFromDeviceExt(pDevExt)->cDisplays);
    32973297                    for (UINT i = 0; i < pLo->ScreenLayout.cScreens; ++i)
    32983298                    {
    32993299                        PVBOXSCREENLAYOUT_ELEMENT pEl = &pLo->ScreenLayout.aScreens[i];
    3300                         Assert(pEl->VidPnSourceId < (UINT)pDevExt->u.primary.cDisplays);
    3301                         if (pEl->VidPnSourceId < (UINT)pDevExt->u.primary.cDisplays)
     3300                        Assert(pEl->VidPnSourceId < (UINT)commonFromDeviceExt(pDevExt)->cDisplays);
     3301                        if (pEl->VidPnSourceId < (UINT)commonFromDeviceExt(pDevExt)->cDisplays)
    33023302                        {
    33033303                            PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pEl->VidPnSourceId];
     
    34243424            if (Status == STATUS_SUCCESS && bSupported)
    34253425            {
    3426                 for (int id = 0; id < pContext->u.primary.cDisplays; ++id)
     3426                for (int id = 0; id < commonFromDeviceExt(pContext)->cDisplays; ++id)
    34273427                {
    34283428                    D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet;
     
    34553455                if (Status == STATUS_SUCCESS && bSupported)
    34563456                {
    3457                     for (int id = 0; id < pContext->u.primary.cDisplays; ++id)
     3457                    for (int id = 0; id < commonFromDeviceExt(pContext)->cDisplays; ++id)
    34583458                    {
    34593459                        D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet;
     
    35653565    if (Status == STATUS_SUCCESS)
    35663566    {
    3567         for (int i = 0; i < pDevExt->u.primary.cDisplays; ++i)
     3567        for (int i = 0; i < commonFromDeviceExt(pDevExt)->cDisplays; ++i)
    35683568        {
    35693569            Status = vboxVidPnCheckAddMonitorModes(pDevExt, i, D3DKMDT_MCO_DRIVER, &Resolution, 1, 0);
     
    36823682    NTSTATUS Status = STATUS_SUCCESS;
    36833683    PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)hAdapter;
    3684     Assert((UINT)pDevExt->u.primary.cDisplays > pSetVidPnSourceAddress->VidPnSourceId);
     3684    Assert((UINT)commonFromDeviceExt(pDevExt)->cDisplays > pSetVidPnSourceAddress->VidPnSourceId);
    36853685
    36863686    PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pSetVidPnSourceAddress->VidPnSourceId];
     
    36893689    Status = STATUS_SUCCESS;
    36903690
    3691     if ((UINT)pDevExt->u.primary.cDisplays > pSetVidPnSourceAddress->VidPnSourceId)
     3691    if ((UINT)commonFromDeviceExt(pDevExt)->cDisplays > pSetVidPnSourceAddress->VidPnSourceId)
    36923692    {
    36933693        PVBOXWDDM_ALLOCATION pAllocation;
     
    37413741    else
    37423742    {
    3743         drprintf((__FUNCTION__": invalid VidPnSourceId (%d), should be smaller than (%d)\n", pSetVidPnSourceAddress->VidPnSourceId, pDevExt->u.primary.cDisplays));
     3743        drprintf((__FUNCTION__": invalid VidPnSourceId (%d), should be smaller than (%d)\n", pSetVidPnSourceAddress->VidPnSourceId, commonFromDeviceExt(pDevExt)->cDisplays));
    37443744        Status = STATUS_INVALID_PARAMETER;
    37453745    }
     
    37663766    NTSTATUS Status = STATUS_SUCCESS;
    37673767    PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)hAdapter;
    3768     Assert((UINT)pDevExt->u.primary.cDisplays > pSetVidPnSourceVisibility->VidPnSourceId);
     3768    Assert((UINT)commonFromDeviceExt(pDevExt)->cDisplays > pSetVidPnSourceVisibility->VidPnSourceId);
    37693769
    37703770    PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pSetVidPnSourceVisibility->VidPnSourceId];
     
    37733773    Status = STATUS_SUCCESS;
    37743774
    3775     if ((UINT)pDevExt->u.primary.cDisplays > pSetVidPnSourceVisibility->VidPnSourceId)
     3775    if ((UINT)commonFromDeviceExt(pDevExt)->cDisplays > pSetVidPnSourceVisibility->VidPnSourceId)
    37763776    {
    37773777        PVBOXWDDM_ALLOCATION pAllocation = pSource->pPrimaryAllocation;
     
    38193819    else
    38203820    {
    3821         drprintf((__FUNCTION__": invalid VidPnSourceId (%d), should be smaller than (%d)\n", pSetVidPnSourceVisibility->VidPnSourceId, pDevExt->u.primary.cDisplays));
     3821        drprintf((__FUNCTION__": invalid VidPnSourceId (%d), should be smaller than (%d)\n", pSetVidPnSourceVisibility->VidPnSourceId, commonFromDeviceExt(pDevExt)->cDisplays));
    38223822        Status = STATUS_INVALID_PARAMETER;
    38233823    }
     
    38583858        {
    38593859            /* clear all current primaries */
    3860             for (int i = 0; i < pDevExt->u.primary.cDisplays; ++i)
     3860            for (int i = 0; i < commonFromDeviceExt(pDevExt)->cDisplays; ++i)
    38613861            {
    38623862                vboxWddmAssignPrimary(pDevExt, &pDevExt->aSources[i], NULL, i);
     
    40054005    PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)hAdapter;
    40064006
    4007     Assert((UINT)pDevExt->u.primary.cDisplays > pGetScanLine->VidPnTargetId);
     4007    Assert((UINT)commonFromDeviceExt(pDevExt)->cDisplays > pGetScanLine->VidPnTargetId);
    40084008    VBOXWDDM_TARGET *pTarget = &pDevExt->aTargets[pGetScanLine->VidPnTargetId];
    40094009    Assert(pTarget->HeightTotal);
     
    43994399
    44004400    D3DDDI_VIDEO_PRESENT_SOURCE_ID id = pAllocation->SurfDesc.VidPnSourceId;
    4401     if (id >= (D3DDDI_VIDEO_PRESENT_SOURCE_ID)pDevExt->u.primary.cDisplays)
     4401    if (id >= (D3DDDI_VIDEO_PRESENT_SOURCE_ID)commonFromDeviceExt(pDevExt)->cDisplays)
    44024402        return false;
    44034403
     
    49684968            Assert(pCreateContext->Flags.Value <= 2); /* 2 is a GDI context in Win7 */
    49694969            pContext->enmType = VBOXWDDM_CONTEXT_TYPE_SYSTEM;
    4970             for (int i = 0; i < pDevExt->u.primary.cDisplays; ++i)
     4970            for (int i = 0; i < commonFromDeviceExt(pDevExt)->cDisplays; ++i)
    49714971            {
    49724972                pDevExt->aSources[i].offVram = VBOXVIDEOOFFSET_VOID;
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