Apply tizen coding rule 53/60053/1
authorChangyeon Lee <cyeon.lee@samsung.com>
Mon, 22 Feb 2016 08:54:03 +0000 (17:54 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Tue, 23 Feb 2016 01:23:22 +0000 (10:23 +0900)
Change-Id: I400495c69753e29c80ad5c83846bf63124129d7b
Signed-off-by: Changyeon Lee <cyeon.lee@samsung.com>
src/tbm_bufmgr.c
src/tbm_bufmgr.h
src/tbm_bufmgr_backend.c
src/tbm_bufmgr_backend.h
src/tbm_bufmgr_int.h
src/tbm_surface.c
src/tbm_surface.h
src/tbm_surface_internal.c
src/tbm_surface_internal.h
src/tbm_surface_queue.c
src/tbm_surface_queue.h

index 4ea8c79..8df6c2d 100644 (file)
@@ -39,9 +39,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #define DEBUG
 #ifdef DEBUG
-int bDebug = 0;
-#define DBG(...) if (bDebug&0x1) TBM_LOG(__VA_ARGS__)
-#define DBG_LOCK(...) if (bDebug&0x2) TBM_LOG(__VA_ARGS__)
+int bDebug;
+#define DBG(...) {if (bDebug&0x1) TBM_LOG(__VA_ARGS__)}
+#define DBG_LOCK(...) {if (bDebug&0x2) TBM_LOG(__VA_ARGS__)}
 #else
 #define DBG(...)
 #define DBG_LOCK(...)
@@ -85,22 +85,24 @@ enum {
 /* unneeded version 2.0 */
 enum {
        DEVICE_NONE = 0,
-       DEVICE_CA,                                      /* cache aware device */
-       DEVICE_CO                                       /* cache oblivious device */
+       DEVICE_CA,              /* cache aware device */
+       DEVICE_CO               /* cache oblivious device */
 };
 /* unneeded version 2.0 */
 
 pthread_mutex_t gLock = PTHREAD_MUTEX_INITIALIZER;
-tbm_bufmgr gBufMgr = NULL;
+tbm_bufmgr gBufMgr;
 
 static __thread tbm_error_e tbm_last_error = TBM_ERROR_NONE;
 
-static void _tbm_set_last_result(tbm_error_e err)
+static void
+_tbm_set_last_result(tbm_error_e err)
 {
        tbm_last_error = err;
 }
 
-static void _tbm_util_get_appname_brief(char *brief)
+static void
+_tbm_util_get_appname_brief(char *brief)
 {
        char delim[] = "/";
        char *token = NULL;
@@ -110,17 +112,18 @@ static void _tbm_util_get_appname_brief(char *brief)
        token = strtok_r(brief, delim, &saveptr);
 
        while (token != NULL) {
-               memset(temp, 0x00, 255*sizeof(char));
-               strncpy(temp, token, 254*sizeof(char));
+               memset(temp, 0x00, 255 * sizeof(char));
+               strncpy(temp, token, 254 * sizeof(char));
                token = strtok_r(NULL, delim, &saveptr);
        }
 
        snprintf(brief, sizeof(temp), "%s", temp);
 }
 
-static void _tbm_util_get_appname_from_pid(long pid, char *str)
+static void
+_tbm_util_get_appname_from_pid(long pid, char *str)
 {
-       FILEfp;
+       FILE *fp;
        int len;
        long app_pid = pid;
        char fn_cmdline[255] = {0,};
@@ -152,7 +155,8 @@ static void _tbm_util_get_appname_from_pid(long pid, char *str)
 
 
 /* unneeded version 2.0 */
-static inline int _tgl_init(int fd, unsigned int key)
+static inline int
+_tgl_init(int fd, unsigned int key)
 {
        struct tgl_attribute attr;
        int err;
@@ -162,58 +166,64 @@ static inline int _tgl_init(int fd, unsigned int key)
 
        err = ioctl(fd, TGL_IOC_INIT_LOCK, &attr);
        if (err) {
-               TBM_LOG("[libtbm:%d] "
-                       "error(%s) %s:%d key:%d\n",
-                       getpid(), strerror(errno), __FUNCTION__, __LINE__, key);
+               TBM_LOG("[libtbm:%d] error(%s) %s:%d key:%d\n",
+                       getpid(), strerror(errno), __func__, __LINE__, key);
                return 0;
        }
 
        return 1;
 }
 
-static inline int _tgl_destroy(int fd, unsigned int key)
+static inline int
+_tgl_destroy(int fd, unsigned int key)
 {
        int err;
+
        err = ioctl(fd, TGL_IOC_DESTROY_LOCK, key);
        if (err) {
                TBM_LOG("[libtbm:%d] "
                        "error(%s) %s:%d key:%d\n",
-                       getpid(), strerror(errno), __FUNCTION__, __LINE__, key);
+                       getpid(), strerror(errno), __func__, __LINE__, key);
                return 0;
        }
 
        return 1;
 }
 
-static inline int _tgl_lock(int fd, unsigned int key)
+static inline int
+_tgl_lock(int fd, unsigned int key)
 {
        int err;
+
        err = ioctl(fd, TGL_IOC_LOCK_LOCK, key);
        if (err) {
                TBM_LOG("[libtbm:%d] "
                        "error(%s) %s:%d key:%d\n",
-                       getpid(), strerror(errno), __FUNCTION__, __LINE__, key);
+                       getpid(), strerror(errno), __func__, __LINE__, key);
                return 0;
        }
 
        return 1;
 }
 
-static inline int _tgl_unlock(int fd, unsigned int key)
+static inline int
+_tgl_unlock(int fd, unsigned int key)
 {
        int err;
+
        err = ioctl(fd, TGL_IOC_UNLOCK_LOCK, key);
        if (err) {
                TBM_LOG("[libtbm:%d] "
                        "error(%s) %s:%d key:%d\n",
-                       getpid(), strerror(errno), __FUNCTION__, __LINE__, key);
+                       getpid(), strerror(errno), __func__, __LINE__, key);
                return 0;
        }
 
        return 1;
 }
 
-static inline int _tgl_set_data(int fd, unsigned int key, unsigned int val)
+static inline int
+_tgl_set_data(int fd, unsigned int key, unsigned int val)
 {
        int err;
        struct tgl_user_data arg;
@@ -224,14 +234,15 @@ static inline int _tgl_set_data(int fd, unsigned int key, unsigned int val)
        if (err) {
                TBM_LOG("[libtbm:%d] "
                        "error(%s) %s:%d key:%d\n",
-                       getpid(), strerror(errno), __FUNCTION__, __LINE__, key);
+                       getpid(), strerror(errno), __func__, __LINE__, key);
                return 0;
        }
 
        return 1;
 }
 
-static inline unsigned int _tgl_get_data(int fd, unsigned int key, unsigned int *locked)
+static inline unsigned int
+_tgl_get_data(int fd, unsigned int key, unsigned int *locked)
 {
        int err;
        struct tgl_user_data arg = { 0, };
@@ -241,7 +252,7 @@ static inline unsigned int _tgl_get_data(int fd, unsigned int key, unsigned int
        if (err) {
                TBM_LOG("[libtbm:%d] "
                        "error(%s) %s:%d key:%d\n",
-                       getpid(), strerror(errno), __FUNCTION__, __LINE__, key);
+                       getpid(), strerror(errno), __func__, __LINE__, key);
                return 0;
        }
 
@@ -252,7 +263,8 @@ static inline unsigned int _tgl_get_data(int fd, unsigned int key, unsigned int
 }
 /* unneeded version 2.0 */
 
-tbm_user_data *user_data_lookup(struct list_head *user_data_list, unsigned long key)
+tbm_user_data
+*user_data_lookup(struct list_head *user_data_list, unsigned long key)
 {
        tbm_user_data *user_data = NULL;
        tbm_user_data *old_data = NULL, *tmp = NULL;
@@ -269,7 +281,8 @@ tbm_user_data *user_data_lookup(struct list_head *user_data_list, unsigned long
        return user_data;
 }
 
-tbm_user_data *user_data_create(unsigned long key, tbm_data_free data_free_func)
+tbm_user_data
+*user_data_create(unsigned long key, tbm_data_free data_free_func)
 {
        tbm_user_data *user_data = NULL;
 
@@ -284,7 +297,8 @@ tbm_user_data *user_data_create(unsigned long key, tbm_data_free data_free_func)
        return user_data;
 }
 
-void user_data_delete(tbm_user_data * user_data)
+void
+user_data_delete(tbm_user_data *user_data)
 {
        if (user_data->data && user_data->free_func)
                user_data->free_func(user_data->data);
@@ -294,7 +308,8 @@ void user_data_delete(tbm_user_data * user_data)
        free(user_data);
 }
 
-static int _bo_lock(tbm_bo bo, int device, int opt)
+static int
+_bo_lock(tbm_bo bo, int device, int opt)
 {
        tbm_bufmgr bufmgr = bo->bufmgr;
        int ret = 0;
@@ -309,7 +324,7 @@ static int _bo_lock(tbm_bo bo, int device, int opt)
                } else {
                        TBM_LOG("[libtbm:%d] "
                                "error %s:%d no backend lock functions\n",
-                               getpid(), __FUNCTION__, __LINE__);
+                               getpid(), __func__, __LINE__);
                }
        } else {
                if (TBM_LOCK_CTRL_BACKEND_VALID(bufmgr->backend->flags)) {
@@ -322,7 +337,7 @@ static int _bo_lock(tbm_bo bo, int device, int opt)
                        } else {
                                TBM_LOG("[libtbm:%d] "
                                        "error %s:%d no backend lock functions\n",
-                                       getpid(), __FUNCTION__, __LINE__);
+                                       getpid(), __func__, __LINE__);
                        }
                } else {
                        /* use tizen global lock */
@@ -333,7 +348,8 @@ static int _bo_lock(tbm_bo bo, int device, int opt)
        return ret;
 }
 
-static void _bo_unlock(tbm_bo bo)
+static void
+_bo_unlock(tbm_bo bo)
 {
        tbm_bufmgr bufmgr = bo->bufmgr;
 
@@ -344,10 +360,9 @@ static void _bo_unlock(tbm_bo bo)
                } else {
                        TBM_LOG("[libtbm:%d] "
                                "error %s:%d no backend unlock functions\n",
-                               getpid(), __FUNCTION__, __LINE__);
+                               getpid(), __func__, __LINE__);
                }
-       }
-       else {
+       } else {
                if (TBM_LOCK_CTRL_BACKEND_VALID(bufmgr->backend->flags)) {
                        if (bufmgr->backend->bo_unlock) {
                                /* use backend unlock */
@@ -355,7 +370,7 @@ static void _bo_unlock(tbm_bo bo)
                        } else {
                                TBM_LOG("[libtbm:%d] "
                                        "error %s:%d no backend unlock functions\n",
-                                       getpid(), __FUNCTION__, __LINE__);
+                                       getpid(), __func__, __LINE__);
                        }
                } else {
                        /* use tizen global unlock */
@@ -364,7 +379,8 @@ static void _bo_unlock(tbm_bo bo)
        }
 }
 
-static int _tbm_bo_init_state(tbm_bo bo, int opt)
+static int
+_tbm_bo_init_state(tbm_bo bo, int opt)
 {
        tbm_bufmgr bufmgr = bo->bufmgr;
        tbm_bo_cache_state cache_state;
@@ -401,7 +417,8 @@ static int _tbm_bo_init_state(tbm_bo bo, int opt)
        return 1;
 }
 
-static void _tbm_bo_destroy_state(tbm_bo bo)
+static void
+_tbm_bo_destroy_state(tbm_bo bo)
 {
        tbm_bufmgr bufmgr = bo->bufmgr;
 
@@ -410,7 +427,8 @@ static void _tbm_bo_destroy_state(tbm_bo bo)
        _tgl_destroy(bufmgr->lock_fd, bo->tgl_key);
 }
 
-static int _tbm_bo_set_state(tbm_bo bo, int device, int opt)
+static int
+_tbm_bo_set_state(tbm_bo bo, int device, int opt)
 {
        tbm_bufmgr bufmgr = bo->bufmgr;
        char need_flush = 0;
@@ -430,7 +448,7 @@ static int _tbm_bo_set_state(tbm_bo bo, int device, int opt)
 
        if (DEVICE_IS_CACHE_AWARE(device)) {
                if (bo->cache_state.data.isDirtied == DEVICE_CO &&
-                       bo->cache_state.data.isCached)
+                   bo->cache_state.data.isCached)
                        need_flush = TBM_CACHE_INV;
 
                bo->cache_state.data.isCached = 1;
@@ -442,8 +460,8 @@ static int _tbm_bo_set_state(tbm_bo bo, int device, int opt)
                }
        } else {
                if (bo->cache_state.data.isDirtied == DEVICE_CA &&
-                       bo->cache_state.data.isCached &&
-                       bo->cache_state.data.cntFlush == cntFlush)
+                   bo->cache_state.data.isCached &&
+                   bo->cache_state.data.cntFlush == cntFlush)
                        need_flush = TBM_CACHE_CLN | TBM_CACHE_ALL;
 
                if (opt & TBM_OPTION_WRITE)
@@ -463,18 +481,19 @@ static int _tbm_bo_set_state(tbm_bo bo, int device, int opt)
                bufmgr->backend->bo_cache_flush(bo, need_flush);
 
                DBG("[libtbm:%d] \tcache(%d,%d,%d)....flush:0x%x, cntFlush(%d)\n",
-                       getpid(),
-                       bo->cache_state.data.isCacheable,
-                       bo->cache_state.data.isCached,
-                       bo->cache_state.data.isDirtied,
-                       need_flush,
-                       cntFlush);
+                   getpid(),
+                   bo->cache_state.data.isCacheable,
+                   bo->cache_state.data.isCached,
+                   bo->cache_state.data.isDirtied,
+                   need_flush,
+                   cntFlush);
        }
 
        return 1;
 }
 
-static void _tbm_bo_save_state(tbm_bo bo)
+static void
+_tbm_bo_save_state(tbm_bo bo)
 {
        tbm_bufmgr bufmgr = bo->bufmgr;
        unsigned short cntFlush = 0;
@@ -489,7 +508,8 @@ static void _tbm_bo_save_state(tbm_bo bo)
        _tgl_set_data(bufmgr->lock_fd, bo->tgl_key, bo->cache_state.val);
 }
 
-static int _tbm_bo_lock(tbm_bo bo, int device, int opt)
+static int
+_tbm_bo_lock(tbm_bo bo, int device, int opt)
 {
        tbm_bufmgr bufmgr = NULL;
        int old;
@@ -507,7 +527,7 @@ static int _tbm_bo_lock(tbm_bo bo, int device, int opt)
        if (bo->lock_cnt < 0) {
                TBM_LOG("[libtbm:%d] "
                        "error %s:%d bo:%p(%d) LOCK_CNT=%d\n",
-                       getpid(), __FUNCTION__, __LINE__, bo, bo->tgl_key, bo->lock_cnt);
+                       getpid(), __func__, __LINE__, bo, bo->tgl_key, bo->lock_cnt);
        }
 
        old = bo->lock_cnt;
@@ -529,16 +549,17 @@ static int _tbm_bo_lock(tbm_bo bo, int device, int opt)
        } else {
                TBM_LOG("[libtbm:%d] "
                        "error %s:%d bo:%p lock_type is wrong.\n",
-                       getpid(), __FUNCTION__, __LINE__, bo);
+                       getpid(), __func__, __LINE__, bo);
        }
 
        DBG_LOCK("[libtbm:%d] >> LOCK bo:%p(%d, %d->%d)\n", getpid(),
-                               bo, bo->tgl_key, old, bo->lock_cnt);
+                bo, bo->tgl_key, old, bo->lock_cnt);
 
        return ret;
 }
 
-static void _tbm_bo_unlock(tbm_bo bo)
+static void
+_tbm_bo_unlock(tbm_bo bo)
 {
        tbm_bufmgr bufmgr = NULL;
 
@@ -568,19 +589,20 @@ static void _tbm_bo_unlock(tbm_bo bo)
        } else {
                TBM_LOG("[libtbm:%d] "
                        "error %s:%d bo:%p lock_type is wrong.\n",
-                       getpid(), __FUNCTION__, __LINE__, bo);
+                       getpid(), __func__, __LINE__, bo);
        }
 
        if (bo->lock_cnt < 0)
                bo->lock_cnt = 0;
 
        DBG_LOCK("[libtbm:%d] << unlock bo:%p(%d, %d->%d)\n", getpid(),
-                       bo, bo->tgl_key, old, bo->lock_cnt);
+                bo, bo->tgl_key, old, bo->lock_cnt);
 }
 
-static int _tbm_bo_is_valid(tbm_bo bo)
+static int
+_tbm_bo_is_valid(tbm_bo bo)
 {
-       tbm_bo old_data = NULL, tmp = NULL;;
+       tbm_bo old_data = NULL, tmp = NULL;
 
        if (bo == NULL)
                return 0;
@@ -595,12 +617,14 @@ static int _tbm_bo_is_valid(tbm_bo bo)
        return 0;
 }
 
-static void _tbm_bo_ref(tbm_bo bo)
+static void
+_tbm_bo_ref(tbm_bo bo)
 {
        bo->ref_cnt++;
 }
 
