Use the buffer handler directly
authorSung-jae Park <nicesj.park@samsung.com>
Mon, 3 Nov 2014 05:45:00 +0000 (14:45 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Mon, 3 Nov 2014 05:45:00 +0000 (14:45 +0900)
[model] Redwood,Kiran,B3(Wearable)
[binary_type] AP
[customer] Docomo/Orange/ATT/Open
[issue#] N/A
[problem]
[cause]
[solution]
[team] HomeTF
[request]
[horizontal_expansion]

Change-Id: I68bd7b35feddde71ff5767f5b9d404cecf3d4b09

CMakeLists.txt
include/debug.h
src/dynamicbox.c
src/virtual_window.c

index 127c155..46ef806 100644 (file)
@@ -58,6 +58,7 @@ ADD_DEFINITIONS("-DNDEBUG")
 ADD_DEFINITIONS("-D_USE_ECORE_TIME_GET")
 ADD_DEFINITIONS("-DMASTER_PKGNAME=\"data-provider-master\"")
 ADD_DEFINITIONS("-DSLAVE_PKGNAME=\"com.samsung.data-provider-slave\"")
+#ADD_DEFINITIONS("-D_ENABLE_PERF")
 
 SET (BUILD_SOURCE
        ${BUILD_SOURCE}
index abda5f1..1d6ad5e 100644 (file)
 #define ErrPrint(format, arg...)    SECURE_LOGE(format, ##arg)
 #define WarnPrint(format, arg...)   SECURE_LOGW(format, ##arg)
 
+#if defined(_ENABLE_PERF)
+#define PERF_INIT() \
+       struct timeval __stv; \
+       struct timeval __etv; \
+       struct timeval __rtv
+
+#define PERF_BEGIN() do { \
+       if (gettimeofday(&__stv, NULL) < 0) { \
+               ErrPrint("gettimeofday: %s\n", strerror(errno)); \
+       } \
+} while (0)
+
+#define PERF_MARK(tag) do { \
+       if (gettimeofday(&__etv, NULL) < 0) { \
+               ErrPrint("gettimeofday: %s\n", strerror(errno)); \
+       } \
+       timersub(&__etv, &__stv, &__rtv); \
+       DbgPrint("[%s] %u.%06u\n", tag, __rtv.tv_sec, __rtv.tv_usec); \
+} while (0)
+#else
+#define PERF_INIT()
+#define PERF_BEGIN()
+#define PERF_MARK(tag)
+#endif
+
 /* End of a file */
index 8a58b9e..9f3040c 100644 (file)
@@ -93,11 +93,11 @@ static struct info {
 
     union _updated {
        struct _slave {
-           int (*send)(const char *pkgname, const char *id, int idx, int x, int y, int w, int h, int gbar, const char *descfile);
+           int (*send)(const char *pkgname, const char *id, dynamicbox_buffer_h handle, int idx, int x, int y, int w, int h, int gbar, const char *descfile);
        } slave;
 
        struct _app {
-           int (*send)(const char *id, int idx, int x, int y, int w, int h, int gbar);
+           int (*send)(dynamicbox_buffer_h handle, int idx, int x, int y, int w, int h, int gbar);
        } app;
     } updated;
 } s_info = {
@@ -109,8 +109,8 @@ static struct info {
 };
 
 #define FUNC_PREFIX                               "dynamicbox_"
-#define FUNC_DYNAMICBOX_SEND_UPDATED              FUNC_PREFIX "send_updated"
-#define FUNC_DYNAMICBOX_PROVIDER_APP_UPDATED      FUNC_PREFIX "provider_app_updated"
+#define FUNC_DYNAMICBOX_SEND_UPDATED              FUNC_PREFIX "send_buffer_updated"
+#define FUNC_DYNAMICBOX_PROVIDER_APP_UPDATED      FUNC_PREFIX "provider_app_buffer_updated"
 #define FUNC_DYNAMICBOX_FIND_PKGNAME              FUNC_PREFIX "find_pkgname"
 #define FUNC_DYNAMICBOX_REQUEST_UPDATE_BY_ID      FUNC_PREFIX "request_update_by_id"
 #define FUNC_DYNAMICBOX_TRIGGER_UPDATE_MONITOR    FUNC_PREFIX "trigger_update_monitor"
@@ -132,7 +132,7 @@ static inline void load_update_function(void)
     }
 }
 
