1 /**************************************************************************
5 * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
7 * Contact: Eunchul Kim <chulspro.kim@samsung.com>,
8 * JinYoung Jeon <jy0.jeon@samsung.com>,
9 * Taeheon Kim <th908.kim@samsung.com>,
10 * YoungJun Cho <yj44.cho@samsung.com>,
11 * SooChan Lim <sc1.lim@samsung.com>,
12 * Boram Park <sc1.lim@samsung.com>
14 * Permission is hereby granted, free of charge, to any person obtaining a
15 * copy of this software and associated documentation files (the
16 * "Software"), to deal in the Software without restriction, including
17 * without limitation the rights to use, copy, modify, merge, publish,
18 * distribute, sub license, and/or sell copies of the Software, and to
19 * permit persons to whom the Software is furnished to do so, subject to
20 * the following conditions:
22 * The above copyright notice and this permission notice (including the
23 * next paragraph) shall be included in all copies or substantial portions
26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
27 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
29 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
30 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
31 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
32 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 **************************************************************************/
36 #ifndef _TDM_PRIVATE_H_
37 #define _TDM_PRIVATE_H_
47 #include <sys/types.h>
53 #include <sys/syscall.h>
54 #include <sys/eventfd.h>
57 #include <wayland-server-protocol.h>
58 #include <tbm_bufmgr.h>
59 #include <tbm_surface_queue.h>
60 #include <tbm_surface_internal.h>
61 #include <tbm_drm_helper.h>
63 #include "tdm_private_types.h"
64 #include "tdm_macro.h"
65 #include "tdm_helper.h"
66 #include "tdm_thread.h"
67 #include "tdm_config.h"
75 /*****************************************************************************
77 * - other private headers
78 * - function prototypes
79 *****************************************************************************/
81 extern int tdm_debug_dump;
82 extern int tdm_ttrace_module;
83 extern int tdm_ttrace_output;
86 tdm_display_is_valid(tdm_display *display);
88 tdm_display_get(void);
91 tdm_backend_check_module_abi(tdm_private_backend *private_backend, int abimaj, int abimin);
94 tdm_display_find_output_stamp(tdm_private_display *private_display, double stamp);
96 tdm_display_find_private_output(tdm_private_display *private_display, tdm_output *output_backend);
99 tdm_output_init(tdm_private_display *private_display);
101 tdm_output_is_valid(tdm_output *output);
104 tdm_output_thread_cb_change(tdm_private_display *private_display, void *object, tdm_thread_cb_base *cb_base, void *user_data);
106 tdm_output_cb_status(tdm_output *output_backend, tdm_output_conn_status status,
109 tdm_output_cb_dpms(tdm_output *output_backend, tdm_output_dpms dpms,
112 tdm_output_cb_need_validate(tdm_private_output *private_output);
115 tdm_output_vblank_print_wait_information(tdm_private_output *private_output, void *user_data);
117 tdm_output_wait_vblank_add_front(tdm_output *output, int interval, int sync,
118 tdm_output_vblank_handler func, void *user_data);
120 tdm_output_commit_internal(tdm_output *output, int sync, tdm_output_commit_handler func, void *user_data);
122 tdm_output_get_dpms_internal(tdm_output *output, tdm_output_dpms *dpms_value);
125 tdm_output_need_validate_event_init(tdm_output *output);
127 tdm_output_need_validate_handler_thread(tdm_private_display *private_display, void *object, tdm_thread_cb_base *cb_base, void *user_data);
129 tdm_output_choose_commit_per_vblank_mode(tdm_private_output *private_output, int mode);
132 tdm_output_remove_vblank_handler_internal(tdm_output *output, tdm_output_vblank_handler func, void *user_data);
134 tdm_output_remove_commit_handler_internal(tdm_output *output, tdm_output_commit_handler func, void *user_data);
136 tdm_layer_remove_commit_handler_internal(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
139 tdm_layer_commit_internal(tdm_private_layer *private_layer, tdm_layer_commit_handler func, void *user_data);
141 tdm_layer_commit_pending_data(tdm_private_layer *private_layer);
143 tdm_layer_committed(tdm_private_layer *private_layer, tdm_private_layer_buffer **committed_buffer);
145 tdm_layer_set_info_internal(tdm_private_layer *private_layer, tdm_info_layer *info);
147 tdm_layer_set_buffer_internal(tdm_private_layer *private_layer, tbm_surface_h buffer);
149 tdm_layer_unset_buffer_internal(tdm_private_layer *private_layer);
152 tdm_vblank_init(tdm_display *dpy);
154 tdm_vblank_deinit(tdm_display *dpy);
156 tdm_vblank_set_add_front(tdm_vblank *vblank, unsigned int add_front);
158 tdm_vblank_set_resource(tdm_vblank *vblank, struct wl_resource *resource);
160 tdm_vblank_get_stamp(tdm_vblank *vblank);
162 tdm_vblank_set_client_vblank_fps(unsigned int pid, const char *name, unsigned int fps);
164 tdm_vblank_get_vblank_list_information(tdm_display *dpy, char *reply, int *len);
167 tdm_pp_init(tdm_private_display *private_display);
169 tdm_pp_create_internal(tdm_private_backend *private_backend, tdm_error *error);
171 tdm_pp_destroy_internal(tdm_private_pp *private_pp);
174 tdm_hwc_window_create_internal(tdm_private_output *private_output, int is_video, tdm_error *error);
176 tdm_hwc_window_destroy_internal(tdm_private_hwc_window * private_hwc_window);
179 tdm_capture_init(tdm_private_display *private_display);
180 tdm_private_capture *
181 tdm_capture_create_output_internal(tdm_private_output *private_output,
183 tdm_private_capture *
184 tdm_capture_create_layer_internal(tdm_private_layer *private_layer,
187 tdm_capture_destroy_internal(tdm_private_capture *private_capture);
189 /* utility buffer functions for private */
191 tdm_buffer_get_info(tbm_surface_h buffer);
193 tdm_buffer_remove_release_handler_internal(tbm_surface_h buffer);
195 /* event functions for private */
197 tdm_event_loop_init(tdm_private_display *private_display);
199 tdm_event_loop_deinit(tdm_private_display *private_display);
201 tdm_event_loop_stop(tdm_private_display *private_display);
203 tdm_event_loop_create_backend_source(tdm_private_display *private_display);
205 tdm_event_loop_get_fd(tdm_private_display *private_display);
207 tdm_event_loop_dispatch(tdm_private_display *private_display);
209 tdm_event_loop_flush(tdm_private_display *private_display);
211 tdm_event_loop_trace_enable(tdm_private_display *private_display, unsigned int enable);
214 tdm_server_init(tdm_private_loop *private_loop);
216 tdm_server_deinit(tdm_private_loop *private_loop);
218 tdm_server_get_client_name(pid_t pid);
220 tdm_server_enable_ttrace_client_vblank(tdm_display *dpy, tdm_output *output, int enable);
223 tdm_helper_dump_make_directory(const char *path, char *reply, int *len);
225 tdm_helper_get_time(void);
227 extern int tdm_dump_enable;
228 extern char *tdm_debug_dump_dir;
231 tdm_display_update_output(tdm_private_backend *private_backend,
232 tdm_output *output_backend, int pipe, unsigned int need_new_caps);
234 tdm_display_enable_debug_module(const char*modules);
236 tdm_display_enable_dump(tdm_private_display *private_display, const char *dump_str, char *reply, int *len);
238 tdm_display_enable_ttrace(tdm_private_display *private_display, const char *ttrace, int output_id, char *reply, int *len);
240 tdm_display_enable_fps(tdm_private_display *private_display, int enable);
243 tdm_monitor_server_command(tdm_display *dpy, const char *options, char *reply, int *len);
249 #endif /* _TDM_PRIVATE_H_ */