hwc: vd: Dynamic dumping of frames for virtual displays
Provides a way to enable/disable dumping of virtual display
frames at runtime via binder. The dumping needs to be enabled
from a priviliged shell.
For example,
$ adb shell service call display.qservice 15 i32 3 i32 1
Here 15 is the integer code for DYNAMIC_DEBUG in IQService.h
The first parameter 3 is for DEBUG_VD
The second parameter 1 is to enable.
Change-Id: Idd62c5d9ffa6e4eb7dec585984d145bc6a421336
diff --git a/libhwcomposer/hwc_qclient.cpp b/libhwcomposer/hwc_qclient.cpp
index 892e9c0..efe6e16 100644
--- a/libhwcomposer/hwc_qclient.cpp
+++ b/libhwcomposer/hwc_qclient.cpp
@@ -32,6 +32,7 @@
#include <hwc_utils.h>
#include <mdp_version.h>
#include <hwc_mdpcomp.h>
+#include <hwc_virtual.h>
#define QCLIENT_DEBUG 0
@@ -231,6 +232,10 @@
ctx->vstate.debug = enable;
if (debug_type != IQService::DEBUG_ALL)
break;
+ case IQService::DEBUG_VD:
+ HWCVirtualBase::dynamicDebug(enable);
+ if (debug_type != IQService::DEBUG_ALL)
+ break;
}
}
diff --git a/libhwcomposer/hwc_virtual.cpp b/libhwcomposer/hwc_virtual.cpp
index db43435..b65f417 100644
--- a/libhwcomposer/hwc_virtual.cpp
+++ b/libhwcomposer/hwc_virtual.cpp
@@ -36,6 +36,7 @@
using namespace qhwc;
using namespace overlay;
+bool HWCVirtualBase::sVDDumpEnabled = false;
HWCVirtualBase* HWCVirtualBase::getObject(bool isVDSEnabled) {
if(isVDSEnabled) {
@@ -49,16 +50,6 @@
}
}
-HWCVirtualVDS::HWCVirtualVDS() {
- char value[PROPERTY_VALUE_MAX];
- mVDSDumpEnabled = false;
- if((property_get("debug.hwc.enable_vds_dump", value, NULL) > 0)) {
- if(atoi(value) != 0) {
- mVDSDumpEnabled = true;
- }
- }
-}
-
void HWCVirtualVDS::init(hwc_context_t *ctx) {
const int dpy = HWC_DISPLAY_VIRTUAL;
ctx->mFBUpdate[dpy] =
@@ -216,7 +207,7 @@
ret = -1;
}
- if(mVDSDumpEnabled) {
+ if(sVDDumpEnabled) {
char bufferName[128];
// Dumping frame buffer
sync_wait(fbLayer->acquireFenceFd, 1000);
diff --git a/libhwcomposer/hwc_virtual.h b/libhwcomposer/hwc_virtual.h
index 26d89c9..5f7b20f 100644
--- a/libhwcomposer/hwc_virtual.h
+++ b/libhwcomposer/hwc_virtual.h
@@ -42,11 +42,17 @@
hwc_display_contents_1_t** displays) = 0;
virtual void pause(hwc_context_t* ctx, int dpy) = 0;
virtual void resume(hwc_context_t* ctx, int dpy) = 0;
+ // We can dump the frame buffer and WB
+ // output buffer by dynamically enabling
+ // dumping via a binder call:
+ // adb shell service call display.qservice 15 i32 3 i32 1
+ static bool sVDDumpEnabled;
+ static void dynamicDebug(bool enable) {sVDDumpEnabled = enable;};
};
class HWCVirtualVDS : public HWCVirtualBase {
public:
- explicit HWCVirtualVDS();
+ explicit HWCVirtualVDS(){};
virtual ~HWCVirtualVDS(){};
// Chooses composition type and configures pipe for each layer in virtual
// display list
@@ -64,12 +70,6 @@
hwc_display_contents_1_t** displays);
virtual void pause(hwc_context_t* ctx, int dpy);
virtual void resume(hwc_context_t* ctx, int dpy);
-private:
- // If WFD is enabled through VDS solution
- // we can dump the frame buffer and WB
- // output buffer by setting the property
- // debug.hwc.enable_vds_dump
- bool mVDSDumpEnabled;
};
class HWCVirtualV4L2 : public HWCVirtualBase {
diff --git a/libqservice/IQService.h b/libqservice/IQService.h
index c222eb9..9be04b2 100644
--- a/libqservice/IQService.h
+++ b/libqservice/IQService.h
@@ -65,6 +65,7 @@
DEBUG_ALL,
DEBUG_MDPCOMP,
DEBUG_VSYNC,
+ DEBUG_VD
};
// Register a client that can be notified