change sscanf to strtol for getting fd
[platform/core/uifw/libtdm.git] / src / tdm_private.h
index cd7405d..2a92f24 100644 (file)
@@ -54,6 +54,7 @@
 #include <sys/types.h>
 #include <math.h>
 
+#include <wayland-server-protocol.h>
 #include <tbm_bufmgr.h>
 #include <tbm_surface_queue.h>
 
@@ -130,6 +131,7 @@ typedef struct _tdm_private_vblank_handler tdm_private_vblank_handler;
 typedef struct _tdm_private_output_commit_handler tdm_private_output_commit_handler;
 typedef struct _tdm_private_layer_commit_handler tdm_private_layer_commit_handler;
 typedef struct _tdm_private_change_handler tdm_private_change_handler;
+typedef struct _tdm_private_layer_buffer tdm_private_layer_buffer;
 
 struct _tdm_private_display {
        pthread_mutex_t lock;
@@ -229,9 +231,13 @@ struct _tdm_private_layer {
        tdm_caps_layer caps;
        tdm_layer *layer_backend;
 
-       tbm_surface_h pending_buffer;
-       tbm_surface_h waiting_buffer;
-       tbm_surface_h showing_buffer;
+       /* When a buffer is set to a layer, it will be stored to waiting_buffer.
+        * And when a layer is committed, it will be moved to committed_buffer.
+        * Finally when a commit handler is called, it will be moved to showing_buffer.
+        */
+       tdm_private_layer_buffer *waiting_buffer;
+       tdm_private_layer_buffer *committed_buffer;   /* for output_commit */
+       tdm_private_layer_buffer *showing_buffer;
        tbm_surface_queue_h buffer_queue;
 
        struct list_head capture_list;
@@ -346,6 +352,8 @@ struct _tdm_private_layer_commit_handler {
        tdm_private_layer *private_layer;
        tdm_layer_commit_handler func;
        void *user_data;
+
+       tdm_private_layer_buffer *committed_buffer;   /* for layer_commit */
 };
 
 struct _tdm_private_change_handler {
@@ -358,6 +366,11 @@ struct _tdm_private_change_handler {
        pid_t owner_tid;
 };
 
+struct _tdm_private_layer_buffer {
+       tbm_surface_h buffer;
+       struct list_head link;
+};
+
 typedef struct _tdm_buffer_info {
        tbm_surface_h buffer;
 
@@ -409,6 +422,20 @@ tdm_output_cb_dpms(tdm_output *output_backend, tdm_output_dpms dpms,
 tdm_error
 tdm_output_wait_vblank_add_front(tdm_output *output, int interval, int sync,
                                                                 tdm_output_vblank_handler func, void *user_data);
+tdm_error
+tdm_output_commit_internal(tdm_output *output, int sync, tdm_output_commit_handler func, void *user_data);
+tdm_error
+tdm_output_get_dpms_internal(tdm_output *output, tdm_output_dpms *dpms_value);
+
+void
+tdm_output_remove_vblank_handler_internal(tdm_output *output, tdm_output_vblank_handler func, void *user_data);
+void
+tdm_output_remove_commit_handler_internal(tdm_output *output, tdm_output_commit_handler func, void *user_data);
+void
+tdm_layer_remove_commit_handler_internal(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
+
+void
+tdm_layer_committed(tdm_private_layer *private_layer, tdm_private_layer_buffer **committed_buffer);
 
 void
 tdm_pp_cb_done(tdm_pp *pp_backend, tbm_surface_h src, tbm_surface_h dst,
@@ -420,6 +447,12 @@ tdm_error
 tdm_vblank_cb_vblank_SW(tdm_vblank *vblank, double vblank_stamp);
 tdm_error
 tdm_vblank_set_add_front(tdm_vblank *vblank, unsigned int add_front);
+tdm_error
+tdm_vblank_set_resource(tdm_vblank *vblank, struct wl_resource *resource);
+tdm_error
+tdm_vblank_set_client_vblank_fps(unsigned int pid, const char *name, unsigned int fps);
+void
+tdm_vblank_get_vblank_list_information(tdm_display *dpy, char *reply, int *len);
 
 void
 tdm_output_call_change_handler_internal(tdm_private_output *private_output,
@@ -566,6 +599,8 @@ extern pthread_mutex_t tdm_mutex_check_lock;
 extern int tdm_mutex_locked;
 extern const char *tdm_mutex_lock_func;
 extern int tdm_mutex_lock_line;
+extern const char *tdm_mutex_unlock_func;
+extern int tdm_mutex_unlock_line;
 extern int tdm_dump_enable;
 extern char *tdm_debug_dump_dir;
 
@@ -577,6 +612,8 @@ extern char *tdm_debug_dump_dir;
                tdm_mutex_locked = 0; \
                tdm_mutex_lock_func = NULL; \
                tdm_mutex_lock_line = 0; \
+               tdm_mutex_unlock_func = __FUNCTION__; \
+               tdm_mutex_unlock_line = __LINE__; \
                pthread_mutex_unlock(&tdm_mutex_check_lock); \
                pthread_mutex_unlock(l); \
        } while (0)
@@ -598,6 +635,8 @@ extern char *tdm_debug_dump_dir;
                        tdm_mutex_locked = 1; \
                        tdm_mutex_lock_func = __FUNCTION__; \
                        tdm_mutex_lock_line = __LINE__; \
+                       tdm_mutex_unlock_func = NULL; \
+                       tdm_mutex_unlock_line = 0; \
                        pthread_mutex_unlock(&tdm_mutex_check_lock); \
                } \
        } while (0)
@@ -611,6 +650,8 @@ extern char *tdm_debug_dump_dir;
                tdm_mutex_locked = 1; \
                tdm_mutex_lock_func = __FUNCTION__; \
                tdm_mutex_lock_line = __LINE__; \
+               tdm_mutex_unlock_func = NULL; \
+               tdm_mutex_unlock_line = 0; \
                pthread_mutex_unlock(&tdm_mutex_check_lock); \
        } while (0)
 #endif //TDM_CONFIG_MUTEX_TIMEOUT