summaryrefslogtreecommitdiffstats
path: root/hwc
diff options
context:
space:
mode:
authorSunita Nadampalli <sunitan@ti.com>2014-03-24 11:45:45 -0700
committerHashcode <hashcode0f@gmail.com>2015-02-02 15:48:09 -0800
commitd7450466dcedf2ef91ea0b135056f2d46ce5438e (patch)
treefb54a566ce6831542c4906b6be75c6dbaff58275 /hwc
parent836fbecc3ecba3eba213605e11182ca17f31a22d (diff)
downloadhardware_ti_omap4-d7450466dcedf2ef91ea0b135056f2d46ce5438e.zip
hardware_ti_omap4-d7450466dcedf2ef91ea0b135056f2d46ce5438e.tar.gz
hardware_ti_omap4-d7450466dcedf2ef91ea0b135056f2d46ce5438e.tar.bz2
hwc: Fix div_by_0 crash in hwcomposer
Inside sw_vsync generation loop, there is a logic error while reading the vsync_rate. The vsync_rate should be re-read after user sets the vsync_rate by calling start_sw_vsync explicitly. This is guaranteed by re-reading it ONLY after the vsync_cond is signalled. Change-Id: I2da97e6cb972cc812f789c7f0fd621503679177d
Diffstat (limited to 'hwc')
-rw-r--r--hwc/sw_vsync.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/hwc/sw_vsync.c b/hwc/sw_vsync.c
index cf24b31..fce6d37 100644
--- a/hwc/sw_vsync.c
+++ b/hwc/sw_vsync.c
@@ -60,10 +60,16 @@ static void *vsync_loop(void *data)
for (;;) {
pthread_mutex_lock(&vsync_mutex);
- period = vsync_rate; /* re-read rate */
while (!vsync_loop_active) {
pthread_cond_wait(&vsync_cond, &vsync_mutex);
}
+ /* the vsync_rate should be re-read after
+ * user sets the vsync_rate by calling start_sw_vsync
+ * explicitly. This is guaranteed by re-reading it
+ * after the vsync_cond is signalled.
+ */
+ period = vsync_rate; /* re-read rate */
+
pthread_mutex_unlock(&vsync_mutex);
clock_gettime(CLOCK_MONOTONIC, &tp);