-static void _tbm_bo_unref(tbm_bo bo)
+static void
+_tbm_bo_unref(tbm_bo bo)
 {
        tbm_bufmgr bufmgr = bo->bufmgr;
        tbm_user_data *old_data = NULL, *tmp = NULL;
@@ -613,8 +637,8 @@ static void _tbm_bo_unref(tbm_bo bo)
                /* destory the user_data_list */
                if (!LIST_IS_EMPTY(&bo->user_data_list)) {
                        LIST_FOR_EACH_ENTRY_SAFE(old_data, tmp, &bo->user_data_list, item_link) {
-                               DBG("[libtbm:%d] free user_data \n",
-                                       getpid());
+                               DBG("[libtbm:%d] free user_data\n",
+                                   getpid());
                                user_data_delete(old_data);
                        }
                }
@@ -622,7 +646,7 @@ static void _tbm_bo_unref(tbm_bo bo)
                if (bo->lock_cnt > 0) {
                        TBM_LOG("[libtbm:%d] "
                                "error %s:%d lock_cnt:%d\n",
-                               getpid(), __FUNCTION__, __LINE__, bo->lock_cnt);
+                               getpid(), __func__, __LINE__, bo->lock_cnt);
                        _bo_unlock(bo);
                }
 
@@ -642,7 +666,8 @@ static void _tbm_bo_unref(tbm_bo bo)
 
 }
 
-static int _tbm_bufmgr_init_state(tbm_bufmgr bufmgr)
+static int
+_tbm_bufmgr_init_state(tbm_bufmgr bufmgr)
 {
        RETURN_VAL_CHECK_FLAG(TBM_ALL_CTRL_BACKEND_VALID(bufmgr->backend->flags), 1);
 
@@ -669,14 +694,16 @@ static int _tbm_bufmgr_init_state(tbm_bufmgr bufmgr)
        return 1;
 }
 
-static void _tbm_bufmgr_destroy_state(tbm_bufmgr bufmgr)
+static void
+_tbm_bufmgr_destroy_state(tbm_bufmgr bufmgr)
 {
        RETURN_CHECK_FLAG(TBM_ALL_CTRL_BACKEND_VALID(bufmgr->backend->flags));
 
        close(bufmgr->lock_fd);
 }
 
-static int _check_version(TBMModuleVersionInfo * data)
+static int
+_check_version(TBMModuleVersionInfo *data)
 {
        int abimaj, abimin;
        int vermaj, vermin;
@@ -685,16 +712,16 @@ static int _check_version(TBMModuleVersionInfo * data)
        abimin = GET_ABI_MINOR(data->abiversion);
 
        DBG("[libtbm:%d] "
-               "TBM module %s: vendor=\"%s\" ABI=%d,%d\n",
-               getpid(), data->modname ? data->modname : "UNKNOWN!",
-               data->vendor ? data->vendor : "UNKNOWN!", abimaj, abimin);
+           "TBM module %s: vendor=\"%s\" ABI=%d,%d\n",
+           getpid(), data->modname ? data->modname : "UNKNOWN!",
+           data->vendor ? data->vendor : "UNKNOWN!", abimaj, abimin);
 
        vermaj = GET_ABI_MAJOR(TBM_ABI_VERSION);
        vermin = GET_ABI_MINOR(TBM_ABI_VERSION);
 
        DBG("[libtbm:%d] "
-               "TBM ABI version %d.%d\n",
-               getpid(), vermaj, vermin);
+           "TBM ABI version %d.%d\n",
+           getpid(), vermaj, vermin);
 
        if (abimaj != vermaj) {
                TBM_LOG("[libtbm:%d] "
@@ -710,7 +737,8 @@ static int _check_version(TBMModuleVersionInfo * data)
        return 1;
 }
 
-static int _tbm_bufmgr_load_module(tbm_bufmgr bufmgr, int fd, const char *file)
+static int
+_tbm_bufmgr_load_module(tbm_bufmgr bufmgr, int fd, const char *file)
 {
        char path[PATH_MAX] = { 0, };
        TBMModuleData *initdata = NULL;
@@ -782,13 +810,14 @@ static int _tbm_bufmgr_load_module(tbm_bufmgr bufmgr, int fd, const char *file)
        bufmgr->module_data = module_data;
 
        DBG("[libtbm:%d] "
-               "Success to load module(%s)\n",
-               getpid(), file);
+           "Success to load module(%s)\n",
+           getpid(), file);
 
        return 1;
 }
 
-static int _tbm_load_module(tbm_bufmgr bufmgr, int fd)
+static int
+_tbm_load_module(tbm_bufmgr bufmgr, int fd)
 {
        struct dirent **namelist;
        const char *p = NULL;
@@ -809,10 +838,8 @@ static int _tbm_load_module(tbm_bufmgr bufmgr, int fd)
                        while (n--) {
                                if (!ret && strstr(namelist[n]->d_name, PREFIX_LIB)) {
                                        p = strstr(namelist[n]->d_name, SUFFIX_LIB);
-                                       if (p != NULL) {
-                                               if (!strcmp(p, SUFFIX_LIB))
-                                                       ret = _tbm_bufmgr_load_module(bufmgr, fd, namelist[n]->d_name);
-                                       }
+                                       if (p && !strcmp(p, SUFFIX_LIB))
+                                               ret = _tbm_bufmgr_load_module(bufmgr, fd, namelist[n]->d_name);
                                }
                                free(namelist[n]);
                        }
@@ -823,7 +850,8 @@ static int _tbm_load_module(tbm_bufmgr bufmgr, int fd)
        return ret;
 }
 
-tbm_bufmgr tbm_bufmgr_init(int fd)
+tbm_bufmgr
+tbm_bufmgr_init(int fd)
 {
        char *env;
        int fd_flag = 0;
@@ -836,8 +864,9 @@ tbm_bufmgr tbm_bufmgr_init(int fd)
        if (env) {
                bDebug = atoi(env);
                TBM_LOG("GEM_DEBUG=%s\n", env);
-       } else
+       } else {
                bDebug = 0;
+       }
 #endif
 
        /* initialize buffer manager */
@@ -853,20 +882,19 @@ tbm_bufmgr tbm_bufmgr_init(int fd)
                                        return NULL;
                                }
                                DBG("[libtbm:%d] duplicate the drm_fd(%d), new drm_fd(%d).\n",
-                                       getpid(), gBufMgr->fd, fd);
+                                   getpid(), gBufMgr->fd, fd);
                        }
                }
                gBufMgr->ref_count++;
 
                DBG("[libtbm:%d] bufmgr ref: fd=%d, ref_count:%d\n",
-                       getpid(), gBufMgr->fd, gBufMgr->ref_count);
+                   getpid(), gBufMgr->fd, gBufMgr->ref_count);
                pthread_mutex_unlock(&gLock);
                return gBufMgr;
        }
 
-       if (fd < 0) {
+       if (fd < 0)
                fd_flag = 1;
-       }
 
        DBG("[libtbm:%d] bufmgr init: fd=%d\n", getpid(), fd);
 
@@ -894,13 +922,13 @@ tbm_bufmgr tbm_bufmgr_init(int fd)
                        return NULL;
                }
                DBG("[libtbm:%d] duplicate the drm_fd(%d), bufmgr use fd(%d).\n",
-                       getpid(), fd, gBufMgr->fd);
+                   getpid(), fd, gBufMgr->fd);
        }
 
        /* load bufmgr priv from env */
        if (!_tbm_load_module(gBufMgr, gBufMgr->fd)) {
                _tbm_set_last_result(TBM_BO_ERROR_LOAD_MODULE_FAILED);
-               TBM_LOG("[libtbm:%d] " "error : Fail to load bufmgr backend\n", getpid());
+               TBM_LOG("[libtbm:%d] error : Fail to load bufmgr backend\n", getpid());
 
                if (gBufMgr->fd > 0)
                        close(gBufMgr->fd);
@@ -909,36 +937,36 @@ tbm_bufmgr tbm_bufmgr_init(int fd)
                gBufMgr = NULL;
                pthread_mutex_unlock(&gLock);
                return NULL;
-       } else {
-               backend_flag = gBufMgr->backend->flags;
-               /* log for tbm backend_flag */
-               DBG("[libtbm:%d] ", getpid());
-               DBG("cache_crtl:");
-               if (backend_flag & TBM_CACHE_CTRL_BACKEND) {
-                       DBG("BACKEND ");
-               } else {
-                       DBG("TBM ");
-               }
+       }
 
-               DBG("lock_crtl:");
-               if (backend_flag & TBM_LOCK_CTRL_BACKEND) {
-                       DBG("BACKEND ");
-               } else {
-                       DBG("TBM ");
-               }
+       backend_flag = gBufMgr->backend->flags;
+       /* log for tbm backend_flag */
+       DBG("[libtbm:%d] ", getpid());
+       DBG("cache_crtl:");
+       if (backend_flag & TBM_CACHE_CTRL_BACKEND) {
+               DBG("BACKEND ");
+       } else {
+               DBG("TBM ");
+       }
 
-               if (backend_flag & TBM_USE_2_0_BACKEND) {
-                       gBufMgr->use_2_0 = 1;
-                       DBG("USE 2.0 backend");
-               }
+       DBG("lock_crtl:");
+       if (backend_flag & TBM_LOCK_CTRL_BACKEND) {
+               DBG("BACKEND ");
+       } else {
+               DBG("TBM ");
+       }
 
-               DBG("\n");
+       if (backend_flag & TBM_USE_2_0_BACKEND) {
+               gBufMgr->use_2_0 = 1;
+               DBG("USE 2.0 backend");
        }
 
+       DBG("\n");
+
        gBufMgr->ref_count = 1;
 
        DBG("[libtbm:%d] create tizen bufmgr: ref_count:%d\n",
-               getpid(), gBufMgr->ref_count);
+           getpid(), gBufMgr->ref_count);
 
        if (pthread_mutex_init(&gBufMgr->lock, NULL) != 0) {
                _tbm_set_last_result(TBM_BO_ERROR_THREAD_INIT_FAILED);
@@ -959,7 +987,7 @@ tbm_bufmgr tbm_bufmgr_init(int fd)
                /* intialize the tizen global status */
                if (!_tbm_bufmgr_init_state(gBufMgr)) {
                        _tbm_set_last_result(TBM_BO_ERROR_INIT_STATE_FAILED);
-                       TBM_LOG("[libtbm:%d] " "error: Fail to init state\n", getpid());
+                       TBM_LOG("[libtbm:%d] error: Fail to init state\n", getpid());
                        gBufMgr->backend->bufmgr_deinit(gBufMgr->backend->priv);
                        tbm_backend_free(gBufMgr->backend);
                        pthread_mutex_destroy(&gBufMgr->lock);
@@ -981,7 +1009,7 @@ tbm_bufmgr tbm_bufmgr_init(int fd)
                else
                        gBufMgr->use_map_cache = 1;
                DBG("[libtbm:%d] BUFMGR_MAP_CACHE=%s\n",
-                       getpid(), env ? env : "default:true");
+                   getpid(), env ? env : "default:true");
        }
 
        /* setup the lock_type */
@@ -996,7 +1024,7 @@ tbm_bufmgr tbm_bufmgr_init(int fd)
                gBufMgr->lock_type = LOCK_TRY_ALWAYS;
 
        DBG("[libtbm:%d] BUFMGR_LOCK_TYPE=%s\n",
-               getpid(), env ? env : "default:once");
+           getpid(), env ? env : "default:once");
 
        /* intialize bo_list */
        LIST_INITHEAD(&gBufMgr->bo_list);
@@ -1008,7 +1036,8 @@ tbm_bufmgr tbm_bufmgr_init(int fd)
        return gBufMgr;
 }
 
-void tbm_bufmgr_deinit(tbm_bufmgr bufmgr)
+void
+tbm_bufmgr_deinit(tbm_bufmgr bufmgr)
 {
        TBM_RETURN_IF_FAIL(TBM_BUFMGR_IS_VALID(bufmgr));
 
@@ -1033,7 +1062,7 @@ void tbm_bufmgr_deinit(tbm_bufmgr bufmgr)
        if (!LIST_IS_EMPTY(&bufmgr->bo_list)) {
                LIST_FOR_EACH_ENTRY_SAFE(bo, tmp, &bufmgr->bo_list, item_link) {
                        TBM_LOG("[libtbm:%d] "
-                               "Un-freed bo(%p, ref:%d) \n",
+                               "Un-freed bo(%p, ref:%d)\n",
                                getpid(), bo, bo->ref_cnt);
                        bo->ref_cnt = 1;
                        tbm_bo_unref(bo);
@@ -1044,7 +1073,7 @@ void tbm_bufmgr_deinit(tbm_bufmgr bufmgr)
        if (!LIST_IS_EMPTY(&bufmgr->surf_list)) {
                LIST_FOR_EACH_ENTRY_SAFE(surf, tmp_surf, &bufmgr->surf_list, item_link) {
                        TBM_LOG("[libtbm:%d] "
-                               "Destroy surf(%p) \n",
+                               "Destroy surf(%p)\n",
                                getpid(), surf);
                        tbm_surface_destroy(surf);
                }
@@ -1064,8 +1093,8 @@ void tbm_bufmgr_deinit(tbm_bufmgr bufmgr)
        pthread_mutex_destroy(&bufmgr->lock);
 
        DBG("[libtbm:%d] "
-               "tizen bufmgr destroy: bufmgr:%p\n",
-               getpid(), bufmgr);
+           "tizen bufmgr destroy: bufmgr:%p\n",
+           getpid(), bufmgr);
 
        dlclose(bufmgr->module_data);
 
@@ -1079,7 +1108,8 @@ void tbm_bufmgr_deinit(tbm_bufmgr bufmgr)
        pthread_mutex_unlock(&gLock);
 }
 
-int tbm_bo_size(tbm_bo bo)
+int
+tbm_bo_size(tbm_bo bo)
 {
        TBM_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), 0);
 
@@ -1095,7 +1125,8 @@ int tbm_bo_size(tbm_bo bo)
        return size;
 }
 
-tbm_bo tbm_bo_ref(tbm_bo bo)
+tbm_bo
+tbm_bo_ref(tbm_bo bo)
 {
        TBM_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), NULL);
 
@@ -1110,7 +1141,8 @@ tbm_bo tbm_bo_ref(tbm_bo bo)
        return bo;
 }
 
-void tbm_bo_unref(tbm_bo bo)
+void
+tbm_bo_unref(tbm_bo bo)
 {
        TBM_RETURN_IF_FAIL(_tbm_bo_is_valid(bo));
 
@@ -1123,7 +1155,8 @@ void tbm_bo_unref(tbm_bo bo)
        pthread_mutex_unlock(&bufmgr->lock);
 }
 
-tbm_bo tbm_bo_alloc(tbm_bufmgr bufmgr, int size, int flags)
+tbm_bo
+tbm_bo_alloc(tbm_bufmgr bufmgr, int size, int flags)
 {
        TBM_RETURN_VAL_IF_FAIL(TBM_BUFMGR_IS_VALID(bufmgr) && (size > 0), NULL);
 
@@ -1174,7 +1207,8 @@ tbm_bo tbm_bo_alloc(tbm_bufmgr bufmgr, int size, int flags)
        return bo;
 }
 
