VirtualBox

Changeset 26794 in vbox for trunk


Ignore:
Timestamp:
Feb 25, 2010 1:18:57 PM (15 years ago)
Author:
vboxsync
Message:

wddm: more impl + bugfix

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

Legend:

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

    r26770 r26794  
    167167
    168168           BOOLEAN bVBoxVideoSupported;        /* TRUE if VBoxVideo extensions, including DualView, are supported by the host. */
    169 
     169#ifndef VBOXWDDM
    170170           int cDisplays;                      /* Number of displays. */
    171 
     171#endif
    172172           ULONG cbVRAM;                       /* The VRAM size. */
    173173
     
    581581}
    582582
     583DECLINLINE(VOID) vboxWddmAssignPrimary(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_SOURCE pSource, PVBOXWDDM_ALLOCATION pAllocation, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId)
     584{
     585    if (pSource->pAllocation == pAllocation)
     586        return;
     587
     588    if (pSource->pAllocation)
     589    {
     590        PVBOXWDDM_ALLOCATION pOldAlloc = pSource->pAllocation;
     591        PVBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE pOldPrimaryInfo = VBOXWDDM_ALLOCATION_BODY(pOldAlloc, VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE);
     592        /* clear the visibility info fo the current primary */
     593        pOldPrimaryInfo->bVisible = FALSE;
     594        Assert(pOldPrimaryInfo->VidPnSourceId == srcId);
     595        pOldPrimaryInfo->VidPnSourceId = ~0;
     596    }
     597
     598    if (pAllocation)
     599    {
     600        PVBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE pPrimaryInfo = VBOXWDDM_ALLOCATION_BODY(pAllocation, VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE);
     601        pPrimaryInfo->bVisible = FALSE;
     602        pPrimaryInfo->VidPnSourceId = srcId;
     603    }
     604
     605    pSource->pAllocation = pAllocation;
     606}
     607
    583608#endif
    584609
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideoHGSMI.cpp

    r26767 r26794  
    712712    PrimaryExtension->u.primary.ulVbvaEnabled            = 0;
    713713    PrimaryExtension->u.primary.bVBoxVideoSupported      = FALSE;
     714#ifndef VBOXWDDM
    714715    PrimaryExtension->u.primary.cDisplays                = 1;
     716#endif
    715717    PrimaryExtension->u.primary.cbVRAM                   = AdapterMemorySize;
    716718    PrimaryExtension->u.primary.cbMiniportHeap           = 0;
     
    899901#else
    900902            /* simply store the number of monitors, we will deal with VidPN stuff later */
    901             PrimaryExtension->u.primary.cDisplays = cDisplays;
     903            PrimaryExtension->cSources = cDisplays;
    902904#endif
    903905        }
     
    11751177static int vboxVBVACreateChannelContexts(PDEVICE_EXTENSION PrimaryExtension, VBVA_CHANNELCONTEXTS ** ppContext)
    11761178{
     1179#ifndef VBOXWDDM
    11771180    uint32_t cDisplays = (uint32_t)PrimaryExtension->u.primary.cDisplays;
     1181#else
     1182    uint32_t cDisplays = (uint32_t)PrimaryExtension->cSources;
     1183#endif
    11781184    const size_t size = RT_OFFSETOF(VBVA_CHANNELCONTEXTS, aContexts[cDisplays]);
    11791185    VBVA_CHANNELCONTEXTS * pContext = (VBVA_CHANNELCONTEXTS*)VBoxVideoCmnMemAllocNonPaged(PrimaryExtension, size, MEM_TAG);
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVidPn.cpp

    r26556 r26794  
    893893    return Status;
    894894}
     895
     896NTSTATUS vboxVidPnSetupSourceInfo(struct _DEVICE_EXTENSION* pDevExt, PVBOXWDDM_SOURCE pSource, CONST D3DKMDT_VIDPN_SOURCE_MODE* pVidPnSourceModeInfo, PVBOXWDDM_ALLOCATION pAllocation)
     897{
     898    vboxWddmAssignPrimary(pDevExt, pSource, pAllocation, pVidPnSourceModeInfo->Id);
     899    return STATUS_SUCCESS;
     900}
     901
     902NTSTATUS vboxVidPnCommitSourceMode(struct _DEVICE_EXTENSION* pDevExt, CONST D3DKMDT_VIDPN_SOURCE_MODE* pVidPnSourceModeInfo, PVBOXWDDM_ALLOCATION pAllocation)
     903{
     904    Assert(pVidPnSourceModeInfo->Id < pDevExt->cSources);
     905    if (pVidPnSourceModeInfo->Id < pDevExt->cSources)
     906    {
     907        PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pVidPnSourceModeInfo->Id];
     908        return vboxVidPnSetupSourceInfo(pDevExt, pSource, pVidPnSourceModeInfo, pAllocation);
     909    }
     910
     911    drprintf((__FUNCTION__": invalid mode id (%d), cSources(%d)\n", pVidPnSourceModeInfo->Id, pDevExt->cSources));
     912    return STATUS_INVALID_PARAMETER;
     913}
     914
     915NTSTATUS vboxVidPnCommitSourceModeForSrcId(struct _DEVICE_EXTENSION* pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, PVBOXWDDM_ALLOCATION pAllocation)
     916{
     917    D3DKMDT_HVIDPNSOURCEMODESET hCurVidPnSourceModeSet;
     918    const DXGK_VIDPNSOURCEMODESET_INTERFACE *pCurVidPnSourceModeSetInterface;
     919
     920    NTSTATUS Status = pVidPnInterface->pfnAcquireSourceModeSet(hDesiredVidPn,
     921                srcId,
     922                &hCurVidPnSourceModeSet,
     923                &pCurVidPnSourceModeSetInterface);
     924    Assert(Status == STATUS_SUCCESS);
     925    if (Status == STATUS_SUCCESS)
     926    {
     927        CONST D3DKMDT_VIDPN_SOURCE_MODE* pPinnedVidPnSourceModeInfo;
     928        Status = pCurVidPnSourceModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnSourceModeSet, &pPinnedVidPnSourceModeInfo);
     929        Assert(Status == STATUS_SUCCESS);
     930        if (Status == STATUS_SUCCESS)
     931        {
     932            Assert(pPinnedVidPnSourceModeInfo);
     933            if (pPinnedVidPnSourceModeInfo)
     934            {
     935                Status = vboxVidPnCommitSourceMode(pDevExt, pPinnedVidPnSourceModeInfo, pAllocation);
     936                Assert(Status == STATUS_SUCCESS);
     937                if (Status != STATUS_SUCCESS)
     938                    drprintf((__FUNCTION__": vboxVidPnCommitSourceMode failed Status(0x%x)\n", Status));
     939                /* release */
     940                pCurVidPnSourceModeSetInterface->pfnReleaseModeInfo(hCurVidPnSourceModeSet, pPinnedVidPnSourceModeInfo);
     941            }
     942            else
     943                drprintf((__FUNCTION__": no pPinnedVidPnSourceModeInfo available for source id (%d)\n", srcId));
     944        }
     945        else
     946            drprintf((__FUNCTION__": pfnAcquirePinnedModeInfo failed Status(0x%x)\n", Status));
     947
     948        pVidPnInterface->pfnReleaseSourceModeSet(hDesiredVidPn, hCurVidPnSourceModeSet);
     949    }
     950    else
     951    {
     952        drprintf((__FUNCTION__": pfnAcquireSourceModeSet failed Status(0x%x)\n", Status));
     953    }
     954
     955    return Status;
     956}
     957
     958DECLCALLBACK(BOOLEAN) vboxVidPnCommitPathEnum(struct _DEVICE_EXTENSION* pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
     959        D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
     960        const D3DKMDT_VIDPN_PRESENT_PATH *pVidPnPresentPathInfo, PVOID pContext)
     961{
     962    NTSTATUS Status = STATUS_SUCCESS;
     963    PVBOXVIDPNCOMMIT pCommitInfo = (PVBOXVIDPNCOMMIT)pContext;
     964
     965    if (pCommitInfo->pCommitVidPnArg->AffectedVidPnSourceId == D3DDDI_ID_ALL
     966            || pCommitInfo->pCommitVidPnArg->AffectedVidPnSourceId == pVidPnPresentPathInfo->VidPnSourceId)
     967    {
     968        Status = vboxVidPnCommitSourceModeForSrcId(pDevExt, hDesiredVidPn, pVidPnInterface, pVidPnPresentPathInfo->VidPnSourceId, (PVBOXWDDM_ALLOCATION)pCommitInfo->pCommitVidPnArg->hPrimaryAllocation);
     969        Assert(Status == STATUS_SUCCESS);
     970        if (Status != STATUS_SUCCESS)
     971            drprintf((__FUNCTION__": vboxVidPnCommitSourceModeForSrcId failed Status(0x%x)\n", Status));
     972    }
     973
     974    pCommitInfo->Status = Status;
     975    pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pVidPnPresentPathInfo);
     976    return Status == STATUS_SUCCESS;
     977}
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVidPn.h

    r26770 r26794  
    4747    uint32_t cResolutions;
    4848    D3DKMDT_2DREGION *pResolutions;
    49 }VBOXVIDPNCOFUNCMODALITY, *PVBOXVIDPNCOFUNCMODALITY;
     49} VBOXVIDPNCOFUNCMODALITY, *PVBOXVIDPNCOFUNCMODALITY;
     50
     51typedef struct VBOXVIDPNCOMMIT
     52{
     53    NTSTATUS Status;
     54    CONST DXGKARG_COMMITVIDPN* pCommitVidPnArg;
     55} VBOXVIDPNCOMMIT, *PVBOXVIDPNCOMMIT;
    5056
    5157/* !!!NOTE: The callback is responsible for releasing the path */
     
    8086        const D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo, PVOID pContext);
    8187
     88DECLCALLBACK(BOOLEAN) vboxVidPnCommitPathEnum(struct _DEVICE_EXTENSION* pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
     89        D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
     90        const D3DKMDT_VIDPN_PRESENT_PATH *pNewVidPnPresentPathInfo, PVOID pContext);
     91
     92NTSTATUS vboxVidPnCommitSourceModeForSrcId(struct _DEVICE_EXTENSION* pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, struct VBOXWDDM_ALLOCATION *pAllocation);
     93
    8294NTSTATUS vboxVidPnEnumPaths(struct _DEVICE_EXTENSION* pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
    8395        D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp

    r26770 r26794  
    141141        pView->u32ViewIndex     = pPrimaryInfo->VidPnSourceId;
    142142        pView->u32ViewOffset    = offVram;
    143         pView->u32ViewSize      = vboxWddmVramReportedSize(pDevExt)/pDevExt->u.primary.cDisplays;
     143        pView->u32ViewSize      = vboxWddmVramReportedSize(pDevExt)/pDevExt->cSources;
    144144
    145145        pView->u32MaxScreenSize = pView->u32ViewSize;
     
    812812                {
    813813                    drprintf(("VBoxVideoWddm: using HGSMI\n"));
    814                     *NumberOfVideoPresentSources = pContext->u.primary.cDisplays;
    815                     *NumberOfChildren = pContext->u.primary.cDisplays;
     814                    *NumberOfVideoPresentSources = pContext->cSources;
     815                    *NumberOfChildren = pContext->cSources;
    816816                    dprintf(("VBoxVideoWddm: sources(%d), children(%d)\n", *NumberOfVideoPresentSources, *NumberOfChildren));
    817817                }
     
    10221022
    10231023    dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", MiniportDeviceContext));
    1024     for (int i = 0; i < pDevExt->u.primary.cDisplays; ++i)
     1024    Assert(ChildRelationsSize == (pDevExt->cSources + 1)*sizeof(DXGK_CHILD_DESCRIPTOR));
     1025    for (UINT i = 0; i < pDevExt->cSources; ++i)
    10251026    {
    10261027        ChildRelations[i].ChildDeviceType = TypeVideoOutput;
     
    18361837            if (Status == STATUS_SUCCESS && bSupported)
    18371838            {
    1838                 for (int id = 0; id < pContext->u.primary.cDisplays; id++)
     1839                for (UINT id = 0; id < pContext->cSources; ++id)
    18391840                {
    18401841                    D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet;
     
    18671868                if (Status == STATUS_SUCCESS && bSupported)
    18681869                {
    1869                     for (int id = 0; id < pContext->u.primary.cDisplays; id++)
     1870                    for (UINT id = 0; id < pContext->cSources; ++id)
    18701871                    {
    18711872                        D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet;
     
    19111912    dfprintf(("<== "__FUNCTION__ ", status(0x%x), context(0x%x)\n", Status, hAdapter));
    19121913
    1913     return STATUS_SUCCESS;
     1914    return Status;
    19141915}
    19151916
     
    21612162    dfprintf(("<== "__FUNCTION__ ", status(0x%x), context(0x%x)\n", Status, hAdapter));
    21622163
    2163     return STATUS_NOT_IMPLEMENTED;
     2164    return Status;
    21642165}
    21652166
     
    21882189        if (pSetVidPnSourceAddress->hAllocation)
    21892190        {
    2190             pSource->pAllocation = (PVBOXWDDM_ALLOCATION)pSetVidPnSourceAddress->hAllocation;
    21912191            pAllocation = (PVBOXWDDM_ALLOCATION)pSetVidPnSourceAddress->hAllocation;
     2192            vboxWddmAssignPrimary(pDevExt, pSource, pAllocation, pSetVidPnSourceAddress->VidPnSourceId);
    21922193        }
    21932194        else
     
    22852286    )
    22862287{
    2287 
    2288     return STATUS_NOT_IMPLEMENTED;
     2288    dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", hAdapter));
     2289
     2290    PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)hAdapter;
     2291
     2292    const DXGK_VIDPN_INTERFACE* pVidPnInterface = NULL;
     2293    NTSTATUS Status = pDevExt->u.primary.DxgkInterface.DxgkCbQueryVidPnInterface(pCommitVidPnArg->hFunctionalVidPn, DXGK_VIDPN_INTERFACE_VERSION_V1, &pVidPnInterface);
     2294    if (Status == STATUS_SUCCESS)
     2295    {
     2296        if (pCommitVidPnArg->AffectedVidPnSourceId != D3DDDI_ID_ALL)
     2297        {
     2298            Status = vboxVidPnCommitSourceModeForSrcId(
     2299                    pDevExt,
     2300                    pCommitVidPnArg->hFunctionalVidPn, pVidPnInterface,
     2301                    pCommitVidPnArg->AffectedVidPnSourceId, (PVBOXWDDM_ALLOCATION)pCommitVidPnArg->hPrimaryAllocation);
     2302            Assert(Status == STATUS_SUCCESS);
     2303            if (Status != STATUS_SUCCESS)
     2304                drprintf((__FUNCTION__ ": vboxVidPnCommitSourceModeForSrcId failed Status(0x%x)\n", Status));
     2305        }
     2306        else
     2307        {
     2308            /* clear all current primaries */
     2309            for (UINT i = 0; i < pDevExt->cSources; ++i)
     2310            {
     2311                vboxWddmAssignPrimary(pDevExt, &pDevExt->aSources[i], NULL, i);
     2312            }
     2313
     2314            D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology;
     2315            const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface;
     2316            NTSTATUS Status = pVidPnInterface->pfnGetTopology(pCommitVidPnArg->hFunctionalVidPn, &hVidPnTopology, &pVidPnTopologyInterface);
     2317            Assert(Status == STATUS_SUCCESS);
     2318            if (Status == STATUS_SUCCESS)
     2319            {
     2320                VBOXVIDPNCOMMIT CbContext = {0};
     2321                CbContext.pCommitVidPnArg = pCommitVidPnArg;
     2322                Status = vboxVidPnEnumPaths(pDevExt, pCommitVidPnArg->hFunctionalVidPn, pVidPnInterface,
     2323                            hVidPnTopology, pVidPnTopologyInterface,
     2324                            vboxVidPnCommitPathEnum, &CbContext);
     2325                Assert(Status == STATUS_SUCCESS);
     2326                if (Status == STATUS_SUCCESS)
     2327                {
     2328                        Status = CbContext.Status;
     2329                        Assert(Status == STATUS_SUCCESS);
     2330                        if (Status != STATUS_SUCCESS)
     2331                            drprintf((__FUNCTION__ ": vboxVidPnAdjustSourcesTargetsCallback failed Status(0x%x)\n", Status));
     2332                }
     2333                else
     2334                    drprintf((__FUNCTION__ ": vboxVidPnEnumPaths failed Status(0x%x)\n", Status));
     2335            }
     2336            else
     2337                drprintf((__FUNCTION__ ": pfnGetTopology failed Status(0x%x)\n", Status));
     2338        }
     2339    }
     2340    else
     2341        drprintf((__FUNCTION__ ": DxgkCbQueryVidPnInterface failed Status(0x%x)\n", Status));
     2342
     2343    dfprintf(("<== "__FUNCTION__ ", status(0x%x), context(0x%x)\n", Status, hAdapter));
     2344
     2345    return Status;
    22892346}
    22902347
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.h

    r26767 r26794  
    8181#define VBOXWDDM_ALLOCATION_HEAD(_pb) ((VBOXWDDM_ALLOCATION*)((uint8_t *)(_pb) - VBOXWDDM_ALLOCATION_HEADSIZE()))
    8282
     83
     84
     85
     86
    8387typedef struct VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE
    8488{
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