Author: sgasiorek
Date: Sat Jun 24 13:53:22 2017
New Revision: 75182
URL:
http://svn.reactos.org/svn/reactos?rev=75182&view=rev
Log:
[DXG] Initial implementation of DxDdLock and better stub for DxDdUnlock
Added:
trunk/reactos/win32ss/reactx/dxg/ddsurf.c (with props)
Modified:
trunk/reactos/sdk/include/reactos/drivers/directx/directxint.h
trunk/reactos/win32ss/reactx/dxg/CMakeLists.txt
trunk/reactos/win32ss/reactx/dxg/dxg_driver.h
trunk/reactos/win32ss/reactx/dxg/dxg_int.h
Modified: trunk/reactos/sdk/include/reactos/drivers/directx/directxint.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/reactos/driver…
==============================================================================
--- trunk/reactos/sdk/include/reactos/drivers/directx/directxint.h [iso-8859-1]
(original)
+++ trunk/reactos/sdk/include/reactos/drivers/directx/directxint.h [iso-8859-1] Sat Jun 24
13:53:22 2017
@@ -24,8 +24,8 @@
/* 0x2C */ FLONG fl;
/* 0x30 */ struct _EDD_DIRECTDRAW_LOCAL *peDirectDrawLocal_prev; // verified to match
Windows XP,
// points to the old
DDLocal when new handle is created.
-/* 0x34 */ ULONG unk_034;
-/* 0x38 */ ULONG unk_038;
+/* 0x34 */ FLATPTR fpProcess2; // surface memory
address returned by graphic driver
+/* 0x38 */ ULONG isMemoryMapped; // surface memory
mapped?
/* 0x3C */ HANDLE UniqueProcess;
/* 0x40 */ PEPROCESS Process;
/* 0x44 */ VOID *unk_044;
Modified: trunk/reactos/win32ss/reactx/dxg/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/dxg/CMakeLi…
==============================================================================
--- trunk/reactos/win32ss/reactx/dxg/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/win32ss/reactx/dxg/CMakeLists.txt [iso-8859-1] Sat Jun 24 13:53:22 2017
@@ -7,6 +7,7 @@
d3d.c
dd.c
ddraw.c
+ ddsurf.c
eng.c
historic.c
dxg_int.h)
Added: trunk/reactos/win32ss/reactx/dxg/ddsurf.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/dxg/ddsurf.…
==============================================================================
--- trunk/reactos/win32ss/reactx/dxg/ddsurf.c (added)
+++ trunk/reactos/win32ss/reactx/dxg/ddsurf.c [iso-8859-1] Sat Jun 24 13:53:22 2017
@@ -0,0 +1,100 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS kernel
+ * PURPOSE: Native driver for dxg implementation
+ * FILE: win32ss/reactx/dxg/ddsurf.c
+ * PROGRAMER: Sebastian Gasiorek (sebastian.gasiorek(a)reactos.org)
+ */
+
+/*++
+* @name DxDdLock
+* @implemented
+*
+* The function DxDdLock locks the surface and calls
+* MapMemory driver function to assign surface memory.
+* Surface memory is returned in mapMemoryData.fpProcess variable
+*
+* @param HANDLE hSurface
+* Handle to DirectDraw surface
+*
+* @param PDD_LOCKDATA puLockData
+* Structure with lock details
+*
+* @param HDC hdcClip
+* Reserved
+*
+* @return
+* Returns DDHAL_DRIVER_HANDLED or DDHAL_DRIVER_NOTHANDLED.
+*
+* @remarks.
+* Missing lock data and error handling.
+*--*/
+DWORD
+NTAPI
+DxDdLock(HANDLE hSurface,
+ PDD_LOCKDATA puLockData,
+ HDC hdcClip)
+{
+ PEDD_SURFACE pSurface;
+ PEDD_DIRECTDRAW_LOCAL peDdL;
+ PEDD_DIRECTDRAW_GLOBAL peDdGl;
+ DD_MAPMEMORYDATA mapMemoryData;
+
+ pSurface = (PEDD_SURFACE)DdHmgLock(hSurface, ObjType_DDSURFACE_TYPE, TRUE);
+ peDdL = pSurface->peDirectDrawLocal;
+ peDdGl = peDdL->peDirectDrawGlobal2;
+
+ // Map memory if it's not already mapped and driver function is provided
+ if (!peDdL->isMemoryMapped && (peDdGl->ddCallbacks.dwFlags &
DDHAL_CB32_MAPMEMORY))
+ {
+ mapMemoryData.bMap = 1;
+ mapMemoryData.hProcess = (HANDLE)-1;
+ mapMemoryData.fpProcess = 0;
+ mapMemoryData.lpDD = (PDD_DIRECTDRAW_GLOBAL)peDdGl;
+
+ peDdGl->ddCallbacks.MapMemory(&mapMemoryData);
+
+ if (!mapMemoryData.ddRVal)
+ {
+ peDdL->isMemoryMapped = 1;
+ peDdL->fpProcess2 = mapMemoryData.fpProcess;
+ }
+ }
+
+ if (pSurface)
+ {
+ InterlockedExchangeAdd((LONG*)&pSurface->pobj.cExclusiveLock,
0xFFFFFFFF);
+ }
+
+ puLockData->ddRVal = DD_OK;
+
+ return DDHAL_DRIVER_HANDLED;
+}
+
+/*++
+* @name DxDdUnlock
+* @unimplemented
+*
+* The function DxDdUnlock releases the lock from specified surface
+*
+* @param HANDLE hSurface
+* Handle to DirectDraw surface
+*
+* @param PDD_UNLOCKDATA puUnlockData
+* Structure with lock details
+*
+* @return
+* Returns DDHAL_DRIVER_HANDLED or DDHAL_DRIVER_NOTHANDLED.
+*
+* @remarks.
+* Stub
+*--*/
+DWORD
+NTAPI
+DxDdUnlock(HANDLE hSurface,
+ PDD_UNLOCKDATA puUnlockData)
+{
+ puUnlockData->ddRVal = DD_OK;
+
+ return DDHAL_DRIVER_HANDLED;
+}
Propchange: trunk/reactos/win32ss/reactx/dxg/ddsurf.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/win32ss/reactx/dxg/dxg_driver.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/dxg/dxg_dri…
==============================================================================
--- trunk/reactos/win32ss/reactx/dxg/dxg_driver.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/reactx/dxg/dxg_driver.h [iso-8859-1] Sat Jun 24 13:53:22 2017
@@ -345,15 +345,6 @@
DWORD
NTAPI
-DxDdLock(
- PVOID p1)
-{
- TRACE();
- return 0;
-}
-
-DWORD
-NTAPI
DxDdLockD3D(
PVOID p1,
PVOID p2)
@@ -459,15 +450,6 @@
DxDdUnattachSurface(
PVOID p1,
PVOID p2)
-{
- TRACE();
- return 0;
-}
-
-DWORD
-NTAPI
-DxDdUnlock(
- PVOID p1)
{
TRACE();
return 0;
Modified: trunk/reactos/win32ss/reactx/dxg/dxg_int.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/dxg/dxg_int…
==============================================================================
--- trunk/reactos/win32ss/reactx/dxg/dxg_int.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/reactx/dxg/dxg_int.h [iso-8859-1] Sat Jun 24 13:53:22 2017
@@ -202,6 +202,8 @@
DWORD NTAPI DxDdReenableDirectDrawObject(HANDLE DdHandle, PVOID p2);
DWORD NTAPI DxDdCanCreateSurface(HANDLE DdHandle, PDD_CANCREATESURFACEDATA SurfaceData);
DWORD NTAPI DxDdCanCreateD3DBuffer(HANDLE DdHandle, PDD_CANCREATESURFACEDATA
SurfaceData);
+DWORD NTAPI DxDdLock(HANDLE hSurface, PDD_LOCKDATA puLockData, HDC hdcClip);
+DWORD NTAPI DxDdUnlock(HANDLE hSurface, PDD_UNLOCKDATA puUnlockData);
/* Internal functions */