X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Ftbm_surface_internal.h;h=d8367742c4c1dfdc0d9aa0e76c027665b8e75234;hb=66ec6ab5bdc909aff5ce73aaecd5c67923eac464;hp=68a2233b5827d3f272df4654ba8a0d277cc8bf31;hpb=8b59c1dcf54a6e59c868480273031b29bba8fc15;p=platform%2Fcore%2Fuifw%2Flibtbm.git diff --git a/src/tbm_surface_internal.h b/src/tbm_surface_internal.h old mode 100755 new mode 100644 index 68a2233..d836774 --- a/src/tbm_surface_internal.h +++ b/src/tbm_surface_internal.h @@ -41,7 +41,7 @@ extern "C" { /** * @brief Queries formats which the system can support. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks The formats must be released using free(). * @param[in] bufmgr : the buffer manager * @param[out] *formats : format array which the system can support. This pointer has to be freed by user. @@ -65,11 +65,12 @@ extern "C" { tbm_surface_bufmgr_deinit (bufmgr); @endcode */ -int tbm_surface_internal_query_supported_formats (uint32_t **formats, uint32_t *num); +int tbm_surface_internal_query_supported_formats(uint32_t **formats, + uint32_t *num); /** * @brief Creates the tbm_surface with memory type. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @details * #TBM_BO_DEFAULT is default memory: it depends on the backend\n * #TBM_BO_SCANOUT is scanout memory\n @@ -95,7 +96,7 @@ int tbm_surface_internal_query_supported_formats (uint32_t **formats, uint32_t * uint32_t format_num; bufmgr = tbm_bufmgr_create (bufmgr_fd); - surface = tbm_surface_internal_create_with_flags (bufmgr, 128, 128, TBM_FORMAT_YUV420, TBM_BO_DEFAULT); + surface = tbm_surface_internal_create_with_flags (128, 128, TBM_FORMAT_YUV420, TBM_BO_DEFAULT); ... @@ -103,11 +104,12 @@ int tbm_surface_internal_query_supported_formats (uint32_t **formats, uint32_t * tbm_surface_bufmgr_deinit (bufmgr); @endcode */ -tbm_surface_h tbm_surface_internal_create_with_flags (int width, int height, int format, int flags); +tbm_surface_h tbm_surface_internal_create_with_flags(int width, int height, + int format, int flags); /** * @brief Creates the tbm_surface with buffer objects. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] bufmgr : the buffer manager * @param[in] width : the width of surface * @param[in] height : the height of surface @@ -125,14 +127,25 @@ tbm_surface_h tbm_surface_internal_create_with_flags (int width, int height, int int bufmgr_fd tbm_bufmgr bufmgr; tbm_surface_h surface; + tbm_surface_info_s info; uint32_t *format; uint32_t format_num; - tbm_bo bo[2]; + tbm_bo bo[1]; bufmgr = tbm_bufmgr_init (bufmgr_fd); - bo[1] = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT); - bo[2] = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT); - surface = tbm_surface_internal_create_with_bos (bufmgr, 128, 128, TBM_FORMAT_YUV420, TBM_BO_DEFAULT); + bo[0] = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT); + + info.width = 128; + info.height = 128; + info.format = TBM_FORMAT_ARGB8888; + info.bpp = 32; + info.size = 65536; + info.num_planes = 1; + info.planes[0].size = 65536; + info.planes[0].offset = 0; + info.planes[0].stride = 512; + + surface = tbm_surface_internal_create_with_bos (&info, bo, 1); ... @@ -140,18 +153,30 @@ tbm_surface_h tbm_surface_internal_create_with_flags (int width, int height, int tbm_surface_bufmgr_deinit (bufmgr); @endcode */ -tbm_surface_h tbm_surface_internal_create_with_bos (int width, int height, int format, tbm_bo *bos, int num); - +tbm_surface_h tbm_surface_internal_create_with_bos(tbm_surface_info_s *info, + tbm_bo *bos, int num); /** * @brief Destroy the tbm surface TODO: */ -void tbm_surface_internal_destroy (tbm_surface_h surface); +void tbm_surface_internal_destroy(tbm_surface_h surface); + +/** + * @brief reference the tbm surface + TODO: + */ +void tbm_surface_internal_ref(tbm_surface_h surface); + +/** + * @brief unreference the tbm surface + TODO: + */ +void tbm_surface_internal_unref(tbm_surface_h surface); /** * @brief Gets the number of buffer objects associated with the tbm_surface. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] surface : the tbm_surface_h * @return the number of buffer objects associated with the tbm_surface_h, otherwise -1. * @par Example @@ -170,11 +195,11 @@ void tbm_surface_internal_destroy (tbm_surface_h surface); tbm_surface_destroy (surface); @endcode */ -int tbm_surface_internal_get_num_bos (tbm_surface_h surface); +int tbm_surface_internal_get_num_bos(tbm_surface_h surface); /** * @brief Gets the buffor object by the bo_index. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] surface : the tbm_surface_h * @param[in] bo_idx : the bo index in the the tbm_surface * @return the buffer object, otherwise NULL. @@ -200,11 +225,11 @@ int tbm_surface_internal_get_num_bos (tbm_surface_h surface); tbm_surface_destroy (surface); @endcode */ -tbm_bo tbm_surface_internal_get_bo (tbm_surface_h surface, int bo_idx); +tbm_bo tbm_surface_internal_get_bo(tbm_surface_h surface, int bo_idx); /** * @brief Gets the size of the surface. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] surface : the tbm_surface_h * @return the size of tbm_surface, otherwise -1. * @par Example @@ -221,16 +246,16 @@ tbm_bo tbm_surface_internal_get_bo (tbm_surface_h surface, int bo_idx); tbm_surface_destroy (surface); @endcode */ -int tbm_surface_internal_get_size (tbm_surface_h surface); +int tbm_surface_internal_get_size(tbm_surface_h surface); /** * @brief Gets size, offset and pitch data of plane by the plane_index. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] surface : the tbm_surface_h * @param[in] plane_idx : the bo index in the the tbm_surface - * @param[out] size : the size of plan in tbm_surface - * @param[out] offset : the offset of plan in tbm_surface - * @param[out] pitch : the pitch of plan in tbm_surface + * @param[out] size : the size of plane in tbm_surface + * @param[out] offset : the offset of plane in tbm_surface + * @param[out] pitch : the pitch of plane in tbm_surface * @return 1 if this function succeeds, otherwise 0. * @par Example @code @@ -241,7 +266,7 @@ int tbm_surface_internal_get_size (tbm_surface_h surface); uint32_t size, offset, pitch; int ret; - surface = tbm_surfacel_create (128, 128, TBM_FORMAT_YUV420); + surface = tbm_surface_create (128, 128, TBM_FORMAT_YUV420); ret = tbm_surface_internal_get_plane_data (surface, 1, &size, &offset, &pitch); ... @@ -249,11 +274,197 @@ int tbm_surface_internal_get_size (tbm_surface_h surface); tbm_surface_destroy (surface); @endcode */ -int tbm_surface_internal_get_plane_data (tbm_surface_h surface, int plane_idx, uint32_t *size, uint32_t *offset, uint32_t *pitch); +int tbm_surface_internal_get_plane_data(tbm_surface_h surface, int plane_idx, + uint32_t *size, uint32_t *offset, uint32_t *pitch); + +/** + * @brief Gets number of planes by the format. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @param[in] format : the format of surface + * @return number of planes by the format, otherwise 0. + * @par Example + @code + #include + #include + + int num; + + num = tbm_surface_internal_get_num_planes (TBM_FORMAT_YUV420); + + ... + + @endcode + */ +int tbm_surface_internal_get_num_planes(tbm_format format); + +/** + * @brief Gets bpp by the format. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @param[in] format : the format of surface + * @return bpp by the format, otherwise 0. + * @par Example + @code + #include + #include + + int bpp; + + bpp = tbm_surface_internal_get_bpp (TBM_FORMAT_YUV420); + + ... + + @endcode + */ +int tbm_surface_internal_get_bpp(tbm_format format); + +/** + * @brief Gets bo index of plane. + * @since_tizen 2.4 + * @param[in] surface : the tbm_surface_h + * @param[in] plane_idx : the bo index in the tbm_surface + * @return bo index of plane, otherwise -1. + * @par Example + @code + #include + #include + + int bo_idx; + tbm_surface_h surface; + + surface = tbm_surface_create (128, 128, TBM_FORMAT_YUV420); + bo_idx = tbm_surface_internal_get_plane_bo_idx (surface, 0); + + ... + + @endcode + */ +int tbm_surface_internal_get_plane_bo_idx(tbm_surface_h surface, int plane_idx); + +/** + * @brief Set the pid to the tbm_surface for debugging. + * @since_tizen 3.0 + * @param[in] surface : the tbm_surface_h + * @param[in] pid : the pid + */ +void tbm_surface_internal_set_debug_pid(tbm_surface_h surface, + unsigned int pid); + +/** + * @brief Set the string value to the tbm_surface for debugging. + * @since_tizen 3.0 + * @param[in] surface : the tbm_surface_h + * @param[in] key : the key for debugging + * @param[in] value : the value for debugging + */ +int tbm_surface_internal_set_debug_data(tbm_surface_h surface, + char *key, char *value); + +/** + * @brief Adds a user_data to the tbm surface. + * @since_tizen 3.0 + * @param[in] surface : the tbm surface. + * @param[in] key : the key associated with the user_data + * @param[in] data_free_func : the function pointer to free the user_data + * @return 1 if this function succeeds, otherwise 0. + * @post the tbm_surface_data_free() will be called under certain conditions, after calling tbm_surface_internal_delete_user_data(). + * @see tbm_surface_free() + * @see tbm_surface_set_user_data() + * @see tbm_surface_get_user_data() + * @see tbm_surface_delete_user_data() + */ +int tbm_surface_internal_add_user_data(tbm_surface_h surface, unsigned long key, + tbm_data_free data_free_func); + +/** + * @brief Sets a user_date to the tbm surface. + * @since_tizen 3.0 + * @param[in] surface : the tbm surface. + * @param[in] key : the key associated with the user_date + * @param[in] data : a pointer of the user_data + * @return 1 if this function succeeds, otherwise 0. + */ +int tbm_surface_internal_set_user_data(tbm_surface_h surface, unsigned long key, + void *data); + +/** + * @brief Gets a user_data from the tbm surface with the key. + * @since_tizen 3.0 + * @param[in] surface : the tbm surface. + * @param[in] key : the key associated with the user_date + * @param[out] data : to get the user data + * @return 1 if this function succeeds, otherwise 0. + */ +int tbm_surface_internal_get_user_data(tbm_surface_h surface, unsigned long key, + void **data); + +/** + * @brief Deletes the user_data in the tbm surface. + * @since_tizen 3.0 + * @param[in] surface : the tbm surface. + * @param[in] key : the key associated with the user_date + * @return 1 if this function succeeds, otherwise 0. + */ +int tbm_surface_internal_delete_user_data(tbm_surface_h surface, + unsigned long key); + +/** + * @brief Start the dump debugging. + * @since_tizen 3.0 + * @param[in] path : the given dump path + * @param[in] w : the width of dump image + * @param[in] h : the height of dump image + * @param[in] count : the dump count number + * @see #tdm_helper_dump_stop() + */ +void tbm_surface_internal_dump_start(char *path, int w, int h, int count); + +/** + * @brief End the dump debugging. + * @since_tizen 3.0 + * @see #tdm_helper_dump_start() + */ +void tbm_surface_internal_dump_end(void); + +/** + * @brief Dump a buffer + * @details + * This function supports only if a buffer has below formats. + * - TBM_FORMAT_ARGB8888 + * - TBM_FORMAT_XRGB8888 + * - TBM_FORMAT_YVU420 + * - TBM_FORMAT_YUV420 + * - TBM_FORMAT_NV12 + * - TBM_FORMAT_NV21 + * - TBM_FORMAT_YUYV + * - TBM_FORMAT_UYVY + * The filename extension should be "png" for TBM_FORMAT_ARGB8888 and TBM_FORMAT_XRGB8888 + * or "yuv" for YUV formats. + * @param[in] surface : a tbm surface + * @param[in] type : a string used by a file name + */ +void tbm_surface_internal_dump_buffer(tbm_surface_h surface, const char *type); + +/** + * @brief Dump a shared memory buffer + * @details + * This function supports shared memory buffer dump. + * @param[in] ptr : a pointer of dump buffer + * @param[in] w : a width of dump buffer + * @param[in] h : a height of dump buffer + * @param[in] stride : a stride of dump buffer + * @param[in] type : a string used by a file name + */ +void tbm_surface_internal_dump_shm_buffer(void *ptr, int w, int h, int stride, const char *type); + +/** + * @brief check valid tbm surface. + * @since_tizen 3.0 + * @param[in] surface : the tbm surface. + * @return 1 if surface is valid, otherwise 0. + */ +int tbm_surface_internal_is_valid(tbm_surface_h surface); #ifdef __cplusplus } #endif - -#endif /* _TBM_SURFACE_INTERNAL_H_ */ - +#endif /* _TBM_SURFACE_INTERNAL_H_ */