diff options
author | Tony Lofthouse <a0741364@ti.com> | 2012-07-06 17:20:53 -0500 |
---|---|---|
committer | Jason Simmons <jsimmons@google.com> | 2012-10-22 15:27:16 -0700 |
commit | 1fd204fb13367eb8279a1e2d1ee245ff0f441571 (patch) | |
tree | ff72868dd84f7f3e75ab113369c0a56f216119ef | |
parent | f11c7bb8c6e7d0254eeaa4aadb8eae412580ac0e (diff) | |
download | omap4-aah-1fd204fb13367eb8279a1e2d1ee245ff0f441571.tar.gz |
hwc: FPS property to show compositor performance
Use setprop debug.hwc.showfps 1 to show the average frames per second
displayed over the last 8 compositions.
debug.hwc.showfps can be set dynamically, the overhead of accessing Android
properties should be minor i.e. an access to an mmap'd() file, so this
should not be a significant overhead to composition when disabled.
Reworked from p-ics-mr1:
9ea53ce HWC: debug.hwc.showfps Android property shows current FPS
66a531d hwc: enable debug.hwc.showfps to be set dynamically
Change-Id: Ie2303e6ae9e73f38cf563d6ed6079928054e4c16
Signed-off-by: Tony Lofthouse <a0741364@ti.com>
(cherry picked from commit 69400d18d6cfc7b2b55b5a563b1fd4387887ded4)
Conflicts:
hwc/hwc.c
-rw-r--r-- | hwc/hwc.c | 29 |
1 files changed, 28 insertions, 1 deletions
@@ -36,6 +36,7 @@ #include <EGL/egl.h> #include <hardware_legacy/uevent.h> #include <png.h> +#include <utils/Timers.h> #include <system/graphics.h> #include <linux/bltsville.h> @@ -228,10 +229,33 @@ typedef struct omap4_hwc_device omap4_hwc_device_t; static int debug = 0; static int debugpost2 = 0; static int debugblt = 0; -static int gshowfps; static rgz_t grgz; static struct bvsurfgeom gscrngeom; +static void showfps(void) +{ + static int framecount = 0; + static int lastframecount = 0; + static nsecs_t lastfpstime = 0; + static float fps = 0; + char value[PROPERTY_VALUE_MAX]; + + property_get("debug.hwc.showfps", value, "0"); + if (!atoi(value)) { + return; + } + + framecount++; + if (!(framecount & 0x7)) { + nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); + nsecs_t diff = now - lastfpstime; + fps = ((framecount - lastframecount) * (float)(s2ns(1))) / diff; + lastfpstime = now; + lastframecount = framecount; + ALOGI("%d Frames, %f FPS", framecount, fps); + } +} + static void dump_layer(hwc_layer_1_t const* l) { ALOGD("\ttype=%d, flags=%08x, handle=%p, tr=%02x, blend=%04x, {%d,%d,%d,%d}, {%d,%d,%d,%d}", @@ -1933,6 +1957,8 @@ static int omap4_hwc_set(struct hwc_composer_device_1 *dev, hwc_dev->buffers, nbufs, dsscomp, omaplfb_comp_data_sz); + showfps(); + #if 0 if (!hwc_dev->use_sgx) { __u32 crt = 0; @@ -2768,6 +2794,7 @@ static int omap4_hwc_device_open(const hw_module_t* module, const char* name, ALOGW("Invalid upscaled_nv12_limit (%s), setting to 2.", value); hwc_dev->upscaled_nv12_limit = 2.; } + done: if (err && hwc_dev) { if (hwc_dev->dsscomp_fd >= 0) |