package version up to 1.16.13
[platform/core/uifw/libtdm.git] / src / tdm_private_types.h
index 6c7d2d5..980ebfe 100644 (file)
@@ -9,7 +9,7 @@
  *          Taeheon Kim <th908.kim@samsung.com>,
  *          YoungJun Cho <yj44.cho@samsung.com>,
  *          SooChan Lim <sc1.lim@samsung.com>,
- *          Boram Park <sc1.lim@samsung.com>
+ *          Boram Park <boram1288.park@samsung.com>
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
@@ -96,6 +96,7 @@ typedef enum {
        TDM_COMMIT_TYPE_LAYER,
 } tdm_commit_type;
 
+typedef struct _tdm_private_module tdm_private_module;
 typedef struct _tdm_private_display tdm_private_display;
 typedef struct _tdm_private_output tdm_private_output;
 typedef struct _tdm_private_layer tdm_private_layer;
@@ -105,28 +106,25 @@ typedef struct _tdm_private_capture tdm_private_capture;
 typedef struct _tdm_private_loop tdm_private_loop;
 typedef struct _tdm_private_server tdm_private_server;
 typedef struct _tdm_private_thread tdm_private_thread;
-typedef struct _tdm_private_vblank_handler tdm_private_vblank_handler;
 typedef struct _tdm_private_output_change_handler tdm_private_output_change_handler;
 typedef struct _tdm_private_output_commit_handler tdm_private_output_commit_handler;
+typedef struct _tdm_private_output_vblank_handler tdm_private_output_vblank_handler;
 typedef struct _tdm_private_layer_commit_handler tdm_private_layer_commit_handler;
 typedef struct _tdm_private_hwc_window_commit_handler tdm_private_hwc_window_commit_handler;
 typedef struct _tdm_private_output_hwc_target_buffer_window_commit_handler tdm_private_output_hwc_target_buffer_commit_handler;
 
 typedef struct _tdm_private_layer_buffer tdm_private_layer_buffer;
 
