1 | /* $Id: VBoxDispDbg.h 36867 2011-04-28 07:27:03Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | * VBoxVideo Display D3D User mode dll
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2011 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef ___VBoxDispDbg_h__
|
---|
20 | #define ___VBoxDispDbg_h__
|
---|
21 |
|
---|
22 | #ifdef DEBUG
|
---|
23 | /* debugging configuration flags */
|
---|
24 |
|
---|
25 | /* generic debugging facilities & extra data checks */
|
---|
26 | # define VBOXWDDMDISP_DEBUG
|
---|
27 | # ifdef DEBUG_misha
|
---|
28 | /* for some reason when debugging with VirtualKD, user-mode DbgPrint's are discarded
|
---|
29 | * the workaround so far is to pass the log info to the kernel driver and DbgPrint'ed from there,
|
---|
30 | * which is enabled by this define */
|
---|
31 | # define VBOXWDDMDISP_DEBUG_PRINTDRV
|
---|
32 | /* use OutputDebugString */
|
---|
33 | # define VBOXWDDMDISP_DEBUG_PRINT
|
---|
34 | /* adds vectored exception handler to be able to catch non-debug UM exceptions in kernel debugger */
|
---|
35 | # define VBOXWDDMDISP_DEBUG_VEHANDLER
|
---|
36 | # endif
|
---|
37 | #endif
|
---|
38 |
|
---|
39 | #if 0
|
---|
40 | # ifdef Assert
|
---|
41 | # undef Assert
|
---|
42 | # define Assert(_a) do{}while(0)
|
---|
43 | # endif
|
---|
44 | # ifdef AssertBreakpoint
|
---|
45 | # undef AssertBreakpoint
|
---|
46 | # define AssertBreakpoint() do{}while(0)
|
---|
47 | # endif
|
---|
48 | # ifdef AssertFailed
|
---|
49 | # undef AssertFailed
|
---|
50 | # define AssertFailed() do{}while(0)
|
---|
51 | # endif
|
---|
52 | #endif
|
---|
53 |
|
---|
54 | #ifdef VBOXWDDMDISP_DEBUG_VEHANDLER
|
---|
55 | void vboxVDbgVEHandlerRegister();
|
---|
56 | void vboxVDbgVEHandlerUnregister();
|
---|
57 | #endif
|
---|
58 |
|
---|
59 | #ifdef VBOXWDDMDISP_DEBUG_PRINTDRV
|
---|
60 | # define DbgPrintDrv(_m) do { vboxDispLogDrvF _m; } while (0)
|
---|
61 | # define DbgPrintDrvRel(_m) do { vboxDispLogDrvF _m; } while (0)
|
---|
62 | # define DbgPrintDrvFlow(_m) do { } while (0)
|
---|
63 | #else
|
---|
64 | # define DbgPrintDrv(_m) do { } while (0)
|
---|
65 | # define DbgPrintDrvRel(_m) do { } while (0)
|
---|
66 | # define DbgPrintDrvFlow(_m) do { } while (0)
|
---|
67 | #endif
|
---|
68 |
|
---|
69 | #ifdef VBOXWDDMDISP_DEBUG_PRINT
|
---|
70 | # define DbgPrintUsr(_m) do { vboxDispLogDbgPrintF _m; } while (0)
|
---|
71 | # define DbgPrintUsrRel(_m) do { vboxDispLogDbgPrintF _m; } while (0)
|
---|
72 | # define DbgPrintUsrFlow(_m) do { } while (0)
|
---|
73 | #else
|
---|
74 | # define DbgPrintUsr(_m) do { } while (0)
|
---|
75 | # define DbgPrintUsrRel(_m) do { } while (0)
|
---|
76 | # define DbgPrintUsrFlow(_m) do { } while (0)
|
---|
77 | #endif
|
---|
78 | #define vboxVDbgPrint(_m) do { \
|
---|
79 | Log(_m); \
|
---|
80 | DbgPrintUsr(_m); \
|
---|
81 | DbgPrintDrv(_m); \
|
---|
82 | } while (0)
|
---|
83 | #define vboxVDbgPrintF(_m) do { \
|
---|
84 | LogFlow(_m); \
|
---|
85 | DbgPrintUsrFlow(_m); \
|
---|
86 | DbgPrintDrvFlow(_m); \
|
---|
87 | } while (0)
|
---|
88 | #define vboxVDbgPrintR(_m) do { \
|
---|
89 | LogRel(_m); \
|
---|
90 | DbgPrintUsrRel(_m); \
|
---|
91 | DbgPrintDrvRel(_m); \
|
---|
92 | } while (0)
|
---|
93 |
|
---|
94 | #ifdef VBOXWDDMDISP_DEBUG
|
---|
95 | extern bool g_bVBoxVDbgFDumpSetTexture;
|
---|
96 | extern bool g_bVBoxVDbgFDumpDrawPrim;
|
---|
97 | extern bool g_bVBoxVDbgFDumpTexBlt;
|
---|
98 | extern bool g_bVBoxVDbgFDumpBlt;
|
---|
99 |
|
---|
100 | void vboxDispLogDrvF(char * szString, ...);
|
---|
101 | void vboxDispLogDrv(char * szString);
|
---|
102 | void vboxDispLogDbgPrintF(char * szString, ...);
|
---|
103 |
|
---|
104 | typedef struct VBOXWDDMDISP_ALLOCATION *PVBOXWDDMDISP_ALLOCATION;
|
---|
105 | typedef struct VBOXWDDMDISP_RESOURCE *PVBOXWDDMDISP_RESOURCE;
|
---|
106 |
|
---|
107 | VOID vboxVDbgDoDumpSurfRectByAlloc(const char * pPrefix, PVBOXWDDMDISP_ALLOCATION pAlloc, const RECT *pRect, const char* pSuffix);
|
---|
108 | VOID vboxVDbgDoDumpAllocRect(const char * pPrefix, PVBOXWDDMDISP_ALLOCATION pAlloc, const RECT *pRect, const char* pSuffix);
|
---|
109 | VOID vboxVDbgDoDumpSurfRectByRc(const char * pPrefix, const PVBOXWDDMDISP_RESOURCE pRc, uint32_t iAlloc, const RECT *pRect, const char* pSuffix);
|
---|
110 | VOID vboxVDbgDoDumpSurfRect(const char * pPrefix, IDirect3DSurface9 *pSurf, const RECT *pRect, const char * pSuffix, bool bBreak);
|
---|
111 | VOID vboxVDbgDoDumpSurf(const char * pPrefix, IDirect3DSurface9 *pSurf, const char * pSuffix);
|
---|
112 | VOID vboxVDbgDoDumpRcRect(const char * pPrefix, IDirect3DResource9 *pRc, const RECT *pRect, const char * pSuffix);
|
---|
113 | VOID vboxVDbgDoDumpRcRectByRc(const char * pPrefix, const PVBOXWDDMDISP_RESOURCE pRc, const RECT *pRect, const char* pSuffix);
|
---|
114 | VOID vboxVDbgDoDumpTex(const char * pPrefix, IDirect3DBaseTexture9 *pTexBase, const char * pSuffix);
|
---|
115 | VOID vboxVDbgDoDumpRt(const char * pPrefix, IDirect3DDevice9 *pDevice, const char * pSuffix);
|
---|
116 |
|
---|
117 | void vboxVDbgDoPrintRect(const char * pPrefix, const RECT *pRect, const char * pSuffix);
|
---|
118 | void vboxVDbgDoPrintAlloc(const char * pPrefix, const PVBOXWDDMDISP_RESOURCE pRc, uint32_t iAlloc, const char * pSuffix);
|
---|
119 | VOID vboxVDbgDoDumpRtData(char * pPrefix, IDirect3DDevice9 *pDevice, char * pSuffix);
|
---|
120 |
|
---|
121 | #define VBOXVDBG_DUMP_DRAWPRIM_ENTER(_pDevice) do { \
|
---|
122 | if (g_bVBoxVDbgFDumpDrawPrim) \
|
---|
123 | { \
|
---|
124 | vboxVDbgDoDumpRt("==>"__FUNCTION__": RenderTarget Dump\n", (_pDevice), "\n"); \
|
---|
125 | }\
|
---|
126 | } while (0)
|
---|
127 |
|
---|
128 | #define VBOXVDBG_DUMP_DRAWPRIM_LEAVE(_pDevice) do { \
|
---|
129 | if (g_bVBoxVDbgFDumpDrawPrim) \
|
---|
130 | { \
|
---|
131 | vboxVDbgDoDumpRt("<=="__FUNCTION__": RenderTarget Dump\n", (_pDevice), "\n"); \
|
---|
132 | }\
|
---|
133 | } while (0)
|
---|
134 |
|
---|
135 | #define VBOXVDBG_DUMP_SETTEXTURE(_pRc) do { \
|
---|
136 | if (g_bVBoxVDbgFDumpSetTexture) \
|
---|
137 | { \
|
---|
138 | vboxVDbgDoDumpRcRectByRc("== "__FUNCTION__": Texture Dump\n", _pRc, NULL, "\n"); \
|
---|
139 | } \
|
---|
140 | } while (0)
|
---|
141 |
|
---|
142 | #define VBOXVDBG_DUMP_TEXBLT_ENTER(_pSrcRc, _pSrcRect, _pDstRc, _pDstPoint) do { \
|
---|
143 | if (g_bVBoxVDbgFDumpTexBlt) \
|
---|
144 | { \
|
---|
145 | RECT _DstRect; \
|
---|
146 | vboxWddmRectMoved(&_DstRect, (_pSrcRect), (_pDstPoint)->x, (_pDstPoint)->y); \
|
---|
147 | vboxVDbgDoDumpRcRectByRc("==>"__FUNCTION__" Src:\n", (_pSrcRc), (_pSrcRect), "\n"); \
|
---|
148 | vboxVDbgDoDumpRcRectByRc("==>"__FUNCTION__" Dst:\n", (_pDstRc), &_DstRect, "\n"); \
|
---|
149 | } \
|
---|
150 | } while (0)
|
---|
151 |
|
---|
152 | #define VBOXVDBG_DUMP_TEXBLT_LEAVE(_pSrcRc, _pSrcRect, _pDstRc, _pDstPoint) do { \
|
---|
153 | if (g_bVBoxVDbgFDumpTexBlt) \
|
---|
154 | { \
|
---|
155 | RECT _DstRect; \
|
---|
156 | vboxWddmRectMoved(&_DstRect, (_pSrcRect), (_pDstPoint)->x, (_pDstPoint)->y); \
|
---|
157 | vboxVDbgDoDumpRcRectByRc("<=="__FUNCTION__" Src:\n", (_pSrcRc), (_pSrcRect), "\n"); \
|
---|
158 | vboxVDbgDoDumpRcRectByRc("<=="__FUNCTION__" Dst:\n", (_pDstRc), &_DstRect, "\n"); \
|
---|
159 | } \
|
---|
160 | } while (0)
|
---|
161 |
|
---|
162 | #define VBOXVDBG_DUMP_BLT_ENTER(_pSrcSurf, _pSrcRect, _pDstSurf, _pDstRect) do { \
|
---|
163 | if (g_bVBoxVDbgFDumpBlt) \
|
---|
164 | { \
|
---|
165 | vboxVDbgDoDumpSurfRect("==>"__FUNCTION__" Src:\n", (_pSrcSurf), (_pSrcRect), "\n", true); \
|
---|
166 | vboxVDbgDoDumpSurfRect("==>"__FUNCTION__" Dst:\n", (_pDstSurf), (_pDstRect), "\n", true); \
|
---|
167 | } \
|
---|
168 | } while (0)
|
---|
169 |
|
---|
170 | #define VBOXVDBG_DUMP_BLT_LEAVE(_pSrcSurf, _pSrcRect, _pDstSurf, _pDstRect) do { \
|
---|
171 | if (g_bVBoxVDbgFDumpBlt) \
|
---|
172 | { \
|
---|
173 | vboxVDbgDoDumpSurfRect("<=="__FUNCTION__" Src:\n", (_pSrcSurf), (_pSrcRect), "\n", true); \
|
---|
174 | vboxVDbgDoDumpSurfRect("<=="__FUNCTION__" Dst:\n", (_pDstSurf), (_pDstRect), "\n", true); \
|
---|
175 | } \
|
---|
176 | } while (0)
|
---|
177 | #else
|
---|
178 | #define VBOXVDBG_DUMP_DRAWPRIM_ENTER(_pDevice) do { } while (0)
|
---|
179 | #define VBOXVDBG_DUMP_DRAWPRIM_LEAVE(_pDevice) do { } while (0)
|
---|
180 | #define VBOXVDBG_DUMP_SETTEXTURE(_pRc) do { } while (0)
|
---|
181 | #define VBOXVDBG_DUMP_TEXBLT_ENTER(_pSrcRc, _pSrcRect, _pDstRc, _pDstPoint) do { } while (0)
|
---|
182 | #define VBOXVDBG_DUMP_TEXBLT_LEAVE(_pSrcRc, _pSrcRect, _pDstRc, _pDstPoint) do { } while (0)
|
---|
183 | #define VBOXVDBG_DUMP_BLT_ENTER(_pSrcSurf, _pSrcRect, _pDstSurf, _pDstRect) do { } while (0)
|
---|
184 | #define VBOXVDBG_DUMP_BLT_LEAVE(_pSrcSurf, _pSrcRect, _pDstSurf, _pDstRect) do { } while (0)
|
---|
185 | #endif
|
---|
186 |
|
---|
187 |
|
---|
188 | #endif /* #ifndef ___VBoxDispDbg_h__ */
|
---|