problem about WDDM miniport driver of win7

Hi Marcel, Thank you for your patience and help all the time.

The code of DxgkDdiPresent is as follows:
{
if (pPresent->Flags.Blt)
{
// ------> up to now, it always is in this case.
pPresent->pDmaBufferPrivateData = (uint8_t*)pPresent->pDmaBufferPrivateData + 128;
pPresent->pDmaBuffer = ((uint8_t*)pPresent->pDmaBuffer) + 128;

RtlZeroMemory(pPresent->pPatchLocationListOut, 2*sizeof (D3DDDI_PATCHLOCATIONLIST));
pPresent->pPatchLocationListOut[0].AllocationIndex = DXGK_PRESENT_SOURCE_INDEX;
pPresent->pPatchLocationListOut[0].PatchOffset = 0;
pPresent->pPatchLocationListOut[1].AllocationIndex = DXGK_PRESENT_DESTINATION_INDEX;
pPresent->pPatchLocationListOut[1].PatchOffset = 128;
pPresent->pPatchLocationListOut += 2;
}
return STATUS_SUCCESS;
}

Is it OK?
So far, I have no idea about how to design and use desgpPresent->pDmaBufferPrivateData and pPresent->pDmaBuffer.

Another question:
I want to make the display driver to support the D3D feature, do I have to implement the user-mode driver ?

Thank you very much. Good Luck!

Zhengwei lou

I can only suggest again to study WDK WDDM topic “Video Memory Management and GPU Scheduling”. This is fundamental prerequisite for understanding DMA buffers and Patch Location Lists.

Since this graphics adapter hardware does not seem to support DMA, two things can be ignored for now:

  • Content of DMA buffers
  • Content of Patch Location List

Still, the above have to be initialized, managed and advanced properly:
Incrementing pPresent->pDmaBuffer by hardcoded value is definitely wrong.
pPresent->pDmaBuffer incrementation needs to check for pPresent->DmaSize.
Incrementation of pPresent-pDmaBufferPrivateData is not necessary.
If incrementing pPresent-pDmaBufferPrivateData, must also check pPresent->DmaBufferPrivateDataSize.
A hardcoded value of 128 for PatchOffset is also wrong.
In this case, PatchOffset can remain 0 for both, source and destination allocation.

D3D support (which is also prerequisite for Windows 7 AERO Glass Transparency look) needs implementation of WDDM User Mode Driver indeed. A WDDM User Mode Driver implementation needs D3D compatible hardware or a D3D software renderer.

PS: I can only suggest to thoroughly study IRQLs, too. Full understanding of IRQLs is prerequisite for comprehensive knowledge of Windows kernel mode synchronization which is a fundamental prerequisite for writing a stable WDDM driver.

Marcel Ruedinger
datronicsoft

Hi Marcel, thanks for your help and suggestions all the time.

I have a good news to tell you, just right now, the present flow went well, and I could see the contents…

I followed your suggestions, that is:

  1. Study the topic “Video Memory Management and GPU Scheduling”;
  2. Define two video memory segments, make both of them visible;
  3. Put the action of “copy screen content” in the DxgkDdiPresent;
    then, it goes well. Thank you very much.

Now, I want to continue to implement the user-mode display driver.

Thanks, Good luck.

Zhengwei lou

1 Like

Hi Marcel,

I googled this discusstion, now I have the same question: where and how I can get the bitmap data from?

I have studied the topic “Video Memory Management and GPU Scheduling” at least 20 times, but my knowledge
still not enough to let me to finish my job.

My video card has no DMA, it’s a virtual device, now it can work correctly in DOD mode, I need it work correctly
in full function mode, I modified my code according to the VirtualBox WDDM Display Card driver, now my full
function video card driver looks working correctly but no display image (I don’t know how to get the bitmap
data), the DXGK_OPERATION_FILL and DXGK_OPERATION_TRANSFER action happens in my driver, should I
get the bitmap data in DXGK_OPERATION_FILL or DXGK_OPERATION_TRANSFER?

BR,
John

Hi Marcel,

I have got the bitmap data, I don’t know if you can see my words, I must say thanks to you,
without you, I can’t solve my problem, thank you very much.

I come from China, you are my hero!

BR,
John