Add missing boilerplate
[platform/adaptation/libtdm-drm.git] / src / libtdm-drm / tdm_drm.h
1 /**************************************************************************
2
3 libtdm_drm
4
5 Copyright 2015 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_DRM_H_
32 #define _TDM_DRM_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_drm_types.h"
58 #include "tdm_drm_hwc.h"
59 #include "tdm_drm_hwc_window.h"
60
61 #if HAVE_UDEV
62 #include <libudev.h>
63 #endif
64
65 /* drm backend functions (display) */
66 tdm_error       drm_display_get_capability(tdm_backend_data *bdata, tdm_caps_display *caps);
67 tdm_error       drm_display_get_pp_capability(tdm_backend_data *bdata, tdm_caps_pp *caps);
68 tdm_output** drm_display_get_outputs(tdm_backend_data *bdata, int *count, tdm_error *error);
69 tdm_error       drm_display_get_fd(tdm_backend_data *bdata, int *fd);
70 tdm_error       drm_display_handle_events(tdm_backend_data *bdata);
71 tdm_pp*   drm_display_create_pp(tdm_backend_data *bdata, tdm_error *error);
72 tdm_error       drm_output_get_capability(tdm_output *output, tdm_caps_output *caps);
73 tdm_layer**  drm_output_get_layers(tdm_output *output, int *count, tdm_error *error);
74 tdm_error       drm_output_set_property(tdm_output *output, unsigned int id, tdm_value value);
75 tdm_error       drm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value);
76 tdm_error       drm_output_wait_vblank(tdm_output *output, int interval, int sync, void *user_data);
77 tdm_error       drm_output_set_vblank_handler(tdm_output *output, tdm_output_vblank_handler func);
78 tdm_error       drm_output_commit(tdm_output *output, int sync, void *user_data);
79 tdm_error       drm_output_set_commit_handler(tdm_output *output, tdm_output_commit_handler func);
80 tdm_error       drm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value);
81 tdm_error       drm_output_get_dpms(tdm_output *output, tdm_output_dpms *dpms_value);
82 tdm_error       drm_output_set_mode(tdm_output *output, const tdm_output_mode *mode);
83 tdm_error       drm_output_get_mode(tdm_output *output, const tdm_output_mode **mode);
84 tdm_error       drm_output_set_status_handler(tdm_output *output, tdm_output_status_handler func, void *user_data);
85 tdm_hwc     *drm_output_get_hwc(tdm_output *output, tdm_error *error);
86
87 tdm_hwc_window      *drm_hwc_create_window(tdm_hwc *hwc, tdm_error *error);
88 tdm_error            drm_hwc_get_video_supported_formats(tdm_hwc *hwc, const tbm_format **formats, int *count);
89 tdm_error            drm_hwc_get_capabilities(tdm_hwc *hwc, tdm_hwc_capability *capabilities);
90 tdm_error            drm_hwc_get_available_properties(tdm_hwc *hwc, const tdm_prop **props, int *count);
91 tbm_surface_queue_h  drm_hwc_get_client_target_buffer_queue(tdm_hwc *hwc, tdm_error *error);
92 tdm_error            drm_hwc_set_client_target_buffer(tdm_hwc *hwc, tbm_surface_h buffer, tdm_region damage);
93 tdm_error            drm_hwc_validate(tdm_hwc *hwc, tdm_hwc_window **composited_wnds, uint32_t num_wnds, uint32_t *num_types);
94 tdm_error            drm_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            drm_hwc_accept_validation(tdm_hwc *hwc);
96 tdm_error            drm_hwc_commit(tdm_hwc *hwc, int sync, void *user_data);
97 tdm_error            drm_hwc_set_commit_handler(tdm_hwc *hwc, tdm_hwc_commit_handler func);
98
99 void           drm_hwc_window_destroy(tdm_hwc_window *hwc_window);
100 tdm_error      drm_hwc_window_set_composition_type(tdm_hwc_window *hwc_window, tdm_hwc_window_composition composition_type);
101 tdm_error      drm_hwc_window_set_buffer_damage(tdm_hwc_window *hwc_window, tdm_region damage);
102 tdm_error      drm_hwc_window_set_info(tdm_hwc_window *hwc_window, tdm_hwc_window_info *info);
103 tdm_error      drm_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h surface);
104 tdm_error      drm_hwc_window_set_property(tdm_hwc_window *hwc_window, unsigned int id, tdm_value value);
105 tdm_error      drm_hwc_window_get_property(tdm_hwc_window *hwc_window, unsigned int id, tdm_value *value);
106 tdm_error      drm_hwc_window_get_constraints(tdm_hwc_window *hwc_window, int *constraints);
107 tdm_error      drm_hwc_window_set_name(tdm_hwc_window *hwc_window, const char *name);
108 tdm_error      drm_hwc_window_set_cursor_image(tdm_hwc_window *hwc_window, int width, int height, int stride, void *ptr);
109
110 tdm_error       drm_layer_get_capability(tdm_layer *layer, tdm_caps_layer *caps);
111 tdm_error       drm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value);
112 tdm_error       drm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value);
113 tdm_error       drm_layer_set_info(tdm_layer *layer, tdm_info_layer *info);
114 tdm_error       drm_layer_get_info(tdm_layer *layer, tdm_info_layer *info);
115 tdm_error       drm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer);
116 tdm_error       drm_layer_unset_buffer(tdm_layer *layer);
117 void             drm_pp_destroy(tdm_pp *pp);
118 tdm_error       drm_pp_set_info(tdm_pp *pp, tdm_info_pp *info);
119 tdm_error       drm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst);
120 tdm_error       drm_pp_commit(tdm_pp *pp);
121 tdm_error       drm_pp_set_done_handler(tdm_pp *pp, tdm_pp_done_handler func, void *user_data);
122
123 uint32_t        tdm_drm_format_to_drm_format(tbm_format format);
124 tbm_format  tdm_drm_format_to_tbm_format(uint32_t format);
125
126 void            tdm_drm_display_update_output_status(tdm_drm_data *drm_data);
127 tdm_error       tdm_drm_display_create_output_list(tdm_drm_data *drm_data);
128 void            tdm_drm_display_destroy_output_list(tdm_drm_data *drm_data);
129 tdm_error       tdm_drm_display_create_layer_list(tdm_drm_data *drm_data);
130
131 tdm_drm_layer_data * drm_output_data_get_layer_data(tdm_drm_output_data *output_data, int layer_zops);
132
133 #endif /* _TDM_DRM_H_ */