-tbm_bo tbm_bo_import(tbm_bufmgr bufmgr, unsigned int key)
+tbm_bo
+tbm_bo_import(tbm_bufmgr bufmgr, unsigned int key)
 {
        TBM_RETURN_VAL_IF_FAIL(TBM_BUFMGR_IS_VALID(bufmgr), NULL);
 
@@ -1191,8 +1225,8 @@ tbm_bo tbm_bo_import(tbm_bufmgr bufmgr, unsigned int key)
                        LIST_FOR_EACH_ENTRY_SAFE(bo2, tmp, &bufmgr->bo_list, item_link) {
                                if (bo2->tgl_key == key) {
                                        DBG("[libtbm:%d] "
-                                               "find bo(%p, ref:%d key:%d) in list \n",
-                                               getpid(), bo2, bo2->ref_cnt, bo2->tgl_key);
+                                           "find bo(%p, ref:%d key:%d) in list\n",
+                                           getpid(), bo2, bo2->ref_cnt, bo2->tgl_key);
 
                                        bo2->ref_cnt++;
                                        pthread_mutex_unlock(&bufmgr->lock);
@@ -1223,8 +1257,8 @@ tbm_bo tbm_bo_import(tbm_bufmgr bufmgr, unsigned int key)
                        LIST_FOR_EACH_ENTRY_SAFE(bo2, tmp, &bufmgr->bo_list, item_link) {
                                if (bo2->priv == bo_priv) {
                                        DBG("[libtbm:%d] "
-                                               "find bo(%p, ref:%d key:%d) in list \n",
-                                               getpid(), bo2, bo2->ref_cnt, bo2->tgl_key);
+                                           "find bo(%p, ref:%d key:%d) in list\n",
+                                           getpid(), bo2, bo2->ref_cnt, bo2->tgl_key);
 
                                        bo2->ref_cnt++;
                                        free(bo);
@@ -1265,7 +1299,8 @@ tbm_bo tbm_bo_import(tbm_bufmgr bufmgr, unsigned int key)
        return bo;
 }
 
-tbm_bo tbm_bo_import_fd(tbm_bufmgr bufmgr, tbm_fd fd)
+tbm_bo
+tbm_bo_import_fd(tbm_bufmgr bufmgr, tbm_fd fd)
 {
        TBM_RETURN_VAL_IF_FAIL(TBM_BUFMGR_IS_VALID(bufmgr), NULL);
 
@@ -1285,8 +1320,8 @@ tbm_bo tbm_bo_import_fd(tbm_bufmgr bufmgr, tbm_fd fd)
                        LIST_FOR_EACH_ENTRY_SAFE(bo2, tmp, &bufmgr->bo_list, item_link) {
                                if (bo2->default_handle.u32 == default_handle.u32) {
                                        DBG("[libtbm:%d] "
-                                               "find bo(%p, ref:%d handle:%d) in list \n",
-                                               getpid(), bo2, bo2->ref_cnt, bo2->default_handle.u32);
+                                           "find bo(%p, ref:%d handle:%d) in list\n",
+                                           getpid(), bo2, bo2->ref_cnt, bo2->default_handle.u32);
 
                                        bo2->ref_cnt++;
                                        pthread_mutex_unlock(&bufmgr->lock);
@@ -1317,8 +1352,8 @@ tbm_bo tbm_bo_import_fd(tbm_bufmgr bufmgr, tbm_fd fd)
                        LIST_FOR_EACH_ENTRY_SAFE(bo2, tmp, &bufmgr->bo_list, item_link) {
                                if (bo2->priv == bo_priv) {
                                        DBG("[libtbm:%d] "
-                                               "find bo(%p, ref:%d key:%d) in list \n",
-                                               getpid(), bo2, bo2->ref_cnt, bo2->tgl_key);
+                                           "find bo(%p, ref:%d key:%d) in list\n",
+                                           getpid(), bo2, bo2->ref_cnt, bo2->tgl_key);
 
                                        bo2->ref_cnt++;
                                        free(bo);
@@ -1359,7 +1394,8 @@ tbm_bo tbm_bo_import_fd(tbm_bufmgr bufmgr, tbm_fd fd)
        return bo;
 }
 
-tbm_key tbm_bo_export(tbm_bo bo)
+tbm_key
+tbm_bo_export(tbm_bo bo)
 {
        TBM_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), 0);
 
@@ -1380,7 +1416,8 @@ tbm_key tbm_bo_export(tbm_bo bo)
        return ret;
 }
 
-tbm_fd tbm_bo_export_fd(tbm_bo bo)
+tbm_fd
+tbm_bo_export_fd(tbm_bo bo)
 {
        TBM_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), -1);
 
@@ -1401,7 +1438,8 @@ tbm_fd tbm_bo_export_fd(tbm_bo bo)
        return ret;
 }
 
-tbm_bo_handle tbm_bo_get_handle(tbm_bo bo, int device)
+tbm_bo_handle
+tbm_bo_get_handle(tbm_bo bo, int device)
 {
        TBM_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), (tbm_bo_handle) 0);
 
@@ -1422,7 +1460,8 @@ tbm_bo_handle tbm_bo_get_handle(tbm_bo bo, int device)
        return bo_handle;
 }
 
-tbm_bo_handle tbm_bo_map(tbm_bo bo, int device, int opt)
+tbm_bo_handle
+tbm_bo_map(tbm_bo bo, int device, int opt)
 {
        TBM_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), (tbm_bo_handle) 0);
 
@@ -1437,7 +1476,7 @@ tbm_bo_handle tbm_bo_map(tbm_bo bo, int device, int opt)
                _tbm_set_last_result(TBM_BO_ERROR_LOCK_FAILED);
                TBM_LOG("[libtbm:%d] "
                        "error %s:%d fail to lock bo:%p)\n",
-                       getpid(), __FUNCTION__, __LINE__, bo);
+                       getpid(), __func__, __LINE__, bo);
                pthread_mutex_unlock(&bufmgr->lock);
                return (tbm_bo_handle) NULL;
        }
@@ -1447,7 +1486,7 @@ tbm_bo_handle tbm_bo_map(tbm_bo bo, int device, int opt)
                _tbm_set_last_result(TBM_BO_ERROR_MAP_FAILED);
                TBM_LOG("[libtbm:%d] "
                        "error %s:%d fail to map bo:%p\n",
-                       getpid(), __FUNCTION__, __LINE__, bo);
+                       getpid(), __func__, __LINE__, bo);
 
                _tbm_bo_unlock(bo);
                pthread_mutex_unlock(&bufmgr->lock);
@@ -1467,7 +1506,8 @@ tbm_bo_handle tbm_bo_map(tbm_bo bo, int device, int opt)
        return bo_handle;
 }
 
-int tbm_bo_unmap(tbm_bo bo)
+int
+tbm_bo_unmap(tbm_bo bo)
 {
        TBM_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), 0);
 
@@ -1501,7 +1541,8 @@ int tbm_bo_unmap(tbm_bo bo)
        return ret;
 }
 
-int tbm_bo_swap(tbm_bo bo1, tbm_bo bo2)
+int
+tbm_bo_swap(tbm_bo bo1, tbm_bo bo2)
 {
        TBM_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo1), 0);
        TBM_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo2), 0);
@@ -1537,7 +1578,8 @@ int tbm_bo_swap(tbm_bo bo1, tbm_bo bo2)
        return 1;
 }
 
-int tbm_bo_locked(tbm_bo bo)
+int
+tbm_bo_locked(tbm_bo bo)
 {
        TBM_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), 0);
 
@@ -1560,7 +1602,9 @@ int tbm_bo_locked(tbm_bo bo)
        return 0;
 }
 
-int tbm_bo_add_user_data(tbm_bo bo, unsigned long key, tbm_data_free data_free_func)
+int
+tbm_bo_add_user_data(tbm_bo bo, unsigned long key,
+                    tbm_data_free data_free_func)
 {
        TBM_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), 0);
 
@@ -1571,7 +1615,7 @@ int tbm_bo_add_user_data(tbm_bo bo, unsigned long key, tbm_data_free data_free_f
        if (data) {
                TBM_LOG("[libtbm:%d] "
                        "waring: %s:%d user data already exist. key:%ld\n",
-                       getpid(), __FUNCTION__, __LINE__, key);
+                       getpid(), __func__, __LINE__, key);
                return 0;
        }
 
@@ -1584,7 +1628,8 @@ int tbm_bo_add_user_data(tbm_bo bo, unsigned long key, tbm_data_free data_free_f
        return 1;
 }
 
-int tbm_bo_set_user_data(tbm_bo bo, unsigned long key, void *data)
+int
+tbm_bo_set_user_data(tbm_bo bo, unsigned long key, void *data)
 {
        TBM_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), 0);
 
@@ -1605,7 +1650,8 @@ int tbm_bo_set_user_data(tbm_bo bo, unsigned long key, void *data)
        return 1;
 }
 
-int tbm_bo_get_user_data(tbm_bo bo, unsigned long key, void **data)
+int
+tbm_bo_get_user_data(tbm_bo bo, unsigned long key, void **data)
 {
        TBM_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), 0);
 
@@ -1625,7 +1671,8 @@ int tbm_bo_get_user_data(tbm_bo bo, unsigned long key, void **data)
        return 1;
 }
 
-int tbm_bo_delete_user_data(tbm_bo bo, unsigned long key)
+int
+tbm_bo_delete_user_data(tbm_bo bo, unsigned long key)
 {
        TBM_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), 0);
 
@@ -1643,12 +1690,14 @@ int tbm_bo_delete_user_data(tbm_bo bo, unsigned long key)
        return 1;
 }
 
-tbm_error_e tbm_get_last_error(void)
+tbm_error_e
+tbm_get_last_error(void)
 {
        return tbm_last_error;
 }
 
-unsigned int tbm_bufmgr_get_capability(tbm_bufmgr bufmgr)
+unsigned int
+tbm_bufmgr_get_capability(tbm_bufmgr bufmgr)
 {
        TBM_RETURN_VAL_IF_FAIL(TBM_BUFMGR_IS_VALID(bufmgr), 0);
 
@@ -1663,14 +1712,16 @@ unsigned int tbm_bufmgr_get_capability(tbm_bufmgr bufmgr)
        return capability;
 }
 
-int tbm_bo_get_flags(tbm_bo bo)
+int
+tbm_bo_get_flags(tbm_bo bo)
 {
        TBM_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), 0);
 
        return bo->flags;
 }
 
-void tbm_bufmgr_debug_show(tbm_bufmgr bufmgr)
+void
+tbm_bufmgr_debug_show(tbm_bufmgr bufmgr)
 {
        TBM_RETURN_IF_FAIL(bufmgr != NULL);
        tbm_bo bo = NULL, tmp_bo = NULL;
@@ -1687,8 +1738,9 @@ void tbm_bufmgr_debug_show(tbm_bufmgr bufmgr)
        TBM_DEBUG("\n");
        _tbm_util_get_appname_from_pid(getpid(), app_name);
        _tbm_util_get_appname_brief(app_name);
-       TBM_DEBUG("============TBM DEBUG: %s(%d)===========================\n", app_name, getpid());
-       memset(app_name, 0x0, 255*sizeof(char));
+       TBM_DEBUG("============TBM DEBUG: %s(%d)===========================\n",
+                 app_name, getpid());
+       memset(app_name, 0x0, 255 * sizeof(char));
 
        TBM_DEBUG("[tbm_surface information]\n");
        TBM_DEBUG("no  surface              refcnt  width  height  bpp  size      num_bos num_planes flags format              app_name\n");
@@ -1697,36 +1749,36 @@ void tbm_bufmgr_debug_show(tbm_bufmgr bufmgr)
                LIST_FOR_EACH_ENTRY_SAFE(surf, tmp_surf, &bufmgr->surf_list, item_link) {
                        pid = _tbm_surface_internal_get_debug_pid(surf);
                        if (!pid) {
-                                       /* if pid is null, set the self_pid */
-                                       pid = getpid();
+                               /* if pid is null, set the self_pid */
+                               pid = getpid();
                        }
 
                        _tbm_util_get_appname_from_pid(pid, app_name);
                        _tbm_util_get_appname_brief(app_name);
 
                        TBM_DEBUG("%-4d%-23p%-6d%-7d%-8d%-5d%-12d%-10d%-9d%-4d%-20s%s\n",
-                               ++surf_cnt,
-                               surf,
-                               surf->refcnt,
-                               surf->info.width,
-                               surf->info.height,
-                               surf->info.bpp,
-                               surf->info.size/1024,
-                               surf->num_bos,
-                               surf->num_planes,
-                               surf->flags,
-                               _tbm_surface_internal_format_to_str(surf->info.format),
-                               app_name);
+                                 ++surf_cnt,
+                                 surf,
+                                 surf->refcnt,
+                                 surf->info.width,
+                                 surf->info.height,
+                                 surf->info.bpp,
+                                 surf->info.size / 1024,
+                                 surf->num_bos,
+                                 surf->num_planes,
+                                 surf->flags,
+                                 _tbm_surface_internal_format_to_str(surf->info.format),
+                                 app_name);
 
                        for (i = 0; i < surf->num_bos; i++) {
                                TBM_DEBUG(" bo:%-12p(key:%2d)   %-26d%-10d\n",
-                                       surf->bos[i],
-                                       surf->bos[i]->tgl_key,
-                                       surf->bos[i]->ref_cnt,
-                                       tbm_bo_size(surf->bos[i])/1024);
+                                         surf->bos[i],
+                                         surf->bos[i]->tgl_key,
+                                         surf->bos[i]->ref_cnt,
+                                         tbm_bo_size(surf->bos[i]) / 1024);
                        }
 
-                       memset(app_name, 0x0, 255*sizeof(char));
+                       memset(app_name, 0x0, 255 * sizeof(char));
                }
        } else {
                TBM_DEBUG("no tbm_surfaces.\n");
@@ -1740,16 +1792,16 @@ void tbm_bufmgr_debug_show(tbm_bufmgr bufmgr)
        if (!LIST_IS_EMPTY(&bufmgr->bo_list)) {
                LIST_FOR_EACH_ENTRY_SAFE(bo, tmp_bo, &bufmgr->bo_list, item_link) {
                        TBM_DEBUG("%-4d%-11p(key:%2d)   %-6d%-12d%-9d%-9d%-10d%-4d%-11p\n",
-                               ++bo_cnt,
-                               bo,
-                               bo->tgl_key,
-                               bo->ref_cnt,
-                               tbm_bo_size(bo)/1024,
-                               bo->lock_cnt,
-                               bo->map_cnt,
-                               bo->cache_state.val,
-                               bo->flags,
-                               bo->surface);
+                                 ++bo_cnt,
+                                 bo,
+                                 bo->tgl_key,
+                                 bo->ref_cnt,
+                                 tbm_bo_size(bo) / 1024,
+                                 bo->lock_cnt,
+                                 bo->map_cnt,
+                                 bo->cache_state.val,
+                                 bo->flags,
+                                 bo->surface);
                }
        } else {
                TBM_DEBUG("no tbm_bos.\n");
@@ -1762,14 +1814,16 @@ void tbm_bufmgr_debug_show(tbm_bufmgr bufmgr)
 
 }
 
-void tbm_bufmgr_debug_trace(tbm_bufmgr bufmgr, int onoff)
+void
+tbm_bufmgr_debug_trace(tbm_bufmgr bufmgr, int onoff)
 {
        TBM_LOG("bufmgr=%p onoff=%d\n", bufmgr, onoff);
        TBM_LOG("Not implemented yet.\n");
 }
 
 /* internal function */
