Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

viogpu: Decouple DBG from WPP #1042

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion viogpu/common/bitops.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "bitops.h"
#include "viogpu.h"

#if !DBG
#if defined(EVENT_TRACING)
#include "bitops.tmh"
#endif

Expand Down
2 changes: 1 addition & 1 deletion viogpu/common/viogpu_idr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#include "viogpu.h"
#include "baseobj.h"
#if !DBG
#if defined(EVENT_TRACING)
#include "viogpu_idr.tmh"
#endif

Expand Down
2 changes: 1 addition & 1 deletion viogpu/common/viogpu_pci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
**********************************************************************/
#include "viogpu.h"
#include "..\viogpudo\viogpudo.h"
#if !DBG
#if defined(EVENT_TRACING)
#include "viogpu_pci.tmh"
#endif

Expand Down
2 changes: 1 addition & 1 deletion viogpu/common/viogpu_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#include "viogpu_queue.h"
#include "baseobj.h"
#if !DBG
#if defined(EVENT_TRACING)
#include "viogpu_queue.tmh"
#endif

Expand Down
2 changes: 1 addition & 1 deletion viogpu/viogpudo/driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "helper.h"
#include "baseobj.h"

#if !DBG
#if defined(EVENT_TRACING)
#include "driver.tmh"
#endif

Expand Down
10 changes: 10 additions & 0 deletions viogpu/viogpudo/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "kdebugprint.h"

//#define DBG 1
#define EVENT_TRACING 1

#ifndef TRACE_LEVEL_INFORMATION
#define TRACE_LEVEL_NONE 0 // Tracing is not on
Expand Down Expand Up @@ -31,6 +32,7 @@
#define VioGpuDbgBreak()\
if (KD_DEBUGGER_ENABLED && !KD_DEBUGGER_NOT_PRESENT && bBreakAlways) DbgBreakPoint();

#undef EVENT_TRACING // DBG build excludes WPP
#define WPP_INIT_TRACING(driver, regpath) InitializeDebugPrints(driver, regpath);
#define WPP_CLEANUP(driver)
#else
Expand Down Expand Up @@ -65,4 +67,12 @@
// end_wpp
//

#ifndef EVENT_TRACING

#define WPP_INIT_TRACING(driver, regpath)
#define WPP_CLEANUP(driver)
#define DbgPrint

#endif

#endif
4 changes: 3 additions & 1 deletion viogpu/viogpudo/viogpudo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "viogpum.h"
#include "edid.h"

#if !DBG
#if defined(EVENT_TRACING)
#include "viogpudo.tmh"
#endif

Expand Down Expand Up @@ -3419,6 +3419,8 @@ BOOLEAN VioGpuAdapter::CreateCursor(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPoin
UINT resid, format, size;
VioGpuObj* obj;
PAGED_CODE();
(void)pSetPointerShape; // unused
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, why those two are added in this commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because those variables are not used. They are only referenced with DbgPrint but when you build non-debug build where it's no-op you'll get compiler warning so by this we silence that warning.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The correct way to do it is to use UNREFERENCED_PARAMETER macro

UNREFERENCED_PARAMETER(pSetPointerShape);
UNREFERENCED_PARAMETER(pCurrentMode);

Like here:

UNREFERENCED_PARAMETER(context);

(void)pCurrentMode; // unused
DbgPrint(TRACE_LEVEL_INFORMATION, ("---> %s - %d: (%d x %d - %d) (%d + %d)\n", __FUNCTION__, m_Id,
pSetPointerShape->Width, pSetPointerShape->Height, pSetPointerShape->Pitch, pSetPointerShape->XHot, pSetPointerShape->YHot));

Expand Down