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_
46 #include <sys/types.h>
52 #include <sys/syscall.h>
53 #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"
74 /*****************************************************************************
76 * - other private headers
77 * - function prototypes
78 *****************************************************************************/
80 extern int tdm_debug_dump;
81 extern int tdm_ttrace_module;
82 extern int tdm_ttrace_output;
85 tdm_display_is_valid(tdm_display *display);
88 tdm_display_check_module_abi(tdm_private_display *private_display, int abimaj, int abimin);
91 tdm_display_find_output_stamp(tdm_private_display *private_display, double stamp);
93 tdm_pp_find_stamp(tdm_private_display *private_display, double stamp);
95 tdm_capture_find_stamp(tdm_private_display *private_display, double stamp);
98 tdm_output_is_valid(tdm_output *output);
101 tdm_output_cb_vblank(tdm_output *output_backend, unsigned int sequence,
102 unsigned int tv_sec, unsigned int tv_usec, void *user_data);
104 tdm_output_cb_commit(tdm_output *output_backend, unsigned int sequence,
105 unsigned int tv_sec, unsigned int tv_usec, void *user_data);
107 tdm_output_cb_status(tdm_output *output_backend, tdm_output_conn_status status,
110 tdm_output_cb_dpms(tdm_output *output_backend, tdm_output_dpms dpms,
113 tdm_output_cb_need_validate(tdm_private_output *private_output);
116 tdm_output_vblank_print_wait_information(tdm_private_output *private_output, void *user_data);
118 tdm_output_wait_vblank_add_front(tdm_output *output, int interval, int sync,
119 tdm_output_vblank_handler func, void *user_data);
121 tdm_output_commit_internal(tdm_output *output, int sync, tdm_output_commit_handler func, void *user_data);
123 tdm_output_get_dpms_internal(tdm_output *output, tdm_output_dpms *dpms_value);
126 tdm_output_need_validate_event_init(tdm_output *output);
128 tdm_output_choose_commit_per_vblank_mode(tdm_private_output *private_output, int mode);
131 tdm_output_remove_vblank_handler_internal(tdm_output *output, tdm_output_vblank_handler func, void *user_data);
133 tdm_output_remove_commit_handler_internal(tdm_output *output, tdm_output_commit_handler func, void *user_data);
135 tdm_layer_remove_commit_handler_internal(tdm_layer *layer, tdm_layer_commit_handler func, void *user_data);
138 tdm_layer_commit_internal(tdm_private_layer *private_layer, tdm_layer_commit_handler func, void *user_data);
140 tdm_layer_commit_pending_data(tdm_private_layer *private_layer);
142 tdm_layer_committed(tdm_private_layer *private_layer, tdm_private_layer_buffer **committed_buffer);
144 tdm_layer_set_info_internal(tdm_private_layer *private_layer, tdm_info_layer *info);
146 tdm_layer_set_buffer_internal(tdm_private_layer *private_layer, tbm_surface_h buffer);
148 tdm_layer_unset_buffer_internal(tdm_private_layer *private_layer);
151 tdm_pp_cb_done(tdm_pp *pp_backend, tbm_surface_h src, tbm_surface_h dst,
154 tdm_capture_cb_done(tdm_capture *capture_backend, tbm_surface_h buffer,
157 tdm_vblank_init(tdm_display *dpy);
159 tdm_vblank_deinit(tdm_display *dpy);
161 tdm_vblank_cb_vblank_SW(tdm_vblank *vblank, double vblank_stamp);
163 tdm_vblank_cb_vblank_create(tdm_vblank *vblank, double vblank_stamp);
165 tdm_vblank_set_add_front(tdm_vblank *vblank, unsigned int add_front);
167 tdm_vblank_set_resource(tdm_vblank *vblank, struct wl_resource *resource);
169 tdm_vblank_get_stamp(tdm_vblank *vblank);
171 tdm_vblank_set_client_vblank_fps(unsigned int pid, const char *name, unsigned int fps);
173 tdm_vblank_get_vblank_list_information(tdm_display *dpy, char *reply, int *len);
176 tdm_output_call_change_handler_internal(tdm_private_output *private_output,
177 struct list_head *change_handler_list,
178 tdm_output_change_type type,
180 int no_check_thread_id);
183 tdm_pp_create_internal(tdm_private_display *private_display, tdm_error *error);
185 tdm_pp_destroy_internal(tdm_private_pp *private_pp);
188 tdm_hwc_window_create_internal(tdm_private_output *private_output, int is_video, tdm_error *error);
190 tdm_hwc_window_destroy_internal(tdm_private_hwc_window * private_hwc_window);
192 tdm_private_capture *
193 tdm_capture_create_output_internal(tdm_private_output *private_output,
195 tdm_private_capture *
196 tdm_capture_create_layer_internal(tdm_private_layer *private_layer,
199 tdm_capture_destroy_internal(tdm_private_capture *private_capture);
201 /* utility buffer functions for private */
203 tdm_buffer_get_info(tbm_surface_h buffer);
205 tdm_buffer_list_get_first_entry(struct list_head *list);
207 tdm_buffer_list_dump(struct list_head *list);
210 tdm_buffer_remove_release_handler_internal(tbm_surface_h buffer);
212 /* event functions for private */
214 tdm_event_loop_init(tdm_private_display *private_display);
216 tdm_event_loop_deinit(tdm_private_display *private_display);
218 tdm_event_loop_stop(tdm_private_display *private_display);
220 tdm_event_loop_create_backend_source(tdm_private_display *private_display);
222 tdm_event_loop_get_fd(tdm_private_display *private_display);
224 tdm_event_loop_dispatch(tdm_private_display *private_display);
226 tdm_event_loop_flush(tdm_private_display *private_display);
228 tdm_event_loop_trace_enable(tdm_private_display *private_display, unsigned int enable);
231 tdm_server_init(tdm_private_loop *private_loop);
233 tdm_server_deinit(tdm_private_loop *private_loop);
235 tdm_server_get_client_name(pid_t pid);
237 tdm_server_enable_ttrace_client_vblank(tdm_display *dpy, tdm_output *output, int enable);
240 tdm_helper_dump_make_directory(const char *path, char *reply, int *len);
242 tdm_helper_get_time(void);
244 extern int tdm_dump_enable;
245 extern char *tdm_debug_dump_dir;
248 tdm_display_update_output(tdm_private_display *private_display,
249 tdm_output *output_backend, int pipe);
251 tdm_display_enable_debug_module(const char*modules);
253 tdm_display_enable_dump(tdm_private_display *private_display, const char *dump_str, char *reply, int *len);
255 tdm_display_enable_path(const char *path);
257 tdm_display_enable_ttrace(tdm_private_display *private_display, const char *ttrace, int output_id, char *reply, int *len);
259 tdm_display_enable_fps(tdm_private_display *private_display, int enable);
262 tdm_monitor_server_command(tdm_display *dpy, const char *options, char *reply, int *len);
268 #endif /* _TDM_PRIVATE_H_ */