Developing Games on Intel Graphics
If you are gaming on graphics integrated in your Intel Processor, this is the place for you! Find answers to your questions or post your issues with PC games
486 Discussions

DXVA driver on XP not work

Letian_Yi
Beginner
754 Views

I'm developing a virtual graphics driver with DXVA for redirecting the video from virtual machine to a remote PC which has intel HD4000 graphics card. But some problems are blocking me. I use DXVA Checker to test my virtual graphics driver. 

I follow the MSDN and add almost all of the functions for DXVA. 
These functions will be called when my video driver is being loaded: 
1)DrvGetDirectDrawInfo  (twice)
2)DrvEnableDirectDraw (int DDCORECAPS, i just set caps which name contain OVERLAY, HARDWARE, CODEC, BOB, FOURCC, YUV, COLORKEY)
3)DdGetDriverInfo  (many times, only provide GUID_MotionCompCallbacks GUID_NTPrivateDriverCaps GUID_DDMoreSurfaceCaps GUID_GetHeapAlignment in my driver)
4)( repeat step 1 to 3)
5)DrvDisableDirectDraw (I'm not sure why DirectDraw is disabled after step 1 to 4)
I'm not sure whether all of the capabilities of driver in DDCORECAPS would work. 

DXVA Checker call DirectDraw functions in driver as the following steps: 
1)DdGetDriverInfo
2)DdCanCreateSurface
3)DdCreateSurface  (create primary surface)
4)DdMoCompGetGuids
5)DdMoCompCreate (problem: only called with DXVA_DeinterlaceContainerDevice in my driver) 
6)DdCreateSurface (create overlay surface)
7)DdMapMemory
8)DdLock (only return DD_OK and DDHAL_DRIVER_HANDLED in my driver, i don't know whether )
9)DdMoCompGetFormats get all color format the video driver supports (in my driver, return YUY2, NV12, YV12) 
10)DdMoCompGetBuffInfo (problem: never called in my video driver) 
11)DdMoCompRender (problem: only called for COPP only in my video driver) 
12)DdMoCompQueryStatus (never called) 
13)DdMoCompBeginFrame (never called) 
14)DdMoCompEndFrame (nerver called) 
15)DdMoCompDestroy (called) 

The MSDN of DXVA nearly make me crazy. 
Could anyone help me make these functions work? 
1)DdMoCompGetBuffInfo (which capability will make this function work?) 
2)DdMoCompQueryStatus 
3)DdMoCompBeginFrame 

Thanks

0 Kudos
7 Replies
Mitchell_L_Intel
Employee
754 Views

FYI, Mike is working to track down an answer for you.

~Mitch

0 Kudos
Michael_C_Intel2
Employee
754 Views

I have been talking with media engineers about this. Microsoft DXVA has a tendency to change behavior based on other driver, and platform, parameters and not just DXVA implementation.  The dependency on things like D3DCaps and other APIs can change what Microsoft does with old DXVA. DXVA affect 2 layers, application, operating system , and driver.  We believe Microsoft does not document all the dependencies or expectations of their OS  components.  It can be a struggle to find out why DXVA OS behavior changes. I will continue to see if I can find someone to help.

0 Kudos
Letian_Yi
Beginner
754 Views

Michael Coppock (Intel) wrote:

I have been talking with media engineers about this. Microsoft DXVA has a tendency to change behavior based on other driver, and platform, parameters and not just DXVA implementation.  The dependency on things like D3DCaps and other APIs can change what Microsoft does with old DXVA. DXVA affect 2 layers, application, operating system , and driver.  We believe Microsoft does not document all the dependencies or expectations of their OS  components.  It can be a struggle to find out why DXVA OS behavior changes. I will continue to see if I can find someone to help.

Hi Michael

Please forget my last message, because have fixed it.
My GPU driver is a windows xp driver, but runs on windows 7.
Now i get new problem with DXVA.
1)When application plays a VC1 video and calls IDirectXVideoDecoder::GetBuffer after IDirectXVideoDecoder::BeginFrame, it will fail.
2)Can't map DXVA1.0 to DXVA2.0 for H264.

