From fc966d144884be2e6ef01780ed30d1dc720b9c06 Mon Sep 17 00:00:00 2001 From: Saurabh Shah Date: Fri, 6 May 2011 19:13:59 -0700 Subject: [PATCH] Remove FPS calculations from userspace. The FPS is stored in reserved[4] field of fb_var_screeninfo structure. Read directly from this field. CRs-fixed: 283750 (cherry picked from commit 0dec3f333db5b58c5ddd9c65fb7fd5c61cc5ef59) Change-Id: I26632dc489ed8a95502b9071fed5b7527b33e54d --- libgralloc-qsd8k/framebuffer.cpp | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/libgralloc-qsd8k/framebuffer.cpp b/libgralloc-qsd8k/framebuffer.cpp index 794adb4..dd961b2 100644 --- a/libgralloc-qsd8k/framebuffer.cpp +++ b/libgralloc-qsd8k/framebuffer.cpp @@ -687,18 +687,6 @@ int mapFrameBufferLocked(struct private_module_t* module) if (ioctl(fd, FBIOGET_VSCREENINFO, &info) == -1) return -errno; - int refreshRate = 1000000000000000LLU / - ( - uint64_t( info.upper_margin + info.lower_margin + info.yres ) - * ( info.left_margin + info.right_margin + info.xres ) - * info.pixclock - ); - - if (refreshRate == 0) { - // bleagh, bad info from the driver - refreshRate = 60*1000; // 60 Hz - } - if (int(info.width) <= 0 || int(info.height) <= 0) { // the driver doesn't return that information // default to 160 dpi @@ -708,7 +696,8 @@ int mapFrameBufferLocked(struct private_module_t* module) float xdpi = (info.xres * 25.4f) / info.width; float ydpi = (info.yres * 25.4f) / info.height; - float fps = refreshRate / 1000.0f; + //The reserved[4] field is used to store FPS by the driver. + float fps = info.reserved[4]; LOGI( "using (fd=%d)\n" "id = %s\n"