Author: greatlrd
Date: Sat Dec 11 12:24:59 2010
New Revision: 50008
URL: http://svn.reactos.org/svn/reactos?rev=50008&view=rev
Log:
fix few dx bugs and comment how dxg calling order
Modified:
branches/reactx/reactos/drivers/video/displays/framebuf/ddenable.c
Modified: branches/reactx/reactos/drivers/video/displays/framebuf/ddenable.c
URL: http://svn.reactos.org/svn/reactos/branches/reactx/reactos/drivers/video/di…
==============================================================================
--- branches/reactx/reactos/drivers/video/displays/framebuf/ddenable.c [iso-8859-1] (original)
+++ branches/reactx/reactos/drivers/video/displays/framebuf/ddenable.c [iso-8859-1] Sat Dec 11 12:24:59 2010
@@ -62,7 +62,7 @@
// pCallBacks->WaitForVerticalBlank = (PDD_WAITFORVERTICALBLANK) DdWaitForVerticalBlank;
// pCallBacks->CreatePalette = (PDD_CREATEPALETTE) DdCreatePalette;
// pCallBacks->GetScanLine = (PDD_GETSCANLINE) DdGetScanLine;
-
+
/* Unused on Microsoft Windows 2000 and later and should be ignored by the driver. '
pCallBacks->DestroyDriver
@@ -76,7 +76,7 @@
memset(pSurfaceCallBacks,0,sizeof(DD_SURFACECALLBACKS));
/* FILL pSurfaceCallBacks with hal stuff */
- // pSurfaceCallBacks->dwSize = sizeof(DDHAL_DDSURFACECALLBACKS);
+ pSurfaceCallBacks->dwSize = sizeof(DDHAL_DDSURFACECALLBACKS);
// DDHAL_SURFCB32_DESTROYSURFACE |
// DDHAL_SURFCB32_FLIP |
// DDHAL_SURFCB32_LOCK |
@@ -111,6 +111,23 @@
return ppdev->bDDInitialized;
}
+/*
+ * Note DrvGetDirectDrawInfo
+ * ms dxg.sys call DrvGetDirectDrawInfo before it call DrvEnableDirectDraw
+ * so we can not check if the drv have enable the directx or not
+ *
+ * Optimze tip ms dxg.sys frist time it call on this api the
+ * pdwNumHeaps and pdwFourCC is NULL,
+ * next time it call it have alloc memmory for them
+ * in the EDD_DIRECTDRAW_GLOBAL in their memory
+ * pdwFourCC have pool tag 'fddG' and
+ * pvmList have pool tag 'vddG'
+ * so we only need fill pHalInfo,pdwNumHeaps,pdwNumFourCCCodes in the
+ * frist call.
+ *
+ * Importet do not forget to fill in pHalInfo->vmiData.pvPrimary if we
+ * forget that no directx hardware acclartions.
+ */
BOOL APIENTRY
DrvGetDirectDrawInfo(
IN DHPDEV dhpdev,
@@ -121,39 +138,33 @@
OUT DWORD *pdwFourCC)
{
PPDEV ppdev = (PPDEV)dhpdev;
- DWORD heap = 1; /* we always alloc one heap */
- BOOL bDDrawHeap = FALSE;
-
- if (ppdev->bDDInitialized == FALSE);
- {
- return FALSE;
- }
-
- /* Setup heap */
- if ( (ppdev->ScreenWidth < ppdev->MemWidth) || (ppdev->ScreenHeight < ppdev->MemHeight))
- {
- bDDrawHeap = TRUE;
- heap++;
- }
-
- ppdev->dwHeap = heap;
- *pdwNumHeaps = heap;
-
- /* We do not support other fourcc */
- *pdwNumFourCCCodes = 0;
/*
- check see if pvmList and pdwFourCC are frist call
- or frist. Secon call we fill in pHalInfo info
+ check see if it is our frist call
+ if it is fill pHalInfo and pdwNumHeaps and pdwNumFourCCCodes.
+
+ if it our second call we must fill in pdwFourCC or pvmList
+ if one or two of them have been set.
+
+ But we do not support heap or any fourcc so we skipp it
*/
- if(!(pvmList && pdwFourCC))
- {
+ if( (!pvmList) && (!pdwFourCC) )
+ {
+ /* Setup heap */
+ ppdev->dwHeap = 0;
+ *pdwNumHeaps = 0;
+
+ /* We do not support other fourcc */
+ *pdwNumFourCCCodes = 0;
+
+
+ /* not document ms dxg.sys call this api twice, frist time it call, the pvmList and pdwFourCC is NULL */
RtlZeroMemory(pHalInfo, sizeof(DD_HALINFO));
pHalInfo->dwSize = sizeof(DD_HALINFO);
- pHalInfo->ddCaps.dwCaps = DDCAPS_NOHARDWARE;
+ pHalInfo->ddCaps.dwCaps = 0;
/* we do not support all this caps
pHalInfo->ddCaps.dwCaps = DDCAPS_BLT | DDCAPS_BLTQUEUE | DDCAPS_BLTCOLORFILL | DDCAPS_READSCANLINE |
DDCAPS_BLTSTRETCH | DDCAPS_COLORKEY | DDCAPS_CANBLTSYSMEM;
@@ -180,6 +191,8 @@
pHalInfo->ddCaps.dwVidMemTotal = (ppdev->MemHeight - ppdev->ScreenHeight) * ppdev->ScreenDelta;
/* fill in some basic info that we need */
+
+ /* if we do not fill in pHalInfo->vmiData.pvPrimary dxg.sys will not activate the dx */
pHalInfo->vmiData.pvPrimary = ppdev->ScreenPtr;
pHalInfo->vmiData.dwDisplayWidth = ppdev->ScreenWidth;
pHalInfo->vmiData.dwDisplayHeight = ppdev->ScreenHeight;
@@ -203,29 +216,6 @@
}
}
- /* Now build pvmList info */
- if(pvmList)
- {
- ppdev->pvmList = pvmList;
-
- if ( bDDrawHeap == TRUE)
- {
- pvmList->dwFlags = VIDMEM_ISLINEAR ;
- pvmList->fpStart = ppdev->ScreenHeight * ppdev->ScreenDelta;
- pvmList->fpEnd = ppdev->MemHeight * ppdev->ScreenDelta - 1;
- pvmList->ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
- pvmList++;
- }
-
- pvmList->fpStart = 0;
- pvmList->fpEnd = (ppdev->MemHeight * ppdev->ScreenDelta) - 1;
- pvmList->dwFlags = VIDMEM_ISNONLOCAL | VIDMEM_ISLINEAR | VIDMEM_ISWC;
- pvmList->ddsCaps.dwCaps = DDSCAPS_FRONTBUFFER | DDSCAPS_BACKBUFFER ;
- pvmList->ddsCapsAlt.dwCaps = DDSCAPS_FRONTBUFFER | DDSCAPS_BACKBUFFER;
-
- pvmList = ppdev->pvmList;
- }
-
return TRUE;
}
Author: greatlrd
Date: Fri Dec 10 11:08:37 2010
New Revision: 50002
URL: http://svn.reactos.org/svn/reactos?rev=50002&view=rev
Log:
intEnableReactXDriver
Primary surface have been rewriten in win32k
ppdev does not alloc edd_directx_global struct
any more, that is not a problem we doing it here
instead. it alloc it when it is need it. not before
Modified:
branches/reactx/reactos/subsystems/win32/win32k/ntddraw/ddraw.c
Modified: branches/reactx/reactos/subsystems/win32/win32k/ntddraw/ddraw.c
URL: http://svn.reactos.org/svn/reactos/branches/reactx/reactos/subsystems/win32…
==============================================================================
--- branches/reactx/reactos/subsystems/win32/win32k/ntddraw/ddraw.c [iso-8859-1] (original)
+++ branches/reactx/reactos/subsystems/win32/win32k/ntddraw/ddraw.c [iso-8859-1] Fri Dec 10 11:08:37 2010
@@ -39,8 +39,6 @@
PGD_DXDDENABLEDIRECTDRAW pfnDdEnableDirectDraw = NULL;
BOOL success = FALSE;
- /* FIXME get the process data */
-
/* Do not try load dxg.sys when it have already been load once */
if (gpfnStartupDxGraphics == NULL)
{
@@ -60,6 +58,20 @@
}
pDev = pDC->ppdev;
+
+ /* This code should be where primary surface is create
+ but we save some memory use to alloc it when it is need it */
+ if (pDev->pEDDgpl == NULL)
+ {
+ pDev->pEDDgpl = ExAllocatePoolWithTag(PagedPool, sizeof(EDD_DIRECTDRAW_GLOBAL), TAG_EDDGBL);
+ if (!pDev->pEDDgpl)
+ {
+ DPRINT1("Warning : Failed to allocate memmory for EDD_DIRECTDRAW_GLOBAL\n");
+ DC_UnlockDc(pDC);
+ return FALSE;
+ }
+ RtlZeroMemory( pDev->pEDDgpl ,sizeof(EDD_DIRECTDRAW_GLOBAL));
+ }
/* test see if drv got a dx interface or not */
if ( ( pDev->DriverFunctions.DisableDirectDraw == NULL) ||
@@ -69,8 +81,7 @@
}
else
{
-
- /* CHeck see if dx have been enable or not */
+ /* Check see if dx have been enable or not */
if ( pDev->pEDDgpl->pvmList == NULL)
{
pDev->pEDDgpl->ddCallbacks.dwSize = sizeof(DD_CALLBACKS);
@@ -98,7 +109,6 @@
success = TRUE;
}
}
-
DPRINT1("Return value : 0x%08x\n",success);
DC_UnlockDc(pDC);