add hal-tbm-type.h header file
authorJunkyeong Kim <jk0430.kim@samsung.com>
Thu, 28 Jan 2021 07:00:13 +0000 (16:00 +0900)
committerJunkyeong Kim <jk0430.kim@samsung.com>
Thu, 28 Jan 2021 07:00:17 +0000 (16:00 +0900)
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
CMakeLists.txt
include/hal-tbm-common.h
include/hal-tbm-interface.h
include/hal-tbm-type.h [new file with mode: 0644]
include/hal-tbm.h
src/hal-api-tbm.c

index 85ccaca..992a2a8 100644 (file)
@@ -46,6 +46,7 @@ SET_TARGET_PROPERTIES(        ${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
 
 CONFIGURE_FILE(                ${PROJECT_NAME}.pc ${PROJECT_NAME}.pc @ONLY)
 INSTALL(TARGETS                ${PROJECT_NAME} DESTINATION ${LIBDIR}/hal)
+INSTALL(FILES          ${CMAKE_CURRENT_SOURCE_DIR}/include/hal-tbm-type.h DESTINATION ${INCLUDEDIR}/hal)
 INSTALL(FILES          ${CMAKE_CURRENT_SOURCE_DIR}/include/hal-tbm-common.h DESTINATION ${INCLUDEDIR}/hal)
 INSTALL(FILES          ${CMAKE_CURRENT_SOURCE_DIR}/include/hal-tbm.h DESTINATION ${INCLUDEDIR}/hal)
 INSTALL(FILES          ${CMAKE_CURRENT_SOURCE_DIR}/include/hal-tbm-interface.h DESTINATION ${INCLUDEDIR}/hal)
index fb23b01..bf59b2a 100644 (file)
@@ -33,6 +33,8 @@
 #ifndef __HAL_TBM_COMMON__
 #define __HAL_TBM_COMMON__
 
+#include "hal-tbm-type.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -75,7 +77,7 @@ typedef enum {
 /**
  * @brief Enumeration of tbm buffer manager capability.
  */
-enum HAL_TBM_BUFMGR_CAPABILITY {
+typedef enum _hal_tbm_bufmgr_capability {
        HAL_TBM_BUFMGR_CAPABILITY_NONE = 0,                  /**< Not Support capability*/
        HAL_TBM_BUFMGR_CAPABILITY_SHARE_KEY = (1 << 0),      /**< Support sharing buffer by tbm key */
        HAL_TBM_BUFMGR_CAPABILITY_SHARE_FD = (1 << 1),       /**< Support sharing buffer by tbm fd */
@@ -86,7 +88,7 @@ enum HAL_TBM_BUFMGR_CAPABILITY {
 /**
  * @brief Enumeration of bo memory type
  */
-enum HAL_TBM_BO_MEMORY_TYPE {
+typedef enum _hal_tbm_bo_memory_type {
        HAL_TBM_BO_DEFAULT = 0,                    /**< default memory: it depends on the backend         */
        HAL_TBM_BO_SCANOUT = (1 << 0),     /**< scanout memory                                    */
        HAL_TBM_BO_NONCACHABLE = (1 << 1), /**< non-cachable memory                               */
index 3d208be..01e5fdd 100644 (file)
@@ -45,7 +45,7 @@ typedef struct _hal_tbm_bufmgr_func {
        hal_tbm_bufmgr_capability (*bufmgr_get_capabilities)(hal_tbm_bufmgr_data *bufmgr_data, hal_tbm_error *error);
        hal_tbm_error (*bufmgr_bind_native_display)(hal_tbm_bufmgr_data *bufmgr_data, hal_tbm_native_display *native_display);
        hal_tbm_error (*bufmgr_get_supported_formats)(hal_tbm_bufmgr_data *bufmgr_data, uint32_t **formats, uint32_t *num);
-       hal_tbm_error (*bufmgr_get_plane_data)(hal_tbm_bufmgr_data *bufmgr_data, tbm_format format, int plane_idx, int width, int height,
+       hal_tbm_error (*bufmgr_get_plane_data)(hal_tbm_bufmgr_data *bufmgr_data, hal_tbm_format format, int plane_idx, int width, int height,
                                                                                uint32_t *size, uint32_t *offset, uint32_t *pitch, int *bo_idx);
        hal_tbm_bo_data *(*bufmgr_alloc_bo)(hal_tbm_bufmgr_data *bufmgr_data, unsigned int size, hal_tbm_bo_memory_type mem_types, hal_tbm_error *error);
        hal_tbm_bo_data *(*bufmgr_alloc_bo_with_format)(hal_tbm_bufmgr_data *bufmgr_data, int format, int bo_idx, int width, int height,
diff --git a/include/hal-tbm-type.h b/include/hal-tbm-type.h
new file mode 100644 (file)
index 0000000..d3810c0
--- /dev/null
@@ -0,0 +1,337 @@
+/**************************************************************************
+ *
+ * hal-api-tbm
+ *
+ * Copyright 2021 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Contact: SooChan Lim <sc1.lim@samsung.com>,
+ *          Junkyeong Kim <jk0430.kim@samsung.com>,
+ *          Changyeon Lee <cyeon.lee@samsung.com>
+ *
+ * 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, sub license, 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 (including the
+ * next paragraph) 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 NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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_TBM_TYPE_H_
+#define _HAL_TBM_TYPE_H_
+
+/**
+ * @addtogroup CAPI_UI_TBM_SURFACE_MODULE
+ * @{
+ */
+
+#include <stdint.h>
+#include <tizen.h>
+
+/**
+ * @brief Definition for the Tizen buffer surface.
+ */
+typedef struct _hal_tbm_surface *hal_tbm_surface_h;
+/**
+ * @brief Definition for the Tizen buffer surface format.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef uint32_t hal_tbm_format;
+
+#define __hal_tbm_fourcc_code(a, b, c, d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \
+                               ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
+
+/* color index */
+/**
+ * @brief Definition for the TBM surface format C8 ([7:0] C).
+ */
+#define HAL_TBM_FORMAT_C8       __hal_tbm_fourcc_code('C', '8', ' ', ' ')
+
+/* 8 bpp RGB */
+/**
+ * @brief Definition for the TBM surface format RGB322 ([7:0] R:G:B 3:3:2).
+ */
+#define HAL_TBM_FORMAT_RGB332   __hal_tbm_fourcc_code('R', 'G', 'B', '8')
+/**
+ * @brief Definition for the TBM surface format RGB233 ([7:0] B:G:R 2:3:3).
+ */
+#define HAL_TBM_FORMAT_BGR233   __hal_tbm_fourcc_code('B', 'G', 'R', '8')
+
+/* 16 bpp RGB */
+/**
+ * @brief Definition for the TBM surface format XRGB4444 ([15:0] x:R:G:B 4:4:4:4 little endian).
+ */
+#define HAL_TBM_FORMAT_XRGB4444 __hal_tbm_fourcc_code('X', 'R', '1', '2')
+/**
+ * @brief Definition for the TBM surface format XBRG4444 ([15:0] x:B:G:R 4:4:4:4 little endian).
+ */
+#define HAL_TBM_FORMAT_XBGR4444 __hal_tbm_fourcc_code('X', 'B', '1', '2')
+/**
+ * @brief Definition for the TBM surface format RGBX4444 ([15:0] R:G:B:x 4:4:4:4 little endian).
+ */
+#define HAL_TBM_FORMAT_RGBX4444 __hal_tbm_fourcc_code('R', 'X', '1', '2')
+/**
+ * @brief Definition for the TBM surface format BGRX4444 ([15:0] B:G:R:x 4:4:4:4 little endian).
+ */
+#define HAL_TBM_FORMAT_BGRX4444 __hal_tbm_fourcc_code('B', 'X', '1', '2')
+
+/**
+ * @brief Definition for the TBM surface format ARGB4444 ([15:0] A:R:G:B 4:4:4:4 little endian).
+ */
+#define HAL_TBM_FORMAT_ARGB4444 __hal_tbm_fourcc_code('A', 'R', '1', '2')
+/**
+ * @brief Definition for the TBM surface format ABGR4444 ([15:0] A:B:G:R 4:4:4:4 little endian).
+ */
+#define HAL_TBM_FORMAT_ABGR4444 __hal_tbm_fourcc_code('A', 'B', '1', '2')
+/**
+ * @brief Definition for the TBM surface format RGBA4444 ([15:0] R:G:B:A 4:4:4:4 little endian).
+ */
+#define HAL_TBM_FORMAT_RGBA4444 __hal_tbm_fourcc_code('R', 'A', '1', '2')
+/**
+ * @brief Definition for the TBM surface format BGRA4444 ([15:0] B:G:R:A 4:4:4:4 little endian).
+ */
+#define HAL_TBM_FORMAT_BGRA4444 __hal_tbm_fourcc_code('B', 'A', '1', '2')
+
+/**
+ * @brief Definition for the TBM surface format XRGB1555 ([15:0] x:R:G:B 1:5:5:5 little endian).
+ */
+#define HAL_TBM_FORMAT_XRGB1555 __hal_tbm_fourcc_code('X', 'R', '1', '5')
+/**
+ * @brief Definition for the TBM surface format XBGR1555 ([15:0] x:B:G:R 1:5:5:5 little endian).
+ */
+#define HAL_TBM_FORMAT_XBGR1555 __hal_tbm_fourcc_code('X', 'B', '1', '5')
+/**
+ * @brief Definition for the TBM surface format RGBX5551 ([15:0] R:G:B:x 5:5:5:1 little endian).
+ */
+#define HAL_TBM_FORMAT_RGBX5551 __hal_tbm_fourcc_code('R', 'X', '1', '5')
+/**
+ * @brief Definition for the TBM surface format BGRX5551 ([15:0] B:G:R:x 5:5:5:1 little endian).
+ */
+#define HAL_TBM_FORMAT_BGRX5551 __hal_tbm_fourcc_code('B', 'X', '1', '5')
+
+/**
+ * @brief Definition for the TBM surface format ARGB1555 ([15:0] A:R:G:B 1:5:5:5 little endian).
+ */
+#define HAL_TBM_FORMAT_ARGB1555 __hal_tbm_fourcc_code('A', 'R', '1', '5')
+/**
+ * @brief Definition for the TBM surface format ABGR1555 ([15:0] A:B:G:R 1:5:5:5 little endian).
+ */
+#define HAL_TBM_FORMAT_ABGR1555 __hal_tbm_fourcc_code('A', 'B', '1', '5')
+/**
+ * @brief Definition for the TBM surface format RGBA5551 ([15:0] R:G:B:A 5:5:5:1 little endian).
+ */
+#define HAL_TBM_FORMAT_RGBA5551 __hal_tbm_fourcc_code('R', 'A', '1', '5')
+/**
+ * @brief Definition for the TBM surface format BGRA5551 ([15:0] B:G:R:A 5:5:5:1 little endian).
+ */
+#define HAL_TBM_FORMAT_BGRA5551 __hal_tbm_fourcc_code('B', 'A', '1', '5')
+
+/**
+ * @brief Definition for the TBM surface format RGB565 ([15:0] R:G:B 5:6:5 little endian).
+ */
+#define HAL_TBM_FORMAT_RGB565   __hal_tbm_fourcc_code('R', 'G', '1', '6')
+/**
+ * @brief Definition for the TBM surface format BGR565 ([15:0] B:G:R 5:6:5 little endian).
+ */
+#define HAL_TBM_FORMAT_BGR565   __hal_tbm_fourcc_code('B', 'G', '1', '6')
+
+/* 24 bpp RGB */
+/**
+ * @brief Definition for the TBM surface format RGB888 ([23:0] R:G:B little endian).
+ */
+#define HAL_TBM_FORMAT_RGB888   __hal_tbm_fourcc_code('R', 'G', '2', '4')
+/**
+ * @brief Definition for the TBM surface format BGR888 ([23:0] B:G:R little endian).
+ */
+#define HAL_TBM_FORMAT_BGR888   __hal_tbm_fourcc_code('B', 'G', '2', '4')
+
+/* 32 bpp RGB */
+/**
+ * @brief Definition for the TBM surface format XRGB8888 ([31:0] x:R:G:B 8:8:8:8 little endian).
+ */
+#define HAL_TBM_FORMAT_XRGB8888 __hal_tbm_fourcc_code('X', 'R', '2', '4')
+/**
+ * @brief Definition for the TBM surface format XBGR8888 ([31:0] x:B:G:R 8:8:8:8 little endian).
+ */
+#define HAL_TBM_FORMAT_XBGR8888 __hal_tbm_fourcc_code('X', 'B', '2', '4')
+/**
+ * @brief Definition for the TBM surface format RGBX8888 ([31:0] R:G:B:x 8:8:8:8 little endian).
+ */
+#define HAL_TBM_FORMAT_RGBX8888 __hal_tbm_fourcc_code('R', 'X', '2', '4')
+/**
+ * @brief Definition for the TBM surface format BGRX8888 ([31:0] B:G:R:x 8:8:8:8 little endian).
+ */
+#define HAL_TBM_FORMAT_BGRX8888 __hal_tbm_fourcc_code('B', 'X', '2', '4')
+
+/**
+ * @brief Definition for the TBM surface format ARGB8888 ([31:0] A:R:G:B 8:8:8:8 little endian).
+ */
+#define HAL_TBM_FORMAT_ARGB8888 __hal_tbm_fourcc_code('A', 'R', '2', '4')
+/**
+ * @brief Definition for the TBM surface format ABGR8888 ([31:0] [31:0] A:B:G:R 8:8:8:8 little endian).
+ */
+#define HAL_TBM_FORMAT_ABGR8888 __hal_tbm_fourcc_code('A', 'B', '2', '4')
+/**
+ * @brief Definition for the TBM surface format RGBA8888 ([31:0] R:G:B:A 8:8:8:8 little endian).
+ */
+#define HAL_TBM_FORMAT_RGBA8888 __hal_tbm_fourcc_code('R', 'A', '2', '4')
+/**
+ * @brief Definition for the TBM surface format BGRA8888 ([31:0] B:G:R:A 8:8:8:8 little endian).
+ */
+#define HAL_TBM_FORMAT_BGRA8888 __hal_tbm_fourcc_code('B', 'A', '2', '4')
+
+/**
+ * @brief Definition for the TBM surface format XRGB2101010 ([31:0] x:R:G:B 2:10:10:10 little endian).
+ */
+#define HAL_TBM_FORMAT_XRGB2101010  __hal_tbm_fourcc_code('X', 'R', '3', '0')
+/**
+ * @brief Definition for the TBM surface format XBGR2101010 ([31:0] x:B:G:R 2:10:10:10 little endian).
+ */
+#define HAL_TBM_FORMAT_XBGR2101010  __hal_tbm_fourcc_code('X', 'B', '3', '0')
+/**
+ * @brief Definition for the TBM surface format RGBX1010102 ([31:0] R:G:B:x 10:10:10:2 little endian).
+ */
+#define HAL_TBM_FORMAT_RGBX1010102  __hal_tbm_fourcc_code('R', 'X', '3', '0')
+/**
+ * @brief Definition for the TBM surface format BGRX1010102 ([31:0] B:G:R:x 10:10:10:2 little endian).
+ */
+#define HAL_TBM_FORMAT_BGRX1010102  __hal_tbm_fourcc_code('B', 'X', '3', '0')
+
+/**
+ * @brief Definition for the TBM surface format ARGB2101010 ([31:0] A:R:G:B 2:10:10:10 little endian).
+ */
+#define HAL_TBM_FORMAT_ARGB2101010  __hal_tbm_fourcc_code('A', 'R', '3', '0')
+/**
+ * @brief Definition for the TBM surface format ABGR2101010 ([31:0] A:B:G:R 2:10:10:10 little endian).
+ */
+#define HAL_TBM_FORMAT_ABGR2101010  __hal_tbm_fourcc_code('A', 'B', '3', '0')
+/**
+ * @brief Definition for the TBM surface format RGBA1010102 ([31:0] R:G:B:A 10:10:10:2 little endian).
+ */
+#define HAL_TBM_FORMAT_RGBA1010102  __hal_tbm_fourcc_code('R', 'A', '3', '0')
+/**
+ * @brief Definition for the TBM surface format BGRA1010102 ([31:0] B:G:R:A 10:10:10:2 little endian).
+ */
+#define HAL_TBM_FORMAT_BGRA1010102  __hal_tbm_fourcc_code('B', 'A', '3', '0')
+
+/* packed YCbCr */
+/**
+ * @brief Definition for the TBM surface format YUYV ([31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian).
+ */
+#define HAL_TBM_FORMAT_YUYV     __hal_tbm_fourcc_code('Y', 'U', 'Y', 'V')
+/**
+ * @brief Definition for the TBM surface format YVYU ([31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian).
+ */
+#define HAL_TBM_FORMAT_YVYU     __hal_tbm_fourcc_code('Y', 'V', 'Y', 'U')
+/**
+ * @brief Definition for the TBM surface format UYVY ([31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian).
+ */
+#define HAL_TBM_FORMAT_UYVY     __hal_tbm_fourcc_code('U', 'Y', 'V', 'Y')
+/**
+ * @brief Definition for the TBM surface format VYUY ([31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian).
+ */
+#define HAL_TBM_FORMAT_VYUY     __hal_tbm_fourcc_code('V', 'Y', 'U', 'Y')
+
+/**
+ * @brief Definition for the TBM surface format AYUV ([31:0] A:Y:Cb:Cr 8:8:8:8 little endian).
+ */
+#define HAL_TBM_FORMAT_AYUV     __hal_tbm_fourcc_code('A', 'Y', 'U', 'V')
+
+/*
+ * 2 plane YCbCr
+ * index 0 = Y plane, [7:0] Y
+ * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian
+ * or
+ * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
+ */
+/**
+ * @brief Definition for the TBM surface format NV12 (2x2 subsampled Cr:Cb plane).
+ */
+#define HAL_TBM_FORMAT_NV12     __hal_tbm_fourcc_code('N', 'V', '1', '2')
+/**
+ * @brief Definition for the TBM surface format NV21 (2x2 subsampled Cb:Cr plane).
+ */
+#define HAL_TBM_FORMAT_NV21     __hal_tbm_fourcc_code('N', 'V', '2', '1')
+/**
+ * @brief Definition for the TBM surface format NV16 (2x1 subsampled Cr:Cb plane).
+ */
+#define HAL_TBM_FORMAT_NV16     __hal_tbm_fourcc_code('N', 'V', '1', '6')
+/**
+ * @brief Definition for the TBM surface format NV61 (2x1 subsampled Cb:Cr plane).
+ */
+#define HAL_TBM_FORMAT_NV61     __hal_tbm_fourcc_code('N', 'V', '6', '1')
+
+/*
+ * 3 plane YCbCr
+ * index 0: Y plane, [7:0] Y
+ * index 1: Cb plane, [7:0] Cb
+ * index 2: Cr plane, [7:0] Cr
+ * or
+ * index 1: Cr plane, [7:0] Cr
+ * index 2: Cb plane, [7:0] Cb
+ */
+/**
+ * @brief Definition for the TBM surface format YUV410 (4x4 subsampled Cb (1) and Cr (2) planes).
+ */
+#define HAL_TBM_FORMAT_YUV410   __hal_tbm_fourcc_code('Y', 'U', 'V', '9')
+/**
+ * @brief Definition for the TBM surface format YVU410 (4x4 subsampled Cr (1) and Cb (2) planes).
+ */
+#define HAL_TBM_FORMAT_YVU410   __hal_tbm_fourcc_code('Y', 'V', 'U', '9')
+/**
+ * @brief Definition for the TBM surface format YUV411 (4x1 subsampled Cb (1) and Cr (2) planes).
+ */
+#define HAL_TBM_FORMAT_YUV411   __hal_tbm_fourcc_code('Y', 'U', '1', '1')
+/**
+ * @brief Definition for the TBM surface format YVU411 (4x1 subsampled Cr (1) and Cb (2) planes).
+ */
+#define HAL_TBM_FORMAT_YVU411   __hal_tbm_fourcc_code('Y', 'V', '1', '1')
+/**
+ * @brief Definition for the TBM surface format YUV420 (2x2 subsampled Cb (1) and Cr (2) planes).
+ */
+#define HAL_TBM_FORMAT_YUV420   __hal_tbm_fourcc_code('Y', 'U', '1', '2')
+/**
+ * @brief Definition for the TBM surface format YVU420 (2x2 subsampled Cr (1) and Cb (2) planes).
+ */
+#define HAL_TBM_FORMAT_YVU420   __hal_tbm_fourcc_code('Y', 'V', '1', '2')
+/**
+ * @brief Definition for the TBM surface format YUV422 (2x1 subsampled Cb (1) and Cr (2) planes).
+ */
+#define HAL_TBM_FORMAT_YUV422   __hal_tbm_fourcc_code('Y', 'U', '1', '6')
+/**
+ * @brief Definition for the TBM surface format YVU422 (2x1 subsampled Cr (1) and Cb (2) planes).
+ */
+#define HAL_TBM_FORMAT_YVU422   __hal_tbm_fourcc_code('Y', 'V', '1', '6')
+/**
+ * @brief Definition for the TBM surface format YUV444 (non-subsampled Cb (1) and Cr (2) planes).
+ */
+#define HAL_TBM_FORMAT_YUV444   __hal_tbm_fourcc_code('Y', 'U', '2', '4')
+/**
+ * @brief Definition for the TBM surface format YVU444 (non-subsampled Cr (1) and Cb (2) planes).
+ */
+#define HAL_TBM_FORMAT_YVU444   __hal_tbm_fourcc_code('Y', 'V', '2', '4')
+
+/* 2 plane YCbCr */
+/**
+ * @brief Definition for the TBM surface format NV12MT (tiled '64x32' & multi-plane version of NV12).
+ */
+#define HAL_TBM_FORMAT_NV12MT   __hal_tbm_fourcc_code('T', 'M', '1', '2')
+
+/**
+* @}
+*/
+
+#endif /* _HAL_TBM_TYPE_H_ */
index c7bd8e7..9d91222 100644 (file)
@@ -46,7 +46,7 @@ void          hal_tbm_put_backend(void);
 hal_tbm_bufmgr_capability   hal_tbm_bufmgr_get_capabilities(hal_tbm_bufmgr_data *bufmgr_data, hal_tbm_error *error);
 hal_tbm_error               hal_tbm_bufmgr_bind_native_display(hal_tbm_bufmgr_data *bufmgr_data, hal_tbm_native_display *native_display);
 hal_tbm_error               hal_tbm_bufmgr_get_supported_formats(hal_tbm_bufmgr_data *bufmgr_data, uint32_t **formats, uint32_t *num);
-hal_tbm_error               hal_tbm_bufmgr_get_plane_data(hal_tbm_bufmgr_data *bufmgr_data, tbm_format format, int plane_idx, int width, int height,
+hal_tbm_error               hal_tbm_bufmgr_get_plane_data(hal_tbm_bufmgr_data *bufmgr_data, hal_tbm_format format, int plane_idx, int width, int height,
                                                                                         uint32_t *size, uint32_t *offset, uint32_t *pitch, int *bo_idx);
 hal_tbm_bo_data            *hal_tbm_bufmgr_alloc_bo(hal_tbm_bufmgr_data *bufmgr_data, unsigned int size, hal_tbm_bo_memory_type mem_types, hal_tbm_error *error);
 hal_tbm_bo_data            *hal_tbm_bufmgr_alloc_bo_with_format(hal_tbm_bufmgr_data *bufmgr_data, int format, int bo_idx, int width, int height,
index 503f48e..424e94e 100644 (file)
        hal_tbm_bufmgr_func *bufmgr_func; \
        if (!g_hal_tbm_bufmgr) { if (error) *error = HAL_TBM_ERROR_NOT_SUPPORTED; return NULL; }
 
+#define BUFMGR_ENTRY_VOID() \
+       hal_tbm_bufmgr_func *bufmgr_func; \
+       if (!g_hal_tbm_bufmgr) return;
+
 #define BUFMGR_ENTRY_GOTO(__goto__) \
        hal_tbm_bufmgr_func *bufmgr_func; \
        if (!g_hal_tbm_bufmgr) goto __goto__;
@@ -181,7 +185,7 @@ hal_tbm_bufmgr_get_supported_formats(hal_tbm_bufmgr_data *bufmgr_data, uint32_t
 }
 
 EXTERN hal_tbm_error
-hal_tbm_bufmgr_get_plane_data(hal_tbm_bufmgr_data *bufmgr_data, tbm_format format, int plane_idx, int width, int height,
+hal_tbm_bufmgr_get_plane_data(hal_tbm_bufmgr_data *bufmgr_data, hal_tbm_format format, int plane_idx, int width, int height,
                                                                        uint32_t *size, uint32_t *offset, uint32_t *pitch, int *bo_idx)
 {
        BUFMGR_FUNC_ENTRY(bufmgr_get_plane_data);
@@ -353,7 +357,7 @@ fail:
 EXTERN int
 hal_tbm_query_display_server(hal_tbm_error *error)
 {
-       BUFMGR_ENTRY_NULL();
+//     BUFMGR_ENTRY_NULL();
 
        //TODO:
        return 0;
@@ -364,8 +368,6 @@ hal_tbm_alloc_bufmgr_func(hal_tbm_error *error)
 {
        BUFMGR_ENTRY_NULL();
 
-       hal_tbm_bufmgr_func *bufmgr_func;
-
        bufmgr_func = calloc(1, sizeof(hal_tbm_bufmgr_func));
        if (!bufmgr_func) {
                _E("error: fail to allocate the tbm_bufmgr_func\n");
@@ -384,10 +386,12 @@ hal_tbm_alloc_bufmgr_func(hal_tbm_error *error)
 EXTERN void
 hal_tbm_free_bufmgr_func(hal_tbm_bufmgr_func *func)
 {
-       BUFMGR_ENTRY();
+       BUFMGR_ENTRY_VOID();
 
        if (func)
                free(func);
+
+       g_hal_tbm_bufmgr->bufmgr_func = NULL;
 }
 
 EXTERN hal_tbm_error
@@ -395,7 +399,7 @@ hal_tbm_register_bufmgr_func(hal_tbm_bufmgr_func *func)
 {
        if (!g_hal_tbm_bufmgr) return HAL_TBM_ERROR_INVALID_OPERATION;
        if (g_hal_tbm_bufmgr->bufmgr_func) return HAL_TBM_ERROR_INVALID_OPERATION;
-       if (!bufmgr || !func) return HAL_TBM_ERROR_INVALID_PARAMETER;
+       if (!func) return HAL_TBM_ERROR_INVALID_PARAMETER;
        g_hal_tbm_bufmgr->bufmgr_func = func;
 
        return HAL_TBM_ERROR_NONE;
@@ -426,10 +430,12 @@ hal_tbm_alloc_bo_func(hal_tbm_error *error)
 EXTERN void
 hal_tbm_free_bo_func(hal_tbm_bo_func *func)
 {
-       BUFMGR_ENTRY();
+       BUFMGR_ENTRY_VOID();
 
        if (func)
                free(func);
+
+       g_hal_tbm_bufmgr->bo_func = NULL;
 }
 
 EXTERN hal_tbm_error
@@ -437,7 +443,7 @@ hal_tbm_register_bo_func(hal_tbm_bo_func *func)
 {
        if (!g_hal_tbm_bufmgr) return HAL_TBM_ERROR_INVALID_OPERATION;
        if (g_hal_tbm_bufmgr->bo_func) return HAL_TBM_ERROR_INVALID_OPERATION;
-       if (!bufmgr || !func) return HAL_TBM_ERROR_INVALID_PARAMETER;
+       if (!func) return HAL_TBM_ERROR_INVALID_PARAMETER;
        g_hal_tbm_bufmgr->bo_func = func;
 
        return HAL_TBM_ERROR_NONE;