summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2013-05-13 15:40:43 -0400
committerYonit Halperin <yhalperi@redhat.com>2013-05-13 15:40:43 -0400
commit4b3b088146ecfb7175b8aa93059b39b7c36cc7f5 (patch)
treeb05fe06938250242d7897ec92e67cff310ea98ce
parent1ef0bee1ef095aec6c0a85b9d60353355e39165c (diff)
logging. most of it related to vidpn. Some commented.
-rw-r--r--C++/bdd_ddi.cxx47
-rw-r--r--C++/bdd_dmm.cxx60
2 files changed, 104 insertions, 3 deletions
diff --git a/C++/bdd_ddi.cxx b/C++/bdd_ddi.cxx
index 680fe0c..cf67a26 100644
--- a/C++/bdd_ddi.cxx
+++ b/C++/bdd_ddi.cxx
@@ -196,6 +196,8 @@ BddDdiAddDevice(
*ppDeviceContext = pBDD;
+
+ LogMessage("AddDevice\n");
return STATUS_SUCCESS;
}
@@ -206,6 +208,7 @@ BddDdiRemoveDevice(
PAGED_CODE();
BASIC_DISPLAY_DRIVER* pBDD = reinterpret_cast<BASIC_DISPLAY_DRIVER*>(pDeviceContext);
+ LogMessage("RemoveDevice\n");
if (pBDD)
{
@@ -394,13 +397,55 @@ BddDdiPresentDisplayOnly(
{
PAGED_CODE();
BDD_ASSERT_CHK(hAdapter != NULL);
-
+ RECT DirtyExtents = {0,};
BASIC_DISPLAY_DRIVER* pBDD = reinterpret_cast<BASIC_DISPLAY_DRIVER*>(hAdapter);
if (!pBDD->IsDriverActive())
{
BDD_LOG_ASSERTION1("BDD (0x%I64x) is being called when not active!", pBDD);
return STATUS_UNSUCCESSFUL;
}
+ LogMessage("BddDdiPresentDisplayOnly: pitch %ld\n", pPresentDisplayOnly->Pitch);
+ LogMessage("BddDdiPresentDisplayOnly: num_moves %lu\n", pPresentDisplayOnly->NumMoves);
+ for (unsigned long int i = 0; i < pPresentDisplayOnly->NumMoves; i++) {
+ LogMessage("BddDdiPresentDisplayOnly: Move %d src-point (%ld, %ld) dst-rect (%ld, %ld) (%ld, %ld)\n",
+ pPresentDisplayOnly->pMoves[i].SourcePoint.x,
+ pPresentDisplayOnly->pMoves[i].SourcePoint.y,
+ pPresentDisplayOnly->pMoves[i].DestRect.left,
+ pPresentDisplayOnly->pMoves[i].DestRect.top,
+ pPresentDisplayOnly->pMoves[i].DestRect.right,
+ pPresentDisplayOnly->pMoves[i].DestRect.bottom);
+ }
+
+ if (pPresentDisplayOnly->NumDirtyRects > 0) {
+ DirtyExtents = pPresentDisplayOnly->pDirtyRect[0];
+ }
+ LogMessage("BddDdiPresentDisplayOnly: num_dirty_rects %lu\n", pPresentDisplayOnly->NumDirtyRects);
+ for (unsigned long int i = 0; i < pPresentDisplayOnly->NumDirtyRects; i++) {
+ LogMessage("BddDdiPresentDisplayOnly: dirty-rect (%ld, %ld) (%ld, %ld)\n",
+ pPresentDisplayOnly->pDirtyRect[i].left,
+ pPresentDisplayOnly->pDirtyRect[i].top,
+ pPresentDisplayOnly->pDirtyRect[i].right,
+ pPresentDisplayOnly->pDirtyRect[i].bottom);
+ if (DirtyExtents.left > pPresentDisplayOnly->pDirtyRect[i].left) {
+ DirtyExtents.left = pPresentDisplayOnly->pDirtyRect[i].left;
+ }
+ if (DirtyExtents.right < pPresentDisplayOnly->pDirtyRect[i].right) {
+ DirtyExtents.right = pPresentDisplayOnly->pDirtyRect[i].right;
+ }
+ if (DirtyExtents.top > pPresentDisplayOnly->pDirtyRect[i].top) {
+ DirtyExtents.top = pPresentDisplayOnly->pDirtyRect[i].top;
+ }
+ if (DirtyExtents.bottom < pPresentDisplayOnly->pDirtyRect[i].bottom) {
+ DirtyExtents.bottom = pPresentDisplayOnly->pDirtyRect[i].bottom;
+ }
+ }
+ if (pPresentDisplayOnly->NumDirtyRects > 0) {
+ LogMessage("BddDdiPresentDisplayOnly: dirty-extents (%ld, %ld) (%ld, %ld)\n",
+ DirtyExtents.left,
+ DirtyExtents.top,
+ DirtyExtents.right,
+ DirtyExtents.bottom);
+ }
return pBDD->PresentDisplayOnly(pPresentDisplayOnly);
}
diff --git a/C++/bdd_dmm.cxx b/C++/bdd_dmm.cxx
index 6ffec82..7a3a3e8 100644
--- a/C++/bdd_dmm.cxx
+++ b/C++/bdd_dmm.cxx
@@ -23,6 +23,7 @@ NTSTATUS BASIC_DISPLAY_DRIVER::IsSupportedVidPn(_Inout_ DXGKARG_ISSUPPORTEDVIDPN
{
PAGED_CODE();
+ //LogMessage("%s\n", __FUNCTION__);
BDD_ASSERT(pIsSupportedVidPn != NULL);
if (pIsSupportedVidPn->hDesiredVidPn == 0)
@@ -76,13 +77,14 @@ NTSTATUS BASIC_DISPLAY_DRIVER::IsSupportedVidPn(_Inout_ DXGKARG_ISSUPPORTEDVIDPN
// All sources succeeded so this VidPn is supported
pIsSupportedVidPn->IsVidPnSupported = TRUE;
+ //LogMessage("%s\n STATUS_SUCCESS", __FUNCTION__);
return STATUS_SUCCESS;
}
NTSTATUS BASIC_DISPLAY_DRIVER::RecommendFunctionalVidPn(_In_ CONST DXGKARG_RECOMMENDFUNCTIONALVIDPN* CONST pRecommendFunctionalVidPn)
{
PAGED_CODE();
-
+// LogMessage("RecommendFunctionalVidPn\n");
BDD_ASSERT(pRecommendFunctionalVidPn == NULL);
return STATUS_GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN;
@@ -91,6 +93,7 @@ NTSTATUS BASIC_DISPLAY_DRIVER::RecommendFunctionalVidPn(_In_ CONST DXGKARG_RECOM
NTSTATUS BASIC_DISPLAY_DRIVER::RecommendVidPnTopology(_In_ CONST DXGKARG_RECOMMENDVIDPNTOPOLOGY* CONST pRecommendVidPnTopology)
{
PAGED_CODE();
+ //LogMessage("RecommendVidPnTopology\n");
BDD_ASSERT(pRecommendVidPnTopology == NULL);
@@ -101,6 +104,7 @@ NTSTATUS BASIC_DISPLAY_DRIVER::RecommendMonitorModes(_In_ CONST DXGKARG_RECOMMEN
{
PAGED_CODE();
+ //LogMessage("%s\n", __FUNCTION__);
// This is always called to recommend modes for the monitor. The sample driver doesn't provide EDID for a monitor, so
// the OS prefills the list with default monitor modes. Since the required mode might not be in the list, it should
// be provided as a recommended mode.
@@ -126,6 +130,7 @@ NTSTATUS BASIC_DISPLAY_DRIVER::EnumVidPnCofuncModality(_In_ CONST DXGKARG_ENUMVI
CONST D3DKMDT_VIDPN_SOURCE_MODE* pVidPnPinnedSourceModeInfo = NULL;
CONST D3DKMDT_VIDPN_TARGET_MODE* pVidPnPinnedTargetModeInfo = NULL;
+ LogMessage("%s\n", __FUNCTION__);
// Get the VidPn Interface so we can get the 'Source Mode Set', 'Target Mode Set' and 'VidPn Topology' interfaces
NTSTATUS Status = m_DxgkInterface.DxgkCbQueryVidPnInterface(pEnumCofuncModality->hConstrainingVidPn, DXGK_VIDPN_INTERFACE_VERSION_V1, &pVidPnInterface);
if (!NT_SUCCESS(Status))
@@ -151,8 +156,11 @@ NTSTATUS BASIC_DISPLAY_DRIVER::EnumVidPnCofuncModality(_In_ CONST DXGKARG_ENUMVI
}
// Loop through all available paths.
+ int i = 0;
while (Status != STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET)
{
+
+ // LogMessage("%s: patch %d \n", __FUNCTION__, i++);
// Get the Source Mode Set interface so the pinned mode can be retrieved
Status = pVidPnInterface->pfnAcquireSourceModeSet(pEnumCofuncModality->hConstrainingVidPn,
pVidPnPresentPath->VidPnSourceId,
@@ -201,7 +209,8 @@ NTSTATUS BASIC_DISPLAY_DRIVER::EnumVidPnCofuncModality(_In_ CONST DXGKARG_ENUMVI
Status, pEnumCofuncModality->hConstrainingVidPn, pVidPnPresentPath->VidPnSourceId);
break;
}
-
+
+ //LogMessage("%s adding source modes\n", __FUNCTION__);
// Add the appropriate modes to the source mode set
{
Status = AddSingleSourceMode(pVidPnSourceModeSetInterface, hVidPnSourceModeSet, pVidPnPresentPath->VidPnSourceId);
@@ -221,8 +230,13 @@ NTSTATUS BASIC_DISPLAY_DRIVER::EnumVidPnCofuncModality(_In_ CONST DXGKARG_ENUMVI
break;
}
hVidPnSourceModeSet = 0; // Successfully assigned it (equivalent to releasing it)
+ } else {
+ // LogMessage("%s source mode pinned \n", __FUNCTION__);
}
}// End: SOURCE MODES
+ else {
+// LogMessage("%s pivot source \n", __FUNCTION__);
+ }
// TARGET MODES: If this target mode isn't the pivot point, do work on the target mode set
if (!((pEnumCofuncModality->EnumPivotType == D3DKMDT_EPT_VIDPNTARGET) &&
@@ -272,6 +286,7 @@ NTSTATUS BASIC_DISPLAY_DRIVER::EnumVidPnCofuncModality(_In_ CONST DXGKARG_ENUMVI
break;
}
+ //LogMessage("%s adding target modes\n", __FUNCTION__);
Status = AddSingleTargetMode(pVidPnTargetModeSetInterface, hVidPnTargetModeSet, pVidPnPinnedSourceModeInfo, pVidPnPresentPath->VidPnSourceId);
if (!NT_SUCCESS(Status))
@@ -291,6 +306,7 @@ NTSTATUS BASIC_DISPLAY_DRIVER::EnumVidPnCofuncModality(_In_ CONST DXGKARG_ENUMVI
}
else
{
+ //LogMessage("%s target mode pinned \n", __FUNCTION__);
// Release the pinned target as there's no other work to do
Status = pVidPnTargetModeSetInterface->pfnReleaseModeInfo(hVidPnTargetModeSet, pVidPnPinnedTargetModeInfo);
if (!NT_SUCCESS(Status))
@@ -312,6 +328,9 @@ NTSTATUS BASIC_DISPLAY_DRIVER::EnumVidPnCofuncModality(_In_ CONST DXGKARG_ENUMVI
hVidPnTargetModeSet = 0; // Successfully released it
}
}// End: TARGET MODES
+ else {
+ //LogMessage("%s pivot target \n", __FUNCTION__);
+ }
// Nothing else needs the pinned source mode so release it
if (pVidPnPinnedSourceModeInfo != NULL)
@@ -356,8 +375,14 @@ NTSTATUS BASIC_DISPLAY_DRIVER::EnumVidPnCofuncModality(_In_ CONST DXGKARG_ENUMVI
LocalVidPnPresentPath.ContentTransformation.ScalingSupport.Identity = 1;
LocalVidPnPresentPath.ContentTransformation.ScalingSupport.Centered = 1;
SupportFieldsModified = TRUE;
+ // LogMessage("%s scaling modified \n", __FUNCTION__);
+ } else {
+ // LogMessage("%s scaling pinned \n", __FUNCTION__);
}
} // End: SCALING
+ else {
+ // LogMessage("%s pivot scaling \n", __FUNCTION__);
+ }
// ROTATION: If this path's rotation isn't the pivot point, do work on the rotation support
if (!((pEnumCofuncModality->EnumPivotType != D3DKMDT_EPT_ROTATION) &&
@@ -373,8 +398,12 @@ NTSTATUS BASIC_DISPLAY_DRIVER::EnumVidPnCofuncModality(_In_ CONST DXGKARG_ENUMVI
LocalVidPnPresentPath.ContentTransformation.RotationSupport.Rotate180 = 0;
LocalVidPnPresentPath.ContentTransformation.RotationSupport.Rotate270 = 0;
SupportFieldsModified = TRUE;
+ // LogMessage("%s rotation modified \n", __FUNCTION__);
}
} // End: ROTATION
+ else {
+ //LogMessage("%s pivot rotation \n", __FUNCTION__);
+ }
if (SupportFieldsModified)
{
@@ -510,9 +539,12 @@ NTSTATUS BASIC_DISPLAY_DRIVER::CommitVidPn(_In_ CONST DXGKARG_COMMITVIDPN* CONST
CONST D3DKMDT_VIDPN_PRESENT_PATH* pVidPnPresentPath = NULL;
CONST D3DKMDT_VIDPN_SOURCE_MODE* pPinnedVidPnSourceModeInfo = NULL;
+ LogMessage("%s\n", __FUNCTION__);
// Check this CommitVidPn is for the mode change notification when monitor is in power off state.
if (pCommitVidPn->Flags.PathPoweredOff)
{
+
+ LogMessage("%s\n", __FUNCTION__);
// Ignore the commitVidPn call for the mode change notification when monitor is in power off state.
Status = STATUS_SUCCESS;
goto CommitVidPnExit;
@@ -590,6 +622,7 @@ NTSTATUS BASIC_DISPLAY_DRIVER::CommitVidPn(_In_ CONST DXGKARG_COMMITVIDPN* CONST
goto CommitVidPnExit;
}
+ LogMessage("%s pinned mode\n", __FUNCTION__);
Status = IsVidPnSourceModeFieldsValid(pPinnedVidPnSourceModeInfo);
if (!NT_SUCCESS(Status))
{
@@ -718,6 +751,7 @@ NTSTATUS BASIC_DISPLAY_DRIVER::SetSourceModeAndPath(CONST D3DKMDT_VIDPN_SOURCE_M
pCurrentBddMode->SrcModeHeight = pSourceMode->Format.Graphics.PrimSurfSize.cy;
pCurrentBddMode->Rotation = pPath->ContentTransformation.Rotation;
+ LogMessage("%s set mode size %ux%u\n", __FUNCTION__, pCurrentBddMode->SrcModeWidth, pCurrentBddMode->SrcModeHeight);
if (!pCurrentBddMode->Flags.DoNotMapOrUnmap)
{
@@ -817,6 +851,12 @@ NTSTATUS BASIC_DISPLAY_DRIVER::IsVidPnSourceModeFieldsValid(CONST D3DKMDT_VIDPN_
{
if (pSourceMode->Format.Graphics.PixelFormat == gBddPixelFormats[PelFmtIdx])
{
+ LogMessage("%s mode surf-size %ux%u vis-region-size %ux%u\n", __FUNCTION__,
+ pSourceMode->Format.Graphics.PrimSurfSize.cx,
+ pSourceMode->Format.Graphics.PrimSurfSize.cy,
+ pSourceMode->Format.Graphics.VisibleRegionSize.cx,
+ pSourceMode->Format.Graphics.VisibleRegionSize.cy
+ );
return STATUS_SUCCESS;
}
}
@@ -859,6 +899,9 @@ NTSTATUS BASIC_DISPLAY_DRIVER::AddSingleSourceMode(_In_ CONST DXGK_VIDPNSOURCEMO
return Status;
}
+ LogMessage("%s adding the default mode... %ux%u\n", __FUNCTION__,
+ m_CurrentModes[SourceId].DispInfo.Width,
+ m_CurrentModes[SourceId].DispInfo.Height);
// Populate mode info with values from current mode and hard-coded values
// Always report 32 bpp format, this will be color converted during the present if the mode is < 32bpp
pVidPnSourceModeInfo->Type = D3DKMDT_RMT_GRAPHICS;
@@ -927,6 +970,9 @@ NTSTATUS BASIC_DISPLAY_DRIVER::AddSingleSourceMode(_In_ CONST DXGK_VIDPNSOURCEMO
return Status;
}
+ LogMessage("%s adding only smaller source modes %ux%u\n", __FUNCTION__,
+ C_SampleSourceMode[ModeIndex].ModeWidth,
+ C_SampleSourceMode[ModeIndex].ModeHeight);
// Populate mode info with values from mode at ModeIndex and hard-coded values
// Always report 32 bpp format, this will be color converted during the present if the mode at ModeIndex was < 32bpp
pVidPnSourceModeInfo->Type = D3DKMDT_RMT_GRAPHICS;
@@ -976,6 +1022,9 @@ NTSTATUS BASIC_DISPLAY_DRIVER::AddSingleTargetMode(_In_ CONST DXGK_VIDPNTARGETMO
return Status;
}
+// LogMessage("%s adding the default mode... %ux%u\n", __FUNCTION__,
+// m_CurrentModes[SourceId].DispInfo.Width,
+// m_CurrentModes[SourceId].DispInfo.Height);
pVidPnTargetModeInfo->VideoSignalInfo.VideoStandard = D3DKMDT_VSS_OTHER;
UNREFERENCED_PARAMETER(pVidPnPinnedSourceModeInfo);
pVidPnTargetModeInfo->VideoSignalInfo.TotalSize.cx = m_CurrentModes[SourceId].DispInfo.Width;
@@ -1018,6 +1067,8 @@ NTSTATUS BASIC_DISPLAY_DRIVER::AddSingleTargetMode(_In_ CONST DXGK_VIDPNTARGETMO
NTSTATUS BASIC_DISPLAY_DRIVER::AddSingleMonitorMode(_In_ CONST DXGKARG_RECOMMENDMONITORMODES* CONST pRecommendMonitorModes)
{
+ SIZE_T num_modes;
+
PAGED_CODE();
D3DKMDT_MONITOR_SOURCE_MODE* pMonitorSourceMode = NULL;
@@ -1029,7 +1080,12 @@ NTSTATUS BASIC_DISPLAY_DRIVER::AddSingleMonitorMode(_In_ CONST DXGKARG_RECOMMEND
return Status;
}
+ Status = pRecommendMonitorModes->pMonitorSourceModeSetInterface->pfnGetNumModes(pRecommendMonitorModes->hMonitorSourceModeSet, &num_modes);
+// LogMessage("%s: cur num_modes %lu", __FUNCTION__, num_modes);
D3DDDI_VIDEO_PRESENT_SOURCE_ID CorrespondingSourceId = FindSourceForTarget(pRecommendMonitorModes->VideoPresentTargetId, TRUE);
+// LogMessage("%s: add pref mode, dimensions %ux%u, taken from DxgkCbAcquirePostDisplayOwnership at StartDevice", __FUNCTION__,
+// m_CurrentModes[CorrespondingSourceId].DispInfo.Width,
+ // m_CurrentModes[CorrespondingSourceId].DispInfo.Height);
// Since we don't know the real monitor timing information, just use the current display mode (from the POST device) with unknown frequencies
pMonitorSourceMode->VideoSignalInfo.VideoStandard = D3DKMDT_VSS_OTHER;