您的位置:首页 > 产品设计 > UI/UE

Virtualbox WDDM之DxgkDdiQueryAdapterInfo

2015-10-27 11:31 1336 查看
/*
The DxgkDdiQueryAdapterInfo function retrieves configuration information from the graphics adapter.
用户层驱动获取CAPS,DXGKQAITYPE_UMDRIVERPRIVATE 
DX驱动获取CAPS,<span style="white-space:pre">	</span>   DXGKQAITYPE_DRIVERCAPS 

DX驱动获取内存段,<span style="white-space:pre">	</span>   DXGKQAITYPE_QUERYSEGMENT 
Memory segments, in the context of the display driver model for Windows Vista and later (WDDM), describe the graphics processing unit's (GPU) address space to the video memory manager.
*/
NTSTATUS APIENTRY DxgkDdiQueryAdapterInfo(
CONST HANDLE  hAdapter,
CONST DXGKARG_QUERYADAPTERINFO*  pQueryAdapterInfo)
{
/* The DxgkDdiQueryAdapterInfo should be made pageable. */
PAGED_CODE();

dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", hAdapter));
NTSTATUS Status = STATUS_SUCCESS;
PDEVICE_EXTENSION pContext = (PDEVICE_EXTENSION)hAdapter;

switch (pQueryAdapterInfo->Type)
{
case DXGKQAITYPE_DRIVERCAPS:
{
DXGK_DRIVERCAPS *pCaps = (DXGK_DRIVERCAPS*)pQueryAdapterInfo->pOutputData;

pCaps->HighestAcceptableAddress.HighPart = 0xffffffffUL;
pCaps->HighestAcceptableAddress.LowPart = 0xffffffffUL;
pCaps->MaxAllocationListSlotId = 0xffffffffUL;
pCaps->ApertureSegmentCommitLimit = 0;
pCaps->MaxPointerWidth = 0xffffffffUL;
pCaps->MaxPointerHeight = 0xffffffffUL;
pCaps->PointerCaps.Value = 0x7; /* Monochrome , Color , MaskedColor */
pCaps->InterruptMessageNumber = 0;
pCaps->NumberOfSwizzlingRanges = 0;
/* @todo: need to adjust this for proper 2D Accel support */
pCaps->MaxOverlays = 0;
pCaps->GammaRampCaps.Value = 0;
pCaps->PresentationCaps.Value = 0;
pCaps->PresentationCaps.NoScreenToScreenBlt = 1;
pCaps->PresentationCaps.NoOverlapScreenBlt = 1;
pCaps->MaxQueuedFlipOnVSync = 1; /* @todo: need more ?? */
pCaps->FlipCaps.Value = 0;
pCaps->FlipCaps.FlipOnVSyncWithNoWait = 1;
pCaps->FlipCaps.FlipOnVSyncMmIo = 1; /* @todo: ?? */
pCaps->SchedulingCaps.Value = 0;
/* @todo: we might need it for Aero.
* Setting this glag would mean we support DeviceContext, i.e.
*  DxgkDdiCreateContext and DxgkDdiDestroyContext
*
*  pCaps->SchedulingCaps.MultiEngineAware = 1;
*/
pCaps->MemoryManagementCaps.Value = 0;
/* @todo: this corelates with pCaps->SchedulingCaps.MultiEngineAware */
pCaps->MemoryManagementCaps.PagingNode = 0;
/* @todo: this corelates with pCaps->SchedulingCaps.MultiEngineAware */
pCaps->GpuEngineTopology.NbAsymetricProcessingNodes = 0;

break;
}
case DXGKQAITYPE_QUERYSEGMENT:
{
/* no need for DXGK_QUERYSEGMENTIN as it contains AGP aperture info, which (AGP aperture) we do not support
* DXGK_QUERYSEGMENTIN *pQsIn = (DXGK_QUERYSEGMENTIN*)pQueryAdapterInfo->pInputData; */
DXGK_QUERYSEGMENTOUT *pQsOut = (DXGK_QUERYSEGMENTOUT*)pQueryAdapterInfo->pOutputData;
if (!pQsOut->pSegmentDescriptor)
{
/* we are requested to provide the number of segments we support */
pQsOut->NbSegment = 1;
}
else if (pQsOut->NbSegment != 1)
{
AssertBreakpoint();
drprintf((__FUNCTION__ " NbSegment (%d) != 1\n", pQsOut->NbSegment));
Status = STATUS_INVALID_PARAMETER;
}
else
{
/* we are requested to provide segment information */
pQsOut->pSegmentDescriptor->BaseAddress.QuadPart = VBE_DISPI_LFB_PHYSICAL_ADDRESS;
pQsOut->pSegmentDescriptor->CpuTranslatedAddress.QuadPart = VBE_DISPI_LFB_PHYSICAL_ADDRESS;
/* make sure the size is page aligned */
pQsOut->pSegmentDescriptor->Size = (pContext->u.primary.cbVRAM - VBVA_ADAPTER_INFORMATION_SIZE - pContext->u.primary.cbMiniportHeap) & (~0xfffUL);
pQsOut->pSegmentDescriptor->NbOfBanks = 0;
pQsOut->pSegmentDescriptor->pBankRangeTable = 0;
pQsOut->pSegmentDescriptor->CommitLimit = pQsOut->pSegmentDescriptor->Size;
pQsOut->pSegmentDescriptor->Flags.Value = 0;
pQsOut->pSegmentDescriptor->Flags.CpuVisible = 1;
}
pQsOut->PagingBufferSegmentId = 0;
pQsOut->PagingBufferSize = 1024; /* @todo: ??*/
pQsOut->PagingBufferPrivateDataSize = 0; /* @todo: ??*/
break;
}
case DXGKQAITYPE_UMDRIVERPRIVATE:
drprintf((__FUNCTION__ ": we do not support DXGKQAITYPE_UMDRIVERPRIVATE\n"));
Status = STATUS_NOT_SUPPORTED;
break;
default:
drprintf((__FUNCTION__ ": unsupported Type (%d)\n", pQueryAdapterInfo->Type));
Status = STATUS_NOT_SUPPORTED;
break;
}
dfprintf(("<== "__FUNCTION__ ", context(0x%x), Status(0x%x)\n", hAdapter, Status));
return Status;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: