mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
msm_fb: display: Make sysfs read request interruptible
Change blocking sysfs read request to be interruptible and protect vsync timestamp value to prevent corruption. Change-Id: I510d84134b0ab70d17729e8c53c91fa926035142 Signed-off-by: Mayank Chopra <makchopra@codeaurora.org> Conflicts: drivers/video/msm/mdp4_overlay_dsi_cmd.c drivers/video/msm/mdp4_overlay_dsi_video.c Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
This commit is contained in:
parent
46fd6a9478
commit
7fa332360f
4 changed files with 37 additions and 14 deletions
|
@ -513,9 +513,9 @@ static void primary_rdptr_isr(int cndx)
|
||||||
pr_debug("%s: ISR, tick=%d pan=%d cpu=%d\n", __func__,
|
pr_debug("%s: ISR, tick=%d pan=%d cpu=%d\n", __func__,
|
||||||
vctrl->expire_tick, vctrl->pan_display, smp_processor_id());
|
vctrl->expire_tick, vctrl->pan_display, smp_processor_id());
|
||||||
vctrl->rdptr_intr_tot++;
|
vctrl->rdptr_intr_tot++;
|
||||||
vctrl->vsync_time = ktime_get();
|
|
||||||
|
|
||||||
spin_lock(&vctrl->spin_lock);
|
spin_lock(&vctrl->spin_lock);
|
||||||
|
vctrl->vsync_time = ktime_get();
|
||||||
|
|
||||||
complete_all(&vctrl->vsync_comp);
|
complete_all(&vctrl->vsync_comp);
|
||||||
vctrl->wait_vsync_cnt = 0;
|
vctrl->wait_vsync_cnt = 0;
|
||||||
|
@ -655,6 +655,7 @@ static ssize_t vsync_show_event(struct device *dev,
|
||||||
struct vsycn_ctrl *vctrl;
|
struct vsycn_ctrl *vctrl;
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
u64 vsync_tick;
|
||||||
|
|
||||||
cndx = 0;
|
cndx = 0;
|
||||||
vctrl = &vsync_ctrl_db[0];
|
vctrl = &vsync_ctrl_db[0];
|
||||||
|
@ -672,8 +673,11 @@ static ssize_t vsync_show_event(struct device *dev,
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = snprintf(buf, PAGE_SIZE, "VSYNC=%llu",
|
spin_lock_irqsave(&vctrl->spin_lock, flags);
|
||||||
ktime_to_ns(vctrl->vsync_time));
|
vsync_tick = ktime_to_ns(vctrl->vsync_time);
|
||||||
|
spin_unlock_irqrestore(&vctrl->spin_lock, flags);
|
||||||
|
|
||||||
|
ret = snprintf(buf, PAGE_SIZE, "VSYNC=%llu", vsync_tick);
|
||||||
buf[strlen(buf) + 1] = '\0';
|
buf[strlen(buf) + 1] = '\0';
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -381,6 +381,7 @@ static ssize_t vsync_show_event(struct device *dev,
|
||||||
struct vsycn_ctrl *vctrl;
|
struct vsycn_ctrl *vctrl;
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
u64 vsync_tick;
|
||||||
|
|
||||||
cndx = 0;
|
cndx = 0;
|
||||||
vctrl = &vsync_ctrl_db[0];
|
vctrl = &vsync_ctrl_db[0];
|
||||||
|
@ -398,8 +399,11 @@ static ssize_t vsync_show_event(struct device *dev,
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = snprintf(buf, PAGE_SIZE, "VSYNC=%llu",
|
spin_lock_irqsave(&vctrl->spin_lock, flags);
|
||||||
ktime_to_ns(vctrl->vsync_time));
|
vsync_tick = ktime_to_ns(vctrl->vsync_time);
|
||||||
|
spin_unlock_irqrestore(&vctrl->spin_lock, flags);
|
||||||
|
|
||||||
|
ret = snprintf(buf, PAGE_SIZE, "VSYNC=%llu", vsync_tick);
|
||||||
buf[strlen(buf) + 1] = '\0';
|
buf[strlen(buf) + 1] = '\0';
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -937,9 +941,10 @@ void mdp4_primary_vsync_dsi_video(void)
|
||||||
cndx = 0;
|
cndx = 0;
|
||||||
vctrl = &vsync_ctrl_db[cndx];
|
vctrl = &vsync_ctrl_db[cndx];
|
||||||
pr_debug("%s: cpu=%d\n", __func__, smp_processor_id());
|
pr_debug("%s: cpu=%d\n", __func__, smp_processor_id());
|
||||||
vctrl->vsync_time = ktime_get();
|
|
||||||
|
|
||||||
spin_lock(&vctrl->spin_lock);
|
spin_lock(&vctrl->spin_lock);
|
||||||
|
vctrl->vsync_time = ktime_get();
|
||||||
|
|
||||||
if (vctrl->wait_vsync_cnt) {
|
if (vctrl->wait_vsync_cnt) {
|
||||||
complete_all(&vctrl->vsync_comp);
|
complete_all(&vctrl->vsync_comp);
|
||||||
vctrl->wait_vsync_cnt = 0;
|
vctrl->wait_vsync_cnt = 0;
|
||||||
|
|
|
@ -322,6 +322,7 @@ static ssize_t vsync_show_event(struct device *dev,
|
||||||
struct vsycn_ctrl *vctrl;
|
struct vsycn_ctrl *vctrl;
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
u64 vsync_tick;
|
||||||
|
|
||||||
cndx = 0;
|
cndx = 0;
|
||||||
vctrl = &vsync_ctrl_db[0];
|
vctrl = &vsync_ctrl_db[0];
|
||||||
|
@ -336,10 +337,15 @@ static ssize_t vsync_show_event(struct device *dev,
|
||||||
INIT_COMPLETION(vctrl->vsync_comp);
|
INIT_COMPLETION(vctrl->vsync_comp);
|
||||||
vctrl->wait_vsync_cnt++;
|
vctrl->wait_vsync_cnt++;
|
||||||
spin_unlock_irqrestore(&vctrl->spin_lock, flags);
|
spin_unlock_irqrestore(&vctrl->spin_lock, flags);
|
||||||
wait_for_completion(&vctrl->vsync_comp);
|
ret = wait_for_completion_interruptible(&vctrl->vsync_comp);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
ret = snprintf(buf, PAGE_SIZE, "VSYNC=%llu",
|
spin_lock_irqsave(&vctrl->spin_lock, flags);
|
||||||
ktime_to_ns(vctrl->vsync_time));
|
vsync_tick = ktime_to_ns(vctrl->vsync_time);
|
||||||
|
spin_unlock_irqrestore(&vctrl->spin_lock, flags);
|
||||||
|
|
||||||
|
ret = snprintf(buf, PAGE_SIZE, "VSYNC=%llu", vsync_tick);
|
||||||
buf[strlen(buf) + 1] = '\0';
|
buf[strlen(buf) + 1] = '\0';
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -861,9 +867,10 @@ void mdp4_external_vsync_dtv(void)
|
||||||
cndx = 0;
|
cndx = 0;
|
||||||
vctrl = &vsync_ctrl_db[cndx];
|
vctrl = &vsync_ctrl_db[cndx];
|
||||||
pr_debug("%s: cpu=%d\n", __func__, smp_processor_id());
|
pr_debug("%s: cpu=%d\n", __func__, smp_processor_id());
|
||||||
vctrl->vsync_time = ktime_get();
|
|
||||||
|
|
||||||
spin_lock(&vctrl->spin_lock);
|
spin_lock(&vctrl->spin_lock);
|
||||||
|
vctrl->vsync_time = ktime_get();
|
||||||
|
|
||||||
if (vctrl->wait_vsync_cnt) {
|
if (vctrl->wait_vsync_cnt) {
|
||||||
complete_all(&vctrl->vsync_comp);
|
complete_all(&vctrl->vsync_comp);
|
||||||
vctrl->wait_vsync_cnt = 0;
|
vctrl->wait_vsync_cnt = 0;
|
||||||
|
|
|
@ -366,6 +366,7 @@ static ssize_t vsync_show_event(struct device *dev,
|
||||||
struct vsycn_ctrl *vctrl;
|
struct vsycn_ctrl *vctrl;
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
u64 vsync_tick;
|
||||||
|
|
||||||
cndx = 0;
|
cndx = 0;
|
||||||
vctrl = &vsync_ctrl_db[0];
|
vctrl = &vsync_ctrl_db[0];
|
||||||
|
@ -379,10 +380,15 @@ static ssize_t vsync_show_event(struct device *dev,
|
||||||
INIT_COMPLETION(vctrl->vsync_comp);
|
INIT_COMPLETION(vctrl->vsync_comp);
|
||||||
vctrl->wait_vsync_cnt++;
|
vctrl->wait_vsync_cnt++;
|
||||||
spin_unlock_irqrestore(&vctrl->spin_lock, flags);
|
spin_unlock_irqrestore(&vctrl->spin_lock, flags);
|
||||||
wait_for_completion(&vctrl->vsync_comp);
|
ret = wait_for_completion_interruptible(&vctrl->vsync_comp);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
ret = snprintf(buf, PAGE_SIZE, "VSYNC=%llu",
|
spin_lock_irqsave(&vctrl->spin_lock, flags);
|
||||||
ktime_to_ns(vctrl->vsync_time));
|
vsync_tick = ktime_to_ns(vctrl->vsync_time);
|
||||||
|
spin_unlock_irqrestore(&vctrl->spin_lock, flags);
|
||||||
|
|
||||||
|
ret = snprintf(buf, PAGE_SIZE, "VSYNC=%llu", vsync_tick);
|
||||||
buf[strlen(buf) + 1] = '\0';
|
buf[strlen(buf) + 1] = '\0';
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -811,9 +817,10 @@ void mdp4_primary_vsync_lcdc(void)
|
||||||
cndx = 0;
|
cndx = 0;
|
||||||
vctrl = &vsync_ctrl_db[cndx];
|
vctrl = &vsync_ctrl_db[cndx];
|
||||||
pr_debug("%s: cpu=%d\n", __func__, smp_processor_id());
|
pr_debug("%s: cpu=%d\n", __func__, smp_processor_id());
|
||||||
vctrl->vsync_time = ktime_get();
|
|
||||||
|
|
||||||
spin_lock(&vctrl->spin_lock);
|
spin_lock(&vctrl->spin_lock);
|
||||||
|
vctrl->vsync_time = ktime_get();
|
||||||
|
|
||||||
if (vctrl->wait_vsync_cnt) {
|
if (vctrl->wait_vsync_cnt) {
|
||||||
complete_all(&vctrl->vsync_comp);
|
complete_all(&vctrl->vsync_comp);
|
||||||
vctrl->wait_vsync_cnt = 0;
|
vctrl->wait_vsync_cnt = 0;
|
||||||
|
|
Loading…
Reference in a new issue