VirtualBox

Changeset 61548 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jun 7, 2016 5:01:38 PM (9 years ago)
Author:
vboxsync
Message:

3D: Get rid of deprecated gdi32!D3DKMTInvalidateActiveVidPn for Win7 and up (bugref:8244).

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

Legend:

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

    r59518 r61548  
    2020#include "VBoxMPVidPn.h"
    2121#include "common/VBoxMPCommon.h"
     22
     23
     24static NTSTATUS vboxVidPnCheckMonitorModes(PVBOXMP_DEVEXT pDevExt, uint32_t u32Target, const CR_SORTARRAY *pSupportedTargetModes = NULL);
    2225
    2326static D3DDDIFORMAT vboxWddmCalcPixelFormat(const VIDEO_MODE_INFORMATION *pInfo)
     
    658661        if (!NT_SUCCESS(Status))
    659662        {
    660             WARN(("pfnAddMode failed, Status 0x%x", Status));
     663            WARN(("pfnAddMode (%d x %d) failed, Status 0x%x", size.cx, size.cy, Status));
    661664            NTSTATUS tmpStatus = pVidPnModeSetInterface->pfnReleaseModeInfo(hVidPnModeSet, pVidPnModeInfo);
    662665            Assert(tmpStatus == STATUS_SUCCESS);
    663             return Status;
    664         }
     666            continue;
     667        }
     668
     669        LOGF(("mode (%d x %d) added to monitor modeset", size.cx, size.cy));
    665670    }
    666671
     
    882887        return Status;
    883888    }
     889   
     890    Status = vboxVidPnCheckMonitorModes(pDevExt, VidPnTargetId, &aModes[VidPnTargetId]);
     891
     892    if (!NT_SUCCESS(Status))
     893    {
     894        WARN(("vboxVidPnCheckMonitorModes failed, Status(0x%x)", Status));
     895        return Status;
     896    }
    884897
    885898    return STATUS_SUCCESS;
     
    11101123}
    11111124
    1112 static NTSTATUS vboxVidPnCheckMonitorModes(PVBOXMP_DEVEXT pDevExt, uint32_t u32Target)
     1125static NTSTATUS vboxVidPnCheckMonitorModes(PVBOXMP_DEVEXT pDevExt, uint32_t u32Target, const CR_SORTARRAY *pSupportedModes)
    11131126{
    11141127    NTSTATUS Status;
     
    11241137    CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pVidPnModeSetInterface;
    11251138
    1126     const CR_SORTARRAY *pSupportedModes = VBoxWddmVModesGet(pDevExt, u32Target);
     1139    if (!pSupportedModes)
     1140    {
     1141        pSupportedModes = VBoxWddmVModesGet(pDevExt, u32Target);
     1142    }
     1143
    11271144    CR_SORTARRAY DiffModes;
    11281145    int rc = CrSaInit(&DiffModes, CrSaGetSize(pSupportedModes));
     
    11651182        size.cy = pVidPnModeInfo->VideoSignalInfo.ActiveSize.cy;
    11661183        CrSaRemove(&DiffModes, CR_RSIZE2U64(size));
     1184        LOG(("mode (%d x %d) is already in monitor modeset\n", size.cx, size.cy));
    11671185    }
    11681186
     
    11751193        goto done;
    11761194    }
     1195
     1196    LOG(("Adding %d additional modes to monitor modeset\n", CrSaGetSize(&DiffModes)));
    11771197
    11781198    Status = vboxVidPnMonitorModeSetFromArray(hVidPnModeSet, pVidPnModeSetInterface, &DiffModes);
     
    12761296NTSTATUS VBoxVidPnUpdateModes(PVBOXMP_DEVEXT pDevExt, uint32_t u32TargetId, const RTRECTSIZE *pSize)
    12771297{
     1298    LOGF(("ENTER u32TargetId(%d) mode(%d x %d)", u32TargetId, pSize->cx, pSize->cy));
     1299
    12781300    if (u32TargetId >= (uint32_t)VBoxCommonFromDeviceExt(pDevExt)->cDisplays)
    12791301    {
     
    12831305
    12841306    int rc = VBoxWddmVModesAdd(pDevExt, u32TargetId, pSize, TRUE);
     1307    LOGF(("VBoxWddmVModesAdd returned (%d)", rc));
     1308
    12851309    if (RT_FAILURE(rc))
    12861310    {
     
    12931317        /* mode was already in list, just return */
    12941318        Assert(CrSaContains(VBoxWddmVModesGet(pDevExt, u32TargetId), CR_RSIZE2U64(*pSize)));
     1319        LOGF(("LEAVE mode was already in modeset, just return"));
    12951320        return STATUS_SUCCESS;
    12961321    }
    12971322
    12981323    /* modes have changed, need to replug */
     1324/*  The VBOXESC_UPDATEMODES is a hint for VBoxVideoW8.sys to use new display mode as soon as VidPn manager will ask for it.
     1325    Probably, some new interface is required to plug/unplug displays by calling VBoxWddmChildStatusReportReconnected.
     1326    But it is a bad idea to mix sending a display mode hint and (un)plug displays in VBOXESC_UPDATEMODES.
     1327
    12991328    NTSTATUS Status = VBoxWddmChildStatusReportReconnected(pDevExt, u32TargetId);
     1329    LOG(("VBoxWddmChildStatusReportReconnected returned (%d)", Status));
    13001330    if (!NT_SUCCESS(Status))
    13011331    {
     
    13031333        return Status;
    13041334    }
    1305 
     1335*/
     1336    LOGF(("LEAVE u32TargetId(%d)", u32TargetId));
    13061337    return STATUS_SUCCESS;
    13071338}
     
    17341765
    17351766#ifdef VBOXWDDM_DEBUG_VIDPN
    1736     vboxVidPnDumpCofuncModalityArg(">>>>MODALITY Args: ", pEnumCofuncModalityArg, "\n");
    1737     vboxVidPnDumpVidPn(">>>>MODALITY VidPN (IN) : >>>>\n", pDevExt, pEnumCofuncModalityArg->hConstrainingVidPn, pVidPnInterface, "<<<<<<<<<<<<<<<<<<<<\n");
     1767    vboxVidPnDumpCofuncModalityArg(">>>>MODALITY Args: ", enmPivot, pPivot, "\n");
     1768    vboxVidPnDumpVidPn(">>>>MODALITY VidPN (IN) : >>>>\n", pDevExt, hVidPn, pVidPnInterface, "<<<<<<<<<<<<<<<<<<<<\n");
    17381769#endif
    17391770
     
    30423073}
    30433074
    3044 void vboxVidPnDumpCofuncModalityArg(const char *pPrefix, CONST DXGKARG_ENUMVIDPNCOFUNCMODALITY* CONST  pEnumCofuncModalityArg, const char *pSuffix)
    3045 {
    3046     LOGREL_EXACT(("%sPivotType(%s), SourceId(0x%x), TargetId(0x%x),%s", pPrefix, vboxVidPnDumpStrCFMPivotType(pEnumCofuncModalityArg->EnumPivotType),
    3047             pEnumCofuncModalityArg->EnumPivot.VidPnSourceId, pEnumCofuncModalityArg->EnumPivot.VidPnTargetId, pSuffix));
     3075void vboxVidPnDumpCofuncModalityArg(const char *pPrefix, D3DKMDT_ENUMCOFUNCMODALITY_PIVOT_TYPE enmPivot, const DXGK_ENUM_PIVOT *pPivot, const char *pSuffix)
     3076{
     3077    LOGREL_EXACT(("%sPivotType(%s), SourceId(0x%x), TargetId(0x%x),%s", pPrefix, vboxVidPnDumpStrCFMPivotType(enmPivot),
     3078            pPivot->VidPnSourceId, pPivot->VidPnTargetId, pSuffix));
    30483079}
    30493080
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVidPn.h

    r52631 r61548  
    103103
    104104void vboxVidPnDumpVidPn(const char * pPrefix, PVBOXMP_DEVEXT pDevExt, D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, const char * pSuffix);
    105 void vboxVidPnDumpCofuncModalityArg(const char *pPrefix, CONST DXGKARG_ENUMVIDPNCOFUNCMODALITY* CONST  pEnumCofuncModalityArg, const char *pSuffix);
     105void vboxVidPnDumpCofuncModalityArg(const char *pPrefix, D3DKMDT_ENUMCOFUNCMODALITY_PIVOT_TYPE enmPivot, const DXGK_ENUM_PIVOT *pPivot, const char *pSuffix);
    106106DECLCALLBACK(BOOLEAN) vboxVidPnDumpSourceModeSetEnum(D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface,
    107107        const D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo, PVOID pContext);
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp

    r60012 r61548  
    50815081    }
    50825082
    5083     LOGF(("LEAVE, status(0x%x), context(0x%x)", Status, hAdapter));
     5083    LOGF(("LEAVE, isSupported(%d), context(0x%x)", pIsSupportedVidPnArg->IsVidPnSupported, hAdapter));
    50845084
    50855085    return STATUS_SUCCESS;
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDispIf.cpp

    r61530 r61548  
    13411341    }
    13421342
     1343/*  The code below was commented out because VBOXESC_UPDATEMODES should not cause (un)plugging virtual displays.
    13431344    winEr =  vboxDispIfWaitDisplayDataInited(pOp);
    13441345    if (winEr != NO_ERROR)
    13451346        WARN(("VBoxTray: (WDDM) Failed vboxDispIfWaitDisplayDataInited winEr %d\n", winEr));
    1346 
     1347*/
    13471348    return winEr;
    13481349}
     
    13791380static DWORD vboxDispIfResizePerform(PCVBOXDISPIF const pIf, UINT iChangedMode, BOOL fEnable, BOOL fExtDispSup, DISPLAY_DEVICE *paDisplayDevices, DEVMODE *paDeviceModes, UINT cDevModes)
    13801381{
     1382    LogFunc((" ENTER"));
    13811383    DWORD winEr;
     1384
    13821385    if (pIf->enmMode > VBOXDISPIF_MODE_WDDM)
    13831386    {
     
    13921395            WARN(("VBoxTray: (WDDM) Failed vboxDispIfWddmResizeDisplayVista winEr %d\n", winEr));
    13931396    }
     1397
     1398    LogFunc((" LEAVE"));
    13941399    return winEr;
    13951400}
     
    13991404    DWORD winEr = NO_ERROR;
    14001405
    1401     Log(("VBoxTray: vboxDispIfResizeModesWDDM iChanged %d cDevModes %d\n", iChangedMode, cDevModes));
     1406    Log(("VBoxTray: vboxDispIfResizeModesWDDM iChanged %d cDevModes %d fEnable %d fExtDispSup %d\n", iChangedMode, cDevModes, fEnable, fExtDispSup));
    14021407    VBoxRrRetryStop();
    14031408
     
    14301435    }
    14311436
    1432     D3DKMT_INVALIDATEACTIVEVIDPN DdiData = {0};
    1433 
    1434     DdiData.hAdapter = Op.Adapter.hAdapter;
    1435     DdiData.pPrivateDriverData = &VidPnData;
    1436     DdiData.PrivateDriverDataSize = sizeof (VidPnData);
    1437 
    1438     NTSTATUS Status = Op.pIf->modeData.wddm.KmtCallbacks.pfnD3DKMTInvalidateActiveVidPn(&DdiData);
    1439     LogFunc(("InvalidateActiveVidPn 0x%08x\n", Status));
     1437/*  The pfnD3DKMTInvalidateActiveVidPn was deprecated since Win7 and causes deadlocks since Win10 TH2.
     1438    Instead, the VidPn Manager can replace an old VidPn as soon as SetDisplayConfig or ChangeDisplaySettingsEx will try to set a new display mode.
     1439    On Vista D3DKMTInvalidateActiveVidPn is still required. TBD: Get rid of it. */ 
     1440    if (Op.pIf->enmMode < VBOXDISPIF_MODE_WDDM_W7)
     1441    {
     1442        D3DKMT_INVALIDATEACTIVEVIDPN DdiData = {0};
     1443
     1444        DdiData.hAdapter = Op.Adapter.hAdapter;
     1445        DdiData.pPrivateDriverData = &VidPnData;
     1446        DdiData.PrivateDriverDataSize = sizeof (VidPnData);
     1447
     1448        NTSTATUS Status;
     1449        Status = Op.pIf->modeData.wddm.KmtCallbacks.pfnD3DKMTInvalidateActiveVidPn(&DdiData);
     1450        LogFunc(("D3DKMTInvalidateActiveVidPn returned %d)\n", Status));
     1451    }
    14401452
    14411453    /* Resize displays always to keep the display layout because
     
    14511463            Size.cx = paDeviceModes[iChangedMode].dmPelsWidth;
    14521464            Size.cy = paDeviceModes[iChangedMode].dmPelsHeight;
     1465            LogFunc(("Calling vboxDispIfUpdateModesWDDM to change target %d mode to (%d x %d)\n", iChangedMode, Size.cx, Size.cy));
    14531466            winEr = vboxDispIfUpdateModesWDDM(&Op, iChangedMode, &Size);
     1467            LogFunc(("vboxDispIfUpdateModesWDDM returned %d\n", winEr));
     1468
    14541469            if (winEr != NO_ERROR)
    14551470                WARN(("vboxDispIfUpdateModesWDDM failed %d\n", winEr));
     
    14601475            winEr = vboxDispIfResizePerform(pIf, i, fEnable, fExtDispSup, paDisplayDevices, paDeviceModes, cDevModes);
    14611476
     1477            LogFunc(("vboxDispIfResizePerform returned %d\n", winEr));
     1478
    14621479            if (winEr == ERROR_RETRY)
    14631480            {
    14641481                VBoxRrRetrySchedule(pIf, i, fEnable, fExtDispSup, paDisplayDevices, paDeviceModes, cDevModes);
    1465                 /* just pretend everything is fine so far */
     1482
    14661483                winEr = NO_ERROR;
    14671484            }
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