summaryrefslogtreecommitdiffstats
path: root/modules/gralloc/framebuffer.cpp
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2011-01-16 13:06:33 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2011-01-16 13:06:33 -0800
commitd72be75b45812e229d125a91ff4cd9e0aed2e5c5 (patch)
tree421ed9012dfbcdbc463f52b13c3c835023df7ea3 /modules/gralloc/framebuffer.cpp
parent158549c89405186d9ecaefd3811cfae3949056ee (diff)
parentf540c44fc218bffcdfbc226187d3cdc08e213c32 (diff)
downloadhardware_libhardware-d72be75b45812e229d125a91ff4cd9e0aed2e5c5.zip
hardware_libhardware-d72be75b45812e229d125a91ff4cd9e0aed2e5c5.tar.gz
hardware_libhardware-d72be75b45812e229d125a91ff4cd9e0aed2e5c5.tar.bz2
am f540c44f: am 80d3699c: gralloc: Fix division-by-0 during system emulation.
* commit 'f540c44fc218bffcdfbc226187d3cdc08e213c32': gralloc: Fix division-by-0 during system emulation.
Diffstat (limited to 'modules/gralloc/framebuffer.cpp')
-rw-r--r--modules/gralloc/framebuffer.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/gralloc/framebuffer.cpp b/modules/gralloc/framebuffer.cpp
index a487b5d..59c5001 100644
--- a/modules/gralloc/framebuffer.cpp
+++ b/modules/gralloc/framebuffer.cpp
@@ -213,13 +213,17 @@ int mapFrameBufferLocked(struct private_module_t* module)
if (ioctl(fd, FBIOGET_VSCREENINFO, &info) == -1)
return -errno;
- int refreshRate = 1000000000000000LLU /
+ uint64_t refreshQuotient =
(
uint64_t( info.upper_margin + info.lower_margin + info.yres )
* ( info.left_margin + info.right_margin + info.xres )
* info.pixclock
);
+ /* Beware, info.pixclock might be 0 under emulation, so avoid a
+ * division-by-0 here (SIGFPE on ARM) */
+ int refreshRate = refreshQuotient > 0 ? (int)(1000000000000000LLU / refreshQuotient) : 0;
+
if (refreshRate == 0) {
// bleagh, bad info from the driver
refreshRate = 60*1000; // 60 Hz