606a9123e4dbd8067d8458005449b6a66ceb976d
[reactos.git] / reactos / drivers / directx / dxg / dxg_int.h
1
2 /* DDK/NDK/SDK Headers */
3 #include <ddk/ntddk.h>
4 #include <ddk/ntddmou.h>
5 #include <ddk/ntifs.h>
6 #include <ddk/tvout.h>
7 #include <ndk/ntndk.h>
8
9 /* Win32 Headers */
10 #define WINBASEAPI
11 #define STARTF_USESIZE 2
12 #define STARTF_USEPOSITION 4
13 #define INTERNAL_CALL NTAPI
14
15 #include <stdarg.h>
16 #include <windef.h>
17 #include <winerror.h>
18 #include <wingdi.h>
19 #include <winddi.h>
20 #include <prntfont.h>
21 #include <dde.h>
22
23 /* DXG treats this as opaque */
24 typedef PVOID PDC;
25 typedef PVOID PW32THREAD;
26
27 typedef struct _DD_BASEOBJECT
28 {
29 HGDIOBJ hHmgr;
30 ULONG ulShareCount;
31 USHORT cExclusiveLock;
32 USHORT BaseFlags;
33 PW32THREAD Tid;
34 } DD_BASEOBJECT, *PDD_BASEOBJECT;
35
36 #include <drivers/directx/directxint.h>
37 #include <drivers/directx/dxg.h>
38 #include <drivers/directx/dxeng.h>
39
40 #include "tags.h"
41
42 #define ObjType_DDSURFACE_TYPE 2
43 #define ObjType_DDVIDEOPORT_TYPE 4
44 #define ObjType_DDMOTIONCOMP_TYPE 5
45
46 typedef struct _DD_ENTRY
47 {
48 union
49 {
50 PDD_BASEOBJECT pobj;
51 HANDLE hFree;
52 };
53 union
54 {
55 ULONG ulObj;
56 struct
57 {
58 USHORT Count;
59 USHORT Lock;
60 HANDLE Pid;
61 };
62 } ObjectOwner;
63 USHORT FullUnique;
64 UCHAR Objt;
65 UCHAR Flags;
66 PVOID pUser;
67 } DD_ENTRY, *PDD_ENTRY;
68
69 typedef struct _EDD_SURFACE_LOCAL
70 {
71 DD_BASEOBJECT Object;
72 DD_SURFACE_LOCAL Surfacelcl;
73 } EDD_SURFACE_LOCAL, *PEDD_SURFACE_LOCAL;
74
75 /* exported functions */
76 NTSTATUS NTAPI DriverEntry(IN PVOID Context1, IN PVOID Context2);
77 NTSTATUS NTAPI GsDriverEntry(IN PVOID Context1, IN PVOID Context2);
78 NTSTATUS APIENTRY DxDdCleanupDxGraphics();
79
80 /* Global pointers */
81 extern ULONG gcSizeDdHmgr;
82 extern PDD_ENTRY gpentDdHmgr;
83 extern ULONG gcMaxDdHmgr;
84 extern PDD_ENTRY gpentDdHmgrLast;
85 extern HANDLE ghFreeDdHmgr;
86 extern HSEMAPHORE ghsemHmgr;
87 extern LONG gcDummyPageRefCnt;
88 extern HSEMAPHORE ghsemDummyPage;
89 extern VOID *gpDummyPage;
90 extern PEPROCESS gpepSession;
91 extern PLARGE_INTEGER gpLockShortDelay;
92
93 /* Driver list export functions */
94 DWORD NTAPI DxDxgGenericThunk(ULONG_PTR ulIndex, ULONG_PTR ulHandle, SIZE_T *pdwSizeOfPtr1, PVOID pvPtr1, SIZE_T *pdwSizeOfPtr2, PVOID pvPtr2);
95 DWORD NTAPI DxDdIoctl(ULONG ulIoctl, PVOID pBuffer, ULONG ulBufferSize);
96 PDD_SURFACE_LOCAL NTAPI DxDdLockDirectDrawSurface(HANDLE hDdSurface);
97 BOOL NTAPI DxDdUnlockDirectDrawSurface(PDD_SURFACE_LOCAL pSurface);
98
99 /* Internal functions */
100 BOOL FASTCALL VerifyObjectOwner(PDD_ENTRY pEntry);
101 BOOL FASTCALL DdHmgCreate();
102 BOOL FASTCALL DdHmgDestroy();
103 PVOID FASTCALL DdHmgLock( HANDLE DdHandle, UCHAR ObjectType, BOOLEAN LockOwned);
104
105 /* define stuff */
106 #define drvDxEngLockDC gpEngFuncs[DXENG_INDEX_DxEngLockDC]
107 #define drvDxEngGetDCState gpEngFuncs[DXENG_INDEX_DxEngGetDCState]
108 #define drvDxEngGetHdevData gpEngFuncs[DXENG_INDEX_DxEngGetHdevData]
109 #define drvDxEngUnlockDC gpEngFuncs[DXENG_INDEX_DxEngUnlockDC]
110 #define drvDxEngUnlockHdev gpEngFuncs[DXENG_INDEX_DxEngUnlockHdev]
111 #define drvDxEngLockHdev gpEngFuncs[DXENG_INDEX_DxEngLockHdev]
112