drm_hwcomposer: Add Dump() to the Compositor interface
Add a Dump() function to the Compositor base class and pipe it
through hwcomposer. This can be invoked from the shell by
running "dumpsys SurfaceFlinger".
Change-Id: I87646f4e926ac6d52a04ba130957abdfab99c491
Signed-off-by: Sean Paul <seanpaul@chromium.org>
diff --git a/hwcomposer.cpp b/hwcomposer.cpp
index afb0ebe..2f9640e 100644
--- a/hwcomposer.cpp
+++ b/hwcomposer.cpp
@@ -72,6 +72,16 @@
Importer *importer;
};
+static void hwc_dump(struct hwc_composer_device_1* dev, char *buff,
+ int buff_len) {
+ struct hwc_context_t *ctx = (struct hwc_context_t *)&dev->common;
+ std::ostringstream out;
+
+ ctx->drm.compositor()->Dump(&out);
+ std::string out_str = out.str();
+ strncpy(buff, out_str.c_str(), std::min((size_t)buff_len, out_str.length()));
+}
+
static int hwc_prepare(hwc_composer_device_1_t *dev, size_t num_displays,
hwc_display_contents_1_t **display_contents) {
// XXX: Once we have a GL compositor, just make everything HWC_OVERLAY
@@ -511,6 +521,7 @@
ctx->device.common.module = const_cast<hw_module_t *>(module);
ctx->device.common.close = hwc_device_close;
+ ctx->device.dump = hwc_dump;
ctx->device.prepare = hwc_prepare;
ctx->device.set = hwc_set;
ctx->device.eventControl = hwc_event_control;