libgscaler: Update for HDMI full screen video
authorBenoit Goby <benoit@android.com>
Tue, 28 Aug 2012 22:17:09 +0000 (15:17 -0700)
committerBenoit Goby <benoit@android.com>
Tue, 4 Sep 2012 18:13:42 +0000 (11:13 -0700)
Change-Id: I0b85e5a46e1374cf599040e582a75c0ba959df24

include/videodev2_exynos_media.h
libexynosutils/exynos5_format_v4l2.c
libgscaler/exynos_gsc_utils.h
libgscaler/exynos_gscaler.c

index 576c00c9a0c6cbbee38adea73d18aa82be178bf4..bd882a2292bfc7bb4db9ea8d2dbbffad91bff4f4 100644 (file)
@@ -77,6 +77,7 @@
 #define V4L2_CID_TV_CHROMA_ENABLE      (V4L2_CID_EXYNOS_BASE + 53)
 #define V4L2_CID_TV_CHROMA_VALUE       (V4L2_CID_EXYNOS_BASE + 54)
 #define V4L2_CID_TV_HPD_STATUS         (V4L2_CID_EXYNOS_BASE + 55)
+#define V4L2_CID_TV_LAYER_PRIO         (V4L2_CID_EXYNOS_BASE + 56)
 #define V4L2_CID_TV_SET_DVI_MODE       (V4L2_CID_EXYNOS_BASE + 57)
 
 #define V4L2_CID_CONTENT_PROTECTION    (V4L2_CID_EXYNOS_BASE + 201)
index f974b9faea9d46d424da15afa9336fd185739064..8b057173ea7bbdedb629aa2e1c2482b0592b4f7a 100644 (file)
@@ -374,6 +374,7 @@ int V4L2_PIX_2_YUV_INFO(unsigned int v4l2_pixel_format, unsigned int * bpp, unsi
     case V4L2_PIX_FMT_NV21X:
     case V4L2_PIX_FMT_NV12M:
     case V4L2_PIX_FMT_NV21M:
+    case V4L2_PIX_FMT_NV12MT_16X16:
         *bpp    = 12;
         *planes = 2;
         break;
index 25092bf3b62f74d8e2ba7ba7361918355007ff0f..fab170a65b2e453cbd1ccaf6b3e380f73b765ee5 100644 (file)
@@ -49,6 +49,7 @@ extern "C" {
 #define GSCALER_SUBDEV_PAD_SINK     (0)
 #define GSCALER_SUBDEV_PAD_SOURCE   (1)
 #define MIXER_V_SUBDEV_PAD_SINK     (0)
+#define MIXER_V_SUBDEV_PAD_SOURCE   (3)
 #define FIMD_SUBDEV_PAD_SINK     (0)
 #define MAX_BUFFERS                 (6)
 
index 84171a2b7b1a1c5a16defa7e4e63ff6f5b447000..7e7404810368056e485b24b8ca003168f73e15bb 100644 (file)
@@ -1425,8 +1425,13 @@ int exynos_gsc_out_config(void *handle,
     /* set format: src pad of GSC sub-dev*/
     sd_fmt.pad   = GSCALER_SUBDEV_PAD_SOURCE;
     sd_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
-    sd_fmt.format.width  = gsc_handle->dst_img.fw;
-    sd_fmt.format.height = gsc_handle->dst_img.fh;
+    if (gsc_handle->out_mode == GSC_OUT_FIMD) {
+        sd_fmt.format.width  = gsc_handle->dst_img.fw;
+        sd_fmt.format.height = gsc_handle->dst_img.fh;
+    } else {
+        sd_fmt.format.width  = gsc_handle->dst_img.w;
+        sd_fmt.format.height = gsc_handle->dst_img.h;
+    }
     sd_fmt.format.code   = rgb ? V4L2_MBUS_FMT_XRGB8888_4X8_LE :
                                     V4L2_MBUS_FMT_YUV8_1X24;
     if (exynos_subdev_s_fmt(gsc_handle->gsc_sd_entity->fd, &sd_fmt) < 0) {
@@ -1437,10 +1442,17 @@ int exynos_gsc_out_config(void *handle,
     /* set crop: src crop of GSC sub-dev*/
     sd_crop.pad   = GSCALER_SUBDEV_PAD_SOURCE;
     sd_crop.which = V4L2_SUBDEV_FORMAT_ACTIVE;
-    sd_crop.rect.left   = gsc_handle->dst_img.x;
-    sd_crop.rect.top    = gsc_handle->dst_img.y;
-    sd_crop.rect.width  = gsc_handle->dst_img.w;
-    sd_crop.rect.height = gsc_handle->dst_img.h;
+    if (gsc_handle->out_mode == GSC_OUT_FIMD) {
+        sd_crop.rect.left   = gsc_handle->dst_img.x;
+        sd_crop.rect.top    = gsc_handle->dst_img.y;
+        sd_crop.rect.width  = gsc_handle->dst_img.w;
+        sd_crop.rect.height = gsc_handle->dst_img.h;
+    } else {
+        sd_crop.rect.left   = 0;
+        sd_crop.rect.top    = 0;
+        sd_crop.rect.width  = gsc_handle->dst_img.w;
+        sd_crop.rect.height = gsc_handle->dst_img.h;
+    }
     if (exynos_subdev_s_crop(gsc_handle->gsc_sd_entity->fd, &sd_crop) < 0) {
             ALOGE("%s::GSC subdev set crop failed", __func__);
             return -1;
@@ -1448,14 +1460,17 @@ int exynos_gsc_out_config(void *handle,
 
     /* sink pad is connected to GSC out */
     /*  set format: sink sub-dev */
-    if (gsc_handle->out_mode == GSC_OUT_FIMD)
+    if (gsc_handle->out_mode == GSC_OUT_FIMD) {
         sd_fmt.pad   = FIMD_SUBDEV_PAD_SINK;
-    else
+        sd_fmt.format.width  = gsc_handle->dst_img.w;
+        sd_fmt.format.height = gsc_handle->dst_img.h;
+    } else {
         sd_fmt.pad   = MIXER_V_SUBDEV_PAD_SINK;
+        sd_fmt.format.width  = gsc_handle->dst_img.w + gsc_handle->dst_img.x*2;
+        sd_fmt.format.height = gsc_handle->dst_img.h + gsc_handle->dst_img.y*2;
+    }
 
     sd_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
-    sd_fmt.format.width  = gsc_handle->dst_img.w;
-    sd_fmt.format.height = gsc_handle->dst_img.h;
     sd_fmt.format.code   = rgb ? V4L2_MBUS_FMT_XRGB8888_4X8_LE :
                                     V4L2_MBUS_FMT_YUV8_1X24;
     if (exynos_subdev_s_fmt(gsc_handle->sink_sd_entity->fd, &sd_fmt) < 0) {
@@ -1470,15 +1485,45 @@ int exynos_gsc_out_config(void *handle,
         sd_crop.pad   = MIXER_V_SUBDEV_PAD_SINK;
 
     sd_crop.which = V4L2_SUBDEV_FORMAT_ACTIVE;
-    sd_crop.rect.left   = gsc_handle->dst_img.x;
-    sd_crop.rect.top    = gsc_handle->dst_img.y;
-    sd_crop.rect.width  = gsc_handle->dst_img.w;
-    sd_crop.rect.height = gsc_handle->dst_img.h;
+    if (gsc_handle->out_mode == GSC_OUT_FIMD) {
+        sd_crop.rect.left   = gsc_handle->dst_img.x;
+        sd_crop.rect.top    = gsc_handle->dst_img.y;
+        sd_crop.rect.width  = gsc_handle->dst_img.w;
+        sd_crop.rect.height = gsc_handle->dst_img.h;
+    } else {
+        sd_crop.rect.left   = 0;
+        sd_crop.rect.top    = 0;
+        sd_crop.rect.width  = gsc_handle->dst_img.w;
+        sd_crop.rect.height = gsc_handle->dst_img.h;
+    }
     if (exynos_subdev_s_crop(gsc_handle->sink_sd_entity->fd, &sd_crop) < 0) {
             ALOGE("%s::sink: subdev set crop failed(PAD=%d)", __func__, sd_crop.pad);
             return -1;
     }
 
+    if (gsc_handle->out_mode != GSC_OUT_FIMD) {
+        sd_fmt.pad   = MIXER_V_SUBDEV_PAD_SOURCE;
+        sd_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
+        sd_fmt.format.width  = gsc_handle->dst_img.w + gsc_handle->dst_img.x*2;
+        sd_fmt.format.height = gsc_handle->dst_img.h + gsc_handle->dst_img.y*2;
+        sd_fmt.format.code   = V4L2_MBUS_FMT_XRGB8888_4X8_LE;
+        if (exynos_subdev_s_fmt(gsc_handle->sink_sd_entity->fd, &sd_fmt) < 0) {
+            ALOGE("%s::sink:set format failed (PAD=%d)", __func__, sd_fmt.pad);
+            return -1;
+        }
+
+        sd_fmt.pad   = MIXER_V_SUBDEV_PAD_SOURCE;
+        sd_crop.which = V4L2_SUBDEV_FORMAT_ACTIVE;
+        sd_crop.rect.left   = gsc_handle->dst_img.x;
+        sd_crop.rect.top    = gsc_handle->dst_img.y;
+        sd_crop.rect.width  = gsc_handle->dst_img.w;
+        sd_crop.rect.height = gsc_handle->dst_img.h;
+        if (exynos_subdev_s_crop(gsc_handle->sink_sd_entity->fd, &sd_crop) < 0) {
+            ALOGE("%s::sink: subdev set crop failed(PAD=%d)", __func__, sd_crop.pad);
+            return -1;
+        }
+    }
+
     /*set GSC ctrls */
     if (exynos_v4l2_s_ctrl(gsc_handle->gsc_vd_entity->fd, V4L2_CID_ROTATE, rotate) < 0) {
         ALOGE("%s:: exynos_v4l2_s_ctrl (V4L2_CID_ROTATE: %d) failed", __func__,  rotate);