-int _tbm_bo_set_surface(tbm_bo bo, tbm_surface_h surface)
+int
+_tbm_bo_set_surface(tbm_bo bo, tbm_surface_h surface)
 {
        TBM_RETURN_VAL_IF_FAIL(_tbm_bo_is_valid(bo), 0);
 
index 7e0930b..b1ef8fe 100644 (file)
@@ -785,7 +785,8 @@ typedef void (*tbm_data_free) (void *user_data);
    @endcode
  */
 
-int tbm_bo_add_user_data(tbm_bo bo, unsigned long key, tbm_data_free data_free_func);
+int tbm_bo_add_user_data(tbm_bo bo, unsigned long key,
+                        tbm_data_free data_free_func);
 
 /**
  * @brief Deletes the user_data in the buffer object.
@@ -1037,7 +1038,7 @@ int tbm_bo_get_flags(tbm_bo bo);
  * @since_tizen 3.0
  * @param[in] bufmgr : the buffer manager
  */
-void tbm_bufmgr_debug_show (tbm_bufmgr bufmgr);
+void tbm_bufmgr_debug_show(tbm_bufmgr bufmgr);
 
 /**
  * @brief Print out the trace of tbm_bos.
@@ -1045,7 +1046,7 @@ void tbm_bufmgr_debug_show (tbm_bufmgr bufmgr);
  * @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);
+void tbm_bufmgr_debug_trace(tbm_bufmgr bufmgr, int onoff);
 
 
 
index 907c993..7bb3ab2 100644 (file)
@@ -62,12 +62,16 @@ int tbm_backend_init(tbm_bufmgr bufmgr, tbm_bufmgr_backend backend)
        int flags = 0;
 
        if (!bufmgr) {
-               TBM_LOG("[libtbm:%d] " "error (%s): fail to init tbm backend... bufmgr is null\n", getpid(), __FUNCTION__);
+               TBM_LOG("[libtbm:%d] "
+                       "error (%s): fail to init tbm backend... bufmgr is null\n", getpid(),
+                       __func__);
                return 0;
        }
 
        if (!backend) {
-               TBM_LOG("[libtbm:%d] " "error (%s): fail to init tbm backend... backend is null\n", getpid(), __FUNCTION__);
+               TBM_LOG("[libtbm:%d] "
+                       "error (%s): fail to init tbm backend... backend is null\n", getpid(),
+                       __func__);
                return 0;
        }
 
@@ -76,7 +80,9 @@ int tbm_backend_init(tbm_bufmgr bufmgr, tbm_bufmgr_backend backend)
        if (!(flags & TBM_USE_2_0_BACKEND)) {
                if (flags & TBM_CACHE_CTRL_BACKEND) {
                        if (!backend->bo_cache_flush) {
-                               TBM_LOG("[libtbm:%d] " "error (%s): TBM_FLAG_CACHE_CTRL_TBM needs backend->bo_cache_flush\n", getpid(), __FUNCTION__);
+                               TBM_LOG("[libtbm:%d] "
+                                       "error (%s): TBM_FLAG_CACHE_CTRL_TBM needs backend->bo_cache_flush\n", getpid(),
+                                       __func__);
                                return 0;
                        }
                }
index dba8966..940dc3c 100644 (file)
@@ -97,208 +97,210 @@ struct _tbm_bufmgr_backend {
        void *priv;     /**< bufmgr private */
 
        /**
-    * @brief deinitialize the bufmgr private.
-    * @param[in] bufmgr : the private of the bufmgr
-    * @return 1 if this function succeeds, otherwise 0.
-    */
-       void (*bufmgr_deinit) (void *priv);
+       * @brief deinitialize the bufmgr private.
+       * @param[in] bufmgr : the private of the bufmgr
+       * @return 1 if this function succeeds, otherwise 0.
+       */
+       void (*bufmgr_deinit)(void *priv);
 
        /**
-    * @brief get the size of a bo.
-    * @param[in] bo : the buffer object
-    * @return 1 if this function succeeds, otherwise 0.
-    */
-       int (*bo_size) (tbm_bo bo);
+       * @brief get the size of a bo.
+       * @param[in] bo : the buffer object
+       * @return 1 if this function succeeds, otherwise 0.
+       */
+       int (*bo_size)(tbm_bo bo);
 
        /**
-    * @brief allocate the buffer object
-    * @param[in] bo : the buffer object
-    * @param[in] size : the size of buffer object
-    * @param[in] flags : the flags of memory type
-    * @return pointer of the bo private.
-    */
-       void *(*bo_alloc) (tbm_bo bo, int size, int flags);
+       * @brief allocate the buffer object
+       * @param[in] bo : the buffer object
+       * @param[in] size : the size of buffer object
+       * @param[in] flags : the flags of memory type
+       * @return pointer of the bo private.
+       */
+       void *(*bo_alloc)(tbm_bo bo, int size, int flags);
 
        /**
-    * @brief free the buffer object.
-    * @param[in] bo : the buffer object
-    */
-       void (*bo_free) (tbm_bo bo);
+       * @brief free the buffer object.
+       * @param[in] bo : the buffer object
+       */
+       void (*bo_free)(tbm_bo bo);
 
        /**
-    * @brief import the buffer object associated with the key.
-    * @remarks If the backend doesn't support a buffer sharing by tbm key,
+       * @brief import the buffer object associated with the key.
+       * @remarks If the backend doesn't support a buffer sharing by tbm key,
                        fucntion pointer must be set to NULL.
-    * @param[in] bo : the buffer object
-    * @param[in] key : the key associated with the buffer object
-    * @return pointer of the bo private.
-    */
-       void *(*bo_import) (tbm_bo bo, unsigned int key);
+       * @param[in] bo : the buffer object
+       * @param[in] key : the key associated with the buffer object
+       * @return pointer of the bo private.
+       */
+       void *(*bo_import)(tbm_bo bo, unsigned int key);
 
        /**
-    * @brief export the buffer object
-    * @remarks If the backend doesn't support a buffer sharing by tbm key,
+       * @brief export the buffer object
+       * @remarks If the backend doesn't support a buffer sharing by tbm key,
                        fucntion pointer must be set to NULL.
-    * @param[in] bo : the buffer object
-    * @return key associated with the buffer object
-    */
-       unsigned int (*bo_export) (tbm_bo bo);
+       * @param[in] bo : the buffer object
+       * @return key associated with the buffer object
+       */
+       unsigned int (*bo_export)(tbm_bo bo);
 
        /**
-    * @brief get the tbm_bo_handle according to the device type.
-    * @param[in] bo : the buffer object
-    * @param[in] device : the device type to get a handle
-    * @return the handle of the buffer object
-    */
-        tbm_bo_handle(*bo_get_handle) (tbm_bo bo, int device);
+       * @brief get the tbm_bo_handle according to the device type.
+       * @param[in] bo : the buffer object
+       * @param[in] device : the device type to get a handle
+       * @return the handle of the buffer object
+       */
+       tbm_bo_handle(*bo_get_handle)(tbm_bo bo, int device);
 
        /**
-    * @brief map the buffer object according to the device type and the option.
-    * @param[in] bo : the buffer object
-    * @param[in] device : the device type to get a handle
-    * @param[in] option : the option to access the buffer object
-    * @return the handle of the buffer object
-    */
-        tbm_bo_handle(*bo_map) (tbm_bo bo, int device, int opt);
+       * @brief map the buffer object according to the device type and the option.
+       * @param[in] bo : the buffer object
+       * @param[in] device : the device type to get a handle
+       * @param[in] option : the option to access the buffer object
+       * @return the handle of the buffer object
+       */
+       tbm_bo_handle(*bo_map)(tbm_bo bo, int device, int opt);
 
        /**
-    * @brief unmap the buffer object.
-    * @param[in] bo : the buffer object
-    * @return 1 if this function succeeds, otherwise 0.
-    */
-       int (*bo_unmap) (tbm_bo bo);
+       * @brief unmap the buffer object.
+       * @param[in] bo : the buffer object
+       * @return 1 if this function succeeds, otherwise 0.
+       */
+       int (*bo_unmap)(tbm_bo bo);
 
        /* version 2.0 dosen't need to backend function bo_cache_flush */
        /**
-    * @brief flush the cache of the buffer object.
-    * @param[in] bo : the buffer object
-    * @param[in] flags : the flags of cache flush type
-    * @return 1 if this function succeeds, otherwise 0.
-    */
-       int (*bo_cache_flush) (tbm_bo bo, int flags);
+       * @brief flush the cache of the buffer object.
+       * @param[in] bo : the buffer object
+       * @param[in] flags : the flags of cache flush type
+       * @return 1 if this function succeeds, otherwise 0.
+       */
+       int (*bo_cache_flush)(tbm_bo bo, int flags);
 
        /* version 2.0 dosen't need to backend function bo_get_global_key */
        /**
-    * @brief get the global key associated with the buffer object.
-    * @param[in] bo : the buffer object
-    * @return global key associated with the buffer object.
-    */
-       int (*bo_get_global_key) (tbm_bo bo);
+       * @brief get the global key associated with the buffer object.
+       * @param[in] bo : the buffer object
+       * @return global key associated with the buffer object.
+       */
+       int (*bo_get_global_key)(tbm_bo bo);
 
        /**
-    * @brief lock the buffer object.
-    * @param[in] bo : the buffer object
-    * @return 1 if this function succeeds, otherwise 0.
-    * @remark This function pointer could be null. (default: use the tizen global lock)
-    */
-       int (*bo_lock) (tbm_bo bo);
+       * @brief lock the buffer object.
+       * @param[in] bo : the buffer object
+       * @return 1 if this function succeeds, otherwise 0.
+       * @remark This function pointer could be null. (default: use the tizen global lock)
+       */
+       int (*bo_lock)(tbm_bo bo);
 
        /**
-    * @brief unlock the buffer object.
-    * @param[in] bo : the buffer object
-    * @return 1 if this function succeeds, otherwise 0.
-    * @remark This function pointer could be null. (default: use the tizen global lock)
-    */
-       int (*bo_unlock) (tbm_bo bo);
+       * @brief unlock the buffer object.
+       * @param[in] bo : the buffer object
+       * @return 1 if this function succeeds, otherwise 0.
+       * @remark This function pointer could be null. (default: use the tizen global lock)
+       */
+       int (*bo_unlock)(tbm_bo bo);
 
        /**
-    * @brief lock the buffer object with a device and an opt.
-    * @param[in] bo : the buffer object
-    * @param[in] device : the device type to get a handle
-    * @param[in] option : the option to access the buffer object
-    * @return 1 if this function succeeds, otherwise 0.
-    * @remark This function pointer could be null. (default: use the tizen global lock)
-    */
-       int (*bo_lock2) (tbm_bo bo, int device, int opt);
+       * @brief lock the buffer object with a device and an opt.
+       * @param[in] bo : the buffer object
+       * @param[in] device : the device type to get a handle
+       * @param[in] option : the option to access the buffer object
+       * @return 1 if this function succeeds, otherwise 0.
+       * @remark This function pointer could be null. (default: use the tizen global lock)
+       */
+       int (*bo_lock2)(tbm_bo bo, int device, int opt);
 
        /**
-    * @brief query the formats list and the num to be supported by backend.
-    * @param[out] *formats : format array list. this array has to be allocated by backend funtion
-    * @param[out] *num : the number of the formats to be supported by backend
-    * @return 1 if this function succeeds, otherwise 0.
-    */
-       int (*surface_supported_format) (uint32_t ** formats, uint32_t * num);
+       * @brief query the formats list and the num to be supported by backend.
+       * @param[out] *formats : format array list. this array has to be allocated by backend funtion
+       * @param[out] *num : the number of the formats to be supported by backend
+       * @return 1 if this function succeeds, otherwise 0.
+       */
+       int (*surface_supported_format)(uint32_t **formats, uint32_t *num);
 
        /* version 2.0 dosen't need to backend function surface get size*/
        /**
-    * @brief get the size of the surface with a format.
-    * @param[in] surface : the surface
-    * @param[in] width : the width of the surface
-    * @param[in] height : the height of the surface
-    * @param[in] format : the format of the surface
-    * @return size of the surface if this function succeeds, otherwise 0.
-    */
-       int (*surface_get_size) (tbm_surface_h surface, int width, int height, tbm_format format);
+       * @brief get the size of the surface with a format.
+       * @param[in] surface : the surface
+       * @param[in] width : the width of the surface
+       * @param[in] height : the height of the surface
+       * @param[in] format : the format of the surface
+       * @return size of the surface if this function succeeds, otherwise 0.
+       */
+       int (*surface_get_size)(tbm_surface_h surface, int width, int height,
+                               tbm_format format);
 
        /**
-    * @brief get the plane data of the surface.
-    * @param[in] surface : the surface
-    * @param[in] width : the width of the surface
-    * @param[in] height : the height of the surface
-    * @param[in] format : the format of the surface
-    * @param[in] plane_idx : the format of the surface
-    * @param[out] size : the size of the plane
-    * @param[out] offset : the offset of the plane
-    * @param[out] pitch : the pitch of the plane
-    * @param[out] bo_idx : the bo index of the plane
-    * @return 1 if this function succeeds, otherwise 0.
-    */
-       int (*surface_get_plane_data) (tbm_surface_h surface, int width, int height, tbm_format format, int plane_idx, uint32_t * size, uint32_t * offset, uint32_t * pitch, int *bo_idx);
+       * @brief get the plane data of the surface.
+       * @param[in] surface : the surface
+       * @param[in] width : the width of the surface
+       * @param[in] height : the height of the surface
+       * @param[in] format : the format of the surface
+       * @param[in] plane_idx : the format of the surface
+       * @param[out] size : the size of the plane
+       * @param[out] offset : the offset of the plane
+       * @param[out] pitch : the pitch of the plane
+       * @param[out] bo_idx : the bo index of the plane
+       * @return 1 if this function succeeds, otherwise 0.
+       */
+       int (*surface_get_plane_data)(tbm_surface_h surface, int width, int height,
+                                     tbm_format format, int plane_idx, uint32_t *size, uint32_t *offset,
+                                     uint32_t *pitch, int *bo_idx);
 
        /**
-    * @brief import the buffer object associated with the prime fd.
-    * @remarks tbm_fd must be free by user.
-    * @remarks If the backend doesn't support a buffer sharing by tbm fd,
+       * @brief import the buffer object associated with the prime fd.
+       * @remarks tbm_fd must be free by user.
+       * @remarks If the backend doesn't support a buffer sharing by tbm fd,
                        fucntion pointer must be set to NULL.
-    * @param[in] bo : the buffer object
-    * @param[in] fd : the prime fd associated with the buffer object
-    * @return pointer of the bo private.
-    */
-       void *(*bo_import_fd) (tbm_bo bo, tbm_fd fd);
+       * @param[in] bo : the buffer object
+       * @param[in] fd : the prime fd associated with the buffer object
+       * @return pointer of the bo private.
+       */
+       void *(*bo_import_fd)(tbm_bo bo, tbm_fd fd);
 
        /**
-    * @brief export the buffer object
-    * @remarks tbm_fd must be free by user.
-    * @remarks If the backend doesn't support a buffer sharing by tbm fd,
+       * @brief export the buffer object
+       * @remarks tbm_fd must be free by user.
+       * @remarks If the backend doesn't support a buffer sharing by tbm fd,
                        fucntion pointer must be set to NULL.
-    * @param[in] bo : the buffer object
-    * @return tbm_fd associated with the buffer object
-    */
-        tbm_fd(*bo_export_fd) (tbm_bo bo);
-
+       * @param[in] bo : the buffer object
+       * @return tbm_fd associated with the buffer object
+       */
+       tbm_fd (*bo_export_fd)(tbm_bo bo);
 
        /* version 2.0 dosen't need to backend function fd_to_handle */
        /**
-    * @brief get the tbm_bo_handle according to the device type and the prime fd.
-    * @param[in] bufmgr : the tizen buffer manager
-    * @param[in] fd : the prime fd associated with the buffer object
-    * @param[in] device : the option to access the buffer object
-    * @return the handle of the buffer object
-    */
-        tbm_bo_handle(*fd_to_handle) (tbm_bufmgr bufmgr, tbm_fd fd, int device);
+       * @brief get the tbm_bo_handle according to the device type and the prime fd.
+       * @param[in] bufmgr : the tizen buffer manager
+       * @param[in] fd : the prime fd associated with the buffer object
+       * @param[in] device : the option to access the buffer object
+       * @return the handle of the buffer object
+       */
+       tbm_bo_handle(*fd_to_handle)(tbm_bufmgr bufmgr, tbm_fd fd, int device);
 
        /**
-    * @brief get the num of bos with a format.
-    * @param[in] format : the format of the surface
-    * @return num of the bos if this function succeeds, otherwise 0.
-    */
-       int (*surface_get_num_bos) (tbm_format format);
+       * @brief get the num of bos with a format.
+       * @param[in] format : the format of the surface
+       * @return num of the bos if this function succeeds, otherwise 0.
+       */
+       int (*surface_get_num_bos)(tbm_format format);
 
        /**
-    * @brief get the tbm flags of memory type
-    * @param[in] bo : the buffer object
-    * @see #TBM_BO_FLAGS
-    * @return tbm flags of memory type is this function succeeds, otherwise 0.
-    */
-       int (*bo_get_flags) (tbm_bo bo);
+       * @brief get the tbm flags of memory type
+       * @param[in] bo : the buffer object
+       * @see #TBM_BO_FLAGS
+       * @return tbm flags of memory type is this function succeeds, otherwise 0.
+       */
+       int (*bo_get_flags)(tbm_bo bo);
 
        /* Padding for future extension */
-       void (*reserved1) (void);
-       void (*reserved2) (void);
-       void (*reserved3) (void);
-       void (*reserved4) (void);
-       void (*reserved5) (void);
-       void (*reserved6) (void);
+       void (*reserved1)(void);
+       void (*reserved2)(void);
+       void (*reserved3)(void);
+       void (*reserved4)(void);
+       void (*reserved5)(void);
+       void (*reserved6)(void);
 };
 
 /**
index 8c41b22..2305e42 100644 (file)
@@ -54,13 +54,13 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 /* check condition */
 #define TBM_RETURN_IF_FAIL(cond) {\
        if (!(cond)) {\
-               TBM_LOG("[%s] : '%s' failed.\n", __FUNCTION__, #cond);\
+               TBM_LOG("[%s] : '%s' failed.\n", __func__, #cond);\
                return;\
        } \
 }
 #define TBM_RETURN_VAL_IF_FAIL(cond, val) {\
        if (!(cond)) {\
-               TBM_LOG("[%s] : '%s' failed.\n", __FUNCTION__, #cond);\
+               TBM_LOG("[%s] : '%s' failed.\n", __func__, #cond);\
                return val;\
        } \
 }
@@ -80,13 +80,13 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 /* check validation */
 #define TBM_BUFMGR_IS_VALID(mgr) (mgr)
 #define TBM_BO_IS_VALID(bo) (bo && \
-                                               TBM_BUFMGR_IS_VALID(bo->bufmgr) && \
-                                               bo->item_link.next && \
-                                               bo->item_link.next->prev == &bo->item_link)
+                           TBM_BUFMGR_IS_VALID(bo->bufmgr) && \
+                           bo->item_link.next && \
+                           bo->item_link.next->prev == &bo->item_link)
 #define TBM_SURFACE_IS_VALID(surf) (surf && \
-                                               TBM_BUFMGR_IS_VALID(surf->bufmgr) && \
-                                               surf->item_link.next && \
-                                               surf->item_link.next->prev == &surf->item_link)
+                                  TBM_BUFMGR_IS_VALID(surf->bufmgr) && \
+                                  surf->item_link.next && \
+                                  surf->item_link.next->prev == &surf->item_link)
 
 #define TBM_DEBUG(fmt, ...)   fprintf(stderr, "[TBM:DEBUG(%d)] " fmt, getpid(), ##__VA_ARGS__)
 #define TBM_LOG(fmt, ...)  fprintf(stderr, "[TBM(%d):%s] " fmt, getpid(), __func__, ##__VA_ARGS__)
@@ -110,10 +110,10 @@ typedef union _tbm_bo_cache_state tbm_bo_cache_state;
 union _tbm_bo_cache_state {
        unsigned int val;
        struct {
-               unsigned int cntFlush:16;       /*Flush all index for sync */
-               unsigned int isCacheable:1;
-               unsigned int isCached:1;
-               unsigned int isDirtied:2;
+               unsigned int cntFlush: 16;      /*Flush all index for sync */
+               unsigned int isCacheable: 1;
+               unsigned int isCached: 1;
+               unsigned int isDirtied: 2;
        } data;
 };
 /* unneeded version 2.0 */
@@ -225,16 +225,19 @@ int tbm_bufmgr_get_drm_fd_wayland(void);
 int _tbm_bo_set_surface(tbm_bo bo, tbm_surface_h surface);
 
 /* functions for mutex */
