display: Dynamic debug logging via binder
Provides a way to enable/disable logs at runtime via binder.
The logs need to be enabled from a priviliged shell.
For example,
$ adb shell service call display.qservice 15 i32 0 i32 1
Here 15 is the integer code for DYNAMIC_DEBUG in IQService.h
The first parameter 0 is for DEBUG_ALL
The second parameter 1 is to enable.
Hence, this command enables all debug logs.
Another example - this command enables vsync logging
$ adb shell service call display.qservice 15 i32 2 i32 1
Change-Id: I13d5f397d9d03f0ac6a14d3a3c9098ed59fc62fd
diff --git a/libhwcomposer/hwc_qclient.cpp b/libhwcomposer/hwc_qclient.cpp
index 77215ca..892e9c0 100644
--- a/libhwcomposer/hwc_qclient.cpp
+++ b/libhwcomposer/hwc_qclient.cpp
@@ -31,6 +31,7 @@
#include <IQService.h>
#include <hwc_utils.h>
#include <mdp_version.h>
+#include <hwc_mdpcomp.h>
#define QCLIENT_DEBUG 0
@@ -213,6 +214,26 @@
}
}
+static void toggleDynamicDebug(hwc_context_t* ctx, const Parcel* inParcel) {
+ int debug_type = inParcel->readInt32();
+ bool enable = !!inParcel->readInt32();
+ ALOGD("%s: debug_type: %d enable:%d",
+ __FUNCTION__, debug_type, enable);
+ Locker::Autolock _sl(ctx->mDrawLock);
+ switch (debug_type) {
+ //break is ignored for DEBUG_ALL to toggle all of them at once
+ case IQService::DEBUG_ALL:
+ case IQService::DEBUG_MDPCOMP:
+ qhwc::MDPComp::dynamicDebug(enable);
+ if (debug_type != IQService::DEBUG_ALL)
+ break;
+ case IQService::DEBUG_VSYNC:
+ ctx->vstate.debug = enable;
+ if (debug_type != IQService::DEBUG_ALL)
+ break;
+ }
+}
+
status_t QClient::notifyCallback(uint32_t command, const Parcel* inParcel,
Parcel* outParcel) {
status_t ret = NO_ERROR;
@@ -255,6 +276,9 @@
case IQService::SET_VIEW_FRAME:
setViewFrame(mHwcContext, inParcel);
break;
+ case IQService::DYNAMIC_DEBUG:
+ toggleDynamicDebug(mHwcContext, inParcel);
+ break;
default:
ret = NO_ERROR;
}