From bae0d61433d8aaa763eae170c3bb5eb8fa1d2545 Mon Sep 17 00:00:00 2001 From: Janghyuck Kim Date: Tue, 5 Jun 2018 14:44:23 +0900 Subject: [PATCH] [COMMON] media: scaler: fix middle buffer calculation This patch added size calculation for 10bit pixel format to avoid page fault when double scaling is operated with 10bit pixel format. Change-Id: I1b00d991d08498131299f99476ccf398a6d77a2e Signed-off-by: Janghyuck Kim --- .../media/platform/exynos/scaler/scaler-core.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/exynos/scaler/scaler-core.c b/drivers/media/platform/exynos/scaler/scaler-core.c index 80a9bb711b85..995376aa5bdc 100644 --- a/drivers/media/platform/exynos/scaler/scaler-core.c +++ b/drivers/media/platform/exynos/scaler/scaler-core.c @@ -1285,16 +1285,17 @@ static void sc_calc_intbufsize(struct sc_dev *sc, struct sc_int_frame *int_frame frame->addr.size[SC_PLANE_Y] = bytesize; break; case 2: - if (frame->sc_fmt->num_planes == 1) { + if (sc_fmt_is_s10bit_yuv(frame->sc_fmt->pixelformat)) { + sc_calc_s10b_planesize(frame->sc_fmt->pixelformat, + frame->width, frame->height, + &frame->addr.size[SC_PLANE_Y], + &frame->addr.size[SC_PLANE_CB], + false); + } else if (frame->sc_fmt->num_planes == 1) { frame->addr.size[SC_PLANE_Y] = pixsize; frame->addr.size[SC_PLANE_CB] = bytesize - pixsize; } else if (frame->sc_fmt->num_planes == 2) { - if (frame->sc_fmt->pixelformat == V4L2_PIX_FMT_NV12M_S10B) { - frame->addr.size[SC_PLANE_Y] = NV12M_Y_SIZE(frame->width, frame->height); - frame->addr.size[SC_PLANE_CB] = NV12M_CBCR_SIZE(frame->width, frame->height); - } else { - sc_calc_planesize(frame, pixsize); - } + sc_calc_planesize(frame, pixsize); } break; case 3: -- 2.20.1