VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispDbg.h@ 36046

Last change on this file since 36046 was 36046, checked in by vboxsync, 14 years ago

wddm/3d: debugging

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette