Move user data code to tbm_bufmgr 93/58893/1
authorChangyeon Lee <cyeon.lee@samsung.com>
Thu, 4 Feb 2016 12:52:03 +0000 (21:52 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Thu, 4 Feb 2016 13:33:09 +0000 (22:33 +0900)
Change-Id: If64862dc9c25151a78ee44db5294d03fbeae9ef1
Signed-off-by: Changyeon Lee <cyeon.lee@samsung.com>
src/tbm_bufmgr.c
src/tbm_bufmgr_int.h
src/tbm_surface_internal.c
src/tbm_user_data.c [deleted file]
src/tbm_user_data.h [deleted file]

index 1d5f1ef..7916afe 100644 (file)
@@ -36,7 +36,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "tbm_bufmgr_backend.h"
 #include "tbm_bufmgr_tgl.h"
 #include "list.h"
-#include "tbm_user_data.h"
 
 #define DEBUG
 #ifdef DEBUG
@@ -245,6 +244,49 @@ static inline unsigned int _tgl_get_data(int fd, unsigned int key, unsigned int
 
        return arg.data1;
 }
+
+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;
+
+       if (!LIST_IS_EMPTY(user_data_list)) {
+               LIST_FOR_EACH_ENTRY_SAFE(old_data, tmp, user_data_list, item_link) {
+                       if (old_data->key == key) {
+                               user_data = old_data;
+                               return user_data;
+                       }
+               }
+       }
+
+       return user_data;
+}
+
+tbm_user_data *user_data_create(unsigned long key, tbm_data_free data_free_func)
+{
+       tbm_user_data *user_data = NULL;
+
+       user_data = calloc(1, sizeof(tbm_user_data));
+       if (!user_data)
+               return NULL;
+
+       user_data->key = key;
+       user_data->free_func = data_free_func;
+       user_data->data = (void *)0;
+
+       return 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);
+
+       LIST_DEL(&user_data->item_link);
+
+       free(user_data);
+}
+
 static int _bo_lock(tbm_bo bo, int device, int opt)
 {
        tbm_bufmgr bufmgr = bo->bufmgr;
index c78207b..8c7ad56 100644 (file)
@@ -201,6 +201,15 @@ struct _tbm_surface {
        struct list_head user_data_list;        /* list of the user_date in surface */
 };
 
+typedef struct {
+       unsigned long key;
+       void *data;
+       tbm_data_free free_func;
+
+       /* link of user_data */
+       struct list_head item_link;
+} tbm_user_data;
+
 int tbm_bufmgr_get_drm_fd_x11(void);
 int tbm_bufmgr_get_drm_fd_wayland(void);
 
@@ -215,4 +224,8 @@ 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);
 
+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 30e235f..a444dce 100644 (file)
@@ -34,7 +34,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "tbm_bufmgr_int.h"
 #include "tbm_surface_internal.h"
 #include "list.h"
-#include "tbm_user_data.h"
 
 static tbm_bufmgr g_surface_bufmgr = NULL;
 static pthread_mutex_t tbm_surface_lock;
diff --git a/src/tbm_user_data.c b/src/tbm_user_data.c
deleted file mode 100644 (file)
index 0ae9ba9..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/**************************************************************************
-
-libtbm
-
-Copyright 2014 Samsung Electronics co., Ltd. All Rights Reserved.
-
-Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
-Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-#include "config.h"
-#include "tbm_user_data.h"
-
-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;
-
-       if (!LIST_IS_EMPTY(user_data_list)) {
-               LIST_FOR_EACH_ENTRY_SAFE(old_data, tmp, user_data_list, item_link) {
-                       if (old_data->key == key) {
-                               user_data = old_data;
-                               return user_data;
-                       }
-               }
-       }
-
-       return user_data;
-}
-
-tbm_user_data *user_data_create(unsigned long key, tbm_data_free data_free_func)
-{
-       tbm_user_data *user_data = NULL;
-
-       user_data = calloc(1, sizeof(tbm_user_data));
-       if (!user_data)
-               return NULL;
-
-       user_data->key = key;
-       user_data->free_func = data_free_func;
-       user_data->data = (void *)0;
-
-       return 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);
-
-       LIST_DEL(&user_data->item_link);
-
-       free(user_data);
-}
-
diff --git a/src/tbm_user_data.h b/src/tbm_user_data.h
deleted file mode 100644 (file)
index 9d6986e..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/**************************************************************************
-
-libtbm
-
-Copyright 2012 Samsung Electronics co., Ltd. All Rights Reserved.
-
-Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
-Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-#ifndef _TBM_USER_DATA_H_
-#define _TBM_USER_DATA_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-typedef struct {
-       unsigned long key;
-       void *data;
-       tbm_data_free free_func;
-
-       /* link of user_data */
-       struct list_head item_link;
-} tbm_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);
-
-#ifdef __cplusplus
-}
-#endif
-#endif                                                 /* _TBM_USER_DATA_H_ */
-