From: nan_hsing Chang on
I write the display WDDM driver for windwos7. Windwos stopped my
driver during initialization. The DxgkDdiStartDevice callback has be
called, then DxgkDdiQueryChildRelations and dxgkQueryAdapterInfo. In
dxgkQueryAdapterInfo function, I fill DXGK_DRIVERCAPS structure and
return STATUS_SUCCESS. But it can't call DxgkddiCreateDevice, it call
DxgkStopDevice instead. At last, my driver has been removed.

Could someone give me suggestion? Should I report some caps in the
DXGK_DRIVERCAPS structure for windows7. Or My user mode driver can't
be load. I find my user mode driver can't be call and I don't know why.
From: Ivan Brugiolo [MSFT] on
Is this a real device backed by a real piece of hardware, or, some
virtual-bus enumerated device ?
DxgKrnl.sys is extremely picky about hardware resource requirements
for your device, and, it requires a real hardware interrput
(CmResourceTypeInterrupt) and a piece of memory (CmResourceTypeMemory),
and it parses the CM_RESOURCE_LIST to register the interrput for you.

That said, if you made-it past DxgkDdiStartDevice,
it looks like that part is OK.

DxgkDdiQueryAdapterInfo is supposed to called 3 times during initialization:
One for DXGKQAITYPE_DRIVERCAPS
Twice for DXGKQAITYPE_QUERYSEGMENT.
QuerySegment is again really picky about flags, since it tries to make sense
of Memory-Space Segments, Aperture Segments
and (for legacy AGP) AGP-Aperture segments.

The general expectations for your exercise are:

-1- You get past DxgkDdiQueryAdapterInfo, and,
the Video-Memory-Manager gets intialized for your DXGADAPTER
-2- Required registry information is retrieved and parsed correctly
-3- Monitor Modes are requested for non hot-pluggable DxgkChild
-4- DxgkDdiEnumVidPnCofuncModality is called hundreds to thousands of times,
until the topology for that adapter is `constrained` and `made functional`.

If the Gdi view of the VidPn Source is part of the desktop, then:

-5- The Cdd kernel-mode DXGDEVICE is created
-6- Adapter affine allocations (or Stardard Allocations) Shared and Shadow
are created
-7- Allocations are pinned, and your DMA completion routine will confirm
Paging-Buffers
-8- You will get some Gdi `Present` (or Blt) from the Shadow to the Shared

If the desktop compositor is in a configuration where it can compose
all of the Gdi views, or if there is a DX application, then you may see
your User-mode driver to be loaded, and possibly invoked.

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


"nan_hsing Chang" <nhchang03(a)gmail.com> wrote in message
news:7dee95a0-9b81-46c0-99bb-f2c8be96b46f(a)z4g2000prh.googlegroups.com...
>I write the display WDDM driver for windwos7. Windwos stopped my
> driver during initialization. The DxgkDdiStartDevice callback has be
> called, then DxgkDdiQueryChildRelations and dxgkQueryAdapterInfo. In
> dxgkQueryAdapterInfo function, I fill DXGK_DRIVERCAPS structure and
> return STATUS_SUCCESS. But it can't call DxgkddiCreateDevice, it call
> DxgkStopDevice instead. At last, my driver has been removed.
>
> Could someone give me suggestion? Should I report some caps in the
> DXGK_DRIVERCAPS structure for windows7. Or My user mode driver can't
> be load. I find my user mode driver can't be call and I don't know why.

From: nan_hsing Chang on
Thank for your replay.

But I meet a strange situation. Original, I build my driver in WDK
6001.18001 and the function flow is as you says that
DxgkDdiQueryAdapterInfo is called 3 times. But when I build in WDK
7600.16385.0, DxgkDdiQueryAdapterInfo is called only one time for
DXGKQAITYPE_DRIVERCAPS, then the DxgkStopDevice is called, then
DxgkRemoveDevice.

Do I miss some settings for WDK 7600 environment? Because I can't find
video driver sample(ex, r2000) in WDK 7600, I can't try sample code.

BTW, I write display driver for a real device.