-struct _tdm_private_display {
-       pthread_mutex_t lock;
-       unsigned int init_count;
+struct _tdm_private_module {
+       struct list_head link;
+
+       tdm_private_display *private_display;
 
        /* backend module info */
        void *module;
        tdm_backend_module *module_data;
        tdm_backend_data *bdata;
 
-#ifdef INIT_BUFMGR
-       tbm_bufmgr bufmgr;
-#endif
-
        /* backend function */
        tdm_display_capability capabilities;
        tdm_func_display func_display;
@@ -146,20 +144,39 @@ struct _tdm_private_display {
        struct list_head pp_list;
        struct list_head capture_list;
 
-       void **outputs_ptr;
+       /* backend output objects. allocated in backend. freed in frontend. ordered */
+       tdm_output **outputs;
+
+       int fd;
+       tdm_event_loop_source *event_source;
+};
+
+struct _tdm_private_display {
+       pthread_mutex_t lock;
+       unsigned int init_count;
+
+       double stamp;
+
+#ifdef INIT_BUFMGR
+       tbm_bufmgr bufmgr;
+#endif
+
+       struct list_head module_list;
+       tdm_private_module *current_module;  //setted only when loading
+       tdm_private_module *pp_module;       //pp-support backend
+       tdm_private_module *capture_module;  //TODO: remove later
 
        /* for event handling */
        tdm_private_loop *private_loop;
 
-       /* output order */
-       tdm_output **outputs;
-
        int print_fps;
 };
 
 struct _tdm_private_output {
        struct list_head link;
 
+       tdm_private_module *private_module;
+
        int index;
        double stamp;
 
@@ -191,16 +208,12 @@ struct _tdm_private_output {
        int layer_waiting_vblank;
 
        tdm_event_loop_source *vblank_timeout_timer;
+       unsigned int vblank_timeout_timer_expired;
 
-       /* seperate list for multi-thread*/
-       struct list_head change_handler_list_main;
-       struct list_head change_handler_list_sub;
+       struct list_head change_handler_list;
 
        void **layers_ptr;
 
-       /* TODO: temp solution for handling DPMS things in sub-htread */
-       tdm_event_loop_source *dpms_changed_timer;
-
        struct {
                /* look at the tdm_output_set_need_revalidate_handler() declaration for the details */
                tdm_output_need_validate_handler hndl;
@@ -224,6 +237,8 @@ struct _tdm_private_output {
 struct _tdm_private_layer {
        struct list_head link;
 
+       tdm_private_module *private_module;
+
        int index;
 
        tdm_private_display *private_display;
@@ -270,11 +285,13 @@ struct _tdm_private_hwc_window {
 struct _tdm_private_pp {
        struct list_head link;
 
+       tdm_private_module *private_module;
+
        double stamp;
 
        tdm_private_display *private_display;
 
-       tdm_pp *pp_backend;
+       tdm_pp *pp_module;
 
        struct list_head pending_buffer_list;
        struct list_head buffer_list;
@@ -290,6 +307,8 @@ struct _tdm_private_capture {
        struct list_head link;
        struct list_head display_link;
 
+       tdm_private_module *private_module;
+
        double stamp;
 
        tdm_capture_target target;
@@ -298,7 +317,7 @@ struct _tdm_private_capture {
        tdm_private_output *private_output;
        tdm_private_layer *private_layer;
 
-       tdm_capture *capture_backend;
+       tdm_capture *capture_module;
 
        struct list_head pending_buffer_list;
        struct list_head buffer_list;
@@ -323,9 +342,6 @@ struct _tdm_private_loop {
        struct wl_display *wl_display;
        struct wl_event_loop *wl_loop;
 
-       int backend_fd;
-       tdm_event_loop_source *backend_source;
-
        /* In event loop, all resources are accessed by this dpy.
         * CAUTION:
         * - DO NOT include other private structure in this structure because this
@@ -340,9 +356,11 @@ struct _tdm_private_loop {
         * private_thread is NULL.
         */
        tdm_private_thread *private_thread;
+
+       struct list_head source_list;
 };
 
-struct _tdm_private_vblank_handler {
+struct _tdm_private_output_vblank_handler {
        struct list_head link;
 
        tdm_private_output *private_output;
@@ -431,6 +449,7 @@ typedef struct _tdm_capture_private_buffer {
 
 typedef enum {
        TDM_THREAD_CB_NONE,
+       TDM_THREAD_CB_EXIT,             /* special type to exit the tdm-thread */
        TDM_THREAD_CB_OUTPUT_COMMIT,
        TDM_THREAD_CB_OUTPUT_VBLANK,
        TDM_THREAD_CB_OUTPUT_STATUS,
@@ -440,13 +459,14 @@ typedef enum {
        TDM_THREAD_CB_VBLANK_SW,
        TDM_THREAD_CB_VBLANK_CREATE,
        TDM_THREAD_CB_NEED_VALIDATE,
+       TDM_THREAD_CB_MAX,
 } tdm_thread_cb_type;
 
 typedef struct _tdm_thread_cb_base tdm_thread_cb_base;
 typedef struct _tdm_thread_cb_output_vblank tdm_thread_cb_output_commit;
 typedef struct _tdm_thread_cb_output_vblank tdm_thread_cb_output_vblank;
-typedef struct _tdm_thread_cb_output_status tdm_thread_cb_output_status;
 typedef struct _tdm_thread_cb_output_dpms tdm_thread_cb_output_dpms;
+typedef struct _tdm_thread_cb_output_status tdm_thread_cb_output_status;
 typedef struct _tdm_thread_cb_pp_done tdm_thread_cb_pp_done;
 typedef struct _tdm_thread_cb_capture_done tdm_thread_cb_capture_done;
 typedef struct _tdm_thread_cb_vblank_sw tdm_thread_cb_vblank_sw;
@@ -456,49 +476,41 @@ typedef struct _tdm_thread_cb_need_validate tdm_thread_cb_need_validate;
 struct _tdm_thread_cb_base {
        tdm_thread_cb_type type;
        unsigned int length;
+       double object_stamp;
+       void *data;
+       unsigned int sync;
 };
 
 struct _tdm_thread_cb_output_vblank {
        tdm_thread_cb_base base;
-       double output_stamp;
        unsigned int sequence;
        unsigned int tv_sec;
        unsigned int tv_usec;
-       void *user_data;
 };
 
 struct _tdm_thread_cb_output_status {
        tdm_thread_cb_base base;
-       double output_stamp;
        tdm_output_conn_status status;
-       void *user_data;
 };
 
 struct _tdm_thread_cb_output_dpms {
        tdm_thread_cb_base base;
-       double output_stamp;
        tdm_output_dpms dpms;
-       void *user_data;
 };
 
 struct _tdm_thread_cb_pp_done {
        tdm_thread_cb_base base;
-       double pp_stamp;
        tbm_surface_h src;
        tbm_surface_h dst;
-       void *user_data;
 };
 
 struct _tdm_thread_cb_capture_done {
        tdm_thread_cb_base base;
-       double capture_stamp;
        tbm_surface_h buffer;
-       void *user_data;
 };
 
 struct _tdm_thread_cb_vblank_sw {
        tdm_thread_cb_base base;
-       double vblank_stamp;
 };
 
 struct _tdm_thread_cb_vblank_create {
@@ -508,7 +520,6 @@ struct _tdm_thread_cb_vblank_create {
 
 struct _tdm_thread_cb_need_validate {
        tdm_thread_cb_base base;
-       tdm_private_output *o;
 };
 
 struct argument_details {