Package version up to 3.0.6
[platform/adaptation/nexell/libtdm-nexell.git] / src / libtdm-nexell / tdm_nexell.h
1 /**************************************************************************
2
3 libtdm_nexell
4
5 Copyright 2017 Samsung Electronics co., Ltd. All Rights Reserved.
6
7 Contact: SooChan Lim <sc1.lim@samsung.com>
8
9 Permission is hereby granted, free of charge, to any person obtaining a
10 copy of this software and associated documentation files (the
11 "Software"), to deal in the Software without restriction, including
12 without limitation the rights to use, copy, modify, merge, publish,
13 distribute, sub license, and/or sell copies of the Software, and to
14 permit persons to whom the Software is furnished to do so, subject to
15 the following conditions:
16
17 The above copyright notice and this permission notice (including the
18 next paragraph) shall be included in all copies or substantial portions
19 of the Software.
20
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
24 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
25 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
29 **************************************************************************/
30
31 #ifndef _TDM_NEXELL_H_
32 #define _TDM_NEXELL_H_
33
34 #ifdef HAVE_CONFIG_H
35 #include "config.h"
36 #endif
37
38 #include <stdio.h>
39 #include <string.h>
40 #include <stdlib.h>
41 #include <pthread.h>
42 #include <errno.h>
43 #include <unistd.h>
44 #include <limits.h>
45 #include <sys/types.h>
46 #include <sys/stat.h>
47 #include <sys/ioctl.h>
48 #include <fcntl.h>
49
50 #include <xf86drm.h>
51 #include <xf86drmMode.h>
52 #include <tbm_surface.h>
53 #include <tbm_surface_internal.h>
54 #include <tdm_backend.h>
55 #include <tdm_log.h>
56 #include <tdm_list.h>
57 #include "tdm_nexell_types.h"
58 #include "tdm_nexell_hwc.h"
59 #include "tdm_nexell_hwc_window.h"
60
61 #if HAVE_UDEV
62 #include <libudev.h>
63 #endif
64
65 /* drm backend functions (display) */
66 tdm_error    nexell_display_get_capability(tdm_backend_data *bdata, tdm_caps_display *caps);
67 tdm_error    nexell_display_get_pp_capability(tdm_backend_data *bdata, tdm_caps_pp *caps);
68 tdm_output** nexell_display_get_outputs(tdm_backend_data *bdata, int *count, tdm_error *error);
69 tdm_error    nexell_display_get_fd(tdm_backend_data *bdata, int *fd);
70 tdm_error    nexell_display_handle_events(tdm_backend_data *bdata);
71 tdm_pp*      nexell_display_create_pp(tdm_backend_data *bdata, tdm_error *error);
72 tdm_error    nexell_output_get_capability(tdm_output *output, tdm_caps_output *caps);
73 tdm_layer**  nexell_output_get_layers(tdm_output *output, int *count, tdm_error *error);
74 tdm_error    nexell_output_set_property(tdm_output *output, unsigned int id, tdm_value value);
75 tdm_error    nexell_output_get_property(tdm_output *output, unsigned int id, tdm_value *value);
76 tdm_error    nexell_output_wait_vblank(tdm_output *output, int interval, int sync, void *user_data);
77 tdm_error    nexell_output_set_vblank_handler(tdm_output *output, tdm_output_vblank_handler func);
78 tdm_error    nexell_output_commit(tdm_output *output, int sync, void *user_data);
79 tdm_error    nexell_output_set_commit_handler(tdm_output *output, tdm_output_commit_handler func);
80 tdm_error    nexell_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value);
81 tdm_error    nexell_output_get_dpms(tdm_output *output, tdm_output_dpms *dpms_value);
82 tdm_error    nexell_output_set_mode(tdm_output *output, const tdm_output_mode *mode);
83 tdm_error    nexell_output_get_mode(tdm_output *output, const tdm_output_mode **mode);
84 tdm_error    nexell_output_set_status_handler(tdm_output *output, tdm_output_status_handler func, void *user_data);
85 tdm_hwc     *nexell_output_get_hwc(tdm_output *output, tdm_error *error);
86
87 tdm_hwc_window      *nexell_hwc_create_window(tdm_hwc *hwc, tdm_error *error);
88 tdm_error            nexell_hwc_get_video_supported_formats(tdm_hwc *hwc, const tbm_format **formats, int *count);
89 tdm_error            nexell_hwc_get_capabilities(tdm_hwc *hwc, tdm_hwc_capability *capabilities);
90 tdm_error            nexell_hwc_get_available_properties(tdm_hwc *hwc, const tdm_prop **props, int *count);
91 tbm_surface_queue_h  nexell_hwc_get_client_target_buffer_queue(tdm_hwc *hwc, tdm_error *error);
92 tdm_error            nexell_hwc_set_client_target_buffer(tdm_hwc *hwc, tbm_surface_h buffer, tdm_region damage);
93 tdm_error            nexell_hwc_validate(tdm_hwc *hwc, tdm_hwc_window **composited_wnds, uint32_t num_wnds, uint32_t *num_types);
94 tdm_error            nexell_hwc_get_changed_composition_types(tdm_hwc *hwc, uint32_t *num_elements, tdm_hwc_window **hwc_wnds, tdm_hwc_window_composition *composition_types);
95 tdm_error            nexell_hwc_accept_validation(tdm_hwc *hwc);
96 tdm_error            nexell_hwc_commit(tdm_hwc *hwc, int sync, void *user_data);
97 tdm_error            nexell_hwc_set_commit_handler(tdm_hwc *hwc, tdm_hwc_commit_handler func);
98
99 void                 nexell_hwc_window_destroy(tdm_hwc_window *hwc_window);
100 tdm_error            nexell_hwc_window_set_composition_type(tdm_hwc_window *hwc_window, tdm_hwc_window_composition composition_type);
101 tdm_error            nexell_hwc_window_set_buffer_damage(tdm_hwc_window *hwc_window, tdm_region damage);
102 tdm_error            nexell_hwc_window_set_info(tdm_hwc_window *hwc_window, tdm_hwc_window_info *info);
103 tdm_error            nexell_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h surface);
104 tdm_error            nexell_hwc_window_set_property(tdm_hwc_window *hwc_window, unsigned int id, tdm_value value);
105 tdm_error            nexell_hwc_window_get_property(tdm_hwc_window *hwc_window, unsigned int id, tdm_value *value);
106 tdm_error            nexell_hwc_window_get_constraints(tdm_hwc_window *hwc_window, int *constraints);
107 tbm_surface_queue_h  nexell_hwc_window_acquire_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error);
108 void                 nexell_hwc_window_release_buffer_queue(tdm_hwc_window *hwc_window, tbm_surface_queue_h queue);
109 tdm_error            nexell_hwc_window_set_name(tdm_hwc_window *hwc_window, const char *name);
110 tdm_error            nexell_hwc_window_set_cursor_image(tdm_hwc_window *hwc_window, int width, int height, int stride, void *ptr);
111
112 tdm_error    nexell_layer_get_capability(tdm_layer *layer, tdm_caps_layer *caps);
113 tdm_error    nexell_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value);
114 tdm_error    nexell_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value);
115 tdm_error    nexell_layer_set_info(tdm_layer *layer, tdm_info_layer *info);
116 tdm_error    nexell_layer_get_info(tdm_layer *layer, tdm_info_layer *info);
117 tdm_error    nexell_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer);
118 tdm_error    nexell_layer_unset_buffer(tdm_layer *layer);
119 void         nexell_pp_destroy(tdm_pp *pp);
120 tdm_error    nexell_pp_set_info(tdm_pp *pp, tdm_info_pp *info);
121 tdm_error    nexell_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst);
122 tdm_error    nexell_pp_commit(tdm_pp *pp);
123 tdm_error    nexell_pp_set_done_handler(tdm_pp *pp, tdm_pp_done_handler func, void *user_data);
124
125
126
127 uint32_t     tdm_nexell_format_to_drm_format(tbm_format format);
128 tbm_format   tdm_nexell_format_to_tbm_format(uint32_t format);
129
130 void         tdm_nexell_display_update_output_status(tdm_nexell_data *nexell_data);
131 tdm_error    tdm_nexell_display_create_output_list(tdm_nexell_data *nexell_data);
132 void         tdm_nexell_display_destroy_output_list(tdm_nexell_data *nexell_data);
133 tdm_error    tdm_nexell_display_create_layer_list(tdm_nexell_data *nexell_data);
134
135 tdm_nexell_layer_data * nexell_output_data_get_layer_data(tdm_nexell_output_data *output_data, int layer_zops);
136
137 void                 tdm_nexell_data_destroy_buffer_list(tdm_nexell_data *nexell_data);
138 tbm_surface_queue_h  tdm_nexell_hwc_window_create_tbm_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error);
139 tbm_surface_queue_h  tdm_nexell_hwc_window_create_cursor_tbm_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error);
140 void                 tdm_nexell_hwc_window_destroy_tbm_buffer_queue(tbm_surface_queue_h tqueue);
141 #endif /* _TDM_NEXELL_H_ */