From: Changyeon Lee Date: Tue, 6 Aug 2024 11:40:00 +0000 (+0900) Subject: tbm_bufmgr: Add tbm_bufmgr_internal header X-Git-Tag: accepted/tizen/unified/20240809.055134~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=349253131e9112f21570366db357a63a1ce9d885;p=platform%2Fcore%2Fuifw%2Flibtbm.git tbm_bufmgr: Add tbm_bufmgr_internal header Change-Id: I69e19fc99ca63466b6ac2daf9ce878acc5ecd713 --- diff --git a/doc/doxygen/libtbm.doxygen b/doc/doxygen/libtbm.doxygen index 26bf119..ac88a0d 100644 --- a/doc/doxygen/libtbm.doxygen +++ b/doc/doxygen/libtbm.doxygen @@ -777,6 +777,7 @@ INPUT = \ include/tbm_log.h \ include/tbm_error.h \ include/tbm_bufmgr.h \ + include/tbm_bufmgr_internal.h \ include/tbm_bo.h \ include/tbm_surface.h \ include/tbm_surface_internal.h \ diff --git a/include/Makefile.am b/include/Makefile.am index 5455209..6d9f4f4 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -5,6 +5,7 @@ libtbminclude_HEADERS = \ tbm_log.h \ tbm_error.h \ tbm_bufmgr.h \ + tbm_bufmgr_internal.h \ tbm_bo.h \ tbm_surface.h \ tbm_surface_internal.h \ diff --git a/include/tbm_bufmgr.h b/include/tbm_bufmgr.h index 10e8669..3f4139a 100644 --- a/include/tbm_bufmgr.h +++ b/include/tbm_bufmgr.h @@ -51,16 +51,6 @@ extern "C" { /** * @brief Initializes the buffer manager. * @details If fd is lower than zero, fd is get drm fd in tbm_bufmgr_init function\n - * The user can decide the lock type and cache flush type with the environment variables, which are BUFMGR_LOCK_TYPE and BUFMGR_MAP_CACHE.\n - * \n - * BUFMGR_LOCK default is once\n - * once : The previous bo which is locked is unlock when the new bo is trying to be locked\n - * always : The new bo is locked until the previous bo which is locked is unlocked\n - * never : Every bo is never locked.\n - * \n - * BUFMGR_MAP_CACHE default is true\n - * true : use map cache flushing\n - * false : to use map cache flushing * @since_tizen 2.3 * @param[in] fd : file descripter of the system buffer manager * @return a buffer manager @@ -71,9 +61,6 @@ extern "C" { #include int bufmgr_fd; - setenv("BUFMGR_LOCK_TYPE", "once", 1); - setenv("BUFMGR_MAP_CACHE", "true", 1); - tbm_bufmgr bufmgr; bufmgr = tbm_bufmgr_init (bufmgr_fd); @@ -132,103 +119,6 @@ void tbm_bufmgr_deinit(tbm_bufmgr bufmgr); */ unsigned int tbm_bufmgr_get_capability(tbm_bufmgr bufmgr); -/** - * @brief bind the native_display. - * @since_tizen 3.0 - * @param[in] bufmgr : the buffer manager - * @param[in] native_display : the native_display - */ -int tbm_bufmgr_bind_native_display(tbm_bufmgr bufmgr, void *native_display); - -/** - * @brief Initializes the buffer manager at the display server. - * @details use this api to initialize the tbm_bufmgr at the display server. - * @since_tizen 5.0 - */ -tbm_bufmgr tbm_bufmgr_server_init(void); - -/** - * @brief Set the bo_lock_type of the bufffer manager. - * @details set the bo_lock_type - * @since_tizen 5.0 - */ -int tbm_bufmgr_set_bo_lock_type(tbm_bufmgr bufmgr, tbm_bufmgr_bo_lock_type bo_lock_type); - -/** - * @brief Print out the information of tbm_bos. - * @since_tizen 3.0 - * @param[in] bufmgr : the buffer manager - */ -void tbm_bufmgr_debug_show(tbm_bufmgr bufmgr); - -/** - * @brief Get string with the information of tbm_bos. - * @since_tizen 3.0 - * @param[in] bufmgr : the buffer manager - * @return sting with info if this function succeeds, otherwise NULL. It has to be free by user. - */ -char * tbm_bufmgr_debug_tbm_info_get(tbm_bufmgr bufmgr); - -/** - * @brief Print out the trace of tbm_bos. - * @since_tizen 3.0 - * @param[in] bufmgr : the buffer manager - * @param[in] onoff : 1 is on, and 0 is off - */ -void tbm_bufmgr_debug_trace(tbm_bufmgr bufmgr, int onoff); - -/** - * @brief Dump all tbm surfaces - * @param[in] path : the given dump path - * @return 1 if this function succeeds, otherwise 0. - */ -int tbm_bufmgr_debug_dump_all(char *path); - -/** - * @brief Start the dump debugging for queue. - * @since_tizen 3.0 - * @param[in] path : the given dump path - * @param[in] count : the dump count number - * @param[in] onoff : 1 is on, and 0 is off, if onoff==0 path and count are ignored - * @return 1 if this function succeeds, otherwise 0. - */ -int tbm_bufmgr_debug_queue_dump(char *path, int count, int onoff); - -/** - * @brief Set scale factor for the nearest calling tbm_bufmgr_debug_dump_all() or tbm_bufmgr_debug_queue_dump() - * @since_tizen 3.0 - * @param[in] scale : the scale factor, 0 - disable scaling - * @par Example - @code - #include - - // Dump all surface with scale factor 0.5 - tbm_bufmgr_debug_dump_set_scale(0.5); - tbm_bufmgr_debug_dump_all("/tmp/"); - - // Start the dump debugging for queue with scale factor 0.5 - tbm_bufmgr_debug_dump_set_scale(0.2); - tbm_bufmgr_debug_queue_dump("/tmp/", 10, 1); - - @endcode - */ -void tbm_bufmgr_debug_dump_set_scale(double scale); - -/** - * @brief Get ref_count of a global tbm_bufmgr - * @since_tizen 5.0 - */ -int tbm_bufmgr_debug_get_ref_count(void); - -/** - * @brief set or unset the trace_mask to print out the trace logs. - * @since_tizen 5.0 - * @param[in] bufmgr : the buffer manager - * @param[in] mask : enum value for the trace log - * @param[in] set : set the mask when set is 1, otherwise unset the mask when set is 0 - */ -void tbm_bufmgr_debug_set_trace_mask(tbm_bufmgr bufmgr, tbm_bufmgr_debug_trace_mask mask, int set); - #ifdef __cplusplus } #endif diff --git a/include/tbm_bufmgr_internal.h b/include/tbm_bufmgr_internal.h new file mode 100644 index 0000000..e8b8d19 --- /dev/null +++ b/include/tbm_bufmgr_internal.h @@ -0,0 +1,149 @@ +/************************************************************************** + +libtbm + +Copyright 2012 Samsung Electronics co., Ltd. All Rights Reserved. + +Contact: SooChan Lim , Sangjin Lee +Boram Park , Changyeon Lee + +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 _TBM_BUFMGR_INTERNAL_H_ +#define _TBM_BUFMGR_INTERNAL_H_ + +#include +#include +#include +#include + +/** + * \file tbm_bufmgr_internal.h + * \brief Tizen Buffer Manager Internal + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief bind the native_display. + * @since_tizen 3.0 + * @param[in] bufmgr : the buffer manager + * @param[in] native_display : the native_display + */ +int tbm_bufmgr_bind_native_display(tbm_bufmgr bufmgr, void *native_display); + +/** + * @brief Initializes the buffer manager at the display server. + * @details use this api to initialize the tbm_bufmgr at the display server. + * @since_tizen 5.0 + */ +tbm_bufmgr tbm_bufmgr_server_init(void); + +/** + * @brief Set the bo_lock_type of the bufffer manager. + * @details set the bo_lock_type + * @since_tizen 5.0 + */ +int tbm_bufmgr_set_bo_lock_type(tbm_bufmgr bufmgr, tbm_bufmgr_bo_lock_type bo_lock_type); + +/** + * @brief Print out the information of tbm_bos. + * @since_tizen 3.0 + * @param[in] bufmgr : the buffer manager + */ +void tbm_bufmgr_debug_show(tbm_bufmgr bufmgr); + +/** + * @brief Get string with the information of tbm_bos. + * @since_tizen 3.0 + * @param[in] bufmgr : the buffer manager + * @return sting with info if this function succeeds, otherwise NULL. It has to be free by user. + */ +char * tbm_bufmgr_debug_tbm_info_get(tbm_bufmgr bufmgr); + +/** + * @brief Print out the trace of tbm_bos. + * @since_tizen 3.0 + * @param[in] bufmgr : the buffer manager + * @param[in] onoff : 1 is on, and 0 is off + */ +void tbm_bufmgr_debug_trace(tbm_bufmgr bufmgr, int onoff); + +/** + * @brief Dump all tbm surfaces + * @param[in] path : the given dump path + * @return 1 if this function succeeds, otherwise 0. + */ +int tbm_bufmgr_debug_dump_all(char *path); + +/** + * @brief Start the dump debugging for queue. + * @since_tizen 3.0 + * @param[in] path : the given dump path + * @param[in] count : the dump count number + * @param[in] onoff : 1 is on, and 0 is off, if onoff==0 path and count are ignored + * @return 1 if this function succeeds, otherwise 0. + */ +int tbm_bufmgr_debug_queue_dump(char *path, int count, int onoff); + +/** + * @brief Set scale factor for the nearest calling tbm_bufmgr_debug_dump_all() or tbm_bufmgr_debug_queue_dump() + * @since_tizen 3.0 + * @param[in] scale : the scale factor, 0 - disable scaling + * @par Example + @code + #include + + // Dump all surface with scale factor 0.5 + tbm_bufmgr_debug_dump_set_scale(0.5); + tbm_bufmgr_debug_dump_all("/tmp/"); + + // Start the dump debugging for queue with scale factor 0.5 + tbm_bufmgr_debug_dump_set_scale(0.2); + tbm_bufmgr_debug_queue_dump("/tmp/", 10, 1); + + @endcode + */ +void tbm_bufmgr_debug_dump_set_scale(double scale); + +/** + * @brief Get ref_count of a global tbm_bufmgr + * @since_tizen 5.0 + */ +int tbm_bufmgr_debug_get_ref_count(void); + +/** + * @brief set or unset the trace_mask to print out the trace logs. + * @since_tizen 5.0 + * @param[in] bufmgr : the buffer manager + * @param[in] mask : enum value for the trace log + * @param[in] set : set the mask when set is 1, otherwise unset the mask when set is 0 + */ +void tbm_bufmgr_debug_set_trace_mask(tbm_bufmgr bufmgr, tbm_bufmgr_debug_trace_mask mask, int set); + +#ifdef __cplusplus +} +#endif +#endif /* _TBM_BUFMGR_INTERNAL_H_ */ diff --git a/src/tbm_bufmgr_int.h b/src/tbm_bufmgr_int.h index 07e86a4..e605438 100644 --- a/src/tbm_bufmgr_int.h +++ b/src/tbm_bufmgr_int.h @@ -52,6 +52,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #endif #include +#include #include #include #include