VirtualBox

Ignore:
Timestamp:
Feb 8, 2010 1:03:29 PM (15 years ago)
Author:
vboxsync
Message:

wddm: more VidPn impl

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

Legend:

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

    r26320 r26324  
    172172/* preferred mode index */
    173173static uint32_t gPreferredVideoMode = 0;
     174
     175static D3DKMDT_2DREGION g_VBoxWddmVideoResolutions[RT_ELEMENTS(VideoModes)];
     176static uint32_t g_VBoxWddmNumResolutions;
     177
     178DECLINLINE(int) vboxWddmRectComparator(const D3DKMDT_2DREGION *pReg1, const D3DKMDT_2DREGION *pReg2)
     179{
     180    int tmp = pReg1->cx - pReg2->cx;
     181    if(tmp)
     182        return tmp;
     183    tmp = pReg1->cy - pReg2->cy;
     184    return tmp;
     185}
     186
     187/* builds a g_VBoxWddmVideoResolutions given VideoModes info */
     188VOID vboxWddmBuildResolutionTable()
     189{
     190    g_VBoxWddmNumResolutions = 0;
     191
     192    /* we don't care about the efficiency at this time */
     193    for (uint32_t i = 0; i < gNumVideoModes; ++i)
     194    {
     195        VIDEO_MODE_INFORMATION *pMode = &VideoModes[i];
     196        bool bFound = false;
     197        for (uint32_t j = 0; j < g_VBoxWddmNumResolutions; ++j)
     198        {
     199            if (g_VBoxWddmVideoResolutions[j].cx == pMode->VisScreenWidth
     200                    && g_VBoxWddmVideoResolutions[j].cy == pMode->VisScreenHeight)
     201            {
     202                bFound = true;
     203                break;
     204            }
     205        }
     206
     207        if (!bFound)
     208        {
     209            g_VBoxWddmVideoResolutions[g_VBoxWddmNumResolutions].cx = pMode->VisScreenWidth;
     210            g_VBoxWddmVideoResolutions[g_VBoxWddmNumResolutions].cy = pMode->VisScreenHeight;
     211        }
     212    }
     213}
    174214#endif
    175215
     
    893933#endif
    894934
     935#ifdef VBOXWDDM
     936    vboxWddmBuildResolutionTable();
     937#endif
     938
    895939    VBoxVideoCmnRegFini(Reg);
    896940}
     
    903947 * or the available VRAM does not allow for additional modes.
    904948 */
    905 VOID VBoxWddmGetModesTable(PDEVICE_EXTENSION DeviceExtension, bool bRebuildTable, VIDEO_MODE_INFORMATION ** ppModes, uint32_t * pcModes, uint32_t * pPreferrableMode)
     949VOID VBoxWddmGetModesTable(PDEVICE_EXTENSION DeviceExtension, bool bRebuildTable,
     950        VIDEO_MODE_INFORMATION ** ppModes, uint32_t * pcModes, uint32_t * pPreferrableMode,
     951        D3DKMDT_2DREGION **ppResolutions, uint32_t * pcResolutions)
    906952{
    907953    static bool bTableInitialized = false;
     
    915961    *pcModes = gNumVideoModes;
    916962    *pPreferrableMode = gPreferredVideoMode;
     963    *ppResolutions = g_VBoxWddmVideoResolutions;
     964    *pcResolutions = g_VBoxWddmNumResolutions;
    917965}
    918966
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h

    r26320 r26324  
    624624RT_C_DECLS_END
    625625
    626 VOID VBoxWddmGetModesTable(PDEVICE_EXTENSION DeviceExtension, bool bRebuildTable, VIDEO_MODE_INFORMATION ** ppModes, uint32_t * pcModes, uint32_t * pPreferrableMode);
     626VOID VBoxWddmGetModesTable(PDEVICE_EXTENSION DeviceExtension, bool bRebuildTable,
     627        VIDEO_MODE_INFORMATION ** ppModes, uint32_t * pcModes, uint32_t * pPreferrableMode,
     628        D3DKMDT_2DREGION **pResolutions, uint32_t * pcResolutions);
     629
    627630D3DDDIFORMAT vboxWddmCalcPixelFormat(VIDEO_MODE_INFORMATION *pInfo);
    628631UINT vboxWddmCalcBitsPerPixel(D3DDDIFORMAT format);
     
    656659    uint32_t iPreferredMode;
    657660    VIDEO_MODE_INFORMATION *pModes;
     661    uint32_t cResolutions;
     662    D3DKMDT_2DREGION *pResolutions;
    658663}VBOXVIDPNCOFUNCMODALITY, *PVBOXVIDPNCOFUNCMODALITY;
    659664
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVidPn.cpp

    r26320 r26324  
    498498NTSTATUS vboxVidPnPopulateTargetModeInfoFromLegacy(PDEVICE_EXTENSION pDevExt,
    499499        D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo,
    500         VIDEO_MODE_INFORMATION *pMode)
     500        D3DKMDT_2DREGION *pResolution,
     501        BOOLEAN bPreferred)
    501502{
    502503    NTSTATUS Status = STATUS_SUCCESS;
    503 #if 0
    504     todo();
    505     if (pMode->AttributeFlags & VIDEO_MODE_GRAPHICS)
    506     {
    507         /* this is a graphics mode */
    508         pNewVidPnSourceModeInfo->Type = D3DKMDT_RMT_GRAPHICS;
    509         pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx = pMode->VisScreenWidth;
    510         pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy = pMode->VisScreenHeight;
    511         pNewVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize = pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize;
    512         pNewVidPnSourceModeInfo->Format.Graphics.Stride = pMode->ScreenStride;
    513         pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat = vboxWddmCalcPixelFormat(pInfo);
    514         Assert(pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat != D3DDDIFMT_UNKNOWN);
    515         if (pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat != D3DDDIFMT_UNKNOWN)
    516         {
    517             pNewVidPnSourceModeInfo->Format.Graphics.ColorBasis = D3DKMDT_CB_SRGB;
    518             if (pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat == D3DDDIFMT_P8)
    519                 pNewVidPnSourceModeInfo->Format.Graphics.PixelValueAccessMode = D3DKMDT_PVAM_SETTABLEPALETTE;
    520             else
    521                 pNewVidPnSourceModeInfo->Format.Graphics.PixelValueAccessMode = D3DKMDT_PVAM_DIRECT;
    522         }
    523         else
    524         {
    525             drprintf((__FUNCTION__": vboxWddmCalcPixelFormat failed\n"));
    526             Status = STATUS_INVALID_PARAMETER;
    527         }
    528     }
    529     else
    530     {
    531         /* @todo: XPDM driver does not seem to return text modes, should we? */
    532         drprintf((__FUNCTION__": text mode not supported currently\n"));
    533         AssertBreakPoint();
    534         Status = STATUS_INVALID_PARAMETER;
    535     }
    536 #endif
     504
     505    pNewVidPnTargetModeInfo->VideoSignalInfo.VideoStandard  = D3DKMDT_VSS_VESA_DMT;
     506    pNewVidPnTargetModeInfo->VideoSignalInfo.TotalSize = *pResolution;
     507    pNewVidPnTargetModeInfo->VideoSignalInfo.ActiveSize = pNewVidPnTargetModeInfo->VideoSignalInfo.TotalSize;
     508    pNewVidPnTargetModeInfo->VideoSignalInfo.VSyncFreq.Numerator = 60000;
     509    pNewVidPnTargetModeInfo->VideoSignalInfo.VSyncFreq.Denominator = 1000;
     510    pNewVidPnTargetModeInfo->VideoSignalInfo.HSyncFreq.Numerator = pNewVidPnTargetModeInfo->VideoSignalInfo.ActiveSize.cy * 60 * 1.05;
     511    pNewVidPnTargetModeInfo->VideoSignalInfo.HSyncFreq.Denominator = 1;
     512    pNewVidPnTargetModeInfo->VideoSignalInfo.PixelRate = 165000; /* @todo: ? */
     513    pNewVidPnTargetModeInfo->VideoSignalInfo.ScanLineOrdering = D3DDDI_VSSLO_PROGRESSIVE;
     514    pNewVidPnTargetModeInfo->Preference = bPreferred ? D3DKMDT_MP_PREFERRED : D3DKMDT_MP_NOTPREFERRED;
     515
    537516    return Status;
    538517}
     
    541520        D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet,
    542521        const DXGK_VIDPNTARGETMODESET_INTERFACE *pNewVidPnTargetModeSetInterface,
    543         VIDEO_MODE_INFORMATION *pModes,
    544         uint32_t cModes,
    545         uint32_t iPreferredMomde)
     522        D3DKMDT_2DREGION *pResolutions,
     523        uint32_t cResolutions,
     524        VIDEO_MODE_INFORMATION *pPreferredMode)
    546525{
    547526    NTSTATUS Status = STATUS_SUCCESS;
    548     for (uint32_t i = 0; i < cModes; ++i)
     527    for (uint32_t i = 0; i < cResolutions; ++i)
    549528    {
    550529        D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo;
     
    553532        if (Status == STATUS_SUCCESS)
    554533        {
    555             Status = vboxVidPnPopulateTargetModeInfoFromLegacy(pDevExt, pNewVidPnTargetModeInfo, &pModes[i]);
     534            bool bPreferred = pPreferredMode->VisScreenHeight == pResolutions[i].cx
     535                    && pPreferredMode->VisScreenWidth == pResolutions[i].cy;
     536            Status = vboxVidPnPopulateTargetModeInfoFromLegacy(pDevExt, pNewVidPnTargetModeInfo, &pResolutions[i], bPreferred);
    556537            Assert(Status == STATUS_SUCCESS);
    557538            if (Status == STATUS_SUCCESS)
     
    603584    uint32_t cModes = pCbContext->cModes;
    604585    uint32_t iPreferredMode = pCbContext->iPreferredMode;
     586    uint32_t cResolutions = pCbContext->cResolutions;
     587    D3DKMDT_2DREGION * pResolutions = pCbContext->pResolutions;
     588
    605589
    606590    /* adjust scaling */
     
    733717                            Status = vboxVidPnPopulateTargetModeSetFromLegacy(pDevExt,
    734718                                    hNewVidPnTargetModeSet, pNewVidPnTargetModeSetInterface,
    735                                     pModes, cModes, iPreferredMode);
     719                                    pResolutions, cResolutions, &pModes[iPreferredMode]);
    736720                            Assert(Status == STATUS_SUCCESS);
    737721                            if (Status == STATUS_SUCCESS)
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp

    r26320 r26324  
    15071507            VBOXVIDPNCOFUNCMODALITY CbContext = {0};
    15081508            CbContext.pEnumCofuncModalityArg = pEnumCofuncModalityArg;
    1509             VBoxWddmGetModesTable(pContext, true, &CbContext.pModes, &CbContext.cModes, &CbContext.iPreferredMode);
     1509            VBoxWddmGetModesTable(pContext, true, &CbContext.pModes, &CbContext.cModes, &CbContext.iPreferredMode, &CbContext.cResolutions, &CbContext.pResolutions);
    15101510            Assert(CbContext.cModes);
    15111511            Assert(CbContext.cModes > CbContext.iPreferredMode);
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