-static int send_updated(const char *pkgname, const char *id, int idx, int x, int y, int w, int h, int gbar, const char *descfile)
+static int send_updated(const char *pkgname, const char *id, dynamicbox_buffer_h handle, int idx, int x, int y, int w, int h, int gbar, const char *descfile)
 {
     int ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
 
@@ -141,9 +141,12 @@ static int send_updated(const char *pkgname, const char *id, int idx, int x, int
     }
 
     if (s_info.type == LOAD_TYPE_APP) {
-       ret = s_info.updated.app.send(id, idx, x, y, w, h, gbar);
+       ret = s_info.updated.app.send(handle, idx, x, y, w, h, gbar);
     } else if (s_info.type == LOAD_TYPE_SLAVE) {
-       ret = s_info.updated.slave.send(pkgname, id, idx, x, y, w, h, gbar, descfile);
+       /**
+        * pkgname, id are used for finding handle of direct connection.
+        */
+       ret = s_info.updated.slave.send(pkgname, id, handle, idx, x, y, w, h, gbar, descfile);
     } else {
        dynamicbox_damage_region_t region = {
            .x = x,
@@ -151,7 +154,7 @@ static int send_updated(const char *pkgname, const char *id, int idx, int x, int
            .w = w,
            .h = h,
        };
-       ret = dynamicbox_provider_send_updated(pkgname, id, idx, &region, gbar, descfile);
+       ret = dynamicbox_provider_send_buffer_updated(handle, idx, &region, gbar, descfile);
     }
 
     return ret;
@@ -870,11 +873,11 @@ PUBLIC int dynamicbox_sync_buffer(dynamicbox_buffer_h handle)
      */
 
     if (user_data->is_gbar == 1) {
-       if (send_updated(pkgname, id, DBOX_PRIMARY_BUFFER, 0, 0, w, h, user_data->is_gbar, NULL) < 0) {
+       if (send_updated(pkgname, id, handle, DBOX_PRIMARY_BUFFER, 0, 0, w, h, user_data->is_gbar, NULL) < 0) {
            ErrPrint("Failed to send GBAR updated (%s)\n", id);
        }
     } else {
-       if (send_updated(pkgname, id, DBOX_PRIMARY_BUFFER, 0, 0, w, h, user_data->is_gbar, NULL) < 0) {
+       if (send_updated(pkgname, id, handle, DBOX_PRIMARY_BUFFER, 0, 0, w, h, user_data->is_gbar, NULL) < 0) {
            ErrPrint("Failed to send updated (%s)\n", id);
        }
     }
@@ -914,7 +917,7 @@ PUBLIC int dynamicbox_send_updated_by_idx(dynamicbox_buffer_h handle, int idx)
        ErrPrint("Failed to get size (%s)\n", id);
     }
 
-    ret = send_updated(pkgname, id, idx, 0, 0, w, h, user_data->is_gbar, NULL);
+    ret = send_updated(pkgname, id, handle, idx, 0, 0, w, h, user_data->is_gbar, NULL);
     if (ret < 0) {
        ErrPrint("Failed to send GBAR updated (%s) %d\n", id, idx);
     }
@@ -1023,35 +1026,43 @@ PUBLIC int dynamicbox_buffer_post_render(dynamicbox_buffer_h handle)
     int w;
     int h;
     int pixel_size;
+    PERF_INIT();
+    PERF_BEGIN();
 
     if (!handle) {
+       PERF_MARK("post_render");
        return DBOX_STATUS_ERROR_INVALID_PARAMETER;
     }
 
     user_data = dynamicbox_provider_buffer_user_data(handle);
     if (!user_data) {
+       PERF_MARK("post_render");
        return DBOX_STATUS_ERROR_INVALID_PARAMETER;
     }
 
     if (!user_data->accelerated) {
+       PERF_MARK("post_render");
        return DBOX_STATUS_ERROR_NONE;
     }
 
     pkgname = dynamicbox_provider_buffer_pkgname(handle);
     if (!pkgname) {
        ErrPrint("Invalid buffer handle\n");
+       PERF_MARK("post_render");
        return DBOX_STATUS_ERROR_INVALID_PARAMETER;
     }
 
     id = dynamicbox_provider_buffer_id(handle);
     if (!id) {
        ErrPrint("Invalid buffer handler\n");
+       PERF_MARK("post_render");
        return DBOX_STATUS_ERROR_INVALID_PARAMETER;
     }
 
     ret = dynamicbox_provider_buffer_post_render(handle);
     if (ret < 0) {
        ErrPrint("Failed to post render processing\n");
+       PERF_MARK("post_render");
        return ret;
     }
 
@@ -1065,10 +1076,11 @@ PUBLIC int dynamicbox_buffer_post_render(dynamicbox_buffer_h handle)
      * to make more efficient updates
      */
 
-    if (send_updated(pkgname, id, DBOX_PRIMARY_BUFFER, 0, 0, w, h, user_data->is_gbar, NULL) < 0) {
+    if (send_updated(pkgname, id, handle, DBOX_PRIMARY_BUFFER, 0, 0, w, h, user_data->is_gbar, NULL) < 0) {
        ErrPrint("Failed to send GBAR updated (%s)\n", id);
     }
 
+    PERF_MARK("post_render");
     return DBOX_STATUS_ERROR_NONE;
 }
 
index 68bc1e1..622fbbe 100644 (file)
@@ -618,7 +618,7 @@ static Ecore_X_Pixmap alloc_pixmap_cb(void *data, Ecore_X_Window parent, int w,
      * Acquire a buffer for canvas.
      */
     info->type = VWIN_PIXMAP;
-    info->resource_cnt += !!pixmap;
+    info->resource_cnt += !!(unsigned int)pixmap;
     return pixmap;
 }