VirtualBox

Changeset 84658 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Jun 3, 2020 11:30:37 AM (5 years ago)
Author:
vboxsync
Message:

WDDM: allow to change the refresh rate for debug purposes.

Location:
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPMisc.cpp

    r83842 r84658  
    12511251        g_VBoxLogUm = dwValue;
    12521252
     1253    g_RefreshRate = 0;
     1254    Status = vboxWddmRegQueryValueDword(hKey, VBOXWDDM_CFG_STR_RATE, &dwValue);
     1255    if (NT_SUCCESS(Status))
     1256        g_RefreshRate = dwValue;
     1257
     1258    if (g_RefreshRate == 0 || g_RefreshRate > 240)
     1259        g_RefreshRate = VBOXWDDM_DEFAULT_REFRESH_RATE;
     1260
    12531261    ZwClose(hKey);
    12541262
     
    13231331
    13241332        LARGE_INTEGER DueTime;
    1325         DueTime.QuadPart = -166666LL; /* 60 Hz */
    1326         KeSetTimerEx(&pDevExt->VSyncTimer, DueTime, 16, &pDevExt->VSyncDpc);
     1333        DueTime.QuadPart = -10000000LL / g_RefreshRate; /* 100ns units per second / Freq Hz */
     1334        KeSetTimerEx(&pDevExt->VSyncTimer, DueTime, 1000 / g_RefreshRate, &pDevExt->VSyncDpc);
    13271335    }
    13281336
     
    13561364            VSyncTime.QuadPart = VSyncTime.QuadPart - DevVSyncTime.QuadPart;
    13571365            /*
    1358              * Check whether we are in VBlank state or actively drawing a scan line
    1359              * 10% of the 60Hz are dedicated to VBlank.
     1366             * Check whether we are in VBlank state or actively drawing a scan line.
     1367             * 10% of the VSync interval are dedicated to VBlank.
    13601368             *
    13611369             * Time intervals are in 100ns steps.
    13621370             */
    13631371            LARGE_INTEGER VSyncPeriod;
    1364             VSyncPeriod.QuadPart = VSyncTime.QuadPart % 166666LL; /* ASSUMES 60Hz*/
    1365             if (VSyncPeriod.QuadPart >= 150000LL)
     1372            VSyncPeriod.QuadPart = VSyncTime.QuadPart % (10000000LL / g_RefreshRate);
     1373            LARGE_INTEGER VBlankStart;
     1374            VBlankStart.QuadPart = ((10000000LL / g_RefreshRate) * 9) / 10;
     1375            if (VSyncPeriod.QuadPart >= VBlankStart.QuadPart)
    13661376                bVBlank = TRUE;
    13671377            else
    1368                 curScanLine = (uint32_t)((pTarget->Size.cy * VSyncPeriod.QuadPart) / 150000LL);
     1378                curScanLine = (uint32_t)((pTarget->Size.cy * VSyncPeriod.QuadPart) / VBlankStart.QuadPart);
    13691379        }
    13701380
     
    14751485    pAllocData->SurfDesc.cbSize = pInfo->Pitch * pInfo->Height;
    14761486    pAllocData->SurfDesc.VidPnSourceId = pInfo->TargetId;
    1477     pAllocData->SurfDesc.RefreshRate.Numerator = 60000;
     1487    pAllocData->SurfDesc.RefreshRate.Numerator = g_RefreshRate * 1000;
    14781488    pAllocData->SurfDesc.RefreshRate.Denominator = 1000;
    14791489
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPTypes.h

    r82968 r84658  
    3838#include <iprt/avl.h>
    3939#endif
     40
     41#define VBOXWDDM_DEFAULT_REFRESH_RATE 60
    4042
    4143#ifndef VBOX_WITH_MESA3D
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVidPn.cpp

    r82968 r84658  
    202202static void vboxVidPnPopulateMonitorModeInfo(D3DKMDT_MONITOR_SOURCE_MODE *pMonitorSourceMode, const RTRECTSIZE *pResolution)
    203203{
    204     vboxVidPnPopulateVideoSignalInfo(&pMonitorSourceMode->VideoSignalInfo, pResolution, 60 /* ULONG VSync */);
     204    vboxVidPnPopulateVideoSignalInfo(&pMonitorSourceMode->VideoSignalInfo, pResolution, g_RefreshRate);
    205205    pMonitorSourceMode->ColorBasis = D3DKMDT_CB_SRGB;
    206206    pMonitorSourceMode->ColorCoeffDynamicRanges.FirstChannel = 8;
     
    215215{
    216216    pNewVidPnTargetModeInfo->Preference = D3DKMDT_MP_NOTPREFERRED;
    217     return vboxVidPnPopulateVideoSignalInfo(&pNewVidPnTargetModeInfo->VideoSignalInfo, pResolution, 60 /* ULONG VSync */);
     217    return vboxVidPnPopulateVideoSignalInfo(&pNewVidPnTargetModeInfo->VideoSignalInfo, pResolution, g_RefreshRate);
    218218}
    219219
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp

    r84465 r84658  
    4848DWORD g_VBoxLogUm = 0;
    4949#endif
     50DWORD g_RefreshRate = 0;
    5051
    5152/* Whether the driver is display-only (no 3D) for Windows 8 or newer guests. */
     
    23282329    pDescribeAllocation->Format = pAllocation->AllocData.SurfDesc.format;
    23292330    memset (&pDescribeAllocation->MultisampleMethod, 0, sizeof (pDescribeAllocation->MultisampleMethod));
    2330     pDescribeAllocation->RefreshRate.Numerator = 60000;
     2331    pDescribeAllocation->RefreshRate.Numerator = g_RefreshRate * 1000;
    23312332    pDescribeAllocation->RefreshRate.Denominator = 1000;
    23322333    pDescribeAllocation->PrivateDriverFormatAttribute = 0;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.h

    r83840 r84658  
    3838#define VBOXWDDM_CFG_LOG_UM_DBGPRINT 0x00000002
    3939#define VBOXWDDM_CFG_STR_LOG_UM L"VBoxLogUm"
     40#define VBOXWDDM_CFG_STR_RATE L"RefreshRate"
    4041
    4142#define VBOXWDDM_REG_DRV_FLAGS_NAME L"VBoxFlags"
     
    5758
    5859extern DWORD g_VBoxLogUm;
     60extern DWORD g_RefreshRate;
    5961
    6062RT_C_DECLS_BEGIN
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