From: Sanghoon Lee Date: Fri, 1 Jun 2018 07:21:44 +0000 (+0900) Subject: [COMMON] fimc-is2: Flush the old H/W frames for shot done sequence X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e1880609a0097106a81e97eb846476f6a9b049ca;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] fimc-is2: Flush the old H/W frames for shot done sequence If there are the old frames in H/W frame manager, the matched frames in subdev frame manager will be flushed to user as NDONE. When user gets the shot data of these frames, every kernel virtual address for the frames is unmapped. To avoid accessing invalid kernel virtual address in H/W frames, they should also be flushed in shot done sequence. Change-Id: I2e1262cac42a31fd7c3567885e0afbc82790ab83 Signed-off-by: Sanghoon Lee --- diff --git a/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-control.c b/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-control.c index 977179fb083b..c2854b31fcaf 100644 --- a/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-control.c +++ b/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-control.c @@ -2367,6 +2367,23 @@ exit: trans_frame(framemgr, frame, FS_HW_FREE); framemgr_x_barrier_common(framemgr, 0, flags); atomic_set(&frame->shot_done_flag, 0); + + /* Force flush the old H/W frames with DONE state */ + framemgr_e_barrier_common(framemgr, 0, flags); + if (framemgr->queued_count[FS_HW_WAIT_DONE] > 0) { + u32 fcount = frame->fcount; + + frame = peek_frame(framemgr, FS_HW_WAIT_DONE); + while (frame && frame->fcount < fcount) { + msinfo_hw("[F%d]force flush\n", + frame->instance, hw_ip, frame->fcount); + trans_frame(framemgr, frame, FS_HW_FREE); + atomic_set(&frame->shot_done_flag, 0); + frame = peek_frame(framemgr, FS_HW_WAIT_DONE); + } + } + framemgr_x_barrier_common(framemgr, 0, flags); + if (framemgr->queued_count[FS_HW_FREE] > 10) atomic_set(&hw_ip->hardware->bug_count, 0);