1 /**************************************************************************
5 Copyright 2017 Samsung Electronics co., Ltd. All Rights Reserved.
7 Contact: SooChan Lim <sc1.lim@samsung.com>
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:
17 The above copyright notice and this permission notice (including the
18 next paragraph) shall be included in all copies or substantial portions
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.
29 **************************************************************************/
31 #ifndef _TDM_NEXELL_H_
32 #define _TDM_NEXELL_H_
45 #include <sys/types.h>
47 #include <sys/ioctl.h>
51 #include <xf86drmMode.h>
52 #include <tbm_surface.h>
53 #include <tbm_surface_internal.h>
54 #include <tdm_backend.h>
57 #include "tdm_nexell_types.h"
58 #include "tdm_nexell_hwc.h"
59 #include "tdm_nexell_hwc_window.h"
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);
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);
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);
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);
127 uint32_t tdm_nexell_format_to_drm_format(tbm_format format);
128 tbm_format tdm_nexell_format_to_tbm_format(uint32_t format);
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);
135 tdm_nexell_layer_data * nexell_output_data_get_layer_data(tdm_nexell_output_data *output_data, int layer_zops);
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_ */