virtual: define functions and structure for supporting virtual output
[platform/core/uifw/libtdm.git] / src / tdm_private_types.h
index d71664a..993be0e 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
@@ -99,19 +99,24 @@ typedef enum {
 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_voutput tdm_private_voutput;
 typedef struct _tdm_private_layer tdm_private_layer;
+typedef struct _tdm_private_hwc tdm_private_hwc;
 typedef struct _tdm_private_hwc_window tdm_private_hwc_window;
 typedef struct _tdm_private_pp tdm_private_pp;
 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_output_create_handler tdm_private_output_create_handler;
+typedef struct _tdm_private_output_destroy_handler tdm_private_output_destroy_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_output_mode_change_handler tdm_private_output_mode_change_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_hwc_commit_handler tdm_private_hwc_commit_handler;
+typedef struct _tdm_private_voutput_commit_handler tdm_private_voutput_commit_handler;
 
 typedef struct _tdm_private_layer_buffer tdm_private_layer_buffer;
 
@@ -129,7 +134,9 @@ struct _tdm_private_module {
        tdm_display_capability capabilities;
        tdm_func_display func_display;
        tdm_func_output func_output;
+       tdm_func_voutput func_voutput;
        tdm_func_layer func_layer;
+       tdm_func_hwc func_hwc;
        tdm_func_hwc_window func_hwc_window;
        tdm_func_pp func_pp;
        tdm_func_capture func_capture;
@@ -141,6 +148,7 @@ struct _tdm_private_module {
 
        /* output, pp list */
        struct list_head output_list;
+       struct list_head voutput_list;
        struct list_head pp_list;
        struct list_head capture_list;
 
@@ -162,6 +170,8 @@ struct _tdm_private_display {
 #endif
 
        struct list_head module_list;
+       tdm_private_module *dummy_module;
+       tdm_private_module *virtual_module;
        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
@@ -169,6 +179,8 @@ struct _tdm_private_display {
        /* for event handling */
        tdm_private_loop *private_loop;
 
+       struct list_head output_create_handler_list;
+
        int print_fps;
 };
 
@@ -176,6 +188,7 @@ struct _tdm_private_output {
        struct list_head link;
 
        tdm_private_module *private_module;
+       tdm_private_voutput *private_voutput;
 
        int index;
        double stamp;
@@ -196,7 +209,6 @@ struct _tdm_private_output {
        int regist_dpms_cb;
 
        struct list_head layer_list;
-       struct list_head hwc_window_list;
        struct list_head capture_list;
        struct list_head vblank_handler_list;
        struct list_head output_commit_handler_list;
@@ -210,17 +222,11 @@ struct _tdm_private_output {
        tdm_event_loop_source *vblank_timeout_timer;
        unsigned int vblank_timeout_timer_expired;
 
+       struct list_head destroy_handler_list;
        struct list_head change_handler_list;
 
        void **layers_ptr;
 
-       struct {
-               /* look at the tdm_output_set_need_revalidate_handler() declaration for the details */
-               tdm_output_need_validate_handler hndl;
-               int event_fd;
-               tdm_event_loop_source *event_source;
-       } need_validate;
-
        tdm_info_layer target_buffer_info; /* layer_info for the target_buffer */
 
        /* calling a output commit per a vblank */
@@ -232,6 +238,35 @@ struct _tdm_private_output {
 
        /* hwc */
        int need_set_target_info;
+       tdm_private_hwc *private_hwc;
+
+       /* virtual */
+       char name[TDM_NAME_LEN];
+       struct list_head mode_change_request_handler_list;
+};
+
+struct _tdm_private_voutput {
+       struct list_head link;
+
+       tdm_private_module *private_module;
+
+       int regist_commit_cb;
+
+       struct list_head voutput_commit_handler_list;
+
+       int index;
+
+       tdm_private_display *private_display;
+       tdm_private_output *private_output;
+
+       tdm_voutput *voutput_backend;
+
+       char name[TDM_NAME_LEN];
+       tdm_output_mode *modes;
+       int mode_count;
+       unsigned int mmwidth;
+       unsigned int mmheight;
+       int connect_status;
 };
 
 struct _tdm_private_layer {
@@ -269,16 +304,35 @@ struct _tdm_private_layer {
 
        double fps_stamp;
        unsigned int fps_count;
+
+        /* virtual */
+       tbm_surface_h commiting_buffer;
 };
 
-struct _tdm_private_hwc_window {
+struct _tdm_private_hwc {
        struct list_head link;
 
+       tdm_private_module *private_module;
+
        int index;
+       double stamp;
 
-       tdm_private_display *private_display;
        tdm_private_output *private_output;
 
+       struct list_head hwc_window_list;
+       struct list_head hwc_commit_handler_list;
+
+       int regist_commit_cb;
+
+       tdm_hwc *hwc_backend;
+};
+
+struct _tdm_private_hwc_window {
+       struct list_head link;
+
+       tdm_private_module *private_module;
+
+       tdm_private_hwc *private_hwc;
        tdm_hwc_window *hwc_window_backend;
 };
 
@@ -356,6 +410,8 @@ struct _tdm_private_loop {
         * private_thread is NULL.
         */
        tdm_private_thread *private_thread;
+
+       struct list_head source_list;
 };
 
 struct _tdm_private_output_vblank_handler {
@@ -372,6 +428,26 @@ struct _tdm_private_output_vblank_handler {
        pid_t owner_tid;
 };
 
+struct _tdm_private_output_create_handler {
+       struct list_head link;
+
+       tdm_private_display *private_display;
+       tdm_output_create_handler func;
+       void *user_data;
+
+       pid_t owner_tid;
+};
+
+struct _tdm_private_output_destroy_handler {
+       struct list_head link;
+
+       tdm_private_output *private_output;
+       tdm_output_destroy_handler func;
+       void *user_data;
+
+       pid_t owner_tid;
+};
+
 struct _tdm_private_output_change_handler {
        struct list_head link;
 
@@ -392,18 +468,34 @@ struct _tdm_private_output_commit_handler {
        pid_t owner_tid;
 };
 
-struct _tdm_private_hwc_window_commit_handler {
-       tdm_private_hwc_window *private_hwc_window;
-       tdm_hwc_window_commit_handler func;
+struct _tdm_private_voutput_commit_handler {
+       struct list_head link;
+
+       tdm_private_voutput *private_voutput;
+       tdm_voutput_commit_func func;
        void *user_data;
+
+       pid_t owner_tid;
 };
 
-struct _tdm_private_output_hwc_target_buffer_window_commit_handler {
+struct _tdm_private_output_mode_change_handler {
+       struct list_head link;
+
        tdm_private_output *private_output;
-       tdm_output_hwc_target_buffer_commit_handler func;
+       tdm_output_mode_change_request_handler func;
        void *user_data;
 };
 
+struct _tdm_private_hwc_commit_handler {
+       struct list_head link;
+
+       tdm_private_hwc *private_hwc;
+       tdm_hwc_commit_handler func;
+       void *user_data;
+
+       pid_t owner_tid;
+};
+
 struct _tdm_private_layer_commit_handler {
        struct list_head link;
 
@@ -448,6 +540,8 @@ 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_DISPLAY_OUTPUT_CREATE,
+       TDM_THREAD_CB_OUTPUT_DESTROY,
        TDM_THREAD_CB_OUTPUT_COMMIT,
        TDM_THREAD_CB_OUTPUT_VBLANK,
        TDM_THREAD_CB_OUTPUT_STATUS,
@@ -456,11 +550,14 @@ typedef enum {
        TDM_THREAD_CB_CAPTURE_DONE,
        TDM_THREAD_CB_VBLANK_SW,
        TDM_THREAD_CB_VBLANK_CREATE,
-       TDM_THREAD_CB_NEED_VALIDATE,
+       TDM_THREAD_CB_HWC_COMMIT,
+       TDM_THREAD_CB_VOUTPUT_COMMIT,
        TDM_THREAD_CB_MAX,
 } tdm_thread_cb_type;
 
 typedef struct _tdm_thread_cb_base tdm_thread_cb_base;
+typedef struct _tdm_thread_cb_display_output_create tdm_thread_cb_display_output_create;
+typedef struct _tdm_thread_cb_output_destroy tdm_thread_cb_output_destroy;
 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_dpms tdm_thread_cb_output_dpms;
@@ -469,7 +566,8 @@ 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;
 typedef struct _tdm_thread_cb_vblank_create tdm_thread_cb_vblank_create;
-typedef struct _tdm_thread_cb_need_validate tdm_thread_cb_need_validate;
+typedef struct _tdm_thread_cb_output_vblank tdm_thread_cb_hwc_commit;
+typedef struct _tdm_thread_cb_output_vblank tdm_thread_cb_voutput_commit;
 
 struct _tdm_thread_cb_base {
        tdm_thread_cb_type type;
@@ -479,6 +577,15 @@ struct _tdm_thread_cb_base {
        unsigned int sync;
 };
 
+struct _tdm_thread_cb_display_output_create {
+       tdm_thread_cb_base base;
+       tdm_output *output;
+};
+
+struct _tdm_thread_cb_output_destroy {
+       tdm_thread_cb_base base;
+};
+
 struct _tdm_thread_cb_output_vblank {
        tdm_thread_cb_base base;
        unsigned int sequence;
@@ -516,10 +623,6 @@ struct _tdm_thread_cb_vblank_create {
        double vblank_stamp;
 };
 
-struct _tdm_thread_cb_need_validate {
-       tdm_thread_cb_base base;
-};
-
 struct argument_details {
        char type;
        int nullable;