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_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index fdc3f2e..59a42c8 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -127,11 +127,6 @@
sEnableMixedMode = false;
}
- if(property_get("debug.mdpcomp.logs", property, NULL) > 0) {
- if(atoi(property) != 0)
- sDebugLogs = true;
- }
-
sMaxPipesPerMixer = MAX_PIPES_PER_MIXER;
if(property_get("debug.mdpcomp.maxpermixer", property, "-1") > 0) {
int val = atoi(property);
diff --git a/libhwcomposer/hwc_mdpcomp.h b/libhwcomposer/hwc_mdpcomp.h
index 713020a..1ebe0bd 100644
--- a/libhwcomposer/hwc_mdpcomp.h
+++ b/libhwcomposer/hwc_mdpcomp.h
@@ -56,6 +56,7 @@
static bool init(hwc_context_t *ctx);
static void resetIdleFallBack() { sIdleFallBack = false; }
static bool isIdleFallback() { return sIdleFallBack; }
+ static void dynamicDebug(bool enable){ sDebugLogs = enable; }
protected:
enum { MAX_SEC_LAYERS = 1 }; //TODO add property support
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;
}
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index ad06e89..d7e69e9 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -158,6 +158,7 @@
struct VsyncState {
bool enable;
bool fakevsync;
+ bool debug;
};
struct BwcPM {
diff --git a/libhwcomposer/hwc_vsync.cpp b/libhwcomposer/hwc_vsync.cpp
index ca93ad2..47f2229 100644
--- a/libhwcomposer/hwc_vsync.cpp
+++ b/libhwcomposer/hwc_vsync.cpp
@@ -40,7 +40,6 @@
#define PANEL_ON_STR "panel_power_on ="
#define ARRAY_LENGTH(array) (sizeof((array))/sizeof((array)[0]))
const int MAX_DATA = 64;
-bool logvsync = false;
int hwc_vsync_control(hwc_context_t* ctx, int dpy, int enable)
{
@@ -63,7 +62,7 @@
timestamp = strtoull(data + strlen("VSYNC="), NULL, 0);
}
// send timestamp to SurfaceFlinger
- ALOGD_IF (logvsync, "%s: timestamp %"PRIu64" sent to SF for dpy=%d",
+ ALOGD_IF (ctx->vstate.debug, "%s: timestamp %"PRIu64" sent to SF for dpy=%d",
__FUNCTION__, timestamp, dpy);
ctx->proc->vsync(ctx->proc, dpy, timestamp);
}
@@ -110,11 +109,6 @@
ctx->vstate.fakevsync = true;
}
- if(property_get("debug.hwc.logvsync", property, 0) > 0) {
- if(atoi(property) == 1)
- logvsync = true;
- }
-
char node_path[MAX_SYSFS_FILE_PATH];
for (int dpy = HWC_DISPLAY_PRIMARY; dpy < num_displays; dpy++) {