Author: greatlrd Date: Sun Mar 25 14:53:05 2007 New Revision: 26164
URL: http://svn.reactos.org/svn/reactos?rev=26164&view=rev Log: Fixing smaller bugs in dx after some analyzing how vmware drv works.
1. vmware drv do not implement DrvGetDirectDrawInfo that show windows 2000/XP/2003 that mean u are not force to implement this api in the drv, only INDEX_DrvEnableDirectDraw and INDEX_DrvDisableDirectDraw are req to be implement in the driver.
Modified: trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c trunk/reactos/subsystems/win32/win32k/ntddraw/ddsurf.c
Modified: trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntd... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c Sun Mar 25 14:53:05 2007 @@ -85,99 +85,101 @@ * but we get back how many pvmList it whant we should alloc, same * with pdwFourCC. */ - success = pDirectDraw->DrvGetDirectDrawInfo( pDirectDraw->Global.dhpdev, - &HalInfo, - &pDirectDraw->dwNumHeaps, - NULL, - &pDirectDraw->dwNumFourCC, - NULL); - if (!success) - { - DPRINT1("DrvGetDirectDrawInfo frist call fail\n"); - GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); - return FALSE; - } - - - - /* The driver are not respnose to alloc the memory for pvmList - * but it is win32k responsible todo, Windows 9x it is gdi32.dll - */ - if (pDirectDraw->dwNumHeaps != 0) - { - pDirectDraw->pvmList = (PVIDEOMEMORY) ExAllocatePoolWithTag(PagedPool, pDirectDraw->dwNumHeaps * sizeof(VIDEOMEMORY), TAG_DXPVMLIST); - if (pDirectDraw->pvmList == NULL) - { - return FALSE; - } - } - - /* The driver are not respnose to alloc the memory for pdwFourCC - * but it is win32k responsible todo, Windows 9x it is gdi32.dll - */ - - if (pDirectDraw->dwNumFourCC != 0) - { - pDirectDraw->pdwFourCC = (LPDWORD) ExAllocatePoolWithTag(PagedPool, pDirectDraw->dwNumFourCC * sizeof(DWORD), TAG_DXFOURCC); - - if (pDirectDraw->pdwFourCC == NULL) - { - return FALSE; - } - } - - success = pDirectDraw->DrvGetDirectDrawInfo( pDirectDraw->Global.dhpdev, - &HalInfo, - &pDirectDraw->dwNumHeaps, - pDirectDraw->pvmList, - &pDirectDraw->dwNumFourCC, - pDirectDraw->pdwFourCC); - if (!success) - { - DPRINT1("DrvGetDirectDrawInfo second call fail\n"); - GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); - return FALSE; - } - - - /* We need now convert the DD_HALINFO we got, it can be NT4 driver we - * loading ReactOS supporting NT4 and higher to be loading.so we make - * the HALInfo compatible here so we can easy pass it to gdi32.dll - * without converting it later - */ - - if ((HalInfo.dwSize != sizeof(DD_HALINFO)) && - (HalInfo.dwSize != sizeof(DD_HALINFO_V4))) - { - DPRINT1(" Fail not vaild driver DD_HALINFO struct found\n"); - GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); - return FALSE; - } - - if (HalInfo.dwSize != sizeof(DD_HALINFO)) - { - if (HalInfo.dwSize == sizeof(DD_HALINFO_V4)) - { - /* NT4 Compatible */ - DPRINT1("Got DD_HALINFO_V4 sturct we convert it to DD_HALINFO \n"); - HalInfo.dwSize = sizeof(DD_HALINFO); - HalInfo.lpD3DGlobalDriverData = NULL; - HalInfo.lpD3DHALCallbacks = NULL; - HalInfo.lpD3DBufCallbacks = NULL; - } - else - { - /* Unknown version found */ - DPRINT1(" Fail : did not get DD_HALINFO size \n"); - + if (pDirectDraw->DrvGetDirectDrawInfo) + { + DPRINT1("if u are using vmware driver and see this msg, please repot this\n"); + success = pDirectDraw->DrvGetDirectDrawInfo( pDirectDraw->Global.dhpdev, + &HalInfo, + &pDirectDraw->dwNumHeaps, + NULL, + &pDirectDraw->dwNumFourCC, + NULL); + if (!success) + { + DPRINT1("DrvGetDirectDrawInfo frist call fail\n"); GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return FALSE; }
- /* Copy it to user mode pointer the data */ - RtlCopyMemory(&pDirectDraw->Hal, &HalInfo, sizeof(DD_HALINFO)); - } - + + /* The driver are not respnose to alloc the memory for pvmList + * but it is win32k responsible todo, Windows 9x it is gdi32.dll + */ + if (pDirectDraw->dwNumHeaps != 0) + { + pDirectDraw->pvmList = (PVIDEOMEMORY) ExAllocatePoolWithTag(PagedPool, pDirectDraw->dwNumHeaps * sizeof(VIDEOMEMORY), TAG_DXPVMLIST); + if (pDirectDraw->pvmList == NULL) + { + return FALSE; + } + } + + /* The driver are not respnose to alloc the memory for pdwFourCC + * but it is win32k responsible todo, Windows 9x it is gdi32.dll + */ + + if (pDirectDraw->dwNumFourCC != 0) + { + pDirectDraw->pdwFourCC = (LPDWORD) ExAllocatePoolWithTag(PagedPool, pDirectDraw->dwNumFourCC * sizeof(DWORD), TAG_DXFOURCC); + + if (pDirectDraw->pdwFourCC == NULL) + { + return FALSE; + } + } + success = pDirectDraw->DrvGetDirectDrawInfo( pDirectDraw->Global.dhpdev, + &HalInfo, + &pDirectDraw->dwNumHeaps, + pDirectDraw->pvmList, + &pDirectDraw->dwNumFourCC, + pDirectDraw->pdwFourCC); + if (!success) + { + DPRINT1("DrvGetDirectDrawInfo second call fail\n"); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); + return FALSE; + } + + + /* We need now convert the DD_HALINFO we got, it can be NT4 driver we + * loading ReactOS supporting NT4 and higher to be loading.so we make + * the HALInfo compatible here so we can easy pass it to gdi32.dll + * without converting it later + */ + + if ((HalInfo.dwSize != sizeof(DD_HALINFO)) && + (HalInfo.dwSize != sizeof(DD_HALINFO_V4))) + { + DPRINT1(" Fail not vaild driver DD_HALINFO struct found\n"); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); + return FALSE; + } + + if (HalInfo.dwSize != sizeof(DD_HALINFO)) + { + if (HalInfo.dwSize == sizeof(DD_HALINFO_V4)) + { + /* NT4 Compatible */ + DPRINT1("Got DD_HALINFO_V4 sturct we convert it to DD_HALINFO \n"); + HalInfo.dwSize = sizeof(DD_HALINFO); + HalInfo.lpD3DGlobalDriverData = NULL; + HalInfo.lpD3DHALCallbacks = NULL; + HalInfo.lpD3DBufCallbacks = NULL; + } + else + { + /* Unknown version found */ + DPRINT1(" Fail : did not get DD_HALINFO size \n"); + + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); + return FALSE; + } + + /* Copy it to user mode pointer the data */ + RtlCopyMemory(&pDirectDraw->Hal, &HalInfo, sizeof(DD_HALINFO)); + } + } + success = pDirectDraw->EnableDirectDraw( pDirectDraw->Global.dhpdev, &pDirectDraw->DD, &pDirectDraw->Surf, @@ -217,9 +219,8 @@ }
/* test see if drv got a dx interface or not */ - if (( pDC->DriverFunctions.GetDirectDrawInfo == NULL) || - ( pDC->DriverFunctions.DisableDirectDraw == NULL) || - ( pDC->DriverFunctions.EnableDirectDraw == NULL)) + if ( ( pDC->DriverFunctions.DisableDirectDraw == NULL) || + ( pDC->DriverFunctions.EnableDirectDraw == NULL)) { DC_UnlockDc(pDC); return NULL;
Modified: trunk/reactos/subsystems/win32/win32k/ntddraw/ddsurf.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntd... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntddraw/ddsurf.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntddraw/ddsurf.c Sun Mar 25 14:53:05 2007 @@ -82,6 +82,12 @@ }
Blt.ddRVal = DDERR_GENERIC; + + /* MSDN say this member is always set to FALSE in windows 2000 or higher */ + Blt.IsClipped = FALSE; + + /* MSDN say this member is always unuse in windows 2000 or higher */ + Blt.dwROPFlags = 0;
if (pDirectDraw->Surf.dwFlags & DDHAL_SURFCB32_BLT) {