Virtualbox WDDM之DxgkDdiRecommendFunctionalVidPn
2015-10-26 13:51
609 查看
The DxgkDdiRecommendFunctionalVidPn function
creates a functional VidPN that can be implemented on a specified display adapter.
https://msdn.microsoft.com/en-us/library/windows/hardware/ff559775(v=vs.85).aspx
A VidPN is functional if it satisfies the following conditions:
It has a topology that has at least one path. (A path is an association between a source and a target.)
Every source and target in the topology has a pinned mode.
The job of DxgkDdiRecommendFunctionalVidPn is to create a functional VidPN that can be implemented on the display adapter. The following list gives the steps used to create a functional VidPN.
Start with a handle to an empty VidPN object. This handle was supplied in the hDesiredVidPnmember of pRecommendFunctionalVidPnArg.
Add a path (source-target pair) to the topology of the VidPN.
Create a new source mode set and add one source mode to the set. Assign the source mode set to the source in your path. Pin the source mode.
Create a new target mode set and add one target mode to the set. Assign the target mode set to the target in your path. Pin the target mode.
creates a functional VidPN that can be implemented on a specified display adapter.
https://msdn.microsoft.com/en-us/library/windows/hardware/ff559775(v=vs.85).aspx
A VidPN is functional if it satisfies the following conditions:
It has a topology that has at least one path. (A path is an association between a source and a target.)
Every source and target in the topology has a pinned mode.
The job of DxgkDdiRecommendFunctionalVidPn is to create a functional VidPN that can be implemented on the display adapter. The following list gives the steps used to create a functional VidPN.
Start with a handle to an empty VidPN object. This handle was supplied in the hDesiredVidPnmember of pRecommendFunctionalVidPnArg.
Add a path (source-target pair) to the topology of the VidPN.
Create a new source mode set and add one source mode to the set. Assign the source mode set to the source in your path. Pin the source mode.
Create a new target mode set and add one target mode to the set. Assign the target mode set to the target in your path. Pin the target mode.
NTSTATUS APIENTRY DxgkDdiRecommendFunctionalVidPn( CONST HANDLE hAdapter, CONST DXGKARG_RECOMMENDFUNCTIONALVIDPN* CONST pRecommendFunctionalVidPnArg ) { /* The DxgkDdiRecommendFunctionalVidPn should be made pageable. */ PAGED_CODE(); dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", hAdapter)); PDEVICE_EXTENSION pContext = (PDEVICE_EXTENSION)hAdapter; const DXGK_VIDPN_INTERFACE* pVidPnInterface = NULL; <span style="white-space:pre"> </span> <span style="white-space:pre"> </span>/* 获得DXGK_VIDPN_INTERFACE,这样就能调用VidPN manger提供的接口来创建VidPN */ NTSTATUS Status = pContext->u.primary.DxgkInterface.DxgkCbQueryVidPnInterface(pRecommendFunctionalVidPnArg->hRecommendedFunctionalVidPn, DXGK_VIDPN_INTERFACE_VERSION_V1, &pVidPnInterface); if(Status == STATUS_SUCCESS) { D3DKMDT_HVIDPNTOPOLOGY hVidPnTopology; const DXGK_VIDPNTOPOLOGY_INTERFACE* pVidPnTopologyInterface; <span style="white-space:pre"> </span>/* 获得Topology网络 */ Status = pVidPnInterface->pfnGetTopology(pRecommendFunctionalVidPnArg->hRecommendedFunctionalVidPn, &hVidPnTopology, &pVidPnTopologyInterface); if(Status == STATUS_SUCCESS) { D3DKMDT_VIDPN_PRESENT_PATH *pNewVidPnPresentPathInfo; <span style="white-space:pre"> </span>/* 创建一个path */ Status = pVidPnTopologyInterface->pfnCreateNewPathInfo(hVidPnTopology, &pNewVidPnPresentPathInfo); if(Status == STATUS_SUCCESS) { pNewVidPnPresentPathInfo->VidPnSourceId = 0; pNewVidPnPresentPathInfo->VidPnTargetId = 0; pNewVidPnPresentPathInfo->ImportanceOrdinal = D3DKMDT_VPPI_PRIMARY; pNewVidPnPresentPathInfo->ContentTransformation.Scaling = D3DKMDT_VPPS_IDENTITY; memset(&pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport, 0, sizeof(pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport)); pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport.Identity = 1; pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport.Centered = 1; pNewVidPnPresentPathInfo->ContentTransformation.ScalingSupport.Stretched = 0; pNewVidPnPresentPathInfo->ContentTransformation.Rotation = D3DKMDT_VPPR_IDENTITY; pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Identity = 1; pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Rotate180 = 0; pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Rotate270 = 0; pNewVidPnPresentPathInfo->ContentTransformation.RotationSupport.Rotate90 = 0; pNewVidPnPresentPathInfo->VisibleFromActiveTLOffset.cx = 0; pNewVidPnPresentPathInfo->VisibleFromActiveTLOffset.cy = 0; pNewVidPnPresentPathInfo->VisibleFromActiveBROffset.cx = 0; pNewVidPnPresentPathInfo->VisibleFromActiveBROffset.cy = 0; pNewVidPnPresentPathInfo->VidPnTargetColorBasis = D3DKMDT_CB_SRGB; /* @todo: how does it matters? */ pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.FirstChannel = 8; pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.SecondChannel = 8; pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.ThirdChannel = 8; pNewVidPnPresentPathInfo->VidPnTargetColorCoeffDynamicRanges.FourthChannel = 0; pNewVidPnPresentPathInfo->Content = D3DKMDT_VPPC_GRAPHICS; pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionType = D3DKMDT_VPPMT_NOPROTECTION; pNewVidPnPresentPathInfo->CopyProtection.APSTriggerBits = 0; memset(&pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionSupport, 0, sizeof(pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionSupport)); pNewVidPnPresentPathInfo->CopyProtection.CopyProtectionSupport.NoProtection = 1; pNewVidPnPresentPathInfo->GammaRamp.Type = D3DDDI_GAMMARAMP_DEFAULT; pNewVidPnPresentPathInfo->GammaRamp.DataSize = 0; <span style="white-space:pre"> </span>/* topology加入path */ Status = pVidPnTopologyInterface->pfnAddPath(hVidPnTopology, pNewVidPnPresentPathInfo); if(Status == STATUS_SUCCESS) { D3DKMDT_HVIDPNSOURCEMODESET hNewVidPnSourceModeSet; const DXGK_VIDPNSOURCEMODESET_INTERFACE *pVidPnSourceModeSetInterface; <span style="white-space:pre"> </span>/* 创建SourceModeSet */ Status = pVidPnInterface->pfnCreateNewSourceModeSet(pRecommendFunctionalVidPnArg->hRecommendedFunctionalVidPn, 0, /*__in CONST D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId */ &hNewVidPnSourceModeSet, &pVidPnSourceModeSetInterface); if(Status == STATUS_SUCCESS) { D3DKMDT_VIDPN_SOURCE_MODE *pNewVidPnSourceModeInfo; <span style="white-space:pre"> </span>/* 创建一个Source Mode */ Status = pVidPnSourceModeSetInterface->pfnCreateNewModeInfo(hNewVidPnSourceModeSet, &pNewVidPnSourceModeInfo); if(Status == STATUS_SUCCESS) { D3DKMDT_VIDEO_PRESENT_SOURCE_MODE_ID modeId = pNewVidPnSourceModeInfo->Id; pNewVidPnSourceModeInfo->Type = D3DKMDT_RMT_GRAPHICS; /* @todo: should we obtain the default mode from the host? */ pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx = 1024; pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx = 768; pNewVidPnSourceModeInfo->Format.Graphics.VisibleRegionSize = pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize; pNewVidPnSourceModeInfo->Format.Graphics.Stride = pNewVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx * 4; pNewVidPnSourceModeInfo->Format.Graphics.PixelFormat = D3DDDIFMT_X8R8G8B8; pNewVidPnSourceModeInfo->Format.Graphics.ColorBasis = D3DKMDT_CB_SRGB; pNewVidPnSourceModeInfo->Format.Graphics.PixelValueAccessMode = D3DKMDT_PVAM_DIRECT; <span style="white-space:pre"> </span>/* Source Mode Set加入Source Mode */ Status = pVidPnSourceModeSetInterface->pfnAddMode(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo); if(Status == STATUS_SUCCESS) { Status = pVidPnSourceModeSetInterface->pfnPinMode(hNewVidPnSourceModeSet, modeId); if(Status == STATUS_SUCCESS) { } else { drprintf(("VBoxVideoWddm: pfnPinMode failed Status(0x%x)\n")); } } else { drprintf(("VBoxVideoWddm: pfnAddMode failed Status(0x%x)\n")); pVidPnSourceModeSetInterface->pfnReleaseModeInfo(hNewVidPnSourceModeSet, pNewVidPnSourceModeInfo); pNewVidPnSourceModeInfo = NULL; } } else { drprintf(("VBoxVideoWddm: pfnCreateNewModeInfo failed Status(0x%x)\n")); } } else { drprintf(("VBoxVideoWddm: pfnCreateNewSourceModeSet failed Status(0x%x)\n")); } } else { drprintf(("VBoxVideoWddm: pfnAddPath failed Status(0x%x)\n")); pVidPnTopologyInterface->pfnReleasePathInfo(hVidPnTopology, pNewVidPnPresentPathInfo); pNewVidPnPresentPathInfo = NULL; } } else { drprintf(("VBoxVideoWddm: pfnCreateNewPathInfo failed Status(0x%x)\n")); } } else { drprintf(("VBoxVideoWddm: pfnGetTopology failed Status(0x%x)\n")); } } else { drprintf(("VBoxVideoWddm: DxgkCbQueryVidPnInterface failed Status(0x%x)\n")); } dfprintf(("<== "__FUNCTION__ ", status(0x%x), context(0x%x)\n", Status, hAdapter)); return Status; }
相关文章推荐
- mvc jquery ajax
- android支付之银联支付
- hdoj 1012 u Calculate e
- 数据结构之排序(四)希尔排序
- hdu 4462 Scaring the Birds 回溯法
- 数据库的检查约束check约束
- Eclipse崩溃
- java.lang.NoClassDefFoundError: org/springframework/dao/support/DaoSupport:
- 机器学习(Machine Learning)&深度学习(Deep Learning)资料(Chapter 1)
- sql:查询课程号'0312091006'成绩排名第5到第10之间的学生学号
- 2015 10月26日 工作计划与执行
- 数据结构之排序(三)直接插入排序
- input标签内容改变的触发事件
- xcopy 复制了0个文件
- 获取全局变量
- input标签内容改变的触发事件
- Android 对话框【Dialog】去除白色边框代码
- UVa 12342 - Tax Calculator
- Java Servlet与Applet、CGI、JSP的比较
- 如何处理高并发情况下的DB插入