VirtualBox

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

wddm: more VidPn impl

File:
1 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
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