-int tbm_surface_internal_get_info(tbm_surface_h surface, int opt, tbm_surface_info_s * info, int map);
+int tbm_surface_internal_get_info(tbm_surface_h surface, int opt,
+                                 tbm_surface_info_s *info, int map);
 void tbm_surface_internal_unmap(tbm_surface_h surface);
 unsigned int tbm_surface_internal_get_width(tbm_surface_h surface);
 unsigned int tbm_surface_internal_get_height(tbm_surface_h surface);
 tbm_format tbm_surface_internal_get_format(tbm_surface_h surface);
 unsigned int _tbm_surface_internal_get_debug_pid(tbm_surface_h surface);
-char * _tbm_surface_internal_format_to_str(tbm_format format);
+char *_tbm_surface_internal_format_to_str(tbm_format format);
 
-tbm_user_data *user_data_lookup(struct list_head *user_data_list, unsigned long key);
-tbm_user_data *user_data_create(unsigned long key, tbm_data_free data_free_func);
-void user_data_delete(tbm_user_data * user_data);
+tbm_user_data *user_data_lookup(struct list_head *user_data_list,
+                               unsigned long key);
+tbm_user_data *user_data_create(unsigned long key,
+                               tbm_data_free data_free_func);
+void user_data_delete(tbm_user_data *user_data);
 
 #endif                                                 /* _TBM_BUFMGR_INT_H_ */
index 6c5f312..f2d3e39 100644 (file)
@@ -34,7 +34,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "tbm_bufmgr_int.h"
 #include "tbm_surface_internal.h"
 
-int tbm_surface_query_formats(uint32_t ** formats, uint32_t * num)
+int
+tbm_surface_query_formats(uint32_t **formats, uint32_t *num)
 {
        if (!tbm_surface_internal_query_supported_formats(formats, num))
                return TBM_SURFACE_ERROR_INVALID_OPERATION;
@@ -42,7 +43,8 @@ int tbm_surface_query_formats(uint32_t ** formats, uint32_t * num)
        return TBM_SURFACE_ERROR_NONE;
 }
 
