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 _HAL_TDM_NEXELL_H_
32 #define _HAL_TDM_NEXELL_H_
38 #include "tdm_backend_nexell_types.h"
41 hal_tdm_error nexell_display_get_capability(hal_tdm_display *display, hal_tdm_caps_display *caps);
42 hal_tdm_error nexell_display_get_pp_capability(hal_tdm_display *display, hal_tdm_caps_pp *caps);
43 hal_tdm_output **nexell_display_get_outputs(hal_tdm_display *display, int *count, hal_tdm_error *error);
44 hal_tdm_error nexell_display_get_fd(hal_tdm_display *display, int *fd);
45 hal_tdm_error nexell_display_handle_events(hal_tdm_display *display);
46 hal_tdm_pp* nexell_display_create_pp(hal_tdm_display *display, hal_tdm_error *error);
49 hal_tdm_error nexell_output_get_capability(hal_tdm_output *output, hal_tdm_caps_output *caps);
50 hal_tdm_error nexell_output_set_property(hal_tdm_output *output, unsigned int id, hal_tdm_value value);
51 hal_tdm_error nexell_output_get_property(hal_tdm_output *output, unsigned int id, hal_tdm_value *value);
52 hal_tdm_error nexell_output_wait_vblank(hal_tdm_output *output, int interval, int sync, void *user_data);
53 hal_tdm_error nexell_output_set_vblank_handler(hal_tdm_output *output, hal_tdm_output_vblank_handler func);
54 hal_tdm_error nexell_output_commit(hal_tdm_output *output, int sync, void *user_data);
55 hal_tdm_error nexell_output_set_commit_handler(hal_tdm_output *output, hal_tdm_output_commit_handler func);
56 hal_tdm_error nexell_output_set_dpms(hal_tdm_output *output, hal_tdm_output_dpms dpms_value);
57 hal_tdm_error nexell_output_get_dpms(hal_tdm_output *output, hal_tdm_output_dpms *dpms_value);
58 hal_tdm_error nexell_output_set_mode(hal_tdm_output *output, const hal_tdm_output_mode *mode);
59 hal_tdm_error nexell_output_get_mode(hal_tdm_output *output, const hal_tdm_output_mode **mode);
60 hal_tdm_error nexell_output_set_status_handler(hal_tdm_output *output, hal_tdm_output_status_handler func, void *user_data);
61 hal_tdm_hwc *nexell_output_get_hwc(hal_tdm_output *output, hal_tdm_error *error);
64 hal_tdm_hwc_window *nexell_hwc_create_window(hal_tdm_hwc *hwc, hal_tdm_error *error);
65 hal_tdm_error nexell_hwc_get_video_supported_formats(hal_tdm_hwc *hwc, const tbm_format **formats, int *count);
66 hal_tdm_error nexell_hwc_get_capabilities(hal_tdm_hwc *hwc, hal_tdm_hwc_capability *capabilities);
67 hal_tdm_error nexell_hwc_get_available_properties(hal_tdm_hwc *hwc, const hal_tdm_prop **props, int *count);
68 tbm_surface_queue_h nexell_hwc_get_client_target_buffer_queue(hal_tdm_hwc *hwc, hal_tdm_error *error);
69 hal_tdm_error nexell_hwc_set_client_target_buffer(hal_tdm_hwc *hwc, tbm_surface_h buffer, hal_tdm_region damage);
70 hal_tdm_error nexell_hwc_validate(hal_tdm_hwc *hwc, hal_tdm_hwc_window **composited_wnds, uint32_t num_wnds, uint32_t *num_types);
71 hal_tdm_error nexell_hwc_get_changed_composition_types(hal_tdm_hwc *hwc, uint32_t *num_elements, hal_tdm_hwc_window **hwc_wnds, hal_tdm_hwc_window_composition *composition_types);
72 hal_tdm_error nexell_hwc_accept_validation(hal_tdm_hwc *hwc);
73 hal_tdm_error nexell_hwc_commit(hal_tdm_hwc *hwc, int sync, void *user_data);
74 hal_tdm_error nexell_hwc_set_commit_handler(hal_tdm_hwc *hwc, hal_tdm_hwc_commit_handler func);
76 /* hwc_window funcs */
77 void nexell_hwc_window_destroy(hal_tdm_hwc_window *hwc_window);
78 hal_tdm_error nexell_hwc_window_set_composition_type(hal_tdm_hwc_window *hwc_window, hal_tdm_hwc_window_composition composition_type);
79 hal_tdm_error nexell_hwc_window_set_buffer_damage(hal_tdm_hwc_window *hwc_window, hal_tdm_region damage);
80 hal_tdm_error nexell_hwc_window_set_info(hal_tdm_hwc_window *hwc_window, hal_tdm_hwc_window_info *info);
81 hal_tdm_error nexell_hwc_window_set_buffer(hal_tdm_hwc_window *hwc_window, tbm_surface_h surface);
82 hal_tdm_error nexell_hwc_window_set_property(hal_tdm_hwc_window *hwc_window, unsigned int id, hal_tdm_value value);
83 hal_tdm_error nexell_hwc_window_get_property(hal_tdm_hwc_window *hwc_window, unsigned int id, hal_tdm_value *value);
84 hal_tdm_error nexell_hwc_window_get_constraints(hal_tdm_hwc_window *hwc_window, int *constraints);
85 tbm_surface_queue_h nexell_hwc_window_acquire_buffer_queue(hal_tdm_hwc_window *hwc_window, hal_tdm_error *error);
86 void nexell_hwc_window_release_buffer_queue(hal_tdm_hwc_window *hwc_window, tbm_surface_queue_h queue);
87 hal_tdm_error nexell_hwc_window_set_name(hal_tdm_hwc_window *hwc_window, const char *name);
88 hal_tdm_error nexell_hwc_window_set_cursor_image(hal_tdm_hwc_window *hwc_window, int width, int height, int stride, void *ptr);
91 void nexell_pp_destroy(hal_tdm_pp *pp);
92 hal_tdm_error nexell_pp_set_info(hal_tdm_pp *pp, hal_tdm_info_pp *info);
93 hal_tdm_error nexell_pp_attach(hal_tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst);
94 hal_tdm_error nexell_pp_commit(hal_tdm_pp *pp);
95 hal_tdm_error nexell_pp_set_done_handler(hal_tdm_pp *pp, hal_tdm_pp_done_handler func, void *user_data);
98 hal_tdm_error tdm_nexell_display_create_output_list(tdm_nexell_display *display_data);
99 void tdm_nexell_display_destroy_output_list(tdm_nexell_display *display_data);
100 void tdm_nexell_display_update_output_status(tdm_nexell_display *display_data);
101 hal_tdm_error tdm_nexell_display_create_layer_list(tdm_nexell_display *display_data);
102 void tdm_nexell_display_destroy_buffer_list(tdm_nexell_display *display_data);
105 tdm_nexell_layer *nexell_output_data_get_layer_data(tdm_nexell_output *output_data, int layer_zops);
108 hal_tdm_error tdm_nexell_hwc_initailize_target_window(tdm_nexell_hwc *hwc_data);
109 hal_tdm_error nexell_hwc_target_window_set_info(tdm_nexell_hwc *hwc_data, int width, int height);
110 tbm_surface_queue_h tdm_nexell_hwc_window_create_tbm_buffer_queue(hal_tdm_hwc_window *hwc_window, hal_tdm_error *error);
111 tbm_surface_queue_h tdm_nexell_hwc_window_create_cursor_tbm_buffer_queue(hal_tdm_hwc_window *hwc_window, hal_tdm_error *error);
112 void tdm_nexell_hwc_window_destroy_tbm_buffer_queue(tbm_surface_queue_h tqueue);
114 /* nexell layer_data */
115 hal_tdm_error nexell_layer_get_capability(tdm_nexell_layer *layer_data, tdm_nexell_caps_layer *caps);
116 hal_tdm_error nexell_layer_set_property(tdm_nexell_layer *layer_data, unsigned int id, hal_tdm_value value);
117 hal_tdm_error nexell_layer_get_property(tdm_nexell_layer *layer_data, unsigned int id, hal_tdm_value *value);
118 hal_tdm_error nexell_layer_set_info(tdm_nexell_layer *layer_data, tdm_nexell_layer_info *info);
119 hal_tdm_error nexell_layer_get_info(tdm_nexell_layer *layer_data, tdm_nexell_layer_info *info);
120 hal_tdm_error nexell_layer_set_buffer(tdm_nexell_layer *layer_data, tbm_surface_h buffer);
121 hal_tdm_error nexell_layer_unset_buffer(tdm_nexell_layer *layer_data);
124 hal_tdm_error tdm_nexell_pp_get_capability(tdm_nexell_display *display_data, hal_tdm_caps_pp *caps);
125 hal_tdm_pp* tdm_nexell_pp_create(tdm_nexell_display *display_data, hal_tdm_error *error);
126 void tdm_nexell_pp_handler(unsigned int prop_id, unsigned int *buf_idx, unsigned int tv_sec, unsigned int tv_usec, void *data);
127 void tdm_nexell_pp_cb(int fd, unsigned int prop_id, unsigned int *buf_idx, unsigned int tv_sec, unsigned int tv_usec, void *user_data);
130 uint32_t tdm_nexell_format_to_drm_format(tbm_format format);
131 tbm_format tdm_nexell_format_to_tbm_format(uint32_t format);
133 #endif /* _HAL_TDM_NEXELL_H_ */