Implementation of TDM_HWC
[platform/adaptation/nexell/libtdm-nexell.git] / src / tdm_nexell.h
1 #ifndef _TDM_NEXELL_H_
2 #define _TDM_NEXELL_H_
3
4 #ifdef HAVE_CONFIG_H
5 #include "config.h"
6 #endif
7
8 #include <stdio.h>
9 #include <string.h>
10 #include <stdlib.h>
11 #include <pthread.h>
12 #include <errno.h>
13 #include <unistd.h>
14 #include <limits.h>
15 #include <sys/types.h>
16 #include <sys/stat.h>
17 #include <sys/ioctl.h>
18 #include <fcntl.h>
19
20 #include <xf86drm.h>
21 #include <xf86drmMode.h>
22 #include <tbm_surface.h>
23 #include <tbm_surface_internal.h>
24 #include <tdm_backend.h>
25 #include <tdm_log.h>
26 #include <tdm_list.h>
27 #include "tdm_nexell_types.h"
28 #include "tdm_nexell_hwc.h"
29 #include "tdm_nexell_hwc_window.h"
30
31 #if HAVE_UDEV
32 #include <libudev.h>
33 #endif
34
35 /* drm backend functions (display) */
36 tdm_error    nexell_display_get_capability(tdm_backend_data *bdata, tdm_caps_display *caps);
37 tdm_error    nexell_display_get_pp_capability(tdm_backend_data *bdata, tdm_caps_pp *caps);
38 tdm_output** nexell_display_get_outputs(tdm_backend_data *bdata, int *count, tdm_error *error);
39 tdm_error    nexell_display_get_fd(tdm_backend_data *bdata, int *fd);
40 tdm_error    nexell_display_handle_events(tdm_backend_data *bdata);
41 tdm_pp*      nexell_display_create_pp(tdm_backend_data *bdata, tdm_error *error);
42 tdm_error    nexell_output_get_capability(tdm_output *output, tdm_caps_output *caps);
43 tdm_layer**  nexell_output_get_layers(tdm_output *output, int *count, tdm_error *error);
44 tdm_error    nexell_output_set_property(tdm_output *output, unsigned int id, tdm_value value);
45 tdm_error    nexell_output_get_property(tdm_output *output, unsigned int id, tdm_value *value);
46 tdm_error    nexell_output_wait_vblank(tdm_output *output, int interval, int sync, void *user_data);
47 tdm_error    nexell_output_set_vblank_handler(tdm_output *output, tdm_output_vblank_handler func);
48 tdm_error    nexell_output_commit(tdm_output *output, int sync, void *user_data);
49 tdm_error    nexell_output_set_commit_handler(tdm_output *output, tdm_output_commit_handler func);
50 tdm_error    nexell_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value);
51 tdm_error    nexell_output_get_dpms(tdm_output *output, tdm_output_dpms *dpms_value);
52 tdm_error    nexell_output_set_mode(tdm_output *output, const tdm_output_mode *mode);
53 tdm_error    nexell_output_get_mode(tdm_output *output, const tdm_output_mode **mode);
54 tdm_error    nexell_output_set_status_handler(tdm_output *output, tdm_output_status_handler func, void *user_data);
55 tdm_hwc     *nexell_output_get_hwc(tdm_output *output, tdm_error *error);
56
57 tdm_hwc_window      *nexell_hwc_create_window(tdm_hwc *hwc, tdm_error *error);
58 tdm_error            nexell_hwc_get_video_supported_formats(tdm_hwc *hwc, const tbm_format **formats, int *count);
59 tdm_error            nexell_hwc_get_capabilities(tdm_hwc *hwc, tdm_hwc_capability *capabilities);
60 tdm_error            nexell_hwc_get_available_properties(tdm_hwc *hwc, const tdm_prop **props, int *count);
61 tbm_surface_queue_h  nexell_hwc_get_client_target_buffer_queue(tdm_hwc *hwc, tdm_error *error);
62 tdm_error            nexell_hwc_set_client_target_buffer(tdm_hwc *hwc, tbm_surface_h buffer, tdm_region damage);
63 tdm_error            nexell_hwc_validate(tdm_hwc *hwc, tdm_hwc_window **composited_wnds, uint32_t num_wnds, uint32_t *num_types);
64 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);
65 tdm_error            nexell_hwc_accept_validation(tdm_hwc *hwc);
66 tdm_error            nexell_hwc_commit(tdm_hwc *hwc, int sync, void *user_data);
67 tdm_error            nexell_hwc_set_commit_handler(tdm_hwc *hwc, tdm_hwc_commit_handler func);
68
69 void                 nexell_hwc_window_destroy(tdm_hwc_window *hwc_window);
70 tdm_error            nexell_hwc_window_set_composition_type(tdm_hwc_window *hwc_window, tdm_hwc_window_composition composition_type);
71 tdm_error            nexell_hwc_window_set_buffer_damage(tdm_hwc_window *hwc_window, tdm_region damage);
72 tdm_error            nexell_hwc_window_set_info(tdm_hwc_window *hwc_window, tdm_hwc_window_info *info);
73 tdm_error            nexell_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h surface);
74 tdm_error            nexell_hwc_window_set_property(tdm_hwc_window *hwc_window, unsigned int id, tdm_value value);
75 tdm_error            nexell_hwc_window_get_property(tdm_hwc_window *hwc_window, unsigned int id, tdm_value *value);
76 tdm_error            nexell_hwc_window_get_constraints(tdm_hwc_window *hwc_window, int *constraints);
77 tbm_surface_queue_h  nexell_hwc_window_acquire_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error);
78 void                 nexell_hwc_window_release_buffer_queue(tdm_hwc_window *hwc_window, tbm_surface_queue_h queue);
79 tdm_error            nexell_hwc_window_set_name(tdm_hwc_window *hwc_window, const char *name);
80 tdm_error            nexell_hwc_window_set_cursor_image(tdm_hwc_window *hwc_window, int width, int height, int stride, void *ptr);
81
82 tdm_error    nexell_layer_get_capability(tdm_layer *layer, tdm_caps_layer *caps);
83 tdm_error    nexell_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value);
84 tdm_error    nexell_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value);
85 tdm_error    nexell_layer_set_info(tdm_layer *layer, tdm_info_layer *info);
86 tdm_error    nexell_layer_get_info(tdm_layer *layer, tdm_info_layer *info);
87 tdm_error    nexell_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer);
88 tdm_error    nexell_layer_unset_buffer(tdm_layer *layer);
89 void         nexell_pp_destroy(tdm_pp *pp);
90 tdm_error    nexell_pp_set_info(tdm_pp *pp, tdm_info_pp *info);
91 tdm_error    nexell_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst);
92 tdm_error    nexell_pp_commit(tdm_pp *pp);
93 tdm_error    nexell_pp_set_done_handler(tdm_pp *pp, tdm_pp_done_handler func, void *user_data);
94
95
96
97 uint32_t     tdm_nexell_format_to_drm_format(tbm_format format);
98 tbm_format   tdm_nexell_format_to_tbm_format(uint32_t format);
99
100 void         tdm_nexell_display_update_output_status(tdm_nexell_data *nexell_data);
101 tdm_error    tdm_nexell_display_create_output_list(tdm_nexell_data *nexell_data);
102 void         tdm_nexell_display_destroy_output_list(tdm_nexell_data *nexell_data);
103 tdm_error    tdm_nexell_display_create_layer_list(tdm_nexell_data *nexell_data);
104
105 tdm_nexell_layer_data * nexell_output_data_get_layer_data(tdm_nexell_output_data *output_data, int layer_zops);
106
107 void                 tdm_nexell_data_destroy_buffer_list(tdm_nexell_data *nexell_data);
108 tbm_surface_queue_h  tdm_nexell_hwc_window_create_tbm_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error);
109 void                 tdm_nexell_hwc_window_destroy_tbm_buffer_queue(tbm_surface_queue_h tqueue);
110 #endif /* _TDM_NEXELL_H_ */