1 /**************************************************************************
5 Copyright 2015 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 **************************************************************************/
38 drm_hwc_window_destroy(tdm_hwc_window *hwc_window)
40 tdm_drm_hwc_window_data *hwc_window_data = hwc_window;
42 RETURN_IF_FAIL(hwc_window_data != NULL);
44 LIST_DEL(&hwc_window_data->link);
46 free(hwc_window_data);
50 drm_hwc_window_set_composition_type(tdm_hwc_window *hwc_window,
51 tdm_hwc_window_composition comp_type)
53 tdm_drm_hwc_window_data *hwc_window_data = hwc_window;
54 tdm_drm_hwc_data *hwc_data = hwc_window_data->hwc_data;
56 RETURN_VAL_IF_FAIL(hwc_window_data != NULL, TDM_ERROR_INVALID_PARAMETER);
57 RETURN_VAL_IF_FAIL(hwc_data != NULL, TDM_ERROR_INVALID_PARAMETER);
59 /* change the client_type when it is different from one which has before */
60 if (hwc_window_data->client_type == comp_type)
61 return TDM_ERROR_NONE;
63 hwc_window_data->client_type = comp_type;
65 return TDM_ERROR_NONE;
69 drm_hwc_window_set_buffer_damage(tdm_hwc_window *hwc_window, tdm_region damage)
71 tdm_drm_hwc_window_data *hwc_window_data = hwc_window;
73 RETURN_VAL_IF_FAIL(hwc_window_data != NULL, TDM_ERROR_INVALID_PARAMETER);
77 return TDM_ERROR_NONE;
81 drm_hwc_window_set_info(tdm_hwc_window *hwc_window, tdm_hwc_window_info *info)
83 tdm_drm_hwc_window_data *hwc_window_data = hwc_window;
84 tdm_drm_hwc_data *hwc_data;
86 RETURN_VAL_IF_FAIL(hwc_window_data != NULL, TDM_ERROR_INVALID_PARAMETER);
87 hwc_data = hwc_window_data->hwc_data;
88 RETURN_VAL_IF_FAIL(hwc_data != NULL, TDM_ERROR_INVALID_PARAMETER);
89 RETURN_VAL_IF_FAIL(info != NULL, TDM_ERROR_INVALID_PARAMETER);
91 if (!memcmp(&hwc_window_data->info, info, sizeof(tdm_hwc_window_info)))
92 return TDM_ERROR_NONE;
94 hwc_window_data->info = *info;
96 return TDM_ERROR_NONE;
100 drm_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h surface)
102 tdm_drm_hwc_window_data *hwc_window_data = hwc_window;
103 tdm_error err = TDM_ERROR_OPERATION_FAILED;
105 RETURN_VAL_IF_FAIL(hwc_window_data != NULL, err);
107 if (hwc_window_data->surface == surface)
108 return TDM_ERROR_NONE;
110 hwc_window_data->surface = surface;
112 return TDM_ERROR_NONE;
116 drm_hwc_window_set_property(tdm_hwc_window *hwc_window, unsigned int id, tdm_value value)
118 tdm_drm_hwc_window_data *hwc_window_data = hwc_window;
120 RETURN_VAL_IF_FAIL(hwc_window_data != NULL, TDM_ERROR_INVALID_PARAMETER);
124 return TDM_ERROR_NONE;
128 drm_hwc_window_get_property(tdm_hwc_window *hwc_window, unsigned int id, tdm_value *value)
130 tdm_drm_hwc_window_data *hwc_window_data = hwc_window;
132 RETURN_VAL_IF_FAIL(hwc_window_data != NULL, TDM_ERROR_INVALID_PARAMETER);
136 return TDM_ERROR_NONE;
140 drm_hwc_window_get_constraints(tdm_hwc_window *hwc_window, int *constraints)
142 tdm_drm_hwc_window_data *hwc_window_data = hwc_window;
144 RETURN_VAL_IF_FAIL(hwc_window_data != NULL, TDM_ERROR_INVALID_PARAMETER);
145 RETURN_VAL_IF_FAIL(constraints != NULL, TDM_ERROR_INVALID_PARAMETER);
150 return TDM_ERROR_NONE;
154 drm_hwc_window_set_name(tdm_hwc_window *hwc_window, const char *name)
156 tdm_drm_hwc_window_data *hwc_window_data = hwc_window;
158 RETURN_VAL_IF_FAIL(hwc_window_data != NULL, TDM_ERROR_INVALID_PARAMETER);
161 return TDM_ERROR_NONE;
163 snprintf(hwc_window_data->name, TDM_NAME_LEN, "%s", name);
165 return TDM_ERROR_NONE;
169 drm_hwc_window_set_cursor_image(tdm_hwc_window *hwc_window, int width, int height, int stride, void *ptr)
171 tdm_drm_hwc_window_data *hwc_window_data = hwc_window;
173 RETURN_VAL_IF_FAIL(hwc_window_data != NULL, TDM_ERROR_INVALID_PARAMETER);
174 RETURN_VAL_IF_FAIL(hwc_window_data->client_type == TDM_HWC_WIN_COMPOSITION_CURSOR, TDM_ERROR_INVALID_PARAMETER);
176 hwc_window_data->cursor_img.width = width;
177 hwc_window_data->cursor_img.height = height;
178 hwc_window_data->cursor_img.stride = stride;
179 hwc_window_data->cursor_img.ptr = ptr;
181 hwc_window_data->cursor_img_refresh = 1;
183 return TDM_ERROR_NONE;