Ivan Brugiolo [MSFT] wrote:
> Is this a real device backed by a real piece of hardware, or, some
> virtual-bus enumerated device ?
> DxgKrnl.sys is extremely picky about hardware resource requirements
> for your device, and, it requires a real hardware interrput
> (CmResourceTypeInterrupt) and a piece of memory (CmResourceTypeMemory),
> and it parses the CM_RESOURCE_LIST to register the interrput for you.
>
> That said, if you made-it past DxgkDdiStartDevice,
> it looks like that part is OK.
>
> DxgkDdiQueryAdapterInfo is supposed to called 3 times during initialization:
> One for DXGKQAITYPE_DRIVERCAPS
> Twice for DXGKQAITYPE_QUERYSEGMENT.
> QuerySegment is again really picky about flags, since it tries to make sense
> of Memory-Space Segments, Aperture Segments
> and (for legacy AGP) AGP-Aperture segments.
>
> The general expectations for your exercise are:
>
> -1- You get past DxgkDdiQueryAdapterInfo, and,
> the Video-Memory-Manager gets intialized for your DXGADAPTER
> -2- Required registry information is retrieved and parsed correctly
> -3- Monitor Modes are requested for non hot-pluggable DxgkChild
> -4- DxgkDdiEnumVidPnCofuncModality is called hundreds to thousands of times,
> until the topology for that adapter is `constrained` and `made functional`.
>
> If the Gdi view of the VidPn Source is part of the desktop, then:
>
> -5- The Cdd kernel-mode DXGDEVICE is created
> -6- Adapter affine allocations (or Stardard Allocations) Shared and Shadow
> are created
> -7- Allocations are pinned, and your DMA completion routine will confirm
> Paging-Buffers
> -8- You will get some Gdi `Present` (or Blt) from the Shadow to the Shared
>
> If the desktop compositor is in a configuration where it can compose
> all of the Gdi views, or if there is a DX application, then you may see
> your User-mode driver to be loaded, and possibly invoked.
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
> Use of any included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
>
>
> "nan_hsing Chang" <nhchang03(a)gmail.com> wrote in message
> news:7dee95a0-9b81-46c0-99bb-f2c8be96b46f(a)z4g2000prh.googlegroups.com...
> >I write the display WDDM driver for windwos7. Windwos stopped my
> > driver during initialization. The DxgkDdiStartDevice callback has be
> > called, then DxgkDdiQueryChildRelations and dxgkQueryAdapterInfo. In
> > dxgkQueryAdapterInfo function, I fill DXGK_DRIVERCAPS structure and
> > return STATUS_SUCCESS. But it can't call DxgkddiCreateDevice, it call
> > DxgkStopDevice instead. At last, my driver has been removed.
> >
> > Could someone give me suggestion? Should I report some caps in the
> > DXGK_DRIVERCAPS structure for windows7. Or My user mode driver can't
> > be load. I find my user mode driver can't be call and I don't know why.
From: Ivan Brugiolo [MSFT] on
What do you pass as DXGKDDI_INTERFACE_xxx in DRIVER_INITIALIZATION_DATA ?

There is a coupling between that value and what the DRIVERCAPS expexts.

Also, what do you expect as the result your exercise ?
Compile a WDDM 1.0 driver with the Win7 compiler ?
Compile a Win7 only WDDM 1.1 driver ?
A combined 1.0/1.1 package ?

I believe that you are mixing Win7 only #defines unforced by the build
environment
with Legacy - Vista typedefs and other declarations.

I would recommend stepping out of your miniport function, and, see
in the disassembly where DXGADAPTER::Initialize
returns STATUS_REVISION_MISMATCH.

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

AdapterCaps->HighestAcceptableAddress.QuadPart = 0xFFFFFFFFFFF;
//PHYSICAL_ADDRESS
//
// DMA buffer splitting support
//
AdapterCaps->MaxAllocationListSlotId = 2;
AdapterCaps->ApertureSegmentCommitLimit = 0x10000000; // 256Meg
AdapterCaps->MaxPointerWidth = 0x40; // 64 pixel
AdapterCaps->MaxPointerHeight = 0x40; // 64 pixel

//DXGK_POINTERFLAGS
AdapterCaps->PointerCaps.Color = TRUE;
AdapterCaps->PointerCaps.Reserved = 0;

AdapterCaps->InterruptMessageNumber = 0;
AdapterCaps->NumberOfSwizzlingRanges = 0x2;
AdapterCaps->MaxOverlays = 0x0;

//DXGK_GAMMARAMPCAPS
AdapterCaps->GammaRampCaps.Gamma_Rgb256x3x16 = TRUE;

//DXGK_PRESENTATIONCAPS

AdapterCaps->PresentationCaps.Value = 0;
AdapterCaps->PresentationCaps.SupportKernelModeCommandBuffer = TRUE;
AdapterCaps->PresentationCaps.DriverSupportsCddDwmInterop = TRUE;
AdapterCaps->PresentationCaps.SupportAllBltRops = TRUE;

AdapterCaps->MaxQueuedFlipOnVSync = 0x1;

//DXGK_FLIPCAPS
AdapterCaps->FlipCaps.FlipOnVSyncWithNoWait = TRUE;
AdapterCaps->FlipCaps.FlipOnVSyncMmIo = TRUE;

