summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorjung-min.oh <jung-min.oh@samsung.com>2011-08-06 13:08:34 +0900
committerJamie Gennis <jgennis@google.com>2011-08-24 15:23:21 -0700
commit7c54f81840d4beead7cdeb64a1a0e93147817b92 (patch)
tree256e9e234748da5eb523e77855d4bfae086fb287 /include
parent18c23c0cb84ee8390e2f063ad24e8bf30f3d0983 (diff)
downloaddevice_samsung_crespo-7c54f81840d4beead7cdeb64a1a0e93147817b92.zip
device_samsung_crespo-7c54f81840d4beead7cdeb64a1a0e93147817b92.tar.gz
device_samsung_crespo-7c54f81840d4beead7cdeb64a1a0e93147817b92.tar.bz2
libhwcompower: Add HWCompower HAL
Change-Id: I8842908564b4556621af4e9d1245e07673f6d87c Signed-off-by: jung-min.oh <jung-min.oh@samsung.com>
Diffstat (limited to 'include')
-rw-r--r--include/hal_public.h163
-rwxr-xr-xinclude/sec_format.h43
-rwxr-xr-xinclude/sec_lcd.h49
-rw-r--r--include/sec_utils.h331
4 files changed, 586 insertions, 0 deletions
diff --git a/include/hal_public.h b/include/hal_public.h
new file mode 100644
index 0000000..9764ee8
--- /dev/null
+++ b/include/hal_public.h
@@ -0,0 +1,163 @@
+/* Copyright (c) Imagination Technologies Ltd.
+ *
+ * The contents of this file are subject to the MIT license as set out below.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef HAL_PUBLIC_H
+#define HAL_PUBLIC_H
+
+/* Authors of third party hardware composer (HWC) modules will need to include
+ * this header to access functionality in the gralloc and framebuffer HALs.
+ */
+
+#include <hardware/gralloc.h>
+
+#define ALIGN(x,a) (((x) + (a) - 1L) & ~((a) - 1L))
+#define HW_ALIGN 32
+
+/* This can be tuned down as appropriate for the SOC.
+ *
+ * IMG formats are usually a single sub-alloc.
+ * Some OEM video formats are two sub-allocs (Y, UV planes).
+ * Future OEM video formats might be three sub-allocs (Y, U, V planes).
+ */
+#define MAX_SUB_ALLOCS 3
+
+typedef struct
+{
+ native_handle_t base;
+
+ /* These fields can be sent cross process. They are also valid
+ * to duplicate within the same process.
+ *
+ * A table is stored within psPrivateData on gralloc_module_t (this
+ * is obviously per-process) which maps stamps to a mapped
+ * PVRSRV_CLIENT_MEM_INFO in that process. Each map entry has a lock
+ * count associated with it, satisfying the requirements of the
+ * Android API. This also prevents us from leaking maps/allocations.
+ *
+ * This table has entries inserted either by alloc()
+ * (alloc_device_t) or map() (gralloc_module_t). Entries are removed
+ * by free() (alloc_device_t) and unmap() (gralloc_module_t).
+ *
+ * As a special case for framebuffer_device_t, framebuffer_open()
+ * will add and framebuffer_close() will remove from this table.
+ */
+
+#define IMG_NATIVE_HANDLE_NUMFDS MAX_SUB_ALLOCS
+ /* The `fd' field is used to "export" a meminfo to another process.
+ * Therefore, it is allocated by alloc_device_t, and consumed by
+ * gralloc_module_t. The framebuffer_device_t does not need a handle,
+ * and the special value IMG_FRAMEBUFFER_FD is used instead.
+ */
+ int fd[MAX_SUB_ALLOCS];
+
+#define IMG_NATIVE_HANDLE_NUMINTS ((sizeof(unsigned long long) / sizeof(int)) + 5)
+ /* A KERNEL unique identifier for any exported kernel meminfo. Each
+ * exported kernel meminfo will have a unique stamp, but note that in
+ * userspace, several meminfos across multiple processes could have
+ * the same stamp. As the native_handle can be dup(2)'d, there could be
+ * multiple handles with the same stamp but different file descriptors.
+ */
+ unsigned long long ui64Stamp;
+
+ /* This is used for buffer usage validation when locking a buffer,
+ * and also in WSEGL (for the composition bypass feature).
+ */
+ int usage;
+
+ //int dummy;
+ /* In order to do efficient cache flushes we need the buffer dimensions
+ * and format. These are available on the ANativeWindowBuffer,
+ * but the platform doesn't pass them down to the graphics HAL.
+ *
+ * These fields are also used in the composition bypass. In this
+ * capacity, these are the "real" values for the backing allocation.
+ */
+ int iWidth;
+ int iHeight;
+ int iFormat;
+ unsigned int uiBpp;
+}
+__attribute__((aligned(sizeof(int)),packed)) IMG_native_handle_t;
+
+typedef struct
+{
+ framebuffer_device_t base;
+
+ /* The HWC was loaded. post() is no longer responsible for presents */
+ int bBypassPost;
+
+ /* Custom-blit components in lieu of overlay hardware */
+ int (*Blit)(framebuffer_device_t *device, buffer_handle_t src,
+ buffer_handle_t dest, int w, int h, int x, int y);
+
+ /* HWC path for present posts */
+ int (*Post2)(framebuffer_device_t *fb, buffer_handle_t *buffers,
+ int num_buffers, void *data, int data_length);
+}
+IMG_framebuffer_device_public_t;
+
+typedef struct IMG_gralloc_module_public_t
+{
+ gralloc_module_t base;
+
+ /* If the framebuffer has been opened, this will point to the
+ * framebuffer device data required by the allocator, WSEGL
+ * modules and composerhal.
+ */
+ IMG_framebuffer_device_public_t *psFrameBufferDevice;
+
+ int (*GetPhyAddrs)(struct IMG_gralloc_module_public_t const* module,
+ buffer_handle_t handle,
+ unsigned int auiPhyAddr[MAX_SUB_ALLOCS]);
+}
+IMG_gralloc_module_public_t;
+
+typedef struct
+{
+ int l, t, w, h;
+}
+IMG_write_lock_rect_t;
+
+typedef struct IMG_buffer_format_public_t
+{
+ /* Buffer formats are returned as a linked list */
+ struct IMG_buffer_format_public_t *psNext;
+
+ /* HAL_PIXEL_FORMAT_... enumerant */
+ int iHalPixelFormat;
+
+ /* WSEGL_PIXELFORMAT_... enumerant */
+ int iWSEGLPixelFormat;
+
+ /* Friendly name for format */
+ const char *const szName;
+
+ /* Bits (not bytes) per pixel */
+ unsigned int uiBpp;
+
+ /* GPU output format (creates EGLConfig for format) */
+ int bGPURenderable;
+}
+IMG_buffer_format_public_t;
+
+#endif /* HAL_PUBLIC_H */
diff --git a/include/sec_format.h b/include/sec_format.h
new file mode 100755
index 0000000..99a47bf
--- /dev/null
+++ b/include/sec_format.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright@ Samsung Electronics Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+#ifndef _SEC_FORMAT_H_
+#define _SEC_FORMAT_H_
+
+/* enum related to pixel format */
+
+enum {
+ HAL_PIXEL_FORMAT_YCbCr_420_SP = 0x100,
+ HAL_PIXEL_FORMAT_YCbCr_420_P = 0x101,
+ HAL_PIXEL_FORMAT_YCbCr_420_I = 0x102,
+ HAL_PIXEL_FORMAT_CbYCrY_422_I = 0x103,
+ HAL_PIXEL_FORMAT_CbYCrY_420_I = 0x104,
+ HAL_PIXEL_FORMAT_YCbCr_422_P = 0x105,
+ HAL_PIXEL_FORMAT_YCrCb_422_SP = 0x106,
+ // support custom format for zero copy
+ HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP = 0x110,
+ HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP = 0x111,
+ HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED = 0x112,
+ HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_SP = 0x113,
+ HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_SP = 0x114,
+ HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_I = 0x115,
+ HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_I = 0x116,
+ HAL_PIXEL_FORMAT_CUSTOM_CbYCrY_422_I = 0x117,
+ HAL_PIXEL_FORMAT_CUSTOM_CrYCbY_422_I = 0x118,
+ HAL_PIXEL_FORMAT_CUSTOM_MAX
+};
+
+#endif
diff --git a/include/sec_lcd.h b/include/sec_lcd.h
new file mode 100755
index 0000000..b5451b7
--- /dev/null
+++ b/include/sec_lcd.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright@ Samsung Electronics Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _SEC_FB_LCD_
+#define _SEC_FB_LCD_
+
+/*
+ * S T R U C T U R E S F O R C U S T O M I O C T L S
+ *
+*/
+struct secfb_user_window {
+ int x;
+ int y;
+};
+
+/*
+ * C U S T O M I O C T L S
+ *
+*/
+
+#define FBIO_WAITFORVSYNC _IO ('F', 32)
+#define SECFB_WIN_POSITION _IOW ('F', 203, struct secfb_user_window)
+
+
+#define DEFAULT_LCD_WIDTH (480)
+#define DEFAULT_LCD_HEIGHT (800)
+#define DEFAULT_LCD_BPP (32)
+
+/***************** LCD frame buffer *****************/
+#define FB0_NAME "/dev/fb0"
+#define FB1_NAME "/dev/fb1"
+#define FB2_NAME "/dev/fb2"
+#define FB3_NAME "/dev/fb3"
+#define FB4_NAME "/dev/fb4"
+
+#endif
diff --git a/include/sec_utils.h b/include/sec_utils.h
new file mode 100644
index 0000000..80b4493
--- /dev/null
+++ b/include/sec_utils.h
@@ -0,0 +1,331 @@
+/*
+ * Copyright@ Samsung Electronics Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+#ifndef __SAMSUNG_SYSLSI_SEC_COMMON_H__
+#define __SAMSUNG_SYSLSI_SEC_COMMON_H__
+
+//---------------------------------------------------------//
+// Include
+//---------------------------------------------------------//
+
+#include <hardware/hardware.h>
+#include "sec_format.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <linux/videodev2.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+//---------------------------------------------------------//
+// Common structure //
+//---------------------------------------------------------//
+struct ADDRS {
+ unsigned int addr_y;
+ unsigned int addr_cbcr;
+ unsigned int buf_idx;
+ unsigned int reserved;
+};
+
+//---------------------------------------------------------//
+// Common function //
+//---------------------------------------------------------//
+inline int HAL_PIXEL_FORMAT_2_V4L2_PIX(int HAL_PIXEL_FORMAT)
+{
+ int V4L2_PIX = -1;
+
+ switch (HAL_PIXEL_FORMAT) {
+ case HAL_PIXEL_FORMAT_RGBA_8888:
+ case HAL_PIXEL_FORMAT_RGBX_8888:
+ V4L2_PIX = V4L2_PIX_FMT_RGB32;
+ break;
+
+ case HAL_PIXEL_FORMAT_RGB_888:
+ V4L2_PIX = V4L2_PIX_FMT_RGB24;
+ break;
+
+ case HAL_PIXEL_FORMAT_RGB_565:
+ V4L2_PIX = V4L2_PIX_FMT_RGB565;
+ break;
+
+ case HAL_PIXEL_FORMAT_BGRA_8888:
+ //V4L2_PIX = V4L2_PIX_FMT_BGR32; // this is not proper on fimc.
+ V4L2_PIX = V4L2_PIX_FMT_RGB32;
+ break;
+
+ case HAL_PIXEL_FORMAT_RGBA_5551:
+ V4L2_PIX = V4L2_PIX_FMT_RGB555X;
+ break;
+
+ case HAL_PIXEL_FORMAT_RGBA_4444:
+ V4L2_PIX = V4L2_PIX_FMT_RGB444;
+ break;
+
+ case HAL_PIXEL_FORMAT_YV12:
+ case HAL_PIXEL_FORMAT_YCbCr_420_P:
+ V4L2_PIX = V4L2_PIX_FMT_YUV420;
+ break;
+
+ case HAL_PIXEL_FORMAT_YCbCr_422_SP:
+ case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_SP:
+ V4L2_PIX = V4L2_PIX_FMT_NV61;
+ break;
+
+ case HAL_PIXEL_FORMAT_YCbCr_420_SP:
+ case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP:
+ V4L2_PIX = V4L2_PIX_FMT_NV12;
+ break;
+
+ case HAL_PIXEL_FORMAT_YCbCr_422_I:
+ case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_I:
+ V4L2_PIX = V4L2_PIX_FMT_YUYV;
+ break;
+
+ case HAL_PIXEL_FORMAT_YCbCr_422_P:
+ V4L2_PIX = V4L2_PIX_FMT_YUV422P;
+ break;
+
+ case HAL_PIXEL_FORMAT_CbYCrY_422_I:
+ case HAL_PIXEL_FORMAT_CUSTOM_CbYCrY_422_I:
+ V4L2_PIX = V4L2_PIX_FMT_UYVY;
+ break;
+
+ case HAL_PIXEL_FORMAT_YCrCb_422_SP:
+ case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_SP:
+ V4L2_PIX = V4L2_PIX_FMT_NV16;
+ break;
+
+ case HAL_PIXEL_FORMAT_YCrCb_420_SP:
+ case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP:
+ V4L2_PIX = V4L2_PIX_FMT_NV21;
+ break;
+
+ case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED:
+ V4L2_PIX = V4L2_PIX_FMT_NV12T;
+ break;
+
+ case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_I:
+ V4L2_PIX = V4L2_PIX_FMT_YVYU;
+ break;
+
+ case HAL_PIXEL_FORMAT_CUSTOM_CrYCbY_422_I:
+ V4L2_PIX = V4L2_PIX_FMT_VYUY;
+ break;
+
+ default:
+ LOGE("%s::unmatched HAL_PIXEL_FORMAT color_space(0x%x)\n",
+ __func__, HAL_PIXEL_FORMAT);
+ break;
+ }
+
+ return V4L2_PIX;
+}
+
+inline int V4L2_PIX_2_HAL_PIXEL_FORMAT(int V4L2_PIX)
+{
+ int HAL_PIXEL_FORMAT = -1;
+
+ switch (V4L2_PIX) {
+ case V4L2_PIX_FMT_RGB32:
+ HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_RGBA_8888;
+ //HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_RGBX_8888;
+ break;
+
+ case V4L2_PIX_FMT_RGB24:
+ HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_RGB_888;
+ break;
+
+ case V4L2_PIX_FMT_RGB565:
+ HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_RGB_565;
+ break;
+
+ case V4L2_PIX_FMT_BGR32:
+ HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_BGRA_8888;
+ break;
+
+ case V4L2_PIX_FMT_RGB555X:
+ HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_RGBA_5551;
+ break;
+
+ case V4L2_PIX_FMT_RGB444:
+ HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_RGBA_4444;
+ break;
+
+ case V4L2_PIX_FMT_YUV420:
+ //HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_YV12;
+ HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_YCbCr_420_P;
+ break;
+
+ case V4L2_PIX_FMT_NV16:
+ //HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_YCrCb_422_SP;
+ HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_SP;
+ break;
+
+ case V4L2_PIX_FMT_NV12:
+ //HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_YCrCb_420_SP;
+ HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP;
+ break;
+
+ case V4L2_PIX_FMT_YUYV:
+ //HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_YCbCr_422_I;
+ HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_I;
+ break;
+
+ case V4L2_PIX_FMT_YUV422P:
+ HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_YCbCr_422_P;
+ break;
+
+ case V4L2_PIX_FMT_UYVY:
+ //HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CbYCrY_422_I;
+ HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_CbYCrY_422_I;
+ break;
+
+ case V4L2_PIX_FMT_NV21:
+ //HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_YCbCr_420_SP;
+ HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP;
+ break;
+
+ case V4L2_PIX_FMT_NV12T:
+ HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED;
+ break;
+
+ case V4L2_PIX_FMT_NV61:
+ HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_SP;
+ break;
+
+ case V4L2_PIX_FMT_YVYU:
+ HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_I;
+ break;
+
+ case V4L2_PIX_FMT_VYUY:
+ HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_CrYCbY_422_I;
+ break;
+
+ default:
+ LOGE("%s::unmatched V4L2_PIX color_space(%d)\n",
+ __func__, V4L2_PIX);
+ break;
+ }
+
+ return HAL_PIXEL_FORMAT;
+}
+
+#define ALIGN_TO_32B(x) ((((x) + (1 << 5) - 1) >> 5) << 5)
+#define ALIGN_TO_128B(x) ((((x) + (1 << 7) - 1) >> 7) << 7)
+#define ALIGN_TO_8KB(x) ((((x) + (1 << 13) - 1) >> 13) << 13)
+
+#define GET_32BPP_FRAME_SIZE(w, h) (((w) * (h)) << 2)
+#define GET_24BPP_FRAME_SIZE(w, h) (((w) * (h)) * 3)
+#define GET_16BPP_FRAME_SIZE(w, h) (((w) * (h)) << 1)
+
+inline unsigned int FRAME_SIZE(int HAL_PIXEL_FORMAT, int w, int h)
+{
+ unsigned int frame_size = 0;
+ unsigned int size = 0;
+
+ switch (HAL_PIXEL_FORMAT) {
+ // 16bpp
+ case HAL_PIXEL_FORMAT_RGB_565:
+ case HAL_PIXEL_FORMAT_RGBA_5551:
+ //case HAL_PIXEL_FORMAT_ARGB_1555:
+ //case HAL_PIXEL_FORMAT_BGRA_5551:
+ //case HAL_PIXEL_FORMAT_ABGR_1555:
+
+ //case HAL_PIXEL_FORMAT_RGBX_5551:
+ //case HAL_PIXEL_FORMAT_XRGB_1555:
+ //case HAL_PIXEL_FORMAT_BGRX_5551:
+ //case HAL_PIXEL_FORMAT_XBGR_1555:
+
+ case HAL_PIXEL_FORMAT_RGBA_4444:
+ //case HAL_PIXEL_FORMAT_ARGB_4444:
+ //case HAL_PIXEL_FORMAT_BGRA_4444:
+ //case HAL_PIXEL_FORMAT_ABGR_4444:
+
+ //case HAL_PIXEL_FORMAT_RGBX_4444:
+ //case HAL_PIXEL_FORMAT_XRGB_4444:
+ //case HAL_PIXEL_FORMAT_BGRX_4444:
+ //case HAL_PIXEL_FORMAT_XBGR_4444:
+ frame_size = GET_16BPP_FRAME_SIZE(w, h);
+ break;
+
+ // 24bpp
+ case HAL_PIXEL_FORMAT_RGB_888:
+ frame_size = GET_24BPP_FRAME_SIZE(w, h);
+ break;
+
+ // 32bpp
+ case HAL_PIXEL_FORMAT_RGBA_8888:
+ //case HAL_PIXEL_FORMAT_ARGB_8888:
+ case HAL_PIXEL_FORMAT_BGRA_8888:
+ //case HAL_PIXEL_FORMAT_ABGR_8888:
+
+ case HAL_PIXEL_FORMAT_RGBX_8888:
+ //case HAL_PIXEL_FORMAT_XRGB_8888:
+ //case HAL_PIXEL_FORMAT_BGRX_8888:
+ //case HAL_PIXEL_FORMAT_XBGR_8888:
+ frame_size = GET_32BPP_FRAME_SIZE(w, h);
+ break;
+
+ // 12bpp
+ case HAL_PIXEL_FORMAT_YV12:
+ case HAL_PIXEL_FORMAT_YCrCb_420_SP:
+ case HAL_PIXEL_FORMAT_YCbCr_420_P:
+ case HAL_PIXEL_FORMAT_YCbCr_420_I:
+ case HAL_PIXEL_FORMAT_CbYCrY_420_I:
+ case HAL_PIXEL_FORMAT_YCbCr_420_SP:
+ case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP:
+ case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP:
+ size = w * h;
+ // frame_size = width * height * 3 / 2;
+ // sw5771.park : very curious...
+ // frame_size = size + ((size / 4) * 2);
+ frame_size = size + ((size >> 2) << 1);
+ break;
+
+ case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED:
+ frame_size = ALIGN_TO_8KB(ALIGN_TO_128B(w) * ALIGN_TO_32B(h))
+ + ALIGN_TO_8KB(ALIGN_TO_128B(w) * ALIGN_TO_32B(h >> 1));
+ break;
+
+ // 16bpp
+ case HAL_PIXEL_FORMAT_YCbCr_422_SP:
+ case HAL_PIXEL_FORMAT_YCbCr_422_I:
+ case HAL_PIXEL_FORMAT_YCbCr_422_P:
+ case HAL_PIXEL_FORMAT_CbYCrY_422_I:
+ case HAL_PIXEL_FORMAT_YCrCb_422_SP:
+ case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_SP:
+ case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_SP:
+ case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_I:
+ case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_I:
+ case HAL_PIXEL_FORMAT_CUSTOM_CbYCrY_422_I:
+ case HAL_PIXEL_FORMAT_CUSTOM_CrYCbY_422_I:
+ frame_size = GET_16BPP_FRAME_SIZE(w, h);
+ break;
+
+ default:
+ LOGD("%s::no matching source colorformat(0x%x), w(%d), h(%d) fail\n",
+ __func__, HAL_PIXEL_FORMAT, w, h);
+ break;
+ }
+
+ return frame_size;
+}
+
+#endif //__SAMSUNG_SYSLSI_SEC_COMMON_H__