hwc: Implement dump function

Does a basic implementation of the dump function
called by SurfaceFlinger in dumpsys.
Further logs in different areas can be added later on
using the dumpsys_log utility.

Change-Id: I2194b4ed7f10947272b7b824ef802ce2ee3c8a48
This commit is contained in:
Naseer Ahmed
2012-11-26 12:35:16 -05:00
parent 74d978ad79
commit 1d183f59f5
5 changed files with 35 additions and 14 deletions

View File

@@ -451,6 +451,18 @@ int hwc_getDisplayAttributes(struct hwc_composer_device_1* dev, int disp,
return 0;
}
void hwc_dump(struct hwc_composer_device_1* dev, char *buff, int buff_len)
{
hwc_context_t* ctx = (hwc_context_t*)(dev);
android::String8 buf("");
dumpsys_log(buf, "Qualcomm HWC state:\n");
dumpsys_log(buf, " MDPVersion=%d\n", ctx->mMDP.version);
dumpsys_log(buf, " DisplayPanel=%c\n", ctx->mMDP.panel);
MDPComp::dump(buf);
//XXX: Call Other dump functions
strlcpy(buff, buf.string(), buff_len);
}
static int hwc_device_close(struct hw_device_t *dev)
{
if(!dev) {
@@ -487,7 +499,7 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name,
dev->device.blank = hwc_blank;
dev->device.query = hwc_query;
dev->device.registerProcs = hwc_registerProcs;
dev->device.dump = NULL;
dev->device.dump = hwc_dump;
dev->device.getDisplayConfigs = hwc_getDisplayConfigs;
dev->device.getDisplayAttributes = hwc_getDisplayAttributes;
*device = &dev->device.common;

View File

@@ -628,5 +628,15 @@ bool MDPComp::configure(hwc_context_t *ctx,
return isMDPCompUsed;
}
void MDPComp::dump(android::String8& buf)
{
dumpsys_log(buf, " MDP Composition: ");
dumpsys_log(buf, "MDPCompState=%d\n", sMDPCompState);
//XXX: Log more info
}
}; //namespace

View File

@@ -82,6 +82,8 @@ public:
/* draw */
static bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list);
static void dump(android::String8& buf);
private:
/* set/reset flags for MDPComp */
static void setMDPCompLayerFlags(hwc_context_t *ctx,

View File

@@ -92,22 +92,15 @@ void closeContext(hwc_context_t *ctx)
pthread_mutex_destroy(&(ctx->vstate.lock));
pthread_cond_destroy(&(ctx->vstate.cond));
}
void dumpLayer(hwc_layer_1_t const* l)
void dumpsys_log(android::String8& buf, const char* fmt, ...)
{
ALOGD("\ttype=%d, flags=%08x, handle=%p, tr=%02x, blend=%04x, {%d,%d,%d,%d}"
", {%d,%d,%d,%d}",
l->compositionType, l->flags, l->handle, l->transform, l->blending,
l->sourceCrop.left,
l->sourceCrop.top,
l->sourceCrop.right,
l->sourceCrop.bottom,
l->displayFrame.left,
l->displayFrame.top,
l->displayFrame.right,
l->displayFrame.bottom);
va_list varargs;
va_start(varargs, fmt);
buf.appendFormatV(fmt, varargs);
va_end(varargs);
}
static inline bool isAlphaScaled(hwc_layer_1_t const* layer) {

View File

@@ -23,6 +23,7 @@
#include <hardware/hwcomposer.h>
#include <gr.h>
#include <gralloc_priv.h>
#include <utils/String8.h>
#define ALIGN_TO(x, align) (((x) + ((align)-1)) & ~((align)-1))
#define LIKELY( exp ) (__builtin_expect( (exp) != 0, true ))
@@ -125,6 +126,9 @@ void calculate_crop_rects(hwc_rect_t& crop, hwc_rect_t& dst,
bool isSecuring(hwc_context_t* ctx);
bool isExternalActive(hwc_context_t* ctx);
//Helper function to dump logs
void dumpsys_log(android::String8& buf, const char* fmt, ...);
//Sync point impl.
int hwc_sync(hwc_context_t *ctx, hwc_display_contents_1_t* list, int dpy);