//DXGK_VIDSCHCAPS
AdapterCaps->SchedulingCaps.MultiEngineAware = FALSE;
AdapterCaps->SchedulingCaps.VSyncPowerSaveAware = TRUE;

//DXGK_VIDMMCAPS
AdapterCaps->MemoryManagementCaps.OutOfOrderLock = FALSE;
AdapterCaps->MemoryManagementCaps.PagingNode = 0;

//DXGK_GPUENGINETOPOLOGY
AdapterCaps->GpuEngineTopology.NbAsymetricProcessingNodes = 1;

//DXGK_WDDMVERSION
AdapterCaps->WDDMVersion = DXGKDDI_WDDMv1;


} break;


--

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

"nan_hsing Chang" <nhchang03(a)gmail.com> wrote in message
news:80c8282d-ded9-4193-8df8-f3dbab98cc61(a)m3g2000pri.googlegroups.com...
> Thank for your replay.
>
> But I meet a strange situation. Original, I build my driver in WDK
> 6001.18001 and the function flow is as you says that
> DxgkDdiQueryAdapterInfo is called 3 times. But when I build in WDK
> 7600.16385.0, DxgkDdiQueryAdapterInfo is called only one time for
> DXGKQAITYPE_DRIVERCAPS, then the DxgkStopDevice is called, then
> DxgkRemoveDevice.
>
> Do I miss some settings for WDK 7600 environment? Because I can't find
> video driver sample(ex, r2000) in WDK 7600, I can't try sample code.
>
> BTW, I write display driver for a real device.
>
>
> Ivan Brugiolo [MSFT] wrote:
>> Is this a real device backed by a real piece of hardware, or, some
>> virtual-bus enumerated device ?
>> DxgKrnl.sys is extremely picky about hardware resource requirements
>> for your device, and, it requires a real hardware interrput
>> (CmResourceTypeInterrupt) and a piece of memory (CmResourceTypeMemory),
>> and it parses the CM_RESOURCE_LIST to register the interrput for you.
>>
>> That said, if you made-it past DxgkDdiStartDevice,
>> it looks like that part is OK.
>>
>> DxgkDdiQueryAdapterInfo is supposed to called 3 times during
>> initialization:
>> One for DXGKQAITYPE_DRIVERCAPS
>> Twice for DXGKQAITYPE_QUERYSEGMENT.
>> QuerySegment is again really picky about flags, since it tries to make
>> sense
>> of Memory-Space Segments, Aperture Segments
>> and (for legacy AGP) AGP-Aperture segments.
>>
>> The general expectations for your exercise are:
>>
>> -1- You get past DxgkDdiQueryAdapterInfo, and,
>> the Video-Memory-Manager gets intialized for your DXGADAPTER
>> -2- Required registry information is retrieved and parsed correctly
>> -3- Monitor Modes are requested for non hot-pluggable DxgkChild
>> -4- DxgkDdiEnumVidPnCofuncModality is called hundreds to thousands of
>> times,
>> until the topology for that adapter is `constrained` and `made
>> functional`.
>>
>> If the Gdi view of the VidPn Source is part of the desktop, then:
>>
>> -5- The Cdd kernel-mode DXGDEVICE is created
>> -6- Adapter affine allocations (or Stardard Allocations) Shared and
>> Shadow
>> are created
>> -7- Allocations are pinned, and your DMA completion routine will confirm
>> Paging-Buffers
>> -8- You will get some Gdi `Present` (or Blt) from the Shadow to the
>> Shared
>>
>> If the desktop compositor is in a configuration where it can compose
>> all of the Gdi views, or if there is a DX application, then you may see
>> your User-mode driver to be loaded, and possibly invoked.
>>
>> --
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> Use of any included script samples are subject to the terms specified at
>> http://www.microsoft.com/info/cpyright.htm
>>
>>
>> "nan_hsing Chang" <nhchang03(a)gmail.com> wrote in message
>> news:7dee95a0-9b81-46c0-99bb-f2c8be96b46f(a)z4g2000prh.googlegroups.com...
>> >I write the display WDDM driver for windwos7. Windwos stopped my
>> > driver during initialization. The DxgkDdiStartDevice callback has be
>> > called, then DxgkDdiQueryChildRelations and dxgkQueryAdapterInfo. In
>> > dxgkQueryAdapterInfo function, I fill DXGK_DRIVERCAPS structure and
>> > return STATUS_SUCCESS. But it can't call DxgkddiCreateDevice, it call
>> > DxgkStopDevice instead. At last, my driver has been removed.
>> >
>> > Could someone give me suggestion? Should I report some caps in the
>> > DXGK_DRIVERCAPS structure for windows7. Or My user mode driver can't
>> > be load. I find my user mode driver can't be call and I don't know why.