-tbm_surface_h tbm_surface_create(int width, int height, tbm_format format)
+tbm_surface_h
+tbm_surface_create(int width, int height, tbm_format format)
 {
        if (!(width > 0) || !(height > 0)) {
 #ifdef HAVE_CAPI_0_1_1
@@ -53,7 +55,8 @@ tbm_surface_h tbm_surface_create(int width, int height, tbm_format format)
 
        struct _tbm_surface *surf = NULL;
 
-       surf = tbm_surface_internal_create_with_flags(width, height, format, TBM_BO_DEFAULT);
+       surf = tbm_surface_internal_create_with_flags(width, height, format,
+                                                     TBM_BO_DEFAULT);
        if (!surf) {
 #ifdef HAVE_CAPI_0_1_1
                set_last_result(TBM_SURFACE_ERROR_INVALID_OPERATION);
@@ -66,7 +69,8 @@ tbm_surface_h tbm_surface_create(int width, int height, tbm_format format)
        return surf;
 }
 
-int tbm_surface_destroy(tbm_surface_h surface)
+int
+tbm_surface_destroy(tbm_surface_h surface)
 {
        if (!surface)
                return TBM_SURFACE_ERROR_INVALID_PARAMETER;
@@ -76,7 +80,8 @@ int tbm_surface_destroy(tbm_surface_h surface)
        return TBM_SURFACE_ERROR_NONE;
 }
 
-int tbm_surface_map(tbm_surface_h surface, int opt, tbm_surface_info_s * info)
+int
+tbm_surface_map(tbm_surface_h surface, int opt, tbm_surface_info_s *info)
 {
        TBM_RETURN_VAL_IF_FAIL(surface != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
        TBM_RETURN_VAL_IF_FAIL(info != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
@@ -90,7 +95,8 @@ int tbm_surface_map(tbm_surface_h surface, int opt, tbm_surface_info_s * info)
        return TBM_SURFACE_ERROR_NONE;
 }
 
-int tbm_surface_unmap(tbm_surface_h surface)
+int
+tbm_surface_unmap(tbm_surface_h surface)
 {
        TBM_RETURN_VAL_IF_FAIL(surface != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
 
@@ -99,7 +105,8 @@ int tbm_surface_unmap(tbm_surface_h surface)
        return TBM_SURFACE_ERROR_NONE;
 }
 
-int tbm_surface_get_info(tbm_surface_h surface, tbm_surface_info_s * info)
+int
+tbm_surface_get_info(tbm_surface_h surface, tbm_surface_info_s *info)
 {
        TBM_RETURN_VAL_IF_FAIL(surface != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
        TBM_RETURN_VAL_IF_FAIL(info != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
@@ -113,21 +120,24 @@ int tbm_surface_get_info(tbm_surface_h surface, tbm_surface_info_s * info)
        return TBM_SURFACE_ERROR_NONE;
 }
 
-int tbm_surface_get_width(tbm_surface_h surface)
+int
+tbm_surface_get_width(tbm_surface_h surface)
 {
        TBM_RETURN_VAL_IF_FAIL(surface != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
 
        return tbm_surface_internal_get_width(surface);
 }
 
-int tbm_surface_get_height(tbm_surface_h surface)
+int
+tbm_surface_get_height(tbm_surface_h surface)
 {
        TBM_RETURN_VAL_IF_FAIL(surface != NULL, TBM_SURFACE_ERROR_INVALID_PARAMETER);
 
        return tbm_surface_internal_get_height(surface);
 }
 
-tbm_format tbm_surface_get_format(tbm_surface_h surface)
+tbm_format
+tbm_surface_get_format(tbm_surface_h surface)
 {
        if (!surface) {
 #ifdef HAVE_CAPI_0_1_1
index be5e900..c758be6 100644 (file)
@@ -485,7 +485,7 @@ extern "C" {
    free (formats);
    @endcode
  */
-int tbm_surface_query_formats(uint32_t ** formats, uint32_t * num);
+int tbm_surface_query_formats(uint32_t **formats, uint32_t *num);
 
 /**
  * @brief Creates the tbm_surface.
@@ -594,7 +594,7 @@ int tbm_surface_destroy(tbm_surface_h surface);
    tbm_surface_destroy (surface);
    @endcode
  */
-int tbm_surface_map(tbm_surface_h surface, int opt, tbm_surface_info_s * info);
+int tbm_surface_map(tbm_surface_h surface, int opt, tbm_surface_info_s *info);
 
 /**
  * @brief Unmaps the tbm_surface.
@@ -665,7 +665,7 @@ int tbm_surface_unmap(tbm_surface_h surface);
    tbm_surface_destroy (surface);
    @endcode
  */
-int tbm_surface_get_info(tbm_surface_h surface, tbm_surface_info_s * info);
+int tbm_surface_get_info(tbm_surface_h surface, tbm_surface_info_s *info);
 
 /**
  * @brief Gets the width of the tbm_surface.
index 6a394b7..adf7fc5 100644 (file)
@@ -35,10 +35,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "tbm_surface_internal.h"
 #include "list.h"
 
-static tbm_bufmgr g_surface_bufmgr = NULL;
+static tbm_bufmgr g_surface_bufmgr;
 static pthread_mutex_t tbm_surface_lock;
 
-char *_tbm_surface_internal_format_to_str(tbm_format format)
+char *
+_tbm_surface_internal_format_to_str(tbm_format format)
 {
        switch (format) {
        case TBM_FORMAT_C8:
@@ -164,7 +165,8 @@ char *_tbm_surface_internal_format_to_str(tbm_format format)
        }
 }
 
-static bool _tbm_surface_mutex_init(void)
+static bool
+_tbm_surface_mutex_init(void)
 {
        static bool tbm_surface_mutex_init = false;
 
@@ -181,7 +183,8 @@ static bool _tbm_surface_mutex_init(void)
        return true;
 }
 
-void _tbm_surface_mutex_lock(void)
+void
+_tbm_surface_mutex_lock(void)
 {
        if (!_tbm_surface_mutex_init())
                return;
@@ -189,17 +192,20 @@ void _tbm_surface_mutex_lock(void)
        pthread_mutex_lock(&tbm_surface_lock);
 }
 
-void _tbm_surface_mutex_unlock(void)
+void
+_tbm_surface_mutex_unlock(void)
 {
        pthread_mutex_unlock(&tbm_surface_lock);
 }
 
-static void _init_surface_bufmgr()
+static void
+_init_surface_bufmgr(void)
 {
        g_surface_bufmgr = tbm_bufmgr_init(-1);
 }
 
-static void _deinit_surface_bufmgr()
+static void
+_deinit_surface_bufmgr(void)
 {
        if (!g_surface_bufmgr)
                return;
@@ -208,7 +214,9 @@ static void _deinit_surface_bufmgr()
        g_surface_bufmgr = NULL;
 }
 
-static int _tbm_surface_internal_query_plane_data(tbm_surface_h surface, int plane_idx, uint32_t * size, uint32_t * offset, uint32_t * pitch, int *bo_idx)
+static int
+_tbm_surface_internal_query_plane_data(tbm_surface_h surface,
+                                      int plane_idx, uint32_t *size, uint32_t *offset, uint32_t *pitch, int *bo_idx)
 {
        TBM_RETURN_VAL_IF_FAIL(surface, 0);
        TBM_RETURN_VAL_IF_FAIL(plane_idx > -1, 0);
@@ -225,14 +233,16 @@ static int _tbm_surface_internal_query_plane_data(tbm_surface_h surface, int pla
        if (!mgr->backend->surface_get_plane_data)
                return 0;
 
-       ret = mgr->backend->surface_get_plane_data(surf, surf->info.width, surf->info.height, surf->info.format, plane_idx, size, offset, pitch, bo_idx);
+       ret = mgr->backend->surface_get_plane_data(surf, surf->info.width,
+                       surf->info.height, surf->info.format, plane_idx, size, offset, pitch, bo_idx);
        if (!ret)
                return 0;
 
        return 1;
 }
 
-static int _tbm_surface_internal_query_num_bos(tbm_format format)
+static int
+_tbm_surface_internal_query_num_bos(tbm_format format)
 {
        TBM_RETURN_VAL_IF_FAIL(format > 0, 0);
        struct _tbm_bufmgr *mgr;
@@ -250,7 +260,8 @@ static int _tbm_surface_internal_query_num_bos(tbm_format format)
        return ret;
 }
 
-static void _tbm_surface_internal_destroy(tbm_surface_h surface)
+static void
+_tbm_surface_internal_destroy(tbm_surface_h surface)
 {
        int i;
        tbm_bufmgr bufmgr = surface->bufmgr;
@@ -266,7 +277,7 @@ static void _tbm_surface_internal_destroy(tbm_surface_h surface)
        /* destory the user_data_list */
        if (!LIST_IS_EMPTY(&surface->user_data_list)) {
                LIST_FOR_EACH_ENTRY_SAFE(old_data, tmp, &surface->user_data_list, item_link) {
-                       TBM_LOG("[tbm_surface:%d] free user_data \n",
+                       TBM_LOG("[tbm_surface:%d] free user_data\n",
                                getpid());
                        user_data_delete(old_data);
                }
@@ -283,7 +294,9 @@ static void _tbm_surface_internal_destroy(tbm_surface_h surface)
        }
 }
 
-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)
 {
        struct _tbm_bufmgr *mgr;
        int ret = 0;
@@ -309,7 +322,8 @@ int tbm_surface_internal_query_supported_formats(uint32_t ** formats, uint32_t *
        return ret;
 }
 
-int tbm_surface_internal_get_num_planes(tbm_format format)
+int
+tbm_surface_internal_get_num_planes(tbm_format format)
 {
        int num_planes = 0;
 
@@ -386,7 +400,8 @@ int tbm_surface_internal_get_num_planes(tbm_format format)
        return num_planes;
 }
 
-int tbm_surface_internal_get_bpp(tbm_format format)
+int
+tbm_surface_internal_get_bpp(tbm_format format)
 {
        int bpp = 0;
 
@@ -476,7 +491,9 @@ int tbm_surface_internal_get_bpp(tbm_format format)
        return bpp;
 }
 
-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)
 {
        TBM_RETURN_VAL_IF_FAIL(width > 0, NULL);
        TBM_RETURN_VAL_IF_FAIL(height > 0, NULL);
@@ -519,7 +536,8 @@ tbm_surface_h tbm_surface_internal_create_with_flags(int width, int height, int
 
        /* get size, stride and offset bo_idx */
        for (i = 0; i < surf->info.num_planes; i++) {
-               _tbm_surface_internal_query_plane_data(surf, i, &size, &offset, &stride, &bo_idx);
+               _tbm_surface_internal_query_plane_data(surf, i, &size, &offset, &stride,
+                                                      &bo_idx);
                surf->info.planes[i].size = size;
                surf->info.planes[i].offset = offset;
                surf->info.planes[i].stride = stride;
@@ -568,7 +586,9 @@ tbm_surface_h tbm_surface_internal_create_with_flags(int width, int height, int
        return surf;
 }
 
-tbm_surface_h tbm_surface_internal_create_with_bos(tbm_surface_info_s * info, tbm_bo * bos, int num)
+tbm_surface_h
+tbm_surface_internal_create_with_bos(tbm_surface_info_s *info,
+                                    tbm_bo *bos, int num)
 {
        TBM_RETURN_VAL_IF_FAIL(bos, NULL);
        TBM_RETURN_VAL_IF_FAIL(info, NULL);
@@ -648,7 +668,7 @@ tbm_surface_h tbm_surface_internal_create_with_bos(tbm_surface_info_s * info, tb
        _tbm_surface_mutex_unlock();
 
        return surf;
- bail1:
+bail1:
        for (i = 0; i < num; i++) {
                if (surf->bos[i]) {
                        tbm_bo_unref(surf->bos[i]);
@@ -669,7 +689,8 @@ tbm_surface_h tbm_surface_internal_create_with_bos(tbm_surface_info_s * info, tb
        return NULL;
 }
 
-void tbm_surface_internal_destroy(tbm_surface_h surface)
+void
+tbm_surface_internal_destroy(tbm_surface_h surface)
 {
        if (!surface)
                return;
@@ -689,7 +710,8 @@ void tbm_surface_internal_destroy(tbm_surface_h surface)
        _tbm_surface_mutex_unlock();
 }
 
-void tbm_surface_internal_ref(tbm_surface_h surface)
+void
+tbm_surface_internal_ref(tbm_surface_h surface)
 {
        TBM_RETURN_IF_FAIL(surface);
 
@@ -700,7 +722,8 @@ void tbm_surface_internal_ref(tbm_surface_h surface)
        _tbm_surface_mutex_unlock();
 }
 
-void tbm_surface_internal_unref(tbm_surface_h surface)
+void
+tbm_surface_internal_unref(tbm_surface_h surface)
 {
        TBM_RETURN_IF_FAIL(surface);
 
@@ -719,7 +742,8 @@ void tbm_surface_internal_unref(tbm_surface_h surface)
        _tbm_surface_mutex_unlock();
 }
 
-int tbm_surface_internal_get_num_bos(tbm_surface_h surface)
+int
+tbm_surface_internal_get_num_bos(tbm_surface_h surface)
 {
        TBM_RETURN_VAL_IF_FAIL(surface, 0);
 
@@ -736,7 +760,8 @@ int tbm_surface_internal_get_num_bos(tbm_surface_h surface)
        return num;
 }
 
-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)
 {
        TBM_RETURN_VAL_IF_FAIL(surface, NULL);
        TBM_RETURN_VAL_IF_FAIL(bo_idx > -1, NULL);
@@ -754,7 +779,8 @@ tbm_bo tbm_surface_internal_get_bo(tbm_surface_h surface, int bo_idx)
        return bo;
 }
 
-int tbm_surface_internal_get_size(tbm_surface_h surface)
+int
+tbm_surface_internal_get_size(tbm_surface_h surface)
 {
        TBM_RETURN_VAL_IF_FAIL(surface, 0);
 
@@ -771,7 +797,9 @@ int tbm_surface_internal_get_size(tbm_surface_h surface)
        return size;
 }
 
-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)
 {
        TBM_RETURN_VAL_IF_FAIL(surface, 0);
        TBM_RETURN_VAL_IF_FAIL(plane_idx > -1, 0);
@@ -801,7 +829,9 @@ int tbm_surface_internal_get_plane_data(tbm_surface_h surface, int plane_idx, ui
        return 1;
 }
 
-int tbm_surface_internal_get_info(tbm_surface_h surface, int opt, tbm_surface_info_s * info, int map)
+int
+tbm_surface_internal_get_info(tbm_surface_h surface, int opt,
+                             tbm_surface_info_s *info, int map)
 {
        struct _tbm_surface *surf;
        tbm_bo_handle bo_handles[4];
@@ -813,7 +843,7 @@ int tbm_surface_internal_get_info(tbm_surface_h surface, int opt, tbm_surface_in
 
        surf = (struct _tbm_surface *)surface;
 
-       memset(info, 0x00, sizeof (tbm_surface_info_s));
+       memset(info, 0x00, sizeof(tbm_surface_info_s));
        info->width = surf->info.width;
        info->height = surf->info.height;
        info->format = surf->info.format;
@@ -833,9 +863,8 @@ int tbm_surface_internal_get_info(tbm_surface_h surface, int opt, tbm_surface_in
                        }
                }
        } else {
-               for (i = 0; i < surf->num_bos; i++) {
+               for (i = 0; i < surf->num_bos; i++)
                        bo_handles[i] = tbm_bo_get_handle(surf->bos[i], TBM_DEVICE_CPU);
-               }
        }
 
        for (i = 0; i < surf->info.num_planes; i++) {
@@ -844,7 +873,8 @@ int tbm_surface_internal_get_info(tbm_surface_h surface, int opt, tbm_surface_in
                info->planes[i].stride = surf->info.planes[i].stride;
 
                if (bo_handles[surf->planes_bo_idx[i]].ptr)
-                       info->planes[i].ptr = bo_handles[surf->planes_bo_idx[i]].ptr + surf->info.planes[i].offset;
+                       info->planes[i].ptr = bo_handles[surf->planes_bo_idx[i]].ptr +
+                                             surf->info.planes[i].offset;
        }
 
        _tbm_surface_mutex_unlock();
@@ -852,7 +882,8 @@ int tbm_surface_internal_get_info(tbm_surface_h surface, int opt, tbm_surface_in
        return 1;
 }
 
-void tbm_surface_internal_unmap(tbm_surface_h surface)
+void
+tbm_surface_internal_unmap(tbm_surface_h surface)
 {
        struct _tbm_surface *surf;
        int i;
@@ -867,7 +898,8 @@ void tbm_surface_internal_unmap(tbm_surface_h surface)
        _tbm_surface_mutex_unlock();
 }
 
-unsigned int tbm_surface_internal_get_width(tbm_surface_h surface)
+unsigned int
+tbm_surface_internal_get_width(tbm_surface_h surface)
 {
        struct _tbm_surface *surf;
        unsigned int width;
@@ -882,7 +914,8 @@ unsigned int tbm_surface_internal_get_width(tbm_surface_h surface)
        return width;
 }
 
-unsigned int tbm_surface_internal_get_height(tbm_surface_h surface)
+unsigned int
+tbm_surface_internal_get_height(tbm_surface_h surface)
 {
        struct _tbm_surface *surf;
        unsigned int height;
@@ -898,7 +931,8 @@ unsigned int tbm_surface_internal_get_height(tbm_surface_h surface)
 
 }
 
-tbm_format tbm_surface_internal_get_format(tbm_surface_h surface)
+tbm_format
+tbm_surface_internal_get_format(tbm_surface_h surface)
 {
        struct _tbm_surface *surf;
        tbm_format format;
@@ -913,7 +947,8 @@ tbm_format tbm_surface_internal_get_format(tbm_surface_h surface)
        return format;
 }
 
-int tbm_surface_internal_get_plane_bo_idx(tbm_surface_h surface, int plane_idx)
+int
+tbm_surface_internal_get_plane_bo_idx(tbm_surface_h surface, int plane_idx)
 {
        TBM_RETURN_VAL_IF_FAIL(surface, 0);
        TBM_RETURN_VAL_IF_FAIL(plane_idx > -1, 0);
@@ -930,21 +965,25 @@ int tbm_surface_internal_get_plane_bo_idx(tbm_surface_h surface, int plane_idx)
        return bo_idx;
 }
 
-unsigned int _tbm_surface_internal_get_debug_pid(tbm_surface_h surface)
+unsigned int
+_tbm_surface_internal_get_debug_pid(tbm_surface_h surface)
 {
        TBM_RETURN_VAL_IF_FAIL(surface, 0);
 
        return surface->debug_pid;
 }
 
-void tbm_surface_internal_set_debug_pid(tbm_surface_h surface, unsigned int pid)
+void
+tbm_surface_internal_set_debug_pid(tbm_surface_h surface, unsigned int pid)
 {
        TBM_RETURN_IF_FAIL(surface);
 
        surface->debug_pid = pid;
 }
 
-int tbm_surface_internal_add_user_data(tbm_surface_h surface, unsigned long key, tbm_data_free data_free_func)
+int
+tbm_surface_internal_add_user_data(tbm_surface_h surface, unsigned long key,
+                                  tbm_data_free data_free_func)
 {
        TBM_RETURN_VAL_IF_FAIL(surface, 0);
 
@@ -955,7 +994,7 @@ int tbm_surface_internal_add_user_data(tbm_surface_h surface, unsigned long key,
        if (data) {
                TBM_LOG("[libtbm:%d] "
                        "waring: %s:%d user data already exist. key:%ld\n",
-                       getpid(), __FUNCTION__, __LINE__, key);
+                       getpid(), __func__, __LINE__, key);
                return 0;
        }
 
@@ -968,7 +1007,9 @@ int tbm_surface_internal_add_user_data(tbm_surface_h surface, unsigned long key,
        return 1;
 }
 
-int tbm_surface_internal_set_user_data(tbm_surface_h surface, unsigned long key, void *data)
+int
+tbm_surface_internal_set_user_data(tbm_surface_h surface, unsigned long key,
+                                  void *data)
 {
        TBM_RETURN_VAL_IF_FAIL(surface, 0);
 
@@ -989,7 +1030,9 @@ int tbm_surface_internal_set_user_data(tbm_surface_h surface, unsigned long key,
        return 1;
 }
 
-int tbm_surface_internal_get_user_data(tbm_surface_h surface, unsigned long key, void **data)
+int
+tbm_surface_internal_get_user_data(tbm_surface_h surface, unsigned long key,
+                                  void **data)
 {
        TBM_RETURN_VAL_IF_FAIL(surface, 0);
 
@@ -1009,7 +1052,9 @@ int tbm_surface_internal_get_user_data(tbm_surface_h surface, unsigned long key,
        return 1;
 }
 
-int tbm_surface_internal_delete_user_data(tbm_surface_h surface, unsigned long key)
+int
+tbm_surface_internal_delete_user_data(tbm_surface_h surface,
+                                     unsigned long key)
 {
        TBM_RETURN_VAL_IF_FAIL(surface, 0);
 
index 8108faa..dc08067 100644 (file)
@@ -65,7 +65,8 @@ 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.
@@ -103,7 +104,8 @@ 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.
@@ -151,7 +153,8 @@ 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(tbm_surface_info_s * info, 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
@@ -271,7 +274,8 @@ 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.
@@ -342,7 +346,8 @@ int tbm_surface_internal_get_plane_bo_idx(tbm_surface_h surface, int plane_idx);
  * @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);
+void tbm_surface_internal_set_debug_pid(tbm_surface_h surface,
+                                       unsigned int pid);
 
 /**
  * @brief Adds a user_data to the tbm surface.
@@ -357,7 +362,8 @@ void tbm_surface_internal_set_debug_pid(tbm_surface_h surface, unsigned int pid)
  * @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);
+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.
@@ -367,7 +373,8 @@ int tbm_surface_internal_add_user_data(tbm_surface_h surface, unsigned long key,
  * @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);
+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.
@@ -377,7 +384,8 @@ int tbm_surface_internal_set_user_data(tbm_surface_h surface, unsigned long key,
  * @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);
+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.
@@ -386,7 +394,8 @@ int tbm_surface_internal_get_user_data(tbm_surface_h surface, unsigned long key,
  * @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);
+int tbm_surface_internal_delete_user_data(tbm_surface_h surface,
+                                         unsigned long key);
 
 #ifdef __cplusplus
 }
index f24cd01..f10fba6 100644 (file)
@@ -39,9 +39,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define DEBUG 0
 
 #if DEBUG
-#define TBM_TRACE() TBM_LOG("[TRACE] %s:%d surface:%p\n", __FUNCTION__, __LINE__, surface_queue)
-#define TBM_LOCK() TBM_LOG("[LOCK] %s:%d surface:%p\n", __FUNCTION__, __LINE__, surface_queue)
-#define TBM_UNLOCK() TBM_LOG("[UNLOCK] %s:%d surface:%p\n", __FUNCTION__, __LINE__, surface_queue)
+#define TBM_TRACE() TBM_LOG("[TRACE] %s:%d surface:%p\n", __func__, __LINE__, surface_queue)
+#define TBM_LOCK() TBM_LOG("[LOCK] %s:%d surface:%p\n", __func__, __LINE__, surface_queue)
+#define TBM_UNLOCK() TBM_LOG("[UNLOCK] %s:%d surface:%p\n", __func__, __LINE__, surface_queue)
 #else
 #define TBM_TRACE()
 #define TBM_LOCK()
@@ -77,11 +77,11 @@ typedef struct _tbm_surface_queue_interface {
        void (*destroy)(tbm_surface_queue_h queue);
        void (*need_attach)(tbm_surface_queue_h queue);
 
-       void (*enqueue)(tbm_surface_queue_h queue, queue_nodenode);
-       void (*release)(tbm_surface_queue_h queue, queue_nodenode);
-       queue_node(*dequeue)(tbm_surface_queue_h queue);
-       queue_node(*acquire)(tbm_surface_queue_h queue);
-}tbm_surface_queue_interface;
+       void (*enqueue)(tbm_surface_queue_h queue, queue_node *node);
+       void (*release)(tbm_surface_queue_h queue, queue_node *node);
+       queue_node *(*dequeue)(tbm_surface_queue_h queue);
+       queue_node *(*acquire)(tbm_surface_queue_h queue);
+} tbm_surface_queue_interface;
 
 struct _tbm_surface_queue {
        int width;
@@ -117,15 +117,18 @@ struct _tbm_surface_queue {
        void *impl_data;
 };
 
-static queue_node *_queue_node_create(void)
+static queue_node *
+_queue_node_create(void)
 {
        queue_node *node = (queue_node *) calloc(1, sizeof(queue_node));
+
        TBM_RETURN_VAL_IF_FAIL(node != NULL, NULL);
 
        return node;
 }
 
-static void _queue_node_delete(queue_node * node)
+static void
+_queue_node_delete(queue_node *node)
 {
        if (node->surface)
                tbm_surface_destroy(node->surface);
@@ -135,7 +138,8 @@ static void _queue_node_delete(queue_node * node)
        free(node);
 }
 
-static int _queue_is_empty(queue * queue)
+static int
+_queue_is_empty(queue *queue)
 {
        if (queue->head.next == &queue->tail)
                return 1;
@@ -143,21 +147,22 @@ static int _queue_is_empty(queue * queue)
        return 0;
 }
 
-static void _queue_node_push_back(queue * queue, queue_node * node)
+static void
+_queue_node_push_back(queue *queue, queue_node *node)
 {
        LIST_ADDTAIL(&node->item_link, &queue->tail);
        queue->count++;
-       return;
 }
 
-static void _queue_node_push_front(queue * queue, queue_node * node)
+static void
+_queue_node_push_front(queue *queue, queue_node *node)
 {
        LIST_ADD(&node->item_link, &queue->head);
        queue->count++;
-       return;
 }
 
-static queue_node *_queue_node_pop_front(queue * queue)
+static queue_node *
+_queue_node_pop_front(queue *queue)
 {
        queue_node *node = NULL;
 
@@ -169,7 +174,8 @@ static queue_node *_queue_node_pop_front(queue * queue)
        return node;
 }
 
-static queue_node *_queue_node_pop(queue * queue, queue_node* node)
+static queue_node *
+_queue_node_pop(queue *queue, queue_node *node)
 {
        LIST_DEL(&node->item_link);
        queue->count--;
@@ -177,7 +183,9 @@ static queue_node *_queue_node_pop(queue * queue, queue_node* node)
        return node;
 }
 
-static queue_node* _queue_get_node(tbm_surface_queue_h surface_queue, int type, tbm_surface_h surface, int *out_type)
+static queue_node *
+_queue_get_node(tbm_surface_queue_h surface_queue, int type,
+               tbm_surface_h surface, int *out_type)
 {
        queue_node *node = NULL;
        queue_node *tmp = NULL;
@@ -187,34 +195,36 @@ static queue_node* _queue_get_node(tbm_surface_queue_h surface_queue, int type,
        if (out_type)
                *out_type = 0;
 
-       if (type & FREE_QUEUE)
-       {
-               LIST_FOR_EACH_ENTRY_SAFE(node, tmp, &surface_queue->free_queue.head, item_link) {
-                       if (node->surface == surface)
-                       {
-                               if (out_type) *out_type = FREE_QUEUE;
+       if (type & FREE_QUEUE) {
+               LIST_FOR_EACH_ENTRY_SAFE(node, tmp, &surface_queue->free_queue.head,
+                                        item_link) {
+                       if (node->surface == surface) {
+                               if (out_type)
+                                       *out_type = FREE_QUEUE;
+
                                return node;
                        }
                }
        }
 
-       if (type & DIRTY_QUEUE)
-       {
-               LIST_FOR_EACH_ENTRY_SAFE(node, tmp, &surface_queue->dirty_queue.head, item_link) {
-                       if (node->surface == surface)
-                       {
-                               if (out_type) *out_type = DIRTY_QUEUE;
+       if (type & DIRTY_QUEUE) {
+               LIST_FOR_EACH_ENTRY_SAFE(node, tmp, &surface_queue->dirty_queue.head,
+                                        item_link) {
+                       if (node->surface == surface) {
+                               if (out_type)
+                                       *out_type = DIRTY_QUEUE;
+
                                return node;
                        }
                }
        }
 
-       if (type & NODE_LIST)
-       {
+       if (type & NODE_LIST) {
                LIST_FOR_EACH_ENTRY_SAFE(node, tmp, &surface_queue->list, link) {
-                       if (node->surface == surface)
-                       {
-                               if (out_type) *out_type = NODE_LIST;
+                       if (node->surface == surface) {
+                               if (out_type)
+                                       *out_type = NODE_LIST;
+
                                return node;
                        }
                }
@@ -223,7 +233,8 @@ static queue_node* _queue_get_node(tbm_surface_queue_h surface_queue, int type,
        return NULL;
 }
 
-static void _queue_init(queue * queue)
+static void
+_queue_init(queue *queue)
 {
        LIST_INITHEAD(&queue->head);
        LIST_INITHEAD(&queue->tail);
@@ -231,11 +242,14 @@ static void _queue_init(queue * queue)
        queue->count = 0;
 }
 
-static void _notify_add(struct list_head *list, tbm_surface_queue_notify_cb cb, void* data)
+static void
+_notify_add(struct list_head *list, tbm_surface_queue_notify_cb cb,
+           void *data)
 {
        TBM_RETURN_IF_FAIL(cb != NULL);
 
-       queue_notify *item = (queue_notify*)calloc(1, sizeof(queue_notify));
+       queue_notify *item = (queue_notify *)calloc(1, sizeof(queue_notify));
+
        TBM_RETURN_IF_FAIL(item != NULL);
 
        LIST_INITHEAD(&item->link);
@@ -245,7 +259,9 @@ static void _notify_add(struct list_head *list, tbm_surface_queue_notify_cb cb,
        LIST_ADDTAIL(&item->link, list);
 }
 
-static void _notify_remove(struct list_head *list, tbm_surface_queue_notify_cb cb, void* data)
+static void
+_notify_remove(struct list_head *list,
+              tbm_surface_queue_notify_cb cb, void *data)
 {
        queue_notify *item = NULL, *tmp = NULL;
 
@@ -260,7 +276,8 @@ static void _notify_remove(struct list_head *list, tbm_surface_queue_notify_cb c
        TBM_LOG("Cannot find notifiy\n");
 }
 
-static void _notify_remove_all(struct list_head *list)
+static void
+_notify_remove_all(struct list_head *list)
 {
        queue_notify *item = NULL, *tmp = NULL;
 
@@ -270,7 +287,9 @@ static void _notify_remove_all(struct list_head *list)
        }
 }
 
-static void _notify_emit(tbm_surface_queue_h surface_queue, struct list_head *list)
+static void
+_notify_emit(tbm_surface_queue_h surface_queue,
+            struct list_head *list)
 {
        queue_notify *item = NULL, *tmp = NULL;
 
@@ -279,7 +298,9 @@ static void _notify_emit(tbm_surface_queue_h surface_queue, struct list_head *li
        }
 }
 
-void _tbm_surface_queue_attach(tbm_surface_queue_h surface_queue, tbm_surface_h surface)
+void
+_tbm_surface_queue_attach(tbm_surface_queue_h surface_queue,
+                         tbm_surface_h surface)
 {
        queue_node *node = NULL;
 
@@ -293,7 +314,9 @@ void _tbm_surface_queue_attach(tbm_surface_queue_h surface_queue, tbm_surface_h
        _queue_node_push_back(&surface_queue->free_queue, node);
 }
 
-void _tbm_surface_queue_detach(tbm_surface_queue_h surface_queue, tbm_surface_h surface)
+void
+_tbm_surface_queue_detach(tbm_surface_queue_h surface_queue,
+                         tbm_surface_h surface)
 {
        queue_node *node = NULL;
        int queue_type;
@@ -303,7 +326,9 @@ void _tbm_surface_queue_detach(tbm_surface_queue_h surface_queue, tbm_surface_h
                _queue_node_delete(node);
 }
 
-void _tbm_surface_queue_enqueue(tbm_surface_queue_h surface_queue, queue_node* node, int push_back)
+void
+_tbm_surface_queue_enqueue(tbm_surface_queue_h surface_queue,
+                          queue_node *node, int push_back)
 {
        if (push_back)
                _queue_node_push_back(&surface_queue->dirty_queue, node);
@@ -311,7 +336,8 @@ void _tbm_surface_queue_enqueue(tbm_surface_queue_h surface_queue, queue_node* n
                _queue_node_push_front(&surface_queue->dirty_queue, node);
 }
 
-queue_node* _tbm_surface_queue_dequeue(tbm_surface_queue_h surface_queue)
+queue_node *
+_tbm_surface_queue_dequeue(tbm_surface_queue_h surface_queue)
 {
        queue_node *node = NULL;
 
@@ -319,9 +345,8 @@ queue_node* _tbm_surface_queue_dequeue(tbm_surface_queue_h surface_queue)
                if (surface_queue->impl && surface_queue->impl->need_attach)
                        surface_queue->impl->need_attach(surface_queue);
 
-               if (_queue_is_empty(&surface_queue->free_queue)) {
+               if (_queue_is_empty(&surface_queue->free_queue))
                        return NULL;
-               }
        }
 
        node = _queue_node_pop_front(&surface_queue->free_queue);
@@ -329,20 +354,22 @@ queue_node* _tbm_surface_queue_dequeue(tbm_surface_queue_h surface_queue)
        return node;
 }
 
-queue_node* _tbm_surface_queue_acquire(tbm_surface_queue_h surface_queue)
+queue_node *
+_tbm_surface_queue_acquire(tbm_surface_queue_h surface_queue)
 {
        queue_node *node = NULL;
 
-       if (_queue_is_empty(&surface_queue->dirty_queue)) {
+       if (_queue_is_empty(&surface_queue->dirty_queue))
                return NULL;
-       }
 
        node = _queue_node_pop_front(&surface_queue->dirty_queue);
 
        return node;
 }
 
-void _tbm_surface_queue_release(tbm_surface_queue_h surface_queue, queue_node* node, int push_back)
+void
+_tbm_surface_queue_release(tbm_surface_queue_h surface_queue,
+                          queue_node *node, int push_back)
 {
        if (push_back)
                _queue_node_push_back(&surface_queue->free_queue, node);
@@ -350,9 +377,10 @@ void _tbm_surface_queue_release(tbm_surface_queue_h surface_queue, queue_node* n
                _queue_node_push_front(&surface_queue->free_queue, node);
 }
 
-void _tbm_surface_queue_init(tbm_surface_queue_h surface_queue,
-                               int width, int height, int format,
-                               const tbm_surface_queue_interface* impl, void *data)
+void
+_tbm_surface_queue_init(tbm_surface_queue_h surface_queue,
+                       int width, int height, int format,
+                       const tbm_surface_queue_interface *impl, void *data)
 {
        TBM_RETURN_IF_FAIL(surface_queue != NULL);
        TBM_RETURN_IF_FAIL(impl != NULL);
@@ -382,9 +410,13 @@ void _tbm_surface_queue_init(tbm_surface_queue_h surface_queue,
                surface_queue->impl->init(surface_queue);
 }
 
-tbm_surface_queue_error_e tbm_surface_queue_set_destroy_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb destroy_cb, void *data)
+tbm_surface_queue_error_e
+tbm_surface_queue_set_destroy_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb destroy_cb,
+       void *data)
 {
-       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL, TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
+       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL,
+                              TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
 
        pthread_mutex_lock(&surface_queue->lock);
 
@@ -396,9 +428,13 @@ tbm_surface_queue_error_e tbm_surface_queue_set_destroy_cb(tbm_surface_queue_h s
        return TBM_SURFACE_QUEUE_ERROR_NONE;
 }
 
-tbm_surface_queue_error_e tbm_surface_queue_add_destroy_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb destroy_cb, void *data)
+tbm_surface_queue_error_e
+tbm_surface_queue_add_destroy_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb destroy_cb,
+       void *data)
 {
-       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL, TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
+       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL,
+                              TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
 
        pthread_mutex_lock(&surface_queue->lock);
 
@@ -409,9 +445,13 @@ tbm_surface_queue_error_e tbm_surface_queue_add_destroy_cb(tbm_surface_queue_h s
        return TBM_SURFACE_QUEUE_ERROR_NONE;
 }
 
-tbm_surface_queue_error_e tbm_surface_queue_remove_destroy_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb destroy_cb, void *data)
+tbm_surface_queue_error_e
+tbm_surface_queue_remove_destroy_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb destroy_cb,
+       void *data)
 {
-       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL, TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
+       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL,
+                              TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
 
        pthread_mutex_lock(&surface_queue->lock);
 
@@ -422,9 +462,13 @@ tbm_surface_queue_error_e tbm_surface_queue_remove_destroy_cb(tbm_surface_queue_
        return TBM_SURFACE_QUEUE_ERROR_NONE;
 }
 
-tbm_surface_queue_error_e tbm_surface_queue_set_dequeuable_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb dequeuable_cb, void *data)
+tbm_surface_queue_error_e
+tbm_surface_queue_set_dequeuable_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb dequeuable_cb,
+       void *data)
 {
-       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL, TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
+       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL,
+                              TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
 
        pthread_mutex_lock(&surface_queue->lock);
 
@@ -436,9 +480,13 @@ tbm_surface_queue_error_e tbm_surface_queue_set_dequeuable_cb(tbm_surface_queue_
        return TBM_SURFACE_QUEUE_ERROR_NONE;
 }
 
-tbm_surface_queue_error_e tbm_surface_queue_add_dequeuable_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb dequeuable_cb, void *data)
+tbm_surface_queue_error_e
+tbm_surface_queue_add_dequeuable_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb dequeuable_cb,
+       void *data)
 {
-       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL, TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
+       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL,
+                              TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
 
        pthread_mutex_lock(&surface_queue->lock);
 
@@ -449,9 +497,13 @@ tbm_surface_queue_error_e tbm_surface_queue_add_dequeuable_cb(tbm_surface_queue_
        return TBM_SURFACE_QUEUE_ERROR_NONE;
 }
 
-tbm_surface_queue_error_e tbm_surface_queue_remove_dequeuable_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb dequeuable_cb, void *data)
+tbm_surface_queue_error_e
+tbm_surface_queue_remove_dequeuable_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb dequeuable_cb,
+       void *data)
 {
-       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL, TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
+       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL,
+                              TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
 
        pthread_mutex_lock(&surface_queue->lock);
 
@@ -462,9 +514,13 @@ tbm_surface_queue_error_e tbm_surface_queue_remove_dequeuable_cb(tbm_surface_que
        return TBM_SURFACE_QUEUE_ERROR_NONE;
 }
 
-tbm_surface_queue_error_e tbm_surface_queue_set_acquirable_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb acquirable_cb, void *data)
+tbm_surface_queue_error_e
+tbm_surface_queue_set_acquirable_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb acquirable_cb,
+       void *data)
 {
-       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL, TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
+       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL,
+                              TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
 
        pthread_mutex_lock(&surface_queue->lock);
 
@@ -476,9 +532,13 @@ tbm_surface_queue_error_e tbm_surface_queue_set_acquirable_cb(tbm_surface_queue_
        return TBM_SURFACE_QUEUE_ERROR_NONE;
 }
 
-tbm_surface_queue_error_e tbm_surface_queue_add_acquirable_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb acquirable_cb, void *data)
+tbm_surface_queue_error_e
+tbm_surface_queue_add_acquirable_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb acquirable_cb,
+       void *data)
 {
-       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL, TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
+       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL,
+                              TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
 
        pthread_mutex_lock(&surface_queue->lock);
 
@@ -489,9 +549,13 @@ tbm_surface_queue_error_e tbm_surface_queue_add_acquirable_cb(tbm_surface_queue_
        return TBM_SURFACE_QUEUE_ERROR_NONE;
 }
 
-tbm_surface_queue_error_e tbm_surface_queue_remove_acquirable_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb acquirable_cb, void *data)
+tbm_surface_queue_error_e
+tbm_surface_queue_remove_acquirable_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb acquirable_cb,
+       void *data)
 {
-       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL, TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
+       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL,
+                              TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
 
        pthread_mutex_lock(&surface_queue->lock);
 
@@ -502,26 +566,33 @@ tbm_surface_queue_error_e tbm_surface_queue_remove_acquirable_cb(tbm_surface_que
        return TBM_SURFACE_QUEUE_ERROR_NONE;
 }
 
-int tbm_surface_queue_get_width(tbm_surface_queue_h surface_queue)
+int
+tbm_surface_queue_get_width(tbm_surface_queue_h surface_queue)
 {
        TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL, 0);
 
        return surface_queue->width;
 }
 
-int tbm_surface_queue_get_height(tbm_surface_queue_h surface_queue)
+int
+tbm_surface_queue_get_height(tbm_surface_queue_h surface_queue)
 {
        return surface_queue->height;
 }
 
-int tbm_surface_queue_get_format(tbm_surface_queue_h surface_queue)
+int
+tbm_surface_queue_get_format(tbm_surface_queue_h surface_queue)
 {
        return surface_queue->format;
 }
 
-tbm_surface_queue_error_e tbm_surface_queue_set_reset_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb reset_cb, void *data)
+tbm_surface_queue_error_e
+tbm_surface_queue_set_reset_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb reset_cb,
+       void *data)
 {
-       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL, TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
+       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL,
+                              TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
 
        pthread_mutex_lock(&surface_queue->lock);
 
@@ -533,9 +604,13 @@ tbm_surface_queue_error_e tbm_surface_queue_set_reset_cb(tbm_surface_queue_h sur
        return TBM_SURFACE_QUEUE_ERROR_NONE;
 }
 
-tbm_surface_queue_error_e tbm_surface_queue_add_reset_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb reset_cb, void *data)
+tbm_surface_queue_error_e
+tbm_surface_queue_add_reset_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb reset_cb,
+       void *data)
 {
-       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL, TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
+       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL,
+                              TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
 
        pthread_mutex_lock(&surface_queue->lock);
 
@@ -546,9 +621,13 @@ tbm_surface_queue_error_e tbm_surface_queue_add_reset_cb(tbm_surface_queue_h sur
        return TBM_SURFACE_QUEUE_ERROR_NONE;
 }
 
-tbm_surface_queue_error_e tbm_surface_queue_remove_reset_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb reset_cb, void *data)
+tbm_surface_queue_error_e
+tbm_surface_queue_remove_reset_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb reset_cb,
+       void *data)
 {
-       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL, TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
+       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL,
+                              TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
 
        pthread_mutex_lock(&surface_queue->lock);
 
@@ -559,20 +638,24 @@ tbm_surface_queue_error_e tbm_surface_queue_remove_reset_cb(tbm_surface_queue_h
        return TBM_SURFACE_QUEUE_ERROR_NONE;
 }
 
-tbm_surface_queue_error_e tbm_surface_queue_enqueue(tbm_surface_queue_h surface_queue, tbm_surface_h surface)
+tbm_surface_queue_error_e
+tbm_surface_queue_enqueue(tbm_surface_queue_h
+                         surface_queue, tbm_surface_h surface)
 {
        queue_node *node = NULL;
        int queue_type;
 
-       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL, TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
-       TBM_RETURN_VAL_IF_FAIL(surface != NULL, TBM_SURFACE_QUEUE_ERROR_INVALID_SURFACE);
+       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL,
+                              TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
+       TBM_RETURN_VAL_IF_FAIL(surface != NULL,
+                              TBM_SURFACE_QUEUE_ERROR_INVALID_SURFACE);
 
        pthread_mutex_lock(&surface_queue->lock);
 
        node = _queue_get_node(surface_queue, 0, surface, &queue_type);
-       if (node == NULL || queue_type != NODE_LIST)
-       {
-               TBM_LOG("tbm_surface_queue_enqueue::Surface exist in free_queue or dirty_queue node:%p, queue:%d\n", node, queue_type);
+       if (node == NULL || queue_type != NODE_LIST) {
+               TBM_LOG("tbm_surface_queue_enqueue::Surface exist in free_queue or dirty_queue node:%p, queue:%d\n",
+                       node, queue_type);
                pthread_mutex_unlock(&surface_queue->lock);
                return TBM_SURFACE_QUEUE_ERROR_INVALID_SURFACE;
        }
@@ -597,12 +680,16 @@ tbm_surface_queue_error_e tbm_surface_queue_enqueue(tbm_surface_queue_h surface_
        return TBM_SURFACE_QUEUE_ERROR_NONE;
 }
 
-tbm_surface_queue_error_e tbm_surface_queue_dequeue(tbm_surface_queue_h surface_queue, tbm_surface_h * surface)
+tbm_surface_queue_error_e
+tbm_surface_queue_dequeue(tbm_surface_queue_h
+                         surface_queue, tbm_surface_h *surface)
 {
        queue_node *node = NULL;
 
-       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL, TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
-       TBM_RETURN_VAL_IF_FAIL(surface != NULL, TBM_SURFACE_QUEUE_ERROR_INVALID_SURFACE);
+       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL,
+                              TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
+       TBM_RETURN_VAL_IF_FAIL(surface != NULL,
+                              TBM_SURFACE_QUEUE_ERROR_INVALID_SURFACE);
 
        pthread_mutex_lock(&surface_queue->lock);
 
@@ -631,7 +718,8 @@ tbm_surface_queue_error_e tbm_surface_queue_dequeue(tbm_surface_queue_h surface_
        return TBM_SURFACE_QUEUE_ERROR_NONE;
 }
 
-int tbm_surface_queue_can_dequeue(tbm_surface_queue_h surface_queue, int wait)
+int
+tbm_surface_queue_can_dequeue(tbm_surface_queue_h surface_queue, int wait)
 {
        TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL, 0);
 
@@ -658,20 +746,24 @@ int tbm_surface_queue_can_dequeue(tbm_surface_queue_h surface_queue, int wait)
        return 1;
 }
 
-tbm_surface_queue_error_e tbm_surface_queue_release(tbm_surface_queue_h surface_queue, tbm_surface_h surface)
+tbm_surface_queue_error_e
+tbm_surface_queue_release(tbm_surface_queue_h
+                         surface_queue, tbm_surface_h surface)
 {
        queue_node *node = NULL;
        int queue_type;
 
-       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL, TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
-       TBM_RETURN_VAL_IF_FAIL(surface != NULL, TBM_SURFACE_QUEUE_ERROR_INVALID_SURFACE);
+       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL,
+                              TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
+       TBM_RETURN_VAL_IF_FAIL(surface != NULL,
+                              TBM_SURFACE_QUEUE_ERROR_INVALID_SURFACE);
 
        pthread_mutex_lock(&surface_queue->lock);
 
        node = _queue_get_node(surface_queue, 0, surface, &queue_type);
-       if (node == NULL || queue_type != NODE_LIST)
-       {
-               TBM_LOG("tbm_surface_queue_release::Surface exist in free_queue or dirty_queue node:%p, queue:%d\n", node, queue_type);
+       if (node == NULL || queue_type != NODE_LIST) {
+               TBM_LOG("tbm_surface_queue_release::Surface exist in free_queue or dirty_queue node:%p, queue:%d\n",
+                       node, queue_type);
                pthread_mutex_unlock(&surface_queue->lock);
                return TBM_SURFACE_QUEUE_ERROR_INVALID_SURFACE;
        }
@@ -696,12 +788,16 @@ tbm_surface_queue_error_e tbm_surface_queue_release(tbm_surface_queue_h surface_
        return TBM_SURFACE_QUEUE_ERROR_NONE;
 }
 
-tbm_surface_queue_error_e tbm_surface_queue_acquire(tbm_surface_queue_h surface_queue, tbm_surface_h * surface)
+tbm_surface_queue_error_e
+tbm_surface_queue_acquire(tbm_surface_queue_h
+                         surface_queue, tbm_surface_h *surface)
 {
        queue_node *node = NULL;
 
-       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL, TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
-       TBM_RETURN_VAL_IF_FAIL(surface != NULL, TBM_SURFACE_QUEUE_ERROR_INVALID_SURFACE);
+       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL,
+                              TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
+       TBM_RETURN_VAL_IF_FAIL(surface != NULL,
+                              TBM_SURFACE_QUEUE_ERROR_INVALID_SURFACE);
 
        pthread_mutex_lock(&surface_queue->lock);
 
@@ -730,7 +826,8 @@ tbm_surface_queue_error_e tbm_surface_queue_acquire(tbm_surface_queue_h surface_
        return TBM_SURFACE_QUEUE_ERROR_NONE;
 }
 
-int tbm_surface_queue_can_acquire(tbm_surface_queue_h surface_queue, int wait)
+int
+tbm_surface_queue_can_acquire(tbm_surface_queue_h surface_queue, int wait)
 {
        TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL, 0);
 
@@ -752,7 +849,8 @@ int tbm_surface_queue_can_acquire(tbm_surface_queue_h surface_queue, int wait)
        return 1;
 }
 
-void tbm_surface_queue_destroy(tbm_surface_queue_h surface_queue)
+void
+tbm_surface_queue_destroy(tbm_surface_queue_h surface_queue)
 {
        queue_node *node = NULL, *tmp = NULL;
 
@@ -779,13 +877,17 @@ void tbm_surface_queue_destroy(tbm_surface_queue_h surface_queue)
        free(surface_queue);
 }
 
-tbm_surface_queue_error_e tbm_surface_queue_reset(tbm_surface_queue_h surface_queue, int width, int height, int format)
+tbm_surface_queue_error_e
+tbm_surface_queue_reset(tbm_surface_queue_h
+                       surface_queue, int width, int height, int format)
 {
-       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL, TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
+       TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL,
+                              TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE);
 
        queue_node *node = NULL, *tmp = NULL;
 
-       if (width == surface_queue->width && height == surface_queue->height && format == surface_queue->format)
+       if (width == surface_queue->width && height == surface_queue->height &&
+           format == surface_queue->format)
                return TBM_SURFACE_QUEUE_ERROR_NONE;
 
        pthread_mutex_lock(&surface_queue->lock);
@@ -795,8 +897,7 @@ tbm_surface_queue_error_e tbm_surface_queue_reset(tbm_surface_queue_h surface_qu
        surface_queue->format = format;
 
        /* Destory surface and Push to free_queue */
-       LIST_FOR_EACH_ENTRY_SAFE(node, tmp, &surface_queue->list, link)
-       {
+       LIST_FOR_EACH_ENTRY_SAFE(node, tmp, &surface_queue->list, link) {
                _queue_node_delete(node);
        }
 
@@ -818,73 +919,80 @@ tbm_surface_queue_error_e tbm_surface_queue_reset(tbm_surface_queue_h surface_qu
        return TBM_SURFACE_QUEUE_ERROR_NONE;
 }
 
-typedef struct
-{
+typedef struct {
        int queue_size;
        int num_attached;
        int flags;
-}tbm_queue_default;
+} tbm_queue_default;
 
-static void __tbm_queue_default_init(tbm_surface_queue_h surface_queue)
+static void
+__tbm_queue_default_init(tbm_surface_queue_h surface_queue)
 {
-       tbm_queue_default* data = surface_queue->impl_data;
+       tbm_queue_default *data = surface_queue->impl_data;
+
        data->num_attached = 0;
 }
 
-static void __tbm_queue_default_reset(tbm_surface_queue_h surface_queue)
+static void
+__tbm_queue_default_reset(tbm_surface_queue_h surface_queue)
 {
-       tbm_queue_default* data = surface_queue->impl_data;
+       tbm_queue_default *data = surface_queue->impl_data;
+
        data->num_attached = 0;
 }
 
-static void __tbm_queue_default_destroy(tbm_surface_queue_h surface_queue)
+static void
+__tbm_queue_default_destroy(tbm_surface_queue_h surface_queue)
 {
        free(surface_queue->impl_data);
 }
 
-static void __tbm_queue_default_need_attach(tbm_surface_queue_h surface_queue)
+static void
+__tbm_queue_default_need_attach(tbm_surface_queue_h surface_queue)
 {
-       tbm_queue_defaultdata = surface_queue->impl_data;
+       tbm_queue_default *data = surface_queue->impl_data;
        tbm_surface_h surface;
 
        if (data->queue_size == data->num_attached)
                return;
 
        surface = tbm_surface_internal_create_with_flags(surface_queue->width,
-                                               surface_queue->height,
-                                               surface_queue->format,
-                                               data->flags);
+                       surface_queue->height,
+                       surface_queue->format,
+                       data->flags);
        TBM_RETURN_IF_FAIL(surface != NULL);
        _tbm_surface_queue_attach(surface_queue, surface);
        tbm_surface_internal_unref(surface);
        data->num_attached++;
 }
 
-static const tbm_surface_queue_interface tbm_queue_default_impl =
-{
+static const tbm_surface_queue_interface tbm_queue_default_impl = {
        __tbm_queue_default_init,
        __tbm_queue_default_reset,
        __tbm_queue_default_destroy,
        __tbm_queue_default_need_attach,
-       NULL,                           /*__tbm_queue_default_enqueue*/
-       NULL,                           /*__tbm_queue_default_release*/
-       NULL,                           /*__tbm_queue_default_dequeue*/
+       NULL,                           /*__tbm_queue_default_enqueue*/
+       NULL,                           /*__tbm_queue_default_release*/
+       NULL,                           /*__tbm_queue_default_dequeue*/
        NULL,                           /*__tbm_queue_default_acquire*/
 };
 
-tbm_surface_queue_h tbm_surface_queue_create(int queue_size, int width, int height, int format, int flags)
+tbm_surface_queue_h
+tbm_surface_queue_create(int queue_size, int width,
+                        int height, int format, int flags)
 {
        TBM_RETURN_VAL_IF_FAIL(queue_size > 0, NULL);
        TBM_RETURN_VAL_IF_FAIL(width > 0, NULL);
        TBM_RETURN_VAL_IF_FAIL(height > 0, NULL);
        TBM_RETURN_VAL_IF_FAIL(format > 0, NULL);
 
-       tbm_surface_queue_h surface_queue = (tbm_surface_queue_h) calloc(1, sizeof(struct _tbm_surface_queue));
+       tbm_surface_queue_h surface_queue = (tbm_surface_queue_h) calloc(1,
+                                           sizeof(struct _tbm_surface_queue));
        TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL, NULL);
 
-       tbm_queue_default *data = (tbm_queue_default *) calloc(1, sizeof(tbm_queue_default));
-       if (data == NULL)
-       {
+       tbm_queue_default *data = (tbm_queue_default *) calloc(1,
+                                 sizeof(tbm_queue_default));
+       if (data == NULL) {
                free(surface_queue);
                return NULL;
        }
@@ -892,82 +1000,89 @@ tbm_surface_queue_h tbm_surface_queue_create(int queue_size, int width, int heig
        data->queue_size = queue_size;
        data->flags = flags;
        _tbm_surface_queue_init(surface_queue,
-               width, height, format,
-               &tbm_queue_default_impl, data);
+                               width, height, format,
+                               &tbm_queue_default_impl, data);
 
        return surface_queue;
 }
 
-typedef struct
-{
+typedef struct {
        int queue_size;
        int num_attached;
        int flags;
        queue dequeue_list;
-}tbm_queue_sequence;
+} tbm_queue_sequence;
 
-static void __tbm_queue_sequence_init(tbm_surface_queue_h surface_queue)
+static void
+__tbm_queue_sequence_init(tbm_surface_queue_h surface_queue)
 {
-       tbm_queue_sequencedata = surface_queue->impl_data;
+       tbm_queue_sequence *data = surface_queue->impl_data;
 
        data->num_attached = 0;
        _queue_init(&data->dequeue_list);
 }
 
-static void __tbm_queue_sequence_reset(tbm_surface_queue_h surface_queue)
+static void
+__tbm_queue_sequence_reset(tbm_surface_queue_h surface_queue)
 {
-       tbm_queue_sequencedata = surface_queue->impl_data;
+       tbm_queue_sequence *data = surface_queue->impl_data;
 
        data->num_attached = 0;
        _queue_init(&data->dequeue_list);
 }
 
-static void __tbm_queue_sequence_destroy(tbm_surface_queue_h surface_queue)
+static void
+__tbm_queue_sequence_destroy(tbm_surface_queue_h surface_queue)
 {
        free(surface_queue->impl_data);
 }
 
-static void __tbm_queue_sequence_need_attach(tbm_surface_queue_h surface_queue)
+static void
+__tbm_queue_sequence_need_attach(tbm_surface_queue_h surface_queue)
 {
-       tbm_queue_sequencedata = surface_queue->impl_data;
+       tbm_queue_sequence *data = surface_queue->impl_data;
        tbm_surface_h surface;
 
        if (data->queue_size == data->num_attached)
                return;
 
        surface = tbm_surface_internal_create_with_flags(surface_queue->width,
-                                               surface_queue->height,
-                                               surface_queue->format,
-                                               data->flags);
+                       surface_queue->height,
+                       surface_queue->format,
+                       data->flags);
        TBM_RETURN_IF_FAIL(surface != NULL);
        _tbm_surface_queue_attach(surface_queue, surface);
        tbm_surface_internal_unref(surface);
        data->num_attached++;
 }
 
-static void __tbm_queue_sequence_enqueue(tbm_surface_queue_h surface_queue, queue_node* node)
+static void
+__tbm_queue_sequence_enqueue(tbm_surface_queue_h surface_queue,
+                            queue_node *node)
 {
-       tbm_queue_sequencedata = surface_queue->impl_data;
+       tbm_queue_sequence *data = surface_queue->impl_data;
        queue_node *next = NULL;
        queue_node *tmp = NULL;
 
        node->priv_flags = 0;
 
        LIST_FOR_EACH_ENTRY_SAFE(next, tmp, &data->dequeue_list.head, item_link) {
-               if (next->priv_flags) break;
-        _queue_node_pop(&data->dequeue_list, next);
+               if (next->priv_flags)
+                       break;
+               _queue_node_pop(&data->dequeue_list, next);
                _tbm_surface_queue_enqueue(surface_queue, next, 1);
        }
 }
 
-static queue_node* __tbm_queue_sequence_dequeue(tbm_surface_queue_h surface_queue)
+static queue_node *
+__tbm_queue_sequence_dequeue(tbm_surface_queue_h
+                            surface_queue)
 {
-       tbm_queue_sequencedata = surface_queue->impl_data;
-       queue_nodenode = NULL;
+       tbm_queue_sequence *data = surface_queue->impl_data;
+       queue_node *node = NULL;
 
        node = _tbm_surface_queue_dequeue(surface_queue);
-       if (node)
-       {
+       if (node) {
                _queue_node_push_back(&data->dequeue_list, node);
                node->priv_flags = 1;
        }
@@ -975,31 +1090,33 @@ static queue_node* __tbm_queue_sequence_dequeue(tbm_surface_queue_h surface_queu
        return node;
 }
 
-static const tbm_surface_queue_interface tbm_queue_sequence_impl =
-{
+static const tbm_surface_queue_interface tbm_queue_sequence_impl = {
        __tbm_queue_sequence_init,
        __tbm_queue_sequence_reset,
        __tbm_queue_sequence_destroy,
        __tbm_queue_sequence_need_attach,
        __tbm_queue_sequence_enqueue,
-       NULL,                           /*__tbm_queue_sequence_release*/
+       NULL,                                   /*__tbm_queue_sequence_release*/
        __tbm_queue_sequence_dequeue,
-       NULL,                           /*__tbm_queue_sequence_acquire*/
+       NULL,                                   /*__tbm_queue_sequence_acquire*/
 };
 
-tbm_surface_queue_h tbm_surface_queue_sequence_create(int queue_size, int width, int height, int format, int flags)
+tbm_surface_queue_h
+tbm_surface_queue_sequence_create(int queue_size, int width,
+                                 int height, int format, int flags)
 {
        TBM_RETURN_VAL_IF_FAIL(queue_size > 0, NULL);
        TBM_RETURN_VAL_IF_FAIL(width > 0, NULL);
        TBM_RETURN_VAL_IF_FAIL(height > 0, NULL);
        TBM_RETURN_VAL_IF_FAIL(format > 0, NULL);
 
-       tbm_surface_queue_h surface_queue = (tbm_surface_queue_h) calloc(1, sizeof(struct _tbm_surface_queue));
+       tbm_surface_queue_h surface_queue = (tbm_surface_queue_h) calloc(1,
+                                           sizeof(struct _tbm_surface_queue));
        TBM_RETURN_VAL_IF_FAIL(surface_queue != NULL, NULL);
 
-       tbm_queue_sequence *data = (tbm_queue_sequence *) calloc(1, sizeof(tbm_queue_sequence));
-       if (data == NULL)
-       {
+       tbm_queue_sequence *data = (tbm_queue_sequence *) calloc(1,
+                                  sizeof(tbm_queue_sequence));
+       if (data == NULL) {
                free(surface_queue);
                return NULL;
        }
@@ -1007,8 +1124,8 @@ tbm_surface_queue_h tbm_surface_queue_sequence_create(int queue_size, int width,
        data->queue_size = queue_size;
        data->flags = flags;
        _tbm_surface_queue_init(surface_queue,
-               width, height, format,
-               &tbm_queue_sequence_impl, data);
+                               width, height, format,
+                               &tbm_queue_sequence_impl, data);
 
        return surface_queue;
 }
index f1ce98c..bfbec83 100644 (file)
@@ -45,19 +45,24 @@ typedef enum {
 
 typedef struct _tbm_surface_queue *tbm_surface_queue_h;
 
-typedef void (*tbm_surface_queue_notify_cb) (tbm_surface_queue_h surface_queue, void *data);
+typedef void (*tbm_surface_queue_notify_cb) (tbm_surface_queue_h surface_queue,
+               void *data);
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-tbm_surface_queue_error_e tbm_surface_queue_enqueue(tbm_surface_queue_h surface_queue, tbm_surface_h surface);
+tbm_surface_queue_error_e tbm_surface_queue_enqueue(
+               tbm_surface_queue_h surface_queue, tbm_surface_h surface);
 
-tbm_surface_queue_error_e tbm_surface_queue_dequeue(tbm_surface_queue_h surface_queue, tbm_surface_h * surface);
+tbm_surface_queue_error_e tbm_surface_queue_dequeue(
+               tbm_surface_queue_h surface_queue, tbm_surface_h *surface);
 
-tbm_surface_queue_error_e tbm_surface_queue_release(tbm_surface_queue_h surface_queue, tbm_surface_h surface);
+tbm_surface_queue_error_e tbm_surface_queue_release(
+               tbm_surface_queue_h surface_queue, tbm_surface_h surface);
 
-tbm_surface_queue_error_e tbm_surface_queue_acquire(tbm_surface_queue_h surface_queue, tbm_surface_h * surface);
+tbm_surface_queue_error_e tbm_surface_queue_acquire(
+               tbm_surface_queue_h surface_queue, tbm_surface_h *surface);
 
 int tbm_surface_queue_can_dequeue(tbm_surface_queue_h surface_queue, int wait);
 
@@ -71,37 +76,64 @@ int tbm_surface_queue_get_height(tbm_surface_queue_h surface_queue);
 
 int tbm_surface_queue_get_format(tbm_surface_queue_h surface_queue);
 
-tbm_surface_queue_error_e tbm_surface_queue_reset(tbm_surface_queue_h surface_queue, int width, int height, int format);
+tbm_surface_queue_error_e tbm_surface_queue_reset(
+               tbm_surface_queue_h surface_queue, int width, int height, int format);
 
-tbm_surface_queue_error_e tbm_surface_queue_add_reset_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb reset_cb, void *data);
+tbm_surface_queue_error_e tbm_surface_queue_add_reset_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb reset_cb,
+       void *data);
 
-tbm_surface_queue_error_e tbm_surface_queue_remove_reset_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb reset_cb, void *data);
+tbm_surface_queue_error_e tbm_surface_queue_remove_reset_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb reset_cb,
+       void *data);
 
-tbm_surface_queue_error_e tbm_surface_queue_add_destroy_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb destroy_cb, void *data);
+tbm_surface_queue_error_e tbm_surface_queue_add_destroy_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb destroy_cb,
+       void *data);
 
-tbm_surface_queue_error_e tbm_surface_queue_remove_destroy_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb destroy_cb, void *data);
+tbm_surface_queue_error_e tbm_surface_queue_remove_destroy_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb destroy_cb,
+       void *data);
 
-tbm_surface_queue_error_e tbm_surface_queue_add_dequeuable_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb dequeuable_cb, void *data);
+tbm_surface_queue_error_e tbm_surface_queue_add_dequeuable_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb dequeuable_cb,
+       void *data);
 
-tbm_surface_queue_error_e tbm_surface_queue_remove_dequeuable_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb dequeuable_cb, void *data);
+tbm_surface_queue_error_e tbm_surface_queue_remove_dequeuable_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb dequeuable_cb,
+       void *data);
 
-tbm_surface_queue_error_e tbm_surface_queue_add_acquirable_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb acquirable_cb, void *data);
+tbm_surface_queue_error_e tbm_surface_queue_add_acquirable_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb acquirable_cb,
+       void *data);
 
-tbm_surface_queue_error_e tbm_surface_queue_remove_acquirable_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb acquirable_cb, void *data);
+tbm_surface_queue_error_e tbm_surface_queue_remove_acquirable_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb acquirable_cb,
+       void *data);
 
 /*The functions of queue factory*/
-tbm_surface_queue_h tbm_surface_queue_create(int queue_size, int width, int height, int format, int flags);
-tbm_surface_queue_h tbm_surface_queue_sequence_create(int queue_size, int width, int height, int format, int flags);
+tbm_surface_queue_h tbm_surface_queue_create(int queue_size, int width,
+               int height, int format, int flags);
+tbm_surface_queue_h tbm_surface_queue_sequence_create(int queue_size, int width,
+               int height, int format, int flags);
 
 
 /*DEPRECATED apis*/
-tbm_surface_queue_error_e tbm_surface_queue_set_destroy_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb destroy_cb, void *data);
+tbm_surface_queue_error_e tbm_surface_queue_set_destroy_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb destroy_cb,
+       void *data);
 
-tbm_surface_queue_error_e tbm_surface_queue_set_dequeuable_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb dequeuable_cb, void *data);
+tbm_surface_queue_error_e tbm_surface_queue_set_dequeuable_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb dequeuable_cb,
+       void *data);
 
-tbm_surface_queue_error_e tbm_surface_queue_set_acquirable_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb acquirable_cb, void *data);
+tbm_surface_queue_error_e tbm_surface_queue_set_acquirable_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb acquirable_cb,
+       void *data);
 
-tbm_surface_queue_error_e tbm_surface_queue_set_reset_cb(tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb reset_cb, void *data);
+tbm_surface_queue_error_e tbm_surface_queue_set_reset_cb(
+       tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb reset_cb,
+       void *data);
 #ifdef __cplusplus
 }
 #endif