I have posted the function DdMoCompGetBuffInfo of my GPU driver.
If you took a look at it and let me know where is wrong, i'll be very grateful.
Thanks!

DWORD APIENTRY DdMoCompGetBuffInfo(PDD_GETMOCOMPCOMPBUFFDATA lpBufferData)
{
    lpBufferData->ddRVal = DD_OK;
    if (lpBufferData->lpCompBuffInfo == NULL){
        lpBufferData->dwNumTypesCompBuffs = DXVA_NUM_TYPES_COMP_BUFFERS;
        return DDHAL_DRIVER_HANDLED;
    }

    if (IsEqualIID(&DXVA_ModeVC1_VLD, lpBufferData->lpGuid)){
        DWORD buff_size[DXVA_NUM_TYPES_COMP_BUFFERS] = {
                0, sizeof(DXVA_PictureParameters), 0, 0,
                0, sizeof(DXVA_QmatrixData), sizeof(DXVA_SliceInfo), 64*1024,
                0, 0, 0, 0, 0, 0, 0, 0,
                sizeof(DXVA_MVvalue), 0 };
        DWORD buff_num[DXVA_NUM_TYPES_COMP_BUFFERS] = {
                0, 1, 0, 0,
                0, 64, 16, 4,
                0, 0, 0, 0, 0, 0, 0, 0,
                128, 0 };
        DWORD i;
        memset(lpBufferData->lpCompBuffInfo, 0, lpBufferData->dwNumTypesCompBuffs * sizeof(DDCOMPBUFFERINFO) );
        for(i = 0; i < lpBufferData->dwNumTypesCompBuffs; i++){
            lpBufferData->lpCompBuffInfo.dwSize = sizeof(DDCOMPBUFFERINFO);
            lpBufferData->lpCompBuffInfo.dwNumCompBuffers = buff_num;
            lpBufferData->lpCompBuffInfo.dwBytesToAllocate = buff_size;
        }
    }else{
        lpBufferData->ddRVal = DD_FALSE;
    }
    return DDHAL_DRIVER_HANDLED;
}

0 Kudos
Michael_C_Intel2
Employee
754 Views

Sorry for not replying sooner Yi. I am quite busy right now. I am trying to find someone who can look at this for you. My specialty is 3D graphics and gaming not media so I need to find a media engineer to review this.

-Michael

0 Kudos
Letian_Yi
Beginner
754 Views

That's OK!
I was supposed to Microsoft for help, but no one answered my question.
So, I'm very grateful to you.

I have find a way to just use hardware render, this will save most CPU on some video players and video formats.
However, this is not a perfect method. Because some important player can not use hardware acceleration, such as flash player.
Anyway, we have more time to find the answer.

Thanks a lot!

0 Kudos
Michael_C_Intel2
Employee
754 Views

Hi Yi,

Got some more information for you. Try updating your Graphics driver so you can to update to DXVA 2.0 instead of trying to map to it and get it run/support H.264.

The reason is The DXVA 2 API requires Windows Vista or later. The DXVA 1 API is still supported in Windows Vista for backward compatibility. An emulation layer is provided that converts between either version of the API and the opposite version of the DDI:

    If the graphics driver conforms to the Windows Display Driver Model (WDDM), DXVA 1 API calls are converted to DXVA 2 DDI calls.

    If the graphics drivers uses the older Windows XP Display Driver Model (XPDM), DXVA 2 API calls are converted to DXVA 1 DDI calls.

Since you are running Win7 you should be OK but since the driver is XP you are probably not getting the conversion because it is changing it back to DXVA 1 and causing the error. It is probably stuck in a conversion loop or the decoder may not even be accessing the API. Since it sees an XP driver doing  DXVA 1 trying to run something in DXVA2 and then trying to change it back.

I hope this helps,

-Michael

0 Kudos
Letian_Yi
Beginner
754 Views

Got it!
So the best way to fix these issue is updating the driver from XDDM to WDDM for win7.

Thanks!

0 Kudos
Reply