VBoxMPVidPn.cpp revision e5970f9ca60805a4507171d4d88da38e61ca5004
/* $Id$ */
/** @file
* VBox WDDM Miniport driver
*/
/*
* Copyright (C) 2011-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include "VBoxMPWddm.h"
#include "VBoxMPVidPn.h"
#include "common/VBoxMPCommon.h"
{
switch (pInfo->BitsPerPlane)
{
case 32:
if(!(pInfo->AttributeFlags & VIDEO_MODE_PALETTE_DRIVEN) && !(pInfo->AttributeFlags & VIDEO_MODE_MANAGED_PALETTE))
{
return D3DDDIFMT_A8R8G8B8;
WARN(("unsupported format: bpp(%d), rmask(%d), gmask(%d), bmask(%d)",
}
else
{
}
break;
case 24:
if(!(pInfo->AttributeFlags & VIDEO_MODE_PALETTE_DRIVEN) && !(pInfo->AttributeFlags & VIDEO_MODE_MANAGED_PALETTE))
{
return D3DDDIFMT_R8G8B8;
WARN(("unsupported format: bpp(%d), rmask(%d), gmask(%d), bmask(%d)",
}
else
{
}
break;
case 16:
if(!(pInfo->AttributeFlags & VIDEO_MODE_PALETTE_DRIVEN) && !(pInfo->AttributeFlags & VIDEO_MODE_MANAGED_PALETTE))
{
return D3DDDIFMT_R5G6B5;
WARN(("unsupported format: bpp(%d), rmask(%d), gmask(%d), bmask(%d)",
}
else
{
}
break;
case 8:
if((pInfo->AttributeFlags & VIDEO_MODE_PALETTE_DRIVEN) && (pInfo->AttributeFlags & VIDEO_MODE_MANAGED_PALETTE))
{
return D3DDDIFMT_P8;
}
else
{
}
break;
default:
break;
}
return D3DDDIFMT_UNKNOWN;
}
static int vboxWddmResolutionFind(const D3DKMDT_2DREGION *pResolutions, int cResolutions, const D3DKMDT_2DREGION *pRes)
{
for (int i = 0; i < cResolutions; ++i)
{
return i;
}
return -1;
}
static bool vboxWddmVideoModesMatch(const VIDEO_MODE_INFORMATION *pMode1, const VIDEO_MODE_INFORMATION *pMode2)
{
}
static int vboxWddmVideoModeFind(const VIDEO_MODE_INFORMATION *pModes, int cModes, const VIDEO_MODE_INFORMATION *pM)
{
for (int i = 0; i < cModes; ++i)
{
return i;
}
return -1;
}
{
/* we support both GRAPHICS and TEXT modes */
switch (pNewVidPnSourceModeInfo->Type)
{
case D3DKMDT_RMT_GRAPHICS:
/* any primary surface size actually
pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx
pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy
*/
if (pNewVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize.cx != pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx
|| pNewVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize.cy != pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy)
{
LOG(("VisibleRegionSize(%d, %d) != PrimSurfSize(%d, %d)",
bSupported = FALSE;
break;
}
/*
pNewVidPnSourceModeInfo->Format.Graphics.Stride
pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat
pNewVidPnSourceModeInfo->Format.Graphics.ColorBasis
pNewVidPnSourceModeInfo->Format.Graphics.PixelValueAccessMode
*/
break;
case D3DKMDT_RMT_TEXT:
break;
default:
break;
}
return STATUS_SUCCESS;
}
D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface,
{
NTSTATUS Status = pVidPnSourceModeSetInterface->pfnAcquireFirstModeInfo(hNewVidPnSourceModeSet, &pNewVidPnSourceModeInfo);
if (Status == STATUS_SUCCESS)
{
while (1)
{
{
Status = pVidPnSourceModeSetInterface->pfnAcquireNextModeInfo(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo, &pNextVidPnSourceModeInfo);
if (Status == STATUS_SUCCESS)
{
}
else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
{
break;
}
else
{
break;
}
}
else
{
break;
}
}
}
else if (Status == STATUS_GRAPHICS_DATASET_IS_EMPTY)
else
return Status;
}
{
return Status;
}
BOOLEAN vboxVidPnMatchVideoSignal(const D3DKMDT_VIDEO_SIGNAL_INFO *pVsi1, const D3DKMDT_VIDEO_SIGNAL_INFO *pVsi2)
{
return FALSE;
return FALSE;
return FALSE;
return FALSE;
return FALSE;
return FALSE;
return FALSE;
return FALSE;
return FALSE;
return FALSE;
return FALSE;
return TRUE;
}
{
&CmpRes,
pNewVidPnTargetModeInfo->VideoSignalInfo.VSyncFreq.Numerator/pNewVidPnTargetModeInfo->VideoSignalInfo.VSyncFreq.Denominator);
if (Status != STATUS_SUCCESS)
{
return Status;
}
{
WARN(("VideoSignalInfos do not match!!!"));
bSupported = FALSE;
}
return STATUS_SUCCESS;
}
D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet, const DXGK_VIDPNTARGETMODESET_INTERFACE *pVidPnTargetModeSetInterface,
{
NTSTATUS Status = pVidPnTargetModeSetInterface->pfnAcquireFirstModeInfo(hNewVidPnTargetModeSet, &pNewVidPnTargetModeInfo);
if (Status == STATUS_SUCCESS)
{
while (1)
{
{
Status = pVidPnTargetModeSetInterface->pfnAcquireNextModeInfo(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo, &pNextVidPnTargetModeInfo);
if (Status == STATUS_SUCCESS)
{
}
else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
{
break;
}
else
{
break;
}
}
else
{
break;
}
}
}
else if (Status == STATUS_GRAPHICS_DATASET_IS_EMPTY)
else
return Status;
}
NTSTATUS vboxVidPnPopulateSourceModeInfoFromLegacy(D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo,
{
{
/* this is a graphics mode */
pNewVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize = pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize;
{
else
}
else
{
LOGREL(("vboxWddmCalcPixelFormat failed"));
}
}
else
{
/* @todo: XPDM driver does not seem to return text modes, should we? */
LOGREL(("text mode not supported currently"));
}
return Status;
}
{
NTSTATUS Status = vboxVidPnPopulateVideoSignalInfo(&pMonitorSourceMode->VideoSignalInfo, pResolution, 60 /* ULONG VSync */);
if (Status == STATUS_SUCCESS)
{
}
return Status;
}
{
if (Status == STATUS_SUCCESS)
{
do
{
if (Status == STATUS_SUCCESS)
{
if (Status == STATUS_SUCCESS)
break;
}
else
/* we're here because of a failure */
if (tmpStatus != STATUS_SUCCESS)
} while (0);
}
else
return Status;
}
NTSTATUS vboxVidPnPopulateTargetModeInfoFromLegacy(D3DKMDT_VIDPN_TARGET_MODE *pNewVidPnTargetModeInfo, D3DKMDT_2DREGION *pResolution, BOOLEAN fPreferred)
{
return vboxVidPnPopulateVideoSignalInfo(&pNewVidPnTargetModeInfo->VideoSignalInfo, pResolution, 60 /* ULONG VSync */);
}
void VBoxVidPnStTargetCleanup(PVBOXWDDM_SOURCE paSources, uint32_t cScreens, PVBOXWDDM_TARGET pTarget)
{
return;
if (!pSource)
return;
}
void VBoxVidPnStSourceTargetAdd(PVBOXWDDM_SOURCE paSources, uint32_t cScreens, PVBOXWDDM_SOURCE pSource, PVBOXWDDM_TARGET pTarget)
{
return;
}
void VBoxVidPnStTIterInit(PVBOXWDDM_SOURCE pSource, PVBOXWDDM_TARGET paTargets, uint32_t cTargets, VBOXWDDM_TARGET_ITER *pIter)
{
pIter->i = 0;
pIter->c = 0;
}
{
return NULL;
if (i < 0)
STOP_FATAL();
pIter->c++;
}
void VBoxVidPnStSourceCleanup(PVBOXWDDM_SOURCE paSources, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, PVBOXWDDM_TARGET paTargets, uint32_t cTargets)
{
{
/* iterator is not safe wrt target removal, reinit it */
}
}
{
{
}
}
void VBoxVidPnAllocDataInit(VBOXWDDM_ALLOC_DATA *pData, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId)
{
}
void VBoxVidPnSourceInit(PVBOXWDDM_SOURCE pSource, const D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId)
{
}
void VBoxVidPnTargetInit(PVBOXWDDM_TARGET pTarget, const D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId)
{
}
{
VBoxVidPnSourceInit(&pSources[i], i);
}
{
VBoxVidPnTargetInit(&pTargets[i], i);
}
{
}
{
}
{
}
{
}
typedef struct VBOXVIDPNCHECKADDMONITORMODES
{
static DECLCALLBACK(BOOLEAN) vboxVidPnCheckAddMonitorModesEnum(PVBOXMP_DEVEXT pDevExt, D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS, CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf,
{
{
Status = vboxVidPnPopulateTargetModeInfoFromLegacy(&dummyMode, &pData->pResolutions[i], FALSE /* preference does not matter for now */);
if (Status == STATUS_SUCCESS)
{
{
/* mark it as unneeded */
break;
}
}
else
{
break;
}
}
return Status == STATUS_SUCCESS;
}
typedef struct VBOXVIDPNCHECKMONMODESENUM
{
const D3DKMDT_MONITOR_SOURCE_MODE * pMonitorSMI;
static DECLCALLBACK(BOOLEAN) vboxFidPnCheckMonitorModesEnum(D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS, CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf,
{
{
if (pInfo->pMonitorSMI)
{
}
}
else
{
}
return TRUE;
}
typedef struct VBOXVIDPNMATCHMONMODESENUM
{
static DECLCALLBACK(BOOLEAN) vboxFidPnMatchMonitorModesEnum(D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS, CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf,
{
{
{
break;
}
}
if (!fFound)
LOG(("Found non-matching mode (%d X %d)",
}
/* matches the monitor mode set for the given target id with the resolution set, and sets the pfMatch to true if they match, otherwise sets it to false */
NTSTATUS vboxVidPnMatchMonitorModes(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_TARGET_ID targetId,
{
NTSTATUS Status = pDevExt->u.primary.DxgkInterface.DxgkCbQueryMonitorInterface(pDevExt->u.primary.DxgkInterface.DeviceHandle, DXGK_MONITOR_INTERFACE_VERSION_V1, &pMonitorInterface);
if (!NT_SUCCESS(Status))
{
return Status;
}
Status = pMonitorInterface->pfnAcquireMonitorSourceModeSet(pDevExt->u.primary.DxgkInterface.DeviceHandle,
if (!NT_SUCCESS(Status))
{
{
/* this is ok in case we replug the monitor to pick up the monitor modes properly,
* so pretend success */
}
return Status;
}
/* we care only about monitor modes covering all needed resolutions,
* we do NOT care if resolutions do not cover some monitor modes */
if (NT_SUCCESS(Status))
{
if (cModes < cResolutions)
{
LOG(("num modes(%d) and resolutions(%d) do not match, treat as not matched..", cModes, cResolutions));
}
else
{
Status = vboxVidPnEnumMonitorSourceModes(hMonitorSMS, pMonitorSMSIf, vboxFidPnMatchMonitorModesEnum, &Info);
if (NT_SUCCESS(Status))
{
}
else
}
}
else
NTSTATUS tmpStatus = pMonitorInterface->pfnReleaseMonitorSourceModeSet(pDevExt->u.primary.DxgkInterface.DeviceHandle, hMonitorSMS);
if (!NT_SUCCESS(tmpStatus))
return Status;
}
{
Status = pDevExt->u.primary.DxgkInterface.DxgkCbQueryMonitorInterface(pDevExt->u.primary.DxgkInterface.DeviceHandle, DXGK_MONITOR_INTERFACE_VERSION_V1, &pMonitorInterface);
if (!NT_SUCCESS(Status))
{
return Status;
}
Status = pMonitorInterface->pfnAcquireMonitorSourceModeSet(pDevExt->u.primary.DxgkInterface.DeviceHandle,
if (!NT_SUCCESS(Status))
{
{
/* this is ok in case we replug the monitor to pick up the monitor modes properly,
* so pretend success */
}
return Status;
}
for (uint32_t i = 0; i < cResolutions; ++i)
{
pRes,
iPreferred == i
);
if (Status != STATUS_SUCCESS)
{
break;
}
}
NTSTATUS tmpStatus = pMonitorInterface->pfnReleaseMonitorSourceModeSet(pDevExt->u.primary.DxgkInterface.DeviceHandle, hMonitorSMS);
if (!NT_SUCCESS(tmpStatus))
{
}
return Status;
}
const D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, const D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId)
{
NTSTATUS Status = pVidPnInterface->pfnGetTopology(hVidPn, &hVidPnTopology, &pVidPnTopologyInterface);
if (!NT_SUCCESS(Status))
{
AssertFailed();
return Status;
}
if (!NT_SUCCESS(Status))
{
AssertFailed();
return Status;
}
pNewVidPnPresentPathInfo->VidPnTargetColorBasis = D3DKMDT_CB_SRGB; /* @todo: how does it matters? */
// pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionType = D3DKMDT_VPPMT_NOPROTECTION;
memset(&pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionSupport, 0, sizeof (pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionSupport));
// pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionSupport.NoProtection = 1;
// pNewVidPnPresentPathInfo->GammaRamp.Type = D3DDDI_GAMMARAMP_DEFAULT;
// pNewVidPnPresentPathInfo->GammaRamp.DataSize = 0;
if (!NT_SUCCESS(Status))
{
AssertFailed();
NTSTATUS tmpStatus = pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pNewVidPnPresentPathInfo);
}
return Status;
}
static NTSTATUS vboxVidPnCreatePopulateSourceModeInfoFromLegacy(D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
)
{
if (pModeIdToPin)
if (!NT_SUCCESS(Status))
{
AssertFailed();
return Status;
}
{
Status = pNewVidPnSourceModeSetInterface->pfnCreateNewModeInfo(hNewVidPnSourceModeSet, &pNewVidPnSourceModeInfo);
if (!NT_SUCCESS(Status))
{
AssertFailed();
break;
}
if (NT_SUCCESS(Status))
{
if (i == iModeToPin)
{
}
Status = pNewVidPnSourceModeSetInterface->pfnAddMode(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo);
if (NT_SUCCESS(Status))
{
/* success */
continue;
}
AssertFailed();
}
else
{
AssertFailed();
}
NTSTATUS tmpStatus = pNewVidPnSourceModeSetInterface->pfnReleaseModeInfo(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo);
/* we're here because of an error */
break;
}
if (!NT_SUCCESS(Status))
{
AssertFailed();
return Status;
}
if (sourceModeId != D3DDDI_ID_UNINITIALIZED)
{
if (pModeIdToPin)
{
}
Assert(iModeToPin >= 0);
if (fDoPin)
{
if (!NT_SUCCESS(Status))
{
AssertFailed();
return Status;
}
}
}
else
{
Assert(iModeToPin < 0);
}
if (!NT_SUCCESS(Status))
{
AssertFailed();
return Status;
}
return Status;
}
static NTSTATUS vboxVidPnCreatePopulateTargetModeInfoFromLegacy(D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
)
{
if (pModeIdToPin)
if (!NT_SUCCESS(Status))
{
AssertFailed();
return Status;
}
for (uint32_t i = 0; i < cResolutions; ++i)
{
Status = pNewVidPnTargetModeSetInterface->pfnCreateNewModeInfo(hNewVidPnTargetModeSet, &pNewVidPnTargetModeInfo);
if (!NT_SUCCESS(Status))
{
AssertFailed();
break;
}
Status = vboxVidPnPopulateTargetModeInfoFromLegacy(pNewVidPnTargetModeInfo, pResolution, fIsPinMode && fSetPreferred);
if (NT_SUCCESS(Status))
{
if (fIsPinMode)
{
}
Status = pNewVidPnTargetModeSetInterface->pfnAddMode(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo);
if (NT_SUCCESS(Status))
{
/* success */
continue;
}
AssertFailed();
}
else
{
AssertFailed();
}
NTSTATUS tmpStatus = pNewVidPnTargetModeSetInterface->pfnReleaseModeInfo(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo);
/* we're here because of an error */
break;
}
if (!NT_SUCCESS(Status))
{
AssertFailed();
return Status;
}
if (targetModeId != D3DDDI_ID_UNINITIALIZED)
{
if (pModeIdToPin)
{
}
if (fDoPin)
{
if (!NT_SUCCESS(Status))
{
AssertFailed();
return Status;
}
}
}
else
{
Assert(!pModeToPin);
}
if (!NT_SUCCESS(Status))
{
AssertFailed();
return Status;
}
return Status;
}
NTSTATUS vboxVidPnCreatePopulateVidPnPathFromLegacy(PVBOXMP_DEVEXT pDevExt, D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
const D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, const D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId)
{
#if 0
if (!NT_SUCCESS(Status))
{
AssertFailed();
return Status;
}
#endif
Status = vboxVidPnCreatePopulateTargetModeInfoFromLegacy(hVidPn, pVidPnInterface, VidPnTargetId, pResolutions, cResolutions, pModeToPin, NULL, TRUE, TRUE);
if (!NT_SUCCESS(Status))
{
AssertFailed();
return Status;
}
Status = vboxVidPnCreatePopulateSourceModeInfoFromLegacy(hVidPn, pVidPnInterface, VidPnSourceId, pModes, cModes, iModeToPin, NULL, TRUE);
if (!NT_SUCCESS(Status))
{
AssertFailed();
return Status;
}
return Status;
}
typedef struct VBOXVIDPNPOPRESOLUTIONENUM
{
int cResolutions;
int cResultResolutions;
static DECLCALLBACK(BOOLEAN) vboxVidPnPopulateResolutionsFromSourceModeSetEnum(D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface,
{
if (vboxWddmResolutionFind(pInfo->pResolutions, pInfo->cResultResolutions, &pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize) < 0)
{
{
pInfo->pResolutions[pInfo->cResultResolutions] = pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize;
}
else
{
}
}
return Status == STATUS_SUCCESS;
}
static DECLCALLBACK(BOOLEAN) vboxVidPnPopulateResolutionsFromTargetModeSetEnum(D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet, const DXGK_VIDPNTARGETMODESET_INTERFACE *pVidPnTargetModeSetInterface,
{
if (vboxWddmResolutionFind(pInfo->pResolutions, pInfo->cResultResolutions, &pNewVidPnTargetModeInfo->VideoSignalInfo.ActiveSize) < 0)
{
{
pInfo->pResolutions[pInfo->cResultResolutions] = pNewVidPnTargetModeInfo->VideoSignalInfo.ActiveSize;
}
else
{
}
}
return Status == STATUS_SUCCESS;
}
typedef struct VBOXVIDPNPOPMODEENUM
{
int cModes;
int cResultModes;
static DECLCALLBACK(BOOLEAN) vboxVidPnPopulateModesFromSourceModeSetEnum(D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface,
{
{
{
{
++pInfo->cResultModes;
}
else
{
}
}
}
else
{
Assert(0);
}
return Status == STATUS_SUCCESS;
}
typedef struct VBOXVIDPNPOPMODETARGETENUM
{
int cSuperset;
static DECLCALLBACK(BOOLEAN) vboxVidPnPopulateModesFromTargetModeSetEnum(D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet, const DXGK_VIDPNTARGETMODESET_INTERFACE *pVidPnTargetModeSetInterface,
{
Status = VBoxWddmGetModesForResolution(pInfo->pSuperset, pInfo->cSuperset, -1, &pNewVidPnTargetModeInfo->VideoSignalInfo.ActiveSize,
pInfo->Base.pModes + pInfo->Base.cResultModes, pInfo->Base.cModes - pInfo->Base.cResultModes, &cResult, NULL);
if (Status == STATUS_SUCCESS)
{
}
return Status == STATUS_SUCCESS;
}
static D3DKMDT_ENUMCOFUNCMODALITY_PIVOT_TYPE vboxVidPnCofuncModalityCurrentPathPivot(CONST DXGKARG_ENUMVIDPNCOFUNCMODALITY* pEnumCofuncModalityArg,
{
switch (pEnumCofuncModalityArg->EnumPivotType)
{
case D3DKMDT_EPT_VIDPNSOURCE:
return D3DKMDT_EPT_VIDPNSOURCE;
{
#ifdef DEBUG_misha
AssertFailed();
#endif
return D3DKMDT_EPT_VIDPNSOURCE;
}
return D3DKMDT_EPT_NOPIVOT;
case D3DKMDT_EPT_VIDPNTARGET:
return D3DKMDT_EPT_VIDPNTARGET;
{
#ifdef DEBUG_misha
AssertFailed();
#endif
return D3DKMDT_EPT_VIDPNTARGET;
}
return D3DKMDT_EPT_NOPIVOT;
case D3DKMDT_EPT_SCALING:
case D3DKMDT_EPT_ROTATION:
case D3DKMDT_EPT_NOPIVOT:
return D3DKMDT_EPT_NOPIVOT;
default:
AssertFailed();
return D3DKMDT_EPT_NOPIVOT;
}
}
NTSTATUS vboxVidPnHasPinnedTargetMode(D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
{
if (!NT_SUCCESS(Status))
{
AssertFailed();
return Status;
}
Status = pCurVidPnTargetModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnTargetModeSet, &pPinnedVidPnTargetModeInfo);
{
}
else if (!NT_SUCCESS(Status))
{
AssertFailed();
}
else
{
NTSTATUS tmpStatus = pCurVidPnTargetModeSetInterface->pfnReleaseModeInfo(hCurVidPnTargetModeSet, pPinnedVidPnTargetModeInfo);
}
return Status;
}
NTSTATUS vboxVidPnHasPinnedSourceMode(D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
{
if (!NT_SUCCESS(Status))
{
AssertFailed();
return Status;
}
Status = pCurVidPnSourceModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnSourceModeSet, &pPinnedVidPnSourceModeInfo);
{
}
else if (!NT_SUCCESS(Status))
{
AssertFailed();
}
else
{
NTSTATUS tmpStatus = pCurVidPnSourceModeSetInterface->pfnReleaseModeInfo(hCurVidPnSourceModeSet, pPinnedVidPnSourceModeInfo);
}
return Status;
}
{
if (!NT_SUCCESS(Status))
{
AssertFailed();
return Status;
}
Status = pCurVidPnSourceModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnSourceModeSet, &pPinnedVidPnSourceModeInfo);
{
}
else if (!NT_SUCCESS(Status))
{
AssertFailed();
}
else
{
}
if (NT_SUCCESS(Status))
{
if (NT_SUCCESS(Status))
{
// if (VidPnSourceId == VidPnTargetId && pCbContext->apPathInfos[VidPnTargetId].enmState == VBOXVIDPNPATHITEM_STATE_PRESENT)
{
{
{
{
continue;
}
}
Status = pNewVidPnTargetModeSetInterface->pfnCreateNewModeInfo(hNewVidPnTargetModeSet, &pNewVidPnTargetModeInfo);
if (NT_SUCCESS(Status))
{
Status = vboxVidPnPopulateTargetModeInfoFromLegacy(pNewVidPnTargetModeInfo, pResolution, i == pInfo->iPreferredResolution);
if (NT_SUCCESS(Status))
{
Status = pNewVidPnTargetModeSetInterface->pfnAddMode(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo);
if (NT_SUCCESS(Status))
{
/* success */
continue;
}
else
}
else
NTSTATUS tmpStatus = pNewVidPnTargetModeSetInterface->pfnReleaseModeInfo(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo);
}
/* we're here because of an error */
/* ignore mode addition failure */
continue;
}
}
}
else
{
AssertFailed();
}
}
else
{
AssertFailed();
}
{
NTSTATUS tmpStatus = pCurVidPnSourceModeSetInterface->pfnReleaseModeInfo(hCurVidPnSourceModeSet, pPinnedVidPnSourceModeInfo);
}
if (NT_SUCCESS(Status))
{
if (!NT_SUCCESS(Status))
{
}
}
return Status;
}
{
if (!NT_SUCCESS(Status))
{
AssertFailed();
return Status;
}
Status = pCurVidPnTargetModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnTargetModeSet, &pPinnedVidPnTargetModeInfo);
{
}
else if (!NT_SUCCESS(Status))
{
AssertFailed();
}
else
{
}
if (NT_SUCCESS(Status))
{
if (NT_SUCCESS(Status))
{
// if (VidPnSourceId == VidPnTargetId && pCbContext->apPathInfos[VidPnSourceId].enmState == VBOXVIDPNPATHITEM_STATE_PRESENT)
{
{
{
{
continue;
}
}
Status = pNewVidPnSourceModeSetInterface->pfnCreateNewModeInfo(hNewVidPnSourceModeSet, &pNewVidPnSourceModeInfo);
if (NT_SUCCESS(Status))
{
if (NT_SUCCESS(Status))
{
Status = pNewVidPnSourceModeSetInterface->pfnAddMode(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo);
if (NT_SUCCESS(Status))
{
/* success */
continue;
}
else
}
NTSTATUS tmpStatus = pNewVidPnSourceModeSetInterface->pfnReleaseModeInfo(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo);
}
else
/* we're here because of an error */
/* ignore mode addition failure */
continue;
}
}
}
else
{
AssertFailed();
}
}
else
{
AssertFailed();
}
{
NTSTATUS tmpStatus = pCurVidPnTargetModeSetInterface->pfnReleaseModeInfo(hCurVidPnTargetModeSet, pPinnedVidPnTargetModeInfo);
}
if (NT_SUCCESS(Status))
{
if (!NT_SUCCESS(Status))
{
}
}
return Status;
}
{
D3DKMDT_ENUMCOFUNCMODALITY_PIVOT_TYPE enmPivot = vboxVidPnCofuncModalityCurrentPathPivot(pCbContext->pEnumCofuncModalityArg, VidPnSourceId, VidPnTargetId);
if (!NT_SUCCESS(Status))
{
AssertFailed();
return Status;
}
if (fNeedUpdate)
{
}
if (NT_SUCCESS(Status))
{
if (!NT_SUCCESS(Status))
{
AssertFailed();
return Status;
}
if (fNeedUpdate)
{
}
}
return Status;
}
DECLCALLBACK(BOOLEAN) vboxVidPnCofuncModalityPathEnum(D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
{
bool bUpdatePath = false;
{
bUpdatePath = true;
}
{
bUpdatePath = true;
}
if (bUpdatePath)
{
}
Status = vboxVidPnCofuncModalityForPath(pCbContext, pNewVidPnPresentPathInfo->VidPnSourceId, pNewVidPnPresentPathInfo->VidPnTargetId);
return Status == STATUS_SUCCESS;
}
static BOOLEAN vboxVidPnIsPathSupported(PVBOXMP_DEVEXT pDevExt, const D3DKMDT_VIDPN_PRESENT_PATH *pNewVidPnPresentPathInfo)
{
if (!pDevExt->fComplexTopologiesEnabled && pNewVidPnPresentPathInfo->VidPnSourceId != pNewVidPnPresentPathInfo->VidPnTargetId)
{
LOG(("unsupported source(%d)->target(%d) pair", pNewVidPnPresentPathInfo->VidPnSourceId, pNewVidPnPresentPathInfo->VidPnTargetId));
return FALSE;
}
/*
ImportanceOrdinal does not matter for now
pNewVidPnPresentPathInfo->ImportanceOrdinal
*/
{
return FALSE;
}
{
WARN(("unsupported Scaling support"));
return FALSE;
}
{
return FALSE;
}
{
WARN(("unsupported RotationSupport"));
return FALSE;
}
{
WARN(("Non-zero TLOffset: cx(%d), cy(%d)",
return FALSE;
}
{
WARN(("Non-zero TLOffset: cx(%d), cy(%d)",
return FALSE;
}
{
return FALSE;
}
/* channels?
pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.FirstChannel;
pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.SecondChannel;
pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.ThirdChannel;
we definitely not support fourth channel
*/
{
WARN(("Non-zero FourthChannel (%d)", pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.FourthChannel));
return FALSE;
}
/* Content (D3DKMDT_VPPC_GRAPHICS, _NOTSPECIFIED, _VIDEO), does not matter for now
pNewVidPnPresentPathInfo->Content
*/
/* not support copy protection for now */
{
WARN(("Copy protection not supported CopyProtectionType(%d)", pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionType));
return FALSE;
}
{
WARN(("Copy protection not supported APSTriggerBits(%d)", pNewVidPnPresentPathInfo->CopyProtection.APSTriggerBits));
return FALSE;
}
if (memcmp(&tstCPSupport, &pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionSupport, sizeof(tstCPSupport)))
{
WARN(("Copy protection support (0x%x)", *((UINT*)&pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionSupport)));
return FALSE;
}
{
return FALSE;
}
{
WARN(("Warning: non-zero GammaRamp.DataSize (%d), treating as supported", pNewVidPnPresentPathInfo->GammaRamp.DataSize));
}
return TRUE;
}
typedef struct VBOXVIDPNGETPATHSINFO
{
static DECLCALLBACK(BOOLEAN) vboxVidPnCheckTopologyEnum(D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
{
if (!NT_SUCCESS(Status))
return FALSE; /* do not continue on failure */
}
/* we currently support only 0 -> 0, 1 -> 1, 2 -> 2 paths, AND 0 -> 0 must be present
* this routine disables all paths unsupported */
NTSTATUS VBoxVidPnCheckTopology(PVBOXMP_DEVEXT pDevExt, D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface, BOOLEAN *pfSupported)
{
VBOXVIDPNGETPATHSINFO CbContext = {0};
NTSTATUS Status = vboxVidPnEnumPaths(hVidPnTopology, pVidPnTopologyInterface, vboxVidPnCheckTopologyEnum, &CbContext);
if (!NT_SUCCESS(Status))
{
return Status;
}
if (!NT_SUCCESS(Status))
{
return Status;
}
/* now check if 0->0 path is present and enabled, and if not, disable everything */
// if (cItems && aItems[0].enmState != VBOXVIDPNPATHITEM_STATE_PRESENT)
// {
// LOG(("path 0 not set to present\n"));
//// for (i = 0; i < cItems; ++i)
//// {
//// if (aItems[i].enmState == VBOXVIDPNPATHITEM_STATE_PRESENT)
//// aItems[i].enmState = VBOXVIDPNPATHITEM_STATE_DISABLED;
//// }
// fSupported = FALSE;
// }
if (pfSupported)
return Status;
}
NTSTATUS vboxVidPnEnumMonitorSourceModes(D3DKMDT_HMONITORSOURCEMODESET hMonitorSMS, CONST DXGK_MONITORSOURCEMODESET_INTERFACE *pMonitorSMSIf,
{
if (Status == STATUS_SUCCESS)
{
while (1)
{
{
if (Status == STATUS_SUCCESS)
else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
{
break;
}
else
{
LOGREL(("pfnAcquireNextModeInfo Failed Status(0x%x), ignored since callback returned false", Status));
}
break;
}
else if (Status == STATUS_SUCCESS)
else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
{
break;
}
else
{
break;
}
}
}
else if (Status == STATUS_GRAPHICS_DATASET_IS_EMPTY)
else
return Status;
}
NTSTATUS vboxVidPnEnumSourceModes(D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface,
{
NTSTATUS Status = pVidPnSourceModeSetInterface->pfnAcquireFirstModeInfo(hNewVidPnSourceModeSet, &pNewVidPnSourceModeInfo);
if (Status == STATUS_SUCCESS)
{
while (1)
{
Status = pVidPnSourceModeSetInterface->pfnAcquireNextModeInfo(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo, &pNextVidPnSourceModeInfo);
{
if (Status == STATUS_SUCCESS)
else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
{
break;
}
else
{
LOGREL(("pfnAcquireNextModeInfo Failed Status(0x%x), ignored since callback returned false", Status));
}
break;
}
else if (Status == STATUS_SUCCESS)
else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
{
break;
}
else
{
break;
}
}
}
else if (Status == STATUS_GRAPHICS_DATASET_IS_EMPTY)
else
return Status;
}
NTSTATUS vboxVidPnEnumTargetModes(D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet, const DXGK_VIDPNTARGETMODESET_INTERFACE *pVidPnTargetModeSetInterface,
{
NTSTATUS Status = pVidPnTargetModeSetInterface->pfnAcquireFirstModeInfo(hNewVidPnTargetModeSet, &pNewVidPnTargetModeInfo);
if (Status == STATUS_SUCCESS)
{
while (1)
{
Status = pVidPnTargetModeSetInterface->pfnAcquireNextModeInfo(hNewVidPnTargetModeSet, pNewVidPnTargetModeInfo, &pNextVidPnTargetModeInfo);
{
if (Status == STATUS_SUCCESS)
else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
{
break;
}
else
{
LOGREL(("pfnAcquireNextModeInfo Failed Status(0x%x), ignored since callback returned false", Status));
}
break;
}
else if (Status == STATUS_SUCCESS)
else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
{
break;
}
else
{
break;
}
}
}
else if (Status == STATUS_GRAPHICS_DATASET_IS_EMPTY)
else
return Status;
}
NTSTATUS vboxVidPnEnumTargetsForSource(PVBOXMP_DEVEXT pDevExt, D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
{
NTSTATUS Status = pVidPnTopologyInterface->pfnGetNumPathsFromSource(hVidPnTopology, VidPnSourceId, &cTgtPaths);
if (Status == STATUS_SUCCESS)
{
{
Status = pVidPnTopologyInterface->pfnEnumPathTargetsFromSource(hVidPnTopology, VidPnSourceId, i, &VidPnTargetId);
if (Status == STATUS_SUCCESS)
{
if (!pfnCallback(pDevExt, hVidPnTopology, pVidPnTopologyInterface, VidPnSourceId, VidPnTargetId, cTgtPaths, pContext))
break;
}
else
{
break;
}
}
}
else if (Status != STATUS_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY)
return Status;
}
NTSTATUS vboxVidPnEnumPaths(D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
{
NTSTATUS Status = pVidPnTopologyInterface->pfnAcquireFirstPathInfo(hVidPnTopology, &pNewVidPnPresentPathInfo);
if (Status == STATUS_SUCCESS)
{
while (1)
{
Status = pVidPnTopologyInterface->pfnAcquireNextPathInfo(hVidPnTopology, pNewVidPnPresentPathInfo, &pNextVidPnPresentPathInfo);
{
if (Status == STATUS_SUCCESS)
else
{
WARN(("pfnAcquireNextPathInfo Failed Status(0x%x), ignored since callback returned false", Status));
}
break;
}
else if (Status == STATUS_SUCCESS)
else if (Status == STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
{
break;
}
else
{
break;
}
}
}
else if (Status == STATUS_GRAPHICS_DATASET_IS_EMPTY)
else
return Status;
}
NTSTATUS vboxVidPnSetupSourceInfo(PVBOXMP_DEVEXT pDevExt, CONST D3DKMDT_VIDPN_SOURCE_MODE* pVidPnSourceModeInfo, PVBOXWDDM_ALLOCATION pAllocation,
{
/* pVidPnSourceModeInfo could be null if STATUS_GRAPHICS_MODE_NOT_PINNED,
* see VBoxVidPnCommitSourceModeForSrcId */
if (pVidPnSourceModeInfo)
{
{
}
{
}
{
}
if (pSource->AllocData.SurfDesc.bpp != vboxWddmCalcBitsPerPixel(pVidPnSourceModeInfo->Format.Graphics.PixelFormat))
{
pSource->AllocData.SurfDesc.bpp = vboxWddmCalcBitsPerPixel(pVidPnSourceModeInfo->Format.Graphics.PixelFormat);
}
{
}
{
}
if (pSource->AllocData.SurfDesc.cbSize != pVidPnSourceModeInfo->Format.Graphics.Stride * pVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy)
{
pSource->AllocData.SurfDesc.cbSize = pVidPnSourceModeInfo->Format.Graphics.Stride * pVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy;
}
#ifdef VBOX_WDDM_WIN8
if (g_VBoxDisplayOnly)
{
}
#endif
}
else
{
}
return STATUS_SUCCESS;
}
NTSTATUS vboxVidPnCommitSourceMode(PVBOXMP_DEVEXT pDevExt, CONST D3DKMDT_VIDPN_SOURCE_MODE* pVidPnSourceModeInfo, PVBOXWDDM_ALLOCATION pAllocation,
{
return vboxVidPnSetupSourceInfo(pDevExt, pVidPnSourceModeInfo, pAllocation, VidPnSourceId, paSources);
WARN(("invalid srcId (%d), cSources(%d)", VidPnSourceId, VBoxCommonFromDeviceExt(pDevExt)->cDisplays));
return STATUS_INVALID_PARAMETER;
}
typedef struct VBOXVIDPNCOMMITTARGETMODE
{
const DXGK_VIDPN_INTERFACE* pVidPnInterface;
DECLCALLBACK(BOOLEAN) vboxVidPnCommitTargetModeEnum(PVBOXMP_DEVEXT pDevExt, D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
CONST D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId, SIZE_T cTgtPaths, PVOID pContext)
{
NTSTATUS Status = pInfo->pVidPnInterface->pfnAcquireTargetModeSet(pInfo->hVidPn, VidPnTargetId, &hVidPnTargetModeSet, &pVidPnTargetModeSetInterface);
if (Status == STATUS_SUCCESS)
{
Status = pVidPnTargetModeSetInterface->pfnAcquirePinnedModeInfo(hVidPnTargetModeSet, &pPinnedVidPnTargetModeInfo);
if (Status == STATUS_SUCCESS)
{
VBoxVidPnStSourceTargetAdd(pInfo->paSources, VBoxCommonFromDeviceExt(pDevExt)->cDisplays, pSource, pTarget);
}
else
}
else
return Status == STATUS_SUCCESS;
}
NTSTATUS VBoxVidPnCommitSourceModeForSrcId(PVBOXMP_DEVEXT pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, VBOXWDDM_SOURCE *paSources, VBOXWDDM_TARGET *paTargets)
{
VBoxVidPnStTIterInit(pSource, paTargets, (uint32_t)VBoxCommonFromDeviceExt(pDevExt)->cDisplays, &Iter);
{
}
VBoxVidPnStSourceCleanup(paSources, VidPnSourceId, paTargets, (uint32_t)VBoxCommonFromDeviceExt(pDevExt)->cDisplays);
if (Status == STATUS_SUCCESS)
{
Status = pCurVidPnSourceModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnSourceModeSet, &pPinnedVidPnSourceModeInfo);
if (Status == STATUS_SUCCESS)
{
Status = vboxVidPnCommitSourceMode(pDevExt, pPinnedVidPnSourceModeInfo, pAllocation, VidPnSourceId, paSources);
if (Status == STATUS_SUCCESS)
{
if (Status == STATUS_SUCCESS)
{
if (Status == STATUS_SUCCESS)
{
}
else if (Status == STATUS_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY)
{
}
else
}
else
}
else
/* release */
pCurVidPnSourceModeSetInterface->pfnReleaseModeInfo(hCurVidPnSourceModeSet, pPinnedVidPnSourceModeInfo);
}
else if (Status == STATUS_GRAPHICS_MODE_NOT_PINNED)
{
}
else
}
else
{
}
return Status;
}
typedef struct VBOXVIDPNCOMMIT
{
const DXGK_VIDPN_INTERFACE* pVidPnInterface;
DECLCALLBACK(BOOLEAN) vboxVidPnCommitPathEnum(D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
{
Status = VBoxVidPnCommitSourceModeForSrcId(pDevExt, hDesiredVidPn, pVidPnInterface, pCommitInfo->pAllocation,
if (Status != STATUS_SUCCESS)
return Status == STATUS_SUCCESS;
}
NTSTATUS VBoxVidPnCommitAll(PVBOXMP_DEVEXT pDevExt, const D3DKMDT_HVIDPN hDesiredVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface,
{
NTSTATUS Status = pVidPnInterface->pfnGetTopology(hDesiredVidPn, &hVidPnTopology, &pVidPnTopologyInterface);
if (!NT_SUCCESS(Status))
{
return Status;
}
{
continue;
Assert(pTarget->VidPnSourceId < (D3DDDI_VIDEO_PRESENT_SOURCE_ID)VBoxCommonFromDeviceExt(pDevExt)->cDisplays);
}
if (!NT_SUCCESS(Status))
{
return Status;
}
if (!NT_SUCCESS(Status))
{
return Status;
}
return Status;
}
#define VBOXVIDPNDUMP_STRCASE(_t) \
#define VBOXVIDPNDUMP_STRCASE_UNKNOWN() \
default: Assert(0); return "Unknown";
{
switch (ImportanceOrdinal)
{
}
}
{
switch (Scaling)
{
}
}
{
switch (Rotation)
{
}
}
{
switch (ColorBasis)
{
}
}
{
switch (PixelValueAccessMode)
{
}
}
{
switch (Content)
{
}
}
const char* vboxVidPnDumpStrCopyProtectionType(D3DKMDT_VIDPN_PRESENT_PATH_COPYPROTECTION_TYPE CopyProtectionType)
{
switch (CopyProtectionType)
{
}
}
{
switch (Type)
{
}
}
{
switch (Type)
{
}
}
const char* vboxVidPnDumpStrScanLineOrdering(D3DDDI_VIDEO_SIGNAL_SCANLINE_ORDERING ScanLineOrdering)
{
switch (ScanLineOrdering)
{
}
}
{
switch (EnumPivotType)
{
}
}
{
switch (Preference)
{
}
}
{
switch (VideoStandard)
{
}
}
{
switch (PixelFormat)
{
}
}
void vboxVidPnDumpCopyProtectoin(const char *pPrefix, const D3DKMDT_VIDPN_PRESENT_PATH_COPYPROTECTION *pCopyProtection, const char *pSuffix)
{
}
void vboxVidPnDumpPathTransformation(const D3DKMDT_VIDPN_PRESENT_PATH_TRANSFORMATION *pContentTransformation)
{
LOGREL_EXACT((" --Transformation: Scaling(%s), ScalingSupport(%d), Rotation(%s), RotationSupport(%d)--",
vboxVidPnDumpStrRotation(pContentTransformation->Rotation), pContentTransformation->RotationSupport));
}
{
}
void vboxVidPnDumpRational(const char *pPrefix, const D3DDDI_RATIONAL *pRational, const char *pSuffix)
{
LOGREL_EXACT(("%s%d/%d=%d%s", pPrefix, pRational->Numerator, pRational->Denominator, pRational->Numerator/pRational->Denominator, pSuffix));
}
void vboxVidPnDumpRanges(const char *pPrefix, const D3DKMDT_COLOR_COEFF_DYNAMIC_RANGES *pDynamicRanges, const char *pSuffix)
{
LOGREL_EXACT(("%sFirstChannel(%d), SecondChannel(%d), ThirdChannel(%d), FourthChannel(%d)%s", pPrefix,
pSuffix));
}
void vboxVidPnDumpGammaRamp(const char *pPrefix, const D3DKMDT_GAMMA_RAMP *pGammaRamp, const char *pSuffix)
{
pSuffix));
}
void vboxVidPnDumpSourceMode(const char *pPrefix, const D3DKMDT_VIDPN_SOURCE_MODE* pVidPnSourceModeInfo, const char *pSuffix)
{
LOGREL_EXACT(("%sType(%s), ", pPrefix, vboxVidPnDumpStrSourceModeType(pVidPnSourceModeInfo->Type)));
LOGREL_EXACT(("format(%s), ", vboxVidPnDumpStrPixFormat(pVidPnSourceModeInfo->Format.Graphics.PixelFormat)));
LOGREL_EXACT(("clrBasis(%s), ", vboxVidPnDumpStrColorBasis(pVidPnSourceModeInfo->Format.Graphics.ColorBasis)));
LOGREL_EXACT(("pvam(%s)%s", vboxVidPnDumpStrPvam(pVidPnSourceModeInfo->Format.Graphics.PixelValueAccessMode), pSuffix));
}
void vboxVidPnDumpSignalInfo(const char *pPrefix, const D3DKMDT_VIDEO_SIGNAL_INFO *pVideoSignalInfo, const char *pSuffix)
{
LOGREL_EXACT(("%sVStd(%s), ", pPrefix, vboxVidPnDumpStrSignalStandard(pVideoSignalInfo->VideoStandard)));
LOGREL_EXACT(("PixelRate(%d), ScanLineOrdering(%s)%s", pVideoSignalInfo->PixelRate, vboxVidPnDumpStrScanLineOrdering(pVideoSignalInfo->ScanLineOrdering), pSuffix));
}
void vboxVidPnDumpTargetMode(const char *pPrefix, const D3DKMDT_VIDPN_TARGET_MODE* CONST pVidPnTargetModeInfo, const char *pSuffix)
{
LOGREL_EXACT(("Preference(%s)%s", vboxVidPnDumpStrModePreference(pVidPnTargetModeInfo->Preference), pSuffix));
}
void vboxVidPnDumpPinnedSourceMode(const D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId)
{
if (Status == STATUS_SUCCESS)
{
Status = pCurVidPnSourceModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnSourceModeSet, &pPinnedVidPnSourceModeInfo);
if (Status == STATUS_SUCCESS)
{
pCurVidPnSourceModeSetInterface->pfnReleaseModeInfo(hCurVidPnSourceModeSet, pPinnedVidPnSourceModeInfo);
}
else if (Status == STATUS_GRAPHICS_MODE_NOT_PINNED)
{
LOGREL_EXACT(("Source NOT Pinned\n"));
}
else
{
}
}
else
{
}
}
DECLCALLBACK(BOOLEAN) vboxVidPnDumpSourceModeSetEnum(D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet, const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface,
{
return TRUE;
}
void vboxVidPnDumpSourceModeSet(PVBOXMP_DEVEXT pDevExt, const D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId)
{
if (Status == STATUS_SUCCESS)
{
if (Status != STATUS_SUCCESS)
{
}
}
else
{
LOGREL_EXACT(("ERROR getting SourceModeSet for Source(%d), Status(0x%x)\n", VidPnSourceId, Status));
}
}
DECLCALLBACK(BOOLEAN) vboxVidPnDumpTargetModeSetEnum(D3DKMDT_HVIDPNTARGETMODESET hNewVidPnTargetModeSet, const DXGK_VIDPNTARGETMODESET_INTERFACE *pVidPnTargetModeSetInterface,
{
return TRUE;
}
void vboxVidPnDumpTargetModeSet(PVBOXMP_DEVEXT pDevExt, const D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId)
{
if (Status == STATUS_SUCCESS)
{
if (Status != STATUS_SUCCESS)
{
}
}
else
{
LOGREL_EXACT(("ERROR getting TargetModeSet for Target(%d), Status(0x%x)\n", VidPnTargetId, Status));
}
}
void vboxVidPnDumpPinnedTargetMode(const D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId)
{
if (Status == STATUS_SUCCESS)
{
Status = pCurVidPnTargetModeSetInterface->pfnAcquirePinnedModeInfo(hCurVidPnTargetModeSet, &pPinnedVidPnTargetModeInfo);
if (Status == STATUS_SUCCESS)
{
pCurVidPnTargetModeSetInterface->pfnReleaseModeInfo(hCurVidPnTargetModeSet, pPinnedVidPnTargetModeInfo);
}
else if (Status == STATUS_GRAPHICS_MODE_NOT_PINNED)
{
LOGREL_EXACT(("Target NOT Pinned\n"));
}
else
{
}
}
else
{
}
}
void vboxVidPnDumpCofuncModalityArg(const char *pPrefix, CONST DXGKARG_ENUMVIDPNCOFUNCMODALITY* CONST pEnumCofuncModalityArg, const char *pSuffix)
{
LOGREL_EXACT(("%sPivotType(%s), SourceId(0x%x), TargetId(0x%x),%s", pPrefix, vboxVidPnDumpStrCFMPivotType(pEnumCofuncModalityArg->EnumPivotType),
pEnumCofuncModalityArg->EnumPivot.VidPnSourceId, pEnumCofuncModalityArg->EnumPivot.VidPnTargetId, pSuffix));
}
void vboxVidPnDumpPath(const D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, const D3DKMDT_VIDPN_PRESENT_PATH *pVidPnPresentPathInfo)
{
LOGREL_EXACT((" >>**** Start Dump VidPn Path ****>>\n"));
LOGREL_EXACT(("VidPnSourceId(%d), VidPnTargetId(%d)\n",
LOGREL_EXACT(("Importance(%s), TargetColorBasis(%s), Content(%s), ",
vboxVidPnDumpRanges("CCDynamicRanges: ", &pVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges, "| ");
LOGREL_EXACT((" <<**** Stop Dump VidPn Path ****<<"));
}
typedef struct VBOXVIDPNDUMPPATHENUM
{
const DXGK_VIDPN_INTERFACE* pVidPnInterface;
static DECLCALLBACK(BOOLEAN) vboxVidPnDumpPathEnum(D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology, const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface,
{
return TRUE;
}
void vboxVidPnDumpVidPn(const char * pPrefix, PVBOXMP_DEVEXT pDevExt, D3DKMDT_HVIDPN hVidPn, const DXGK_VIDPN_INTERFACE* pVidPnInterface, const char * pSuffix)
{
NTSTATUS Status = pVidPnInterface->pfnGetTopology(hVidPn, &hVidPnTopology, &pVidPnTopologyInterface);
if (Status == STATUS_SUCCESS)
{
}
{
}
}