[COMMON] media: scaler: support linear P010 format
authorJanghyuck Kim <janghyuck.kim@samsung.com>
Wed, 20 Jun 2018 04:32:45 +0000 (13:32 +0900)
committerJanghyuck Kim <janghyuck.kim@samsung.com>
Mon, 23 Jul 2018 05:39:53 +0000 (14:39 +0900)
Change-Id: I0a647422214c8fc8b7f9cf60972265b27365fab6
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
drivers/media/platform/exynos/scaler/scaler-core.c

index 0a9379a2aca61c6d2c5587c2cebc84e7f190f316..83823f3342d77cbff8e9cfe7ab3caad157bf404d 100644 (file)
@@ -287,6 +287,17 @@ static const struct sc_fmt sc_formats[] = {
                .num_comp       = 2,
                .h_shift        = 1,
                .v_shift        = 1,
+       }, {
+               .name           = "YUV 4:2:0 contiguous, Y/CbCr 10-bit",
+               .pixelformat    = V4L2_PIX_FMT_NV12_P010,
+               .cfg_val        = SCALER_CFG_FMT_YCBCR420_2P |
+                                       SCALER_CFG_BYTE_SWAP |
+                                       SCALER_CFG_10BIT_P010,
+               .bitperpixel    = { 24 },
+               .num_planes     = 1,
+               .num_comp       = 2,
+               .h_shift        = 1,
+               .v_shift        = 1,
        }, {
                .name           = "YUV 4:2:2 contiguous 2-planar, Y/CbCr 8+2 bit",
                .pixelformat    = V4L2_PIX_FMT_NV16M_S10B,
@@ -1296,6 +1307,8 @@ static void sc_calc_intbufsize(struct sc_dev *sc, struct sc_int_frame *int_frame
                                        &frame->addr.size[SC_PLANE_CB],
                                        false);
                } else if (frame->sc_fmt->num_planes == 1) {
+                       if (frame->sc_fmt->pixelformat == V4L2_PIX_FMT_NV12_P010)
+                               pixsize *= 2;
                        frame->addr.size[SC_PLANE_Y] = pixsize;
                        frame->addr.size[SC_PLANE_CB] = bytesize - pixsize;
                } else if (frame->sc_fmt->num_planes == 2) {
@@ -2954,6 +2967,8 @@ static int sc_get_bufaddr(struct sc_dev *sc, struct vb2_buffer *vb2buf,
                                frame->addr.size[SC_PLANE_Y] = NV12N_Y_SIZE(w, h);
                                frame->addr.size[SC_PLANE_CB] = NV12N_CBCR_SIZE(w, h);
                        } else {
+                               if (frame->sc_fmt->pixelformat == V4L2_PIX_FMT_NV12_P010)
+                                       pixsize *= 2;
                                frame->addr.ioaddr[SC_PLANE_CB] = frame->addr.ioaddr[SC_PLANE_Y] + pixsize;
                                frame->addr.size[SC_PLANE_Y] = pixsize;
                                frame->addr.size[SC_PLANE_CB] = bytesize - pixsize;
@@ -3425,6 +3440,8 @@ static void sc_m2m1shot_get_bufaddr(struct sc_dev *sc,
                                frame->addr.size[SC_PLANE_Y] = NV12N_Y_SIZE(w, h);
                                frame->addr.size[SC_PLANE_CB] = NV12N_CBCR_SIZE(w, h);
                        } else {
+                               if (frame->sc_fmt->pixelformat == V4L2_PIX_FMT_NV12_P010)
+                                       pixsize *= 2;
                                frame->addr.ioaddr[SC_PLANE_CB] = frame->addr.ioaddr[SC_PLANE_Y] + pixsize;
                                frame->addr.size[SC_PLANE_Y] = pixsize;
                                frame->addr.size[SC_PLANE_CB] = bytesize - pixsize;