Author: greatlrd
Date: Mon Mar 3 21:54:18 2008
New Revision: 32550
URL:
http://svn.reactos.org/svn/reactos?rev=3D32550&view=3Drev
Log:
implemented DdCreateD3DBuffer callbacks and some cleanup
Modified:
trunk/reactos/dll/win32/gdi32/misc/gdientry.c
Modified: trunk/reactos/dll/win32/gdi32/misc/gdientry.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/=
gdientry.c?rev=3D32550&r1=3D32549&r2=3D32550&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/dll/win32/gdi32/misc/gdientry.c (original)
+++ trunk/reactos/dll/win32/gdi32/misc/gdientry.c Mon Mar 3 21:54:18 2008
@@ -139,7 +139,7 @@
/* Call win32k */
return NtGdiDdLock((HANDLE)Lock->lpDDSurface->hDDSurface,
(PDD_LOCKDATA)Lock,
- (HANDLE)Lock->lpDDSurface->hDC);
+ (HANDLE)Lock->lpDDSurface->hDC);
}
=
/*
@@ -312,10 +312,10 @@
* we create the size activate this IF when you start doing the optim=
ze and please also
* take report from user which value they got here
*/ =
-#if 0
+#if 1
{
char buffer[1024]; \
- sprintf ( buffer, "Function %s : Optimze max to %d Surface ? (%s:%=
d)\n", __FUNCTION__,SurfaceCount,__FILE__,__LINE__ );
+ sprintf ( buffer, "Function %s : Optimze max to %d Surface ? (%s:%=
d)\n", __FUNCTION__, (int)SurfaceCount,__FILE__,__LINE__ );
OutputDebugStringA(buffer);
}
#endif
@@ -691,7 +691,7 @@
*/
=
HANDLE phSurfaceVideo[10];
- HANDLE phSurfaceVbi[10]; =
+ HANDLE phSurfaceVbi[10];
=
if (pDvdUpdateVideoPort->dwFlags !=3D DDRAWI_VPORTSTOP)
{
@@ -729,7 +729,7 @@
{
dwNumVBIAutoflip =3D 10;
}
- memcpy(phSurfaceVbi,pDvdUpdateVideoPort->lplpDDVBISurface,dwNu=
mVBIAutoflip*sizeof(HANDLE)); =
+ memcpy(phSurfaceVbi,pDvdUpdateVideoPort->lplpDDVBISurface,dwNu=
mVBIAutoflip*sizeof(HANDLE));
} =
}
=
@@ -761,7 +761,6 @@
return NtGdiDvpGetVideoPortInputFormats(pDvdGetVideoPortInputFormat->l=
pVideoPort->hDDVideoPort, (PDD_GETVPORTINPUTFORMATDATA) pDvdGetVideoPortInp=
utFormat);
}
=
-
/*
* @implemented
*
@@ -786,7 +785,6 @@
return NtGdiDvpGetVideoPortLine(pDvdGetVideoPortOutputFormat->lpVideoP=
ort->hDDVideoPort, (PDD_GETVPORTLINEDATA)pDvdGetVideoPortOutputFormat);
}
=
-
/*
* @implemented
*
@@ -824,7 +822,7 @@
=
if (pDdAlphaBlt->lpDDSrcSurface !=3D 0)
{
- hDDSrcSurface =3D (HANDLE) pDdAlphaBlt->lpDDSrcSurface->hDDSurface=
; =
+ hDDSrcSurface =3D (HANDLE) pDdAlphaBlt->lpDDSrcSurface->hDDSurface;
}
=
return NtGdiDdAlphaBlt((HANDLE)pDdAlphaBlt->lpDDDestSurface->hDDSurfac=
e, hDDSrcSurface, (PDD_BLTDATA)&pDdAlphaBlt);
@@ -841,7 +839,7 @@
{
pDdCreateSurfaceEx->ddRVal =3D NtGdiDdCreateSurfaceEx( GetDdHandle(pDd=
CreateSurfaceEx->lpDDLcl->lpGbl-
hDD),
(HANDLE)pDdCreate=
SurfaceEx->lpDDSLcl->hDDSurface, =
- pDdCreateSurfaceE=
x->lpDDSLcl->lpSurfMore->dwSurfaceHandle); =
+ pDdCreateSurfaceE=
x->lpDDSLcl->lpSurfMore->dwSurfaceHandle);
return TRUE;
}
=
@@ -857,7 +855,6 @@
return NtGdiDdColorControl( (HANDLE) pDdColorControl->lpDDSurface->hDD=
Surface, (PDD_COLORCONTROLDATA) &pDdColorControl);
}
=
-
/*
* @implemented
*
@@ -881,9 +878,6 @@
{
return NtGdiDdFlipToGDISurface( GetDdHandle(pDdFlipToGDISurface->lpDD-=
hDD), (PDD_FLIPTOGDISURFACEDATA)
&pDdFlipToGDISurface);
}
-
-
-
=
/* TODO */
DWORD
@@ -896,7 +890,7 @@
=
/* FIXME add SEH around this functions */
=
- RtlZeroMemory(&pDrvInfoData, sizeof (DDHAL_GETDRIVERINFODATA)); =
=
+ RtlZeroMemory(&pDrvInfoData, sizeof (DDHAL_GETDRIVERINFODATA));
RtlCopyMemory(&pDrvInfoData.guidInfo, &pData->guidInfo, sizeof(GUI=
D));
=
hDD =3D GetDdHandle(pData->dwContext);
@@ -910,15 +904,15 @@
if (IsEqualGUID(&pData->guidInfo, &GUID_VideoPortCallbacks))
{ =
DDHAL_DDVIDEOPORTCALLBACKS pDvdPort;
- DDHAL_DDVIDEOPORTCALLBACKS* pUserDvdPort =3D (DDHAL_DDVIDEOPOR=
TCALLBACKS *)pData->lpvData; =
+ DDHAL_DDVIDEOPORTCALLBACKS* pUserDvdPort =3D (DDHAL_DDVIDEOPOR=
TCALLBACKS *)pData->lpvData;
=
/* Clear internal out buffer and set it up*/
RtlZeroMemory(&pDvdPort, DDVIDEOPORTCALLBACKSSIZE);
pDvdPort.dwSize =3D DDVIDEOPORTCALLBACKSSIZE;
=
- /* set up internal buffer */ =
=
- pDrvInfoData.lpvData =3D (PVOID)&pDvdPort; =
- pDrvInfoData.dwExpectedSize =3D DDVIDEOPORTCALLBACKSSIZE ; =
+ /* set up internal buffer */
+ pDrvInfoData.lpvData =3D (PVOID)&pDvdPort;
+ pDrvInfoData.dwExpectedSize =3D DDVIDEOPORTCALLBACKSSIZE ;
=
/* Call win32k */
retValue =3D NtGdiDdGetDriverInfo(hDD, (PDD_GETDRIVERINFODATA)=
&pDrvInfoData);
@@ -1011,19 +1005,19 @@
RtlZeroMemory(&pColorControl, DDCOLORCONTROLCALLBACKSSIZE);
pColorControl.dwSize =3D DDCOLORCONTROLCALLBACKSSIZE;
=
- /* set up internal buffer */ =
=
- pDrvInfoData.lpvData =3D (PVOID)&pColorControl; =
- pDrvInfoData.dwExpectedSize =3D DDCOLORCONTROLCALLBACKSSIZE ; =
- =
+ /* set up internal buffer */
+ pDrvInfoData.lpvData =3D (PVOID)&pColorControl;
+ pDrvInfoData.dwExpectedSize =3D DDCOLORCONTROLCALLBACKSSIZE ;
+
/* Call win32k */
retValue =3D NtGdiDdGetDriverInfo(hDD, (PDD_GETDRIVERINFODATA)=
&pDrvInfoData);
- =
+
pData->dwActualSize =3D DDCOLORCONTROLCALLBACKSSIZE;
pData->dwFlags =3D pDrvInfoData.dwFlags;
=
pUserColorControl->dwSize =3D DDCOLORCONTROLCALLBACKSSIZE;
pUserColorControl->dwFlags =3D pUserColorControl->dwFlags;
- =
+
if (pColorControl.ColorControl !=3D NULL)
{
pUserColorControl->ColorControl =3D (LPDDHALCOLORCB_COLORC=
ONTROL) DdColorControl;
@@ -1042,15 +1036,15 @@
{
DDHAL_DDMISCELLANEOUSCALLBACKS pMisc;
DDHAL_DDMISCELLANEOUSCALLBACKS* pUserMisc =3D (DDHAL_DDMISCELL=
ANEOUSCALLBACKS *)pData->lpvData;
- =
+
/* Clear internal out buffer and set it up*/
RtlZeroMemory(&pMisc, DDMISCELLANEOUSCALLBACKSSIZE);
pMisc.dwSize =3D DDMISCELLANEOUSCALLBACKSSIZE;
=
- /* set up internal buffer */ =
=
- pDrvInfoData.lpvData =3D (PVOID)&pMisc; =
- pDrvInfoData.dwExpectedSize =3D DDMISCELLANEOUSCALLBACKSSIZE ;=
=
- =
+ /* set up internal buffer */
+ pDrvInfoData.lpvData =3D (PVOID)&pMisc;
+ pDrvInfoData.dwExpectedSize =3D DDMISCELLANEOUSCALLBACKSSIZE ;
+
/* Call win32k */
retValue =3D NtGdiDdGetDriverInfo(hDD, (PDD_GETDRIVERINFODATA)=
&pDrvInfoData);
=
@@ -1083,9 +1077,9 @@
RtlZeroMemory(&pMisc, DDMISCELLANEOUS2CALLBACKSSIZE);
pMisc.dwSize =3D DDMISCELLANEOUS2CALLBACKSSIZE;
=
- /* set up internal buffer */ =
=
- pDrvInfoData.lpvData =3D (PVOID)&pMisc; =
- pDrvInfoData.dwExpectedSize =3D DDMISCELLANEOUS2CALLBACKSSIZE =
; =
+ /* set up internal buffer */
+ pDrvInfoData.lpvData =3D (PVOID)&pMisc;
+ pDrvInfoData.dwExpectedSize =3D DDMISCELLANEOUS2CALLBACKSSIZE ;
=
/* Call win32k */
retValue =3D NtGdiDdGetDriverInfo(hDD, (PDD_GETDRIVERINFODATA)=
&pDrvInfoData);
@@ -1133,9 +1127,9 @@
RtlZeroMemory(&pNtKernel, sizeof(DD_NTCALLBACKS));
pNtKernel.dwSize =3D sizeof(DD_NTCALLBACKS);
=
- /* set up internal buffer */ =
=
- pDrvInfoData.lpvData =3D (PVOID)&pNtKernel; =
- pDrvInfoData.dwExpectedSize =3D sizeof(DD_NTCALLBACKS) ; =
+ /* set up internal buffer */
+ pDrvInfoData.lpvData =3D (PVOID)&pNtKernel;
+ pDrvInfoData.dwExpectedSize =3D sizeof(DD_NTCALLBACKS) ;
=
/* Call win32k */
retValue =3D NtGdiDdGetDriverInfo(hDD, (PDD_GETDRIVERINFODATA)=
&pDrvInfoData);
@@ -1143,11 +1137,11 @@
pData->dwActualSize =3D sizeof(DD_NTCALLBACKS);
=
pUserNtKernel->dwSize =3D sizeof(DD_NTCALLBACKS);
- pUserNtKernel->dwFlags =3D pNtKernel.dwFlags; =
+ pUserNtKernel->dwFlags =3D pNtKernel.dwFlags;
pUserNtKernel->FreeDriverMemory =3D 0;
- =
+
if (pNtKernel.SetExclusiveMode)
- { =
+ {
pUserNtKernel->SetExclusiveMode =3D (PDD_SETEXCLUSIVEMODE)=
DdSetExclusiveMode; =
}
=
@@ -1161,7 +1155,7 @@
* ReactOS keep this behoir to be compatible with
* Windows XP
*/
- pData->ddRVal =3D retValue; =
+ pData->ddRVal =3D retValue;
}
=
/* D3D Callbacks version 2 check and setup for DirectX/ ReactX */
@@ -1196,15 +1190,15 @@
else
{
/* set up internal buffer */ =
- pDrvInfoData.dwExpectedSize =3D pData->dwExpectedSize; =
+ pDrvInfoData.dwExpectedSize =3D pData->dwExpectedSize;
pDrvInfoData.lpvData =3D pData->lpvData;
=
/* We do not cover all callbacks for user mode, they are only =
cover by kmode */
retValue =3D NtGdiDdGetDriverInfo(hDD, (PDD_GETDRIVERINFODATA)=
&pDrvInfoData);
=
- /* Setup return data */ =
+ /* Setup return data */
pData->dwActualSize =3D pDrvInfoData.dwActualSize;
- pData->lpvData =3D pDrvInfoData.lpvData; =
+ pData->lpvData =3D pDrvInfoData.lpvData;
/* Windows XP never repot back the true return value, =
* it only report back if we have a driver or not
* ReactOS keep this behoir to be compatible with
@@ -1235,10 +1229,9 @@
=
return NtGdiD3dContextCreate(GetDdHandle(pdcci->lpDDLcl->hDD), =
(HANDLE)pdcci->lpDDSLcl->hDDSurface,
- hSurfZ, =
- (D3DNTHAL_CONTEXTCREATEI *)pdcci); =
-}
-
+ hSurfZ,
+ (D3DNTHAL_CONTEXTCREATEI *)pdcci);
+}
=
/*
* @implemented
@@ -1262,24 +1255,73 @@
}
=
=
-/* TODO : finish all fixme */ =
+/*
+ * @implemented
+ *
+ * DdCreateD3DBuffer
+ */
DWORD
WINAPI
DdCreateD3DBuffer(LPDDHAL_CREATESURFACEDATA pCreateSurface)
{
-
+ HANDLE puhSurface =3D 0;
+ DDRAWI_DDRAWSURFACE_GBL *pSurfGBL;
+ DDRAWI_DDRAWSURFACE_LCL *pSurfLcl;
DD_SURFACE_GLOBAL puSurfaceGlobalData;
DD_SURFACE_MORE puSurfaceMoreData;
DD_SURFACE_LOCAL puSurfaceLocalData;
- =
- memset(&puSurfaceGlobalData, 0, sizeof(DD_SURFACE_GLOBAL) );
- memset(&puSurfaceMoreData, 0, sizeof(DD_SURFACE_MORE) ) ;
- memset(&puSurfaceLocalData, 0, sizeof(DD_SURFACE_LOCAL) );
- =
- /* FIXME convert the struct to right ones and setup for syscall, then =
retranslated the info back to pCreateSurface */
-
- /* FIXME not supported yet */
- return 0;
+ DWORD retValue;
+
+ /* Zero all local memory pointer */
+ RtlZeroMemory(&puSurfaceGlobalData, sizeof(DD_SURFACE_GLOBAL) );
+ RtlZeroMemory(&puSurfaceMoreData, sizeof(DD_SURFACE_MORE) ) ;
+ RtlZeroMemory(&puSurfaceLocalData, sizeof(DD_SURFACE_LOCAL) );
+
+ pCreateSurface->dwSCnt =3D 1;
+ pSurfLcl =3D pCreateSurface->lplpSList[0];
+ pSurfGBL =3D pSurfLcl->lpGbl;
+
+ /* Convert DDRAWI_DDRAWSURFACE_GBL to DD_SURFACE_GLOBAL */
+ puSurfaceGlobalData.wWidth =3D pSurfGBL->wWidth;
+ puSurfaceGlobalData.wHeight =3D pSurfGBL->wHeight;
+ puSurfaceGlobalData.dwLinearSize =3D pSurfGBL->dwLinearSize;
+ puSurfaceGlobalData.fpVidMem =3D pSurfGBL->fpVidMem;
+ puSurfaceGlobalData.dwBlockSizeX =3D pSurfGBL->dwBlockSizeX;
+ puSurfaceGlobalData.dwBlockSizeY =3D pSurfGBL->dwBlockSizeY;
+
+ /* Convert DDRAWI_DDRAWSURFACE_MORE to DD_SURFACE_MORE */
+ puSurfaceMoreData.dwSurfaceHandle =3D pSurfLcl->lpSurfMore->dwSurfaceH=
andle;
+ puSurfaceMoreData.ddsCapsEx.dwCaps2 =3D pSurfLcl->lpSurfMore->ddsCapsE=
x.dwCaps2;
+ puSurfaceMoreData.ddsCapsEx.dwCaps3 =3D pSurfLcl->lpSurfMore->ddsCapsE=
x.dwCaps3;
+ puSurfaceMoreData.ddsCapsEx.dwCaps4 =3D pSurfLcl->lpSurfMore->ddsCapsE=
x.dwCaps4;
+
+ /* Convert DDRAWI_DDRAWSURFACE_LCL to DD_SURFACE_LOCAL */
+ puSurfaceLocalData.dwFlags =3D pSurfLcl->dwFlags;
+ puSurfaceLocalData.ddsCaps.dwCaps =3D pSurfLcl->ddsCaps.dwCaps;
+
+ /* Call win32k */
+ retValue =3D NtGdiDdCreateD3DBuffer( GetDdHandle(pCreateSurface->lpDD-=
hDD),
+
(HANDLE*)&pSurfLcl->hDDSurface,
+ pCreateSurface->lpDDSurfaceDesc,
+ &puSurfaceGlobalData,
+ &puSurfaceLocalData,
+ &puSurfaceMoreData,
+ (DD_CREATESURFACEDATA *) pCreateSur=
face,
+ &puhSurface);
+
+ /* Setup surface handle if we got one back */
+ if ( puhSurface !=3D NULL )
+ {
+ pCreateSurface->lplpSList[0]->hDDSurface =3D (ULONG_PTR)puhSurface;
+ }
+
+ /* Convert DD_SURFACE_GLOBAL to DDRAWI_DDRAWSURFACE_GBL */
+ pSurfGBL->dwLinearSize =3D puSurfaceGlobalData.dwLinearSize;
+ pSurfGBL->fpVidMem =3D puSurfaceGlobalData.fpVidMem;
+ pSurfGBL->dwBlockSizeX =3D puSurfaceGlobalData.dwBlockSizeX;
+ pSurfGBL->dwBlockSizeY =3D puSurfaceGlobalData.dwBlockSizeY;
+
+ return retValue;
}
=
/*
@@ -1294,6 +1336,7 @@
DWORD retValue =3D 0;
if ( pDestroySurface->lpDDSurface->hDDSurface)
{
+ /* Call win32k */
retValue =3D NtGdiDdDestroyD3DBuffer((HANDLE)pDestroySurface->lpDD=
Surface->hDDSurface);
}
=