VirtualBox

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


Ignore:
Timestamp:
Mar 9, 2010 10:16:07 AM (15 years ago)
Author:
vboxsync
Message:

wddm: bugfix

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

Legend:

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

    r27164 r27201  
    5252#include "Helper.h"
    5353
     54#ifdef DEBUG_misha
     55bool g_bVBoxVDbgBreakF = true;
     56bool g_bVBoxVDbgBreakFv = false;
     57#endif
     58
    5459/**
    5560 * Globals
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/Helper.h

    r27164 r27201  
    8181#endif
    8282
     83#ifdef DEBUG_misha
     84/* specifies whether the vboxVDbgBreakF should break in the debugger
     85 * windbg seems to have some issues when there is a lot ( >~50) of sw breakpoints defined
     86 * to simplify things we just insert breaks for the case of intensive debugging WDDM driver*/
     87extern bool g_bVBoxVDbgBreakF;
     88extern bool g_bVBoxVDbgBreakFv;
     89#define vboxVDbgBreakF() do { if (g_bVBoxVDbgBreakF) AssertBreakpoint(); } while (0)
     90#define vboxVDbgBreakFv() do { if (g_bVBoxVDbgBreakF) AssertBreakpoint(); } while (0)
     91#else
     92#define vboxVDbgBreakF() do { } while (0)
     93#define vboxVDbgBreakFv() do { } while (0)
     94#endif
    8395
    8496#endif // __HELPER_h__
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp

    r27165 r27201  
    346346    ULONG vramSize = DeviceExtension->pPrimary->u.primary.ulMaxFrameBufferSize;
    347347#else
    348     ULONG vramSize = vboxWddmVramReportedSize(DeviceExtension);
     348    ULONG vramSize = vboxWddmVramReportedSegmentSize(DeviceExtension);
    349349
    350350    gPreferredVideoMode = 0;
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h

    r26794 r27201  
    581581}
    582582
     583DECLINLINE(ULONG) vboxWddmVramReportedSegmentSize(PDEVICE_EXTENSION pDevExt)
     584{
     585    ULONG size = vboxWddmVramReportedSize(pDevExt);
     586    size /= 2;
     587    size &= ~0xfffUL;
     588    return size;
     589}
     590
    583591DECLINLINE(VOID) vboxWddmAssignPrimary(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_SOURCE pSource, PVBOXWDDM_ALLOCATION pAllocation, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId)
    584592{
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVidPn.cpp

    r26794 r27201  
    496496}
    497497
     498NTSTATUS vboxVidPnPopulateVideoSignalInfo(PDEVICE_EXTENSION pDevExt,
     499        D3DKMDT_VIDEO_SIGNAL_INFO *pVsi,
     500        D3DKMDT_2DREGION *pResolution,
     501        ULONG VSync)
     502{
     503    NTSTATUS Status = STATUS_SUCCESS;
     504
     505    pVsi->VideoStandard  = D3DKMDT_VSS_VESA_DMT;
     506    pVsi->ActiveSize = *pResolution;
     507    pVsi->VSyncFreq.Numerator = VSync * 1000;
     508    pVsi->VSyncFreq.Denominator = 1000;
     509    pVsi->TotalSize.cx = pVsi->ActiveSize.cx + VBOXVDPN_C_DISPLAY_HBLANK_SIZE;
     510    pVsi->TotalSize.cy = pVsi->ActiveSize.cy + VBOXVDPN_C_DISPLAY_VBLANK_SIZE;
     511    pVsi->PixelRate = pVsi->TotalSize.cx * pVsi->TotalSize.cy * VSync;
     512    pVsi->HSyncFreq.Numerator = (UINT)((pVsi->PixelRate / pVsi->TotalSize.cy) * 1000);
     513    pVsi->HSyncFreq.Denominator = 1000;
     514    pVsi->ScanLineOrdering = D3DDDI_VSSLO_PROGRESSIVE;
     515
     516    return Status;
     517}
     518
     519NTSTATUS vboxVidPnPopulateMonitorSourceModeInfoFromLegacy(PDEVICE_EXTENSION pDevExt,
     520        D3DKMDT_MONITOR_SOURCE_MODE *pMonitorSourceMode,
     521        D3DKMDT_2DREGION *pResolution,
     522        D3DKMDT_MONITOR_CAPABILITIES_ORIGIN enmOrigin,
     523        BOOLEAN bPreferred)
     524{
     525    NTSTATUS Status = vboxVidPnPopulateVideoSignalInfo(pDevExt, &pMonitorSourceMode->VideoSignalInfo, pResolution, 60 /* ULONG VSync */);
     526    Assert(Status == STATUS_SUCCESS);
     527    if (Status == STATUS_SUCCESS)
     528    {
     529        pMonitorSourceMode->ColorBasis = D3DKMDT_CB_SRGB;
     530        pMonitorSourceMode->ColorCoeffDynamicRanges.FirstChannel = 8;
     531        pMonitorSourceMode->ColorCoeffDynamicRanges.SecondChannel = 8;
     532        pMonitorSourceMode->ColorCoeffDynamicRanges.ThirdChannel = 8;
     533        pMonitorSourceMode->ColorCoeffDynamicRanges.FourthChannel = 0;
     534        pMonitorSourceMode->Origin = enmOrigin;
     535        pMonitorSourceMode->Preference = bPreferred ? D3DKMDT_MP_PREFERRED : D3DKMDT_MP_NOTPREFERRED;
     536    }
     537
     538    return Status;
     539}
     540
    498541NTSTATUS vboxVidPnPopulateTargetModeInfoFromLegacy(PDEVICE_EXTENSION pDevExt,
    499542        D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo,
     
    501544        BOOLEAN bPreferred)
    502545{
    503     NTSTATUS Status = STATUS_SUCCESS;
    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 * 63; /* 63 is (60 * 1.05)*/
    511     pNewVidPnTargetModeInfo->VideoSignalInfo.HSyncFreq.Denominator = 1;
    512     pNewVidPnTargetModeInfo->VideoSignalInfo.PixelRate = 165000; /* @todo: ? */
    513     pNewVidPnTargetModeInfo->VideoSignalInfo.ScanLineOrdering = D3DDDI_VSSLO_PROGRESSIVE;
    514546    pNewVidPnTargetModeInfo->Preference = bPreferred ? D3DKMDT_MP_PREFERRED : D3DKMDT_MP_NOTPREFERRED;
    515547
    516     return Status;
     548    return vboxVidPnPopulateVideoSignalInfo(pDevExt, &pNewVidPnTargetModeInfo->VideoSignalInfo, pResolution, 60 /* ULONG VSync */);
    517549}
    518550
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVidPn.h

    r26794 r27201  
    1616#ifndef ___VBoxVideoVidPn_h___
    1717#define ___VBoxVideoVidPn_h___
     18
     19#define VBOXVDPN_C_DISPLAY_HBLANK_SIZE 200
     20#define VBOXVDPN_C_DISPLAY_VBLANK_SIZE 180
    1821
    1922NTSTATUS vboxVidPnCheckTopology(const D3DKMDT_HVIDPN hDesiredVidPn,
     
    104107        PFNVBOXVIDPNENUMTARGETMODES pfnCallback, PVOID pContext);
    105108
     109NTSTATUS vboxVidPnPopulateMonitorSourceModeInfoFromLegacy(struct _DEVICE_EXTENSION* pDevExt,
     110        D3DKMDT_MONITOR_SOURCE_MODE *pMonitorSourceMode,
     111        D3DKMDT_2DREGION *pResolution,
     112        D3DKMDT_MONITOR_CAPABILITIES_ORIGIN enmOrigin,
     113        BOOLEAN bPreferred);
     114
    106115#endif /* #ifndef ___VBoxVideoVidPn_h___ */
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp

    r27055 r27201  
    141141        pView->u32ViewIndex     = pPrimaryInfo->VidPnSourceId;
    142142        pView->u32ViewOffset    = offVram;
    143         pView->u32ViewSize      = vboxWddmVramReportedSize(pDevExt)/pDevExt->cSources;
     143        pView->u32ViewSize      = vboxWddmVramReportedSegmentSize(pDevExt)/pDevExt->cSources;
    144144
    145145        pView->u32MaxScreenSize = pView->u32ViewSize;
     
    917917    PAGED_CODE();
    918918
     919    vboxVDbgBreakFv();
     920
    919921    PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)MiniportDeviceContext;
    920922
     
    943945    /* The DxgkDdiQueryChildStatus should be made pageable. */
    944946    PAGED_CODE();
     947
     948    vboxVDbgBreakFv();
    945949
    946950    dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", MiniportDeviceContext));
     
    959963        default:
    960964            drprintf(("VBoxVideoWddm: ERROR: status type: %d\n", ChildStatus->Type));
     965            AssertBreakpoint();
    961966            Status = STATUS_INVALID_PARAMETER;
    962967            break;
     
    976981    /* The DxgkDdiQueryDeviceDescriptor should be made pageable. */
    977982    PAGED_CODE();
     983
     984    vboxVDbgBreakFv();
    978985
    979986    dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", MiniportDeviceContext));
     
    9981005
    9991006    /* @todo: */
     1007    vboxVDbgBreakF();
    10001008
    10011009    dfprintf(("<== "__FUNCTION__ ", context(0x%x)\n", MiniportDeviceContext));
     
    10141022    dfprintf(("==> "__FUNCTION__ ", MiniportDeviceContext(0x%x)\n", MiniportDeviceContext));
    10151023
    1016     AssertBreakpoint();
     1024    vboxVDbgBreakF();
    10171025
    10181026    dfprintf(("<== "__FUNCTION__ ", MiniportDeviceContext(0x%x)\n", MiniportDeviceContext));
     
    10261034{
    10271035    /* DxgkDdiResetDevice can be called at any IRQL, so it must be in nonpageable memory.  */
     1036    vboxVDbgBreakF();
     1037
    10281038    dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", MiniportDeviceContext));
    10291039    dfprintf(("<== "__FUNCTION__ ", context(0x%x)\n", MiniportDeviceContext));
     
    10501060    dfprintf(("==> "__FUNCTION__ ", MiniportDeviceContext(0x%x)\n", MiniportDeviceContext));
    10511061
    1052     AssertBreakpoint();
     1062    vboxVDbgBreakF();
    10531063
    10541064    dfprintf(("<== "__FUNCTION__ ", MiniportDeviceContext(0x%x)\n", MiniportDeviceContext));
     
    10651075    dfprintf(("==> "__FUNCTION__ "\n"));
    10661076
    1067     AssertBreakpoint();
     1077    vboxVDbgBreakF();
    10681078
    10691079    dfprintf(("<== "__FUNCTION__ "\n"));
     
    10841094    PDEVICE_EXTENSION pContext = (PDEVICE_EXTENSION)hAdapter;
    10851095
    1086     AssertBreakpoint();
     1096    vboxVDbgBreakF();
    10871097
    10881098    switch (pQueryAdapterInfo->Type)
     
    11421152            else
    11431153            {
     1154                DXGK_SEGMENTDESCRIPTOR* pDr = pQsOut->pSegmentDescriptor;
    11441155                /* we are requested to provide segment information */
    1145                 pQsOut->pSegmentDescriptor->BaseAddress.QuadPart = 0; /* VBE_DISPI_LFB_PHYSICAL_ADDRESS; */
    1146                 pQsOut->pSegmentDescriptor->CpuTranslatedAddress.QuadPart = VBE_DISPI_LFB_PHYSICAL_ADDRESS;
     1156                pDr->BaseAddress.QuadPart = 0; /* VBE_DISPI_LFB_PHYSICAL_ADDRESS; */
     1157                pDr->CpuTranslatedAddress.QuadPart = VBE_DISPI_LFB_PHYSICAL_ADDRESS;
    11471158                /* make sure the size is page aligned */
    11481159                /* @todo: need to setup VBVA buffers and adjust the mem size here */
    1149                 pQsOut->pSegmentDescriptor->Size = vboxWddmVramReportedSize(pContext);
    1150                 pQsOut->pSegmentDescriptor->NbOfBanks = 0;
    1151                 pQsOut->pSegmentDescriptor->pBankRangeTable = 0;
    1152                 pQsOut->pSegmentDescriptor->CommitLimit = pQsOut->pSegmentDescriptor->Size;
    1153                 pQsOut->pSegmentDescriptor->Flags.Value = 0;
    1154                 pQsOut->pSegmentDescriptor->Flags.CpuVisible = 1;
    1155             }
    1156             pQsOut->PagingBufferSegmentId = 0;
    1157             pQsOut->PagingBufferSize = 1024;
    1158             pQsOut->PagingBufferPrivateDataSize = 0; /* @todo: do we need a private buffer ? */
     1160                pDr->Size = vboxWddmVramReportedSegmentSize(pContext);
     1161                pDr->NbOfBanks = 0;
     1162                pDr->pBankRangeTable = 0;
     1163                pDr->CommitLimit = pDr->Size;
     1164                pDr->Flags.Value = 0;
     1165                pDr->Flags.CpuVisible = 1;
     1166
     1167                ++pDr;
     1168                /* create cpu-invisible segment of the same size */
     1169                pDr->BaseAddress.QuadPart = 0;
     1170                pDr->CpuTranslatedAddress.QuadPart = 0;
     1171                /* make sure the size is page aligned */
     1172                /* @todo: need to setup VBVA buffers and adjust the mem size here */
     1173                pDr->Size = vboxWddmVramReportedSegmentSize(pContext);
     1174                pDr->NbOfBanks = 0;
     1175                pDr->pBankRangeTable = 0;
     1176                pDr->CommitLimit = pDr->Size;
     1177                pDr->Flags.Value = 0;
     1178
     1179                pQsOut->PagingBufferSegmentId = 0;
     1180                pQsOut->PagingBufferSize = 1024;
     1181                pQsOut->PagingBufferPrivateDataSize = 0; /* @todo: do we need a private buffer ? */
     1182            }
    11591183            break;
    11601184        }
     
    11881212    PDEVICE_EXTENSION pContext = (PDEVICE_EXTENSION)hAdapter;
    11891213
    1190     AssertBreakpoint();
     1214    vboxVDbgBreakFv();
    11911215
    11921216    PVBOXWDDM_DEVICE pDevice = (PVBOXWDDM_DEVICE)vboxWddmMemAllocZero(sizeof (VBOXWDDM_DEVICE));
     
    23832407    dfprintf(("==> "__FUNCTION__ ", hAdapter(0x%x)\n", hAdapter));
    23842408
    2385     AssertBreakpoint();
     2409    vboxVDbgBreakF();
     2410
     2411    PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)hAdapter;
     2412    NTSTATUS Status;
     2413    uint32_t cModes;
     2414    uint32_t iPreferredMode;
     2415    VIDEO_MODE_INFORMATION *pModes;
     2416    uint32_t cResolutions;
     2417    D3DKMDT_2DREGION *pResolutions;
     2418    VBoxWddmGetModesTable(pDevExt, /* PDEVICE_EXTENSION DeviceExtension */
     2419            true, /* bool bRebuildTable*/
     2420            &pModes, /* VIDEO_MODE_INFORMATION ** ppModes*/
     2421            &cModes, /* uint32_t * pcModes */
     2422            &iPreferredMode, /* uint32_t * pPreferrableMode*/
     2423            &pResolutions, /* D3DKMDT_2DREGION **ppResolutions */
     2424            &cResolutions /* uint32_t * pcResolutions */);
     2425
     2426    for (uint32_t i = 0; i < cResolutions; i++)
     2427    {
     2428        D3DKMDT_MONITOR_SOURCE_MODE * pNewMonitorSourceModeInfo;
     2429        Status = pRecommendMonitorModesArg->pMonitorSourceModeSetInterface->pfnCreateNewModeInfo(
     2430                    pRecommendMonitorModesArg->hMonitorSourceModeSet, &pNewMonitorSourceModeInfo);
     2431        Assert(Status == STATUS_SUCCESS);
     2432        if (Status == STATUS_SUCCESS)
     2433        {
     2434            Status = vboxVidPnPopulateMonitorSourceModeInfoFromLegacy(pDevExt,
     2435                    pNewMonitorSourceModeInfo,
     2436                    &pResolutions[i],
     2437                    D3DKMDT_MCO_DRIVER,
     2438                    true);
     2439            Assert(Status == STATUS_SUCCESS);
     2440            if (Status == STATUS_SUCCESS)
     2441            {
     2442                Status = pRecommendMonitorModesArg->pMonitorSourceModeSetInterface->pfnAddMode(
     2443                        pRecommendMonitorModesArg->hMonitorSourceModeSet, pNewMonitorSourceModeInfo);
     2444                Assert(Status == STATUS_SUCCESS);
     2445                if (Status == STATUS_SUCCESS)
     2446                    continue;
     2447            }
     2448
     2449            /* error has occured, release & break */
     2450            pRecommendMonitorModesArg->pMonitorSourceModeSetInterface->pfnReleaseModeInfo(
     2451                    pRecommendMonitorModesArg->hMonitorSourceModeSet, pNewMonitorSourceModeInfo);
     2452            break;
     2453        }
     2454    }
    23862455
    23872456    dfprintf(("<== "__FUNCTION__ ", hAdapter(0x%x)\n", hAdapter));
    23882457
    2389     return STATUS_SUCCESS;
     2458    return Status;
    23902459}
    23912460
     
    23992468    dfprintf(("==> "__FUNCTION__ ", hAdapter(0x%x)\n", hAdapter));
    24002469
    2401     AssertBreakpoint();
     2470    vboxVDbgBreakF();
    24022471
    24032472    dfprintf(("<== "__FUNCTION__ ", hAdapter(0x%x)\n", hAdapter));
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