[COMMON] media: scaler: fix middle buffer calculation
authorJanghyuck Kim <janghyuck.kim@samsung.com>
Tue, 5 Jun 2018 05:44:23 +0000 (14:44 +0900)
committerJanghyuck Kim <janghyuck.kim@samsung.com>
Mon, 23 Jul 2018 05:39:44 +0000 (14:39 +0900)
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 <janghyuck.kim@samsung.com>
drivers/media/platform/exynos/scaler/scaler-core.c

index 80a9bb711b855fda045af83b233bca5f018a2222..995376aa5bdc27284c9738abd23ebe0d93677403 100644 (file)
@@ -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: