Disambiguate framework formats from exynos formats
authorRebecca Schultz Zavin <rebecca@android.com>
Thu, 23 Aug 2012 07:03:05 +0000 (00:03 -0700)
committerRebecca Schultz Zavin <rebecca@android.com>
Thu, 23 Aug 2012 17:33:45 +0000 (10:33 -0700)
Previously exynos hal code was using the framework definitions
of YV12 and NV21 to describe custom exynos formats that are
similar but not the same.  This patch defines new formats that
describe the custom formats that should be used instead.

Change-Id: I05f5c07d4ab77ef614c765f51fb7254b47005f79
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
gralloc/gralloc.cpp
include/exynos_format.h
libcamera2/ExynosCameraHWInterface2.cpp
libexynosutils/exynos5_format_v4l2.c
libhwc/hwc.cpp

index c43ce4112bb5f10c68ae29fb8ef131d3d1a49d34..cb623ed454d440c5e3bd3e75749561bdcb5cac63 100644 (file)
@@ -161,7 +161,7 @@ static int gralloc_alloc_yuv(int ionfd, int w, int h, int format, int usage,
 
     switch (format) {
         ALOGE("invalid yuv format %d\n", format);
-        case HAL_PIXEL_FORMAT_YV12:
+        case HAL_PIXEL_FORMAT_EXYNOS_YV12:
         {
             luma_vstride = ALIGN(h, 16);
             luma_size = luma_vstride * *stride;
@@ -169,7 +169,7 @@ static int gralloc_alloc_yuv(int ionfd, int w, int h, int format, int usage,
             planes = 3;
             break;
         }
-        case HAL_PIXEL_FORMAT_YCrCb_420_SP:
+        case HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP:
         case HAL_PIXEL_FORMAT_YCbCr_420_SP:
         case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
         {
index efc1645586179c26338230db235799479d2cc48f..f4c0466fe425595b63037fcc92d17e49e7f2d005 100644 (file)
@@ -42,6 +42,9 @@ enum {
     HAL_PIXEL_FORMAT_CUSTOM_CbYCrY_422_I        = 0x117,
     HAL_PIXEL_FORMAT_CUSTOM_CrYCbY_422_I        = 0x118,
     HAL_PIXEL_FORMAT_CUSTOM_CbYCr_422_I         = 0x11B,
+
+    HAL_PIXEL_FORMAT_EXYNOS_YV12                = 0x11C,
+    HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP        = 0x11D,
     HAL_PIXEL_FORMAT_CUSTOM_MAX
 };
 
index f939d9fefb3a3b5ae1e4e37fa352d491916ebeca..9437a73f8890a8fc5948c40aa8b9df418b67221a 100644 (file)
@@ -1296,7 +1296,7 @@ int ExynosCameraHWInterface2::allocateStream(uint32_t width, uint32_t height, in
             m_scp_closed = false;
             usleep(100000); // TODO : guarantee the codes below will be run after readyToRunInternal()
 
-            *format_actual = HAL_PIXEL_FORMAT_YV12;
+            *format_actual = HAL_PIXEL_FORMAT_EXYNOS_YV12;
             *usage = GRALLOC_USAGE_SW_WRITE_OFTEN;
             *max_buffers = 8;
 
@@ -2641,7 +2641,7 @@ void ExynosCameraHWInterface2::m_streamThreadFunc(SignalDrivenThread * self)
                         csc_set_src_format(m_exynosVideoCSC,
                                            previewW, previewH,
                                            cropX, cropY, cropW, cropH,
-                                           HAL_PIXEL_FORMAT_YV12,
+                                           HAL_PIXEL_FORMAT_EXYNOS_YV12,
                                            0);
 
                         csc_set_dst_format(m_exynosVideoCSC,
index 04609b4ad048ecc1435be65d814b07963f2d7247..f974b9faea9d46d424da15afa9336fd185739064 100644 (file)
@@ -75,7 +75,7 @@ int HAL_PIXEL_FORMAT_2_V4L2_PIX(
         v4l2_pixel_format = V4L2_PIX_FMT_RGB444;
         break;
 
-    case HAL_PIXEL_FORMAT_YV12:
+    case HAL_PIXEL_FORMAT_EXYNOS_YV12:
         v4l2_pixel_format = V4L2_PIX_FMT_YVU420M;
         break;
 
@@ -112,7 +112,7 @@ int HAL_PIXEL_FORMAT_2_V4L2_PIX(
         v4l2_pixel_format = V4L2_PIX_FMT_NV16;
         break;
 
-    case HAL_PIXEL_FORMAT_YCrCb_420_SP:
+    case HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP:
     case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP:
         v4l2_pixel_format = V4L2_PIX_FMT_NV21M;
         break;
@@ -179,7 +179,7 @@ int V4L2_PIX_2_HAL_PIXEL_FORMAT(
 
     case V4L2_PIX_FMT_YVU420:
     case V4L2_PIX_FMT_YVU420M:
-         hal_pixel_format = HAL_PIXEL_FORMAT_YV12;
+         hal_pixel_format = HAL_PIXEL_FORMAT_EXYNOS_YV12;
          break;
 
     case V4L2_PIX_FMT_NV16:
@@ -238,10 +238,10 @@ int V4L2_PIX_2_HAL_PIXEL_FORMAT(
 int NUM_PLANES(int hal_pixel_format)
 {
     switch(hal_pixel_format) {
-    case HAL_PIXEL_FORMAT_YV12:
+    case HAL_PIXEL_FORMAT_EXYNOS_YV12:
     case HAL_PIXEL_FORMAT_YCbCr_420_P:
        return 3;
-    case HAL_PIXEL_FORMAT_YCrCb_420_SP:
+    case HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP:
     case HAL_PIXEL_FORMAT_YCbCr_420_SP:
     case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP:
     case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP:
@@ -285,7 +285,7 @@ unsigned int FRAME_SIZE(
         break;
 
     // 12bpp
-    case HAL_PIXEL_FORMAT_YV12:
+    case HAL_PIXEL_FORMAT_EXYNOS_YV12:
     case HAL_PIXEL_FORMAT_YCbCr_420_P:
     case HAL_PIXEL_FORMAT_YCbCr_420_I:
     case HAL_PIXEL_FORMAT_CbYCrY_420_I:
@@ -293,7 +293,7 @@ unsigned int FRAME_SIZE(
         frame_size = size + 2 * ALIGN(width >> 1, 8) * ALIGN(height >> 1, 8);
         break;
 
-    case HAL_PIXEL_FORMAT_YCrCb_420_SP:
+    case HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP:
     case HAL_PIXEL_FORMAT_YCbCr_420_SP:
     case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP:
     case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP:
@@ -336,12 +336,12 @@ int PLANAR_FRAME_SIZE(int hal_pixel_format, int width, int height,
     unsigned int size       = 0;
 
     switch(hal_pixel_format) {
-    case HAL_PIXEL_FORMAT_YV12:
+    case HAL_PIXEL_FORMAT_EXYNOS_YV12:
     case HAL_PIXEL_FORMAT_YCbCr_420_P:
         size = width * height;
        *luma_size = size;
        *chroma_size = size >> 2;
-    case HAL_PIXEL_FORMAT_YCrCb_420_SP:
+    case HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP:
     case HAL_PIXEL_FORMAT_YCbCr_420_I:
     case HAL_PIXEL_FORMAT_CbYCrY_420_I:
     case HAL_PIXEL_FORMAT_YCbCr_420_SP:
index 2aa79f911793c595d68cbd6bddc72d52f998ab67..7c352eebaaa92b6b6f89a290affada8fa2f7485e 100644 (file)
@@ -210,7 +210,7 @@ static bool exynos5_format_is_supported_by_gscaler(int format)
     switch (format) {
     case HAL_PIXEL_FORMAT_RGBX_8888:
     case HAL_PIXEL_FORMAT_RGB_565:
-    case HAL_PIXEL_FORMAT_YV12:
+    case HAL_PIXEL_FORMAT_EXYNOS_YV12:
     case HAL_PIXEL_FORMAT_YCbCr_420_P:
     case HAL_PIXEL_FORMAT_YCbCr_422_SP:
     case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_SP:
@@ -223,7 +223,7 @@ static bool exynos5_format_is_supported_by_gscaler(int format)
     case HAL_PIXEL_FORMAT_CUSTOM_CbYCrY_422_I:
     case HAL_PIXEL_FORMAT_YCrCb_422_SP:
     case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_SP:
-    case HAL_PIXEL_FORMAT_YCrCb_420_SP:
+    case HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP:
     case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP:
     case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
     case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED:
@@ -238,7 +238,7 @@ static bool exynos5_format_is_supported_by_gscaler(int format)
 
 static bool exynos5_format_is_ycrcb(int format)
 {
-    return format == HAL_PIXEL_FORMAT_YV12;
+    return format == HAL_PIXEL_FORMAT_EXYNOS_YV12;
 }
 
 static bool exynos5_format_requires_gscaler(int format)
@@ -337,7 +337,7 @@ int hdmi_get_config(struct exynos5_hwc_composer_device_1_t *dev)
             info->h  = enum_preset.height;
             info->fw = enum_preset.width;
             info->fh = enum_preset.height;
-            info->format = HAL_PIXEL_FORMAT_YV12;
+            info->format = HAL_PIXEL_FORMAT_EXYNOS_YV12;
             found = true;
         }
     }