tdm_hwc_window: do not check the null buffer
[platform/core/uifw/libtdm.git] / src / tdm_hwc_window.c
1 /**************************************************************************
2  *
3  * libtdm
4  *
5  * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
6  *
7  * Contact: Eunchul Kim <chulspro.kim@samsung.com>,
8  *          JinYoung Jeon <jy0.jeon@samsung.com>,
9  *          Taeheon Kim <th908.kim@samsung.com>,
10  *          YoungJun Cho <yj44.cho@samsung.com>,
11  *          SooChan Lim <sc1.lim@samsung.com>,
12  *          Boram Park <sc1.lim@samsung.com>
13  *
14  * Permission is hereby granted, free of charge, to any person obtaining a
15  * copy of this software and associated documentation files (the
16  * "Software"), to deal in the Software without restriction, including
17  * without limitation the rights to use, copy, modify, merge, publish,
18  * distribute, sub license, and/or sell copies of the Software, and to
19  * permit persons to whom the Software is furnished to do so, subject to
20  * the following conditions:
21  *
22  * The above copyright notice and this permission notice (including the
23  * next paragraph) shall be included in all copies or substantial portions
24  * of the Software.
25  *
26  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
27  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
29  * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
30  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
31  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
32  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33  *
34 **************************************************************************/
35
36 #ifdef HAVE_CONFIG_H
37 #include "config.h"
38 #endif
39
40 #include "tdm_private.h"
41
42 #define COUNT_MAX   10
43
44 #define HWC_WINDOW_FUNC_ENTRY() \
45         tdm_private_display *private_display; \
46         tdm_private_output *private_output; \
47         tdm_private_hwc_window *private_hwc_window; \
48         tdm_error ret = TDM_ERROR_NONE; /* default TDM_ERROR_NONE */\
49         TDM_RETURN_VAL_IF_FAIL(hwc_window != NULL, TDM_ERROR_INVALID_PARAMETER); \
50         private_hwc_window = (tdm_private_hwc_window*)hwc_window; \
51         private_output = private_hwc_window->private_output; \
52         private_display = private_output->private_display
53
54 #define HWC_WINDOW_FUNC_ENTRY_ERROR() \
55         tdm_private_display *private_display; \
56         tdm_private_output *private_output; \
57         tdm_private_hwc_window *private_hwc_window; \
58         tdm_error ret = TDM_ERROR_NONE; /* default TDM_ERROR_NONE */\
59         TDM_RETURN_VAL_IF_FAIL_WITH_ERROR(hwc_window != NULL, TDM_ERROR_INVALID_PARAMETER, NULL); \
60         private_hwc_window = (tdm_private_hwc_window*)hwc_window; \
61         private_output = private_hwc_window->private_output; \
62         private_display = private_output->private_display
63
64 #define HWC_WINDOW_FUNC_ENTRY_VOID_RETURN() \
65         tdm_private_display *private_display; \
66         tdm_private_output *private_output; \
67         tdm_private_hwc_window *private_hwc_window; \
68         tdm_error ret = TDM_ERROR_NONE; /* default TDM_ERROR_NONE */\
69         TDM_RETURN_IF_FAIL(hwc_window != NULL); \
70         private_hwc_window = (tdm_private_hwc_window*)hwc_window; \
71         private_output = private_hwc_window->private_output; \
72         private_display = private_output->private_display
73
74 tbm_surface_queue_h
75 tdm_hwc_window_get_tbm_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error)
76 {
77         tdm_func_hwc_window *func_hwc_window = NULL;
78         tbm_surface_queue_h queue = NULL;
79
80         HWC_WINDOW_FUNC_ENTRY_ERROR();
81
82         _pthread_mutex_lock(&private_display->lock);
83
84         func_hwc_window = &private_display->func_hwc_window;
85
86         if (!func_hwc_window->hwc_window_get_tbm_buffer_queue) {
87                 /* LCOV_EXCL_START */
88                 _pthread_mutex_unlock(&private_display->lock);
89                 TDM_ERR("not implemented!!");
90                 if (error)
91                         *error = TDM_ERROR_NOT_IMPLEMENTED;
92                 return NULL;
93                 /* LCOV_EXCL_STOP */
94         }
95
96         queue = func_hwc_window->hwc_window_get_tbm_buffer_queue(private_hwc_window->hwc_window_backend, error);
97
98         _pthread_mutex_unlock(&private_display->lock);
99
100         return queue;
101 }
102
103 EXTERN tdm_error
104 tdm_hwc_window_set_composition_type(tdm_hwc_window *hwc_window,
105                                                                         tdm_hwc_window_composition composition_type)
106 {
107         tdm_func_hwc_window *func_hwc_window = NULL;
108
109         HWC_WINDOW_FUNC_ENTRY();
110         TDM_RETURN_VAL_IF_FAIL(composition_type >= TDM_COMPOSITION_NONE, TDM_ERROR_INVALID_PARAMETER);
111         TDM_RETURN_VAL_IF_FAIL(composition_type <= TDM_COMPOSITION_VIDEO, TDM_ERROR_INVALID_PARAMETER);
112
113         _pthread_mutex_lock(&private_display->lock);
114
115         func_hwc_window = &private_display->func_hwc_window;
116
117         if (!func_hwc_window->hwc_window_set_composition_type) {
118                 /* LCOV_EXCL_START */
119                 _pthread_mutex_unlock(&private_display->lock);
120                 TDM_ERR("not implemented!!");
121                 return TDM_ERROR_NOT_IMPLEMENTED;
122                 /* LCOV_EXCL_STOP */
123         }
124
125         ret = func_hwc_window->hwc_window_set_composition_type(private_hwc_window->hwc_window_backend, composition_type);
126
127         _pthread_mutex_unlock(&private_display->lock);
128
129         return ret;
130 }
131
132 EXTERN tdm_error
133 tdm_hwc_window_set_buffer_damage(tdm_hwc_window *hwc_window, tdm_hwc_region damage)
134 {
135         tdm_func_hwc_window *func_hwc_window = NULL;
136
137         HWC_WINDOW_FUNC_ENTRY();
138         if (damage.num_rects > 0)
139                 TDM_RETURN_VAL_IF_FAIL(damage.rects != NULL, TDM_ERROR_INVALID_PARAMETER);
140
141         _pthread_mutex_lock(&private_display->lock);
142
143         func_hwc_window = &private_display->func_hwc_window;
144
145         if (!func_hwc_window->hwc_window_set_buffer_damage) {
146                 /* LCOV_EXCL_START */
147                 _pthread_mutex_unlock(&private_display->lock);
148                 TDM_ERR("not implemented!!");
149                 return TDM_ERROR_NOT_IMPLEMENTED;
150                 /* LCOV_EXCL_STOP */
151         }
152
153         ret = func_hwc_window->hwc_window_set_buffer_damage(private_hwc_window->hwc_window_backend, damage);
154
155         _pthread_mutex_unlock(&private_display->lock);
156
157         return ret;
158 }
159
160
161 EXTERN tdm_error
162 tdm_hwc_window_set_info(tdm_hwc_window *hwc_window, tdm_hwc_window_info *info)
163 {
164         tdm_func_hwc_window *func_hwc_window = NULL;
165         char fmtstr[128];
166
167         HWC_WINDOW_FUNC_ENTRY();
168
169         TDM_RETURN_VAL_IF_FAIL(info != NULL, TDM_ERROR_INVALID_PARAMETER);
170
171         _pthread_mutex_lock(&private_display->lock);
172
173         func_hwc_window = &private_display->func_hwc_window;
174
175         if (!func_hwc_window->hwc_window_set_info) {
176                 /* LCOV_EXCL_START */
177                 _pthread_mutex_unlock(&private_display->lock);
178                 TDM_ERR("not implemented!!");
179                 return TDM_ERROR_NOT_IMPLEMENTED;
180                 /* LCOV_EXCL_STOP */
181         }
182
183         if (info->src_config.format)
184                 snprintf(fmtstr, 128, "%c%c%c%c", FOURCC_STR(info->src_config.format));
185         else
186                 snprintf(fmtstr, 128, "NONE");
187
188         TDM_INFO("hwc_window(%p) info: src(%dx%d %d,%d %dx%d %s) dst(%d,%d %dx%d) trans(%d)",
189                          private_hwc_window, info->src_config.size.h, info->src_config.size.v,
190                          info->src_config.pos.x, info->src_config.pos.y,
191                          info->src_config.pos.w, info->src_config.pos.h,
192                          fmtstr,
193                          info->dst_pos.x, info->dst_pos.y,
194                          info->dst_pos.w, info->dst_pos.h,
195                          info->transform);
196
197         ret = func_hwc_window->hwc_window_set_info(private_hwc_window->hwc_window_backend, info);
198
199         _pthread_mutex_unlock(&private_display->lock);
200
201         return ret;
202 }
203
204 EXTERN tdm_error
205 tdm_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h buffer)
206 {
207         tdm_func_hwc_window *func_hwc_window;
208
209         HWC_WINDOW_FUNC_ENTRY();
210
211         _pthread_mutex_lock(&private_display->lock);
212
213         if ((tdm_debug_dump & TDM_DUMP_FLAG_WINDOW) && buffer) {
214                 /* LCOV_EXCL_START */
215                 char str[TDM_PATH_LEN];
216                 static int i;
217                 snprintf(str, TDM_PATH_LEN, "window_%d_%03d", private_output->index, i++);
218                 tdm_helper_dump_buffer_str(buffer, tdm_debug_dump_dir, str);
219                 /* LCOV_EXCL_STOP */
220         }
221
222         func_hwc_window = &private_display->func_hwc_window;
223
224         if (!func_hwc_window->hwc_window_set_buffer) {
225                 /* LCOV_EXCL_START */
226                 _pthread_mutex_unlock(&private_display->lock);
227                 TDM_ERR("not implemented!!");
228                 return TDM_ERROR_NOT_IMPLEMENTED;
229                 /* LCOV_EXCL_STOP */
230         }
231
232         ret = func_hwc_window->hwc_window_set_buffer(private_hwc_window->hwc_window_backend, buffer);
233
234         _pthread_mutex_unlock(&private_display->lock);
235
236         return ret;
237 }
238
239 EXTERN tdm_error
240 tdm_hwc_window_unset_buffer(tdm_hwc_window *hwc_window)
241 {
242         tdm_func_hwc_window *func_hwc_window;
243
244         HWC_WINDOW_FUNC_ENTRY();
245
246         _pthread_mutex_lock(&private_display->lock);
247
248         func_hwc_window = &private_display->func_hwc_window;
249
250         if (!func_hwc_window->hwc_window_unset_buffer) {
251                 /* LCOV_EXCL_START */
252                 _pthread_mutex_unlock(&private_display->lock);
253                 TDM_ERR("not implemented!!");
254                 return TDM_ERROR_NOT_IMPLEMENTED;
255                 /* LCOV_EXCL_STOP */
256         }
257
258         ret = func_hwc_window->hwc_window_unset_buffer(private_hwc_window->hwc_window_backend);
259
260         _pthread_mutex_unlock(&private_display->lock);
261
262         return ret;
263 }
264
265 INTERN tdm_hwc_window *
266 tdm_hwc_window_create_internal(tdm_private_output *private_output, int is_video,
267                                                                    tdm_error *error)
268 {
269         tdm_private_display *private_display = private_output->private_display;
270         tdm_func_output *func_output = &private_display->func_output;
271         tdm_private_hwc_window *private_hwc_window = NULL;
272         tdm_hwc_window *hwc_window_backend = NULL;
273         tdm_error ret = TDM_ERROR_NONE;
274
275         TDM_RETURN_VAL_IF_FAIL(TDM_MUTEX_IS_LOCKED(), NULL);
276
277         if (!is_video) {
278                 if (!func_output->output_hwc_create_window) {
279                         /* LCOV_EXCL_START */
280                         if (error)
281                                 *error = TDM_ERROR_BAD_MODULE;
282                         return NULL;
283                         /* LCOV_EXCL_STOP */
284                 }
285
286                 hwc_window_backend = func_output->output_hwc_create_window(
287                                                  private_output->output_backend, &ret);
288                 if (ret != TDM_ERROR_NONE) {
289                         if (error)
290                                 *error = ret;
291                         return NULL;
292                 }
293         } else {
294                 if (!func_output->output_hwc_create_video_window) {
295                         /* LCOV_EXCL_START */
296                         if (error)
297                                 *error = TDM_ERROR_NOT_IMPLEMENTED;
298                         return NULL;
299                         /* LCOV_EXCL_STOP */
300                 }
301
302                 hwc_window_backend = func_output->output_hwc_create_video_window(
303                                                  private_output->output_backend, &ret);
304                 if (ret != TDM_ERROR_NONE) {
305                         if (error)
306                                 *error = ret;
307                         return NULL;
308                 }
309         }
310
311         private_hwc_window = calloc(1, sizeof(tdm_private_hwc_window));
312         if (!private_hwc_window) {
313                 /* LCOV_EXCL_START */
314                 TDM_ERR("failed: alloc memory");
315                 func_output->output_hwc_destroy_window(private_output->output_backend, hwc_window_backend);
316                 if (error)
317                         *error = TDM_ERROR_OUT_OF_MEMORY;
318                 return NULL;
319                 /* LCOV_EXCL_STOP */
320         }
321
322         LIST_ADD(&private_hwc_window->link, &private_output->hwc_window_list);
323
324         private_hwc_window->private_display = private_display;
325         private_hwc_window->private_output = private_output;
326         private_hwc_window->hwc_window_backend = hwc_window_backend;
327
328         TDM_DBG("hwc_window(%p) create", private_hwc_window);
329
330         if (error)
331                 *error = TDM_ERROR_NONE;
332
333         return private_hwc_window;
334 }
335
336 INTERN tdm_error
337 tdm_hwc_window_destroy_internal(tdm_private_hwc_window * private_hwc_window)
338 {
339         tdm_private_display *private_display;
340         tdm_private_output *private_output;
341         tdm_func_output *func_output;
342
343         TDM_RETURN_VAL_IF_FAIL(TDM_MUTEX_IS_LOCKED(), TDM_ERROR_OPERATION_FAILED);
344
345         if (!private_hwc_window)
346                 return TDM_ERROR_OPERATION_FAILED;
347
348         private_display = private_hwc_window->private_display;
349         private_output = private_hwc_window->private_output;
350
351         LIST_DEL(&private_hwc_window->link);
352
353         func_output = &private_display->func_output;
354         func_output->output_hwc_destroy_window(private_output->output_backend, private_hwc_window->hwc_window_backend);
355
356         free(private_hwc_window);
357         return TDM_ERROR_NONE;
358 }
359
360 EXTERN tdm_error
361 tdm_hwc_window_set_flags(tdm_hwc_window *hwc_window, tdm_hwc_window_flag flags)
362 {
363         tdm_func_hwc_window *func_hwc_window = NULL;
364
365         HWC_WINDOW_FUNC_ENTRY();
366
367         _pthread_mutex_lock(&private_display->lock);
368
369         func_hwc_window = &private_display->func_hwc_window;
370
371         if (!func_hwc_window->hwc_window_set_flags) {
372                 /* LCOV_EXCL_START */
373                 _pthread_mutex_unlock(&private_display->lock);
374                 TDM_ERR("not implemented!!");
375                 return TDM_ERROR_NOT_IMPLEMENTED;
376                 /* LCOV_EXCL_STOP */
377         }
378
379         ret = func_hwc_window->hwc_window_set_flags(private_hwc_window->hwc_window_backend, flags);
380
381         _pthread_mutex_unlock(&private_display->lock);
382
383         return ret;
384 }
385
386 EXTERN tdm_error
387 tdm_hwc_window_unset_flags(tdm_hwc_window *hwc_window, tdm_hwc_window_flag flags)
388 {
389         tdm_func_hwc_window *func_hwc_window = NULL;
390
391         HWC_WINDOW_FUNC_ENTRY();
392
393         _pthread_mutex_lock(&private_display->lock);
394
395         func_hwc_window = &private_display->func_hwc_window;
396
397         if (!func_hwc_window->hwc_window_unset_flags) {
398                 /* LCOV_EXCL_START */
399                 _pthread_mutex_unlock(&private_display->lock);
400                 TDM_ERR("not implemented!!");
401                 return TDM_ERROR_NOT_IMPLEMENTED;
402                 /* LCOV_EXCL_STOP */
403         }
404
405         ret = func_hwc_window->hwc_window_unset_flags(private_hwc_window->hwc_window_backend, flags);
406
407         _pthread_mutex_unlock(&private_display->lock);
408
409         return ret;
410 }
411
412 static void
413 _tdm_hwc_window_layer_commit_handler(tdm_layer *layer, unsigned int sequence,
414                                                                                  unsigned int tv_sec, unsigned int tv_usec,
415                                                                                  void *user_data)
416 {
417         tdm_private_hwc_window_commit_handler *hwc_window_commit_handler = (tdm_private_hwc_window_commit_handler *)user_data;
418         tdm_hwc_window_commit_handler func = hwc_window_commit_handler->func;
419         tdm_hwc_window *hwc_window = (tdm_hwc_window *)hwc_window_commit_handler->private_hwc_window;
420         void *data = hwc_window_commit_handler->user_data;
421
422         func(hwc_window, sequence, tv_sec, tv_usec, data);
423
424         free(hwc_window_commit_handler);
425 }
426
427 tdm_error
428 tdm_hwc_window_commit(tdm_hwc_window *hwc_window, tdm_hwc_window_commit_handler func, void *user_data)
429 {
430         tdm_func_hwc_window *func_hwc_window = NULL;
431         tdm_private_hwc_window_commit_handler *hwc_window_commit_handler;
432         tdm_layer *layer = NULL;
433         tdm_private_layer *private_layer;
434         tdm_info_layer *info_layer;
435         tdm_hwc_window_info window_info;
436         tbm_surface_h buffer;
437
438         HWC_WINDOW_FUNC_ENTRY();
439
440         _pthread_mutex_lock(&private_display->lock);
441
442         func_hwc_window = &private_display->func_hwc_window;
443
444         if (!func_hwc_window->hwc_window_get_layer) {
445                 /* LCOV_EXCL_START */
446                 _pthread_mutex_unlock(&private_display->lock);
447                 TDM_ERR("not implemented!!");
448                 return TDM_ERROR_NOT_IMPLEMENTED;
449                 /* LCOV_EXCL_STOP */
450         }
451
452         layer = func_hwc_window->hwc_window_get_layer(private_hwc_window->hwc_window_backend,
453                                                                                                                    &ret);
454         if (!layer) {
455                 /* LCOV_EXCL_START */
456                 _pthread_mutex_unlock(&private_display->lock);
457                 TDM_ERR("no assigned layer!!");
458                 return TDM_ERROR_INVALID_PARAMETER;
459                 /* LCOV_EXCL_STOP */
460         }
461
462         private_layer = (tdm_private_layer*)layer;
463
464         buffer = func_hwc_window->hwc_window_get_buffer(private_hwc_window->hwc_window_backend,
465                                                                                                                    &ret);
466         if (buffer)
467                 ret = tdm_layer_set_buffer_internal(private_layer, buffer);
468         else
469                 ret = tdm_layer_unset_buffer_internal(private_layer);
470         if (ret != TDM_ERROR_NONE) {
471                 /* LCOV_EXCL_START */
472                 TDM_ERR("failed: layer set buffer(window)");
473                 /* LCOV_EXCL_STOP */
474                 return ret;
475         }
476
477         ret = func_hwc_window->hwc_window_get_info(private_hwc_window->hwc_window_backend,
478                                                                                                                    &window_info);
479         if (ret != TDM_ERROR_NONE) {
480                 /* LCOV_EXCL_START */
481                 TDM_ERR("failed: commit layer(window)");
482                 /* LCOV_EXCL_STOP */
483                 return ret;
484         }
485
486         info_layer = (tdm_info_layer *)&window_info;
487         ret = tdm_layer_set_info_internal(private_layer, info_layer);
488         if (ret != TDM_ERROR_NONE) {
489                 /* LCOV_EXCL_START */
490                 TDM_ERR("failed: layer set info(window)");
491                 /* LCOV_EXCL_STOP */
492                 return ret;
493         }
494
495         hwc_window_commit_handler = calloc(1, sizeof(tdm_private_hwc_window_commit_handler));
496         if (!hwc_window_commit_handler) {
497                 /* LCOV_EXCL_START */
498                 TDM_ERR("failed: alloc memory");
499                 return TDM_ERROR_OUT_OF_MEMORY;
500                 /* LCOV_EXCL_STOP */
501         }
502
503         hwc_window_commit_handler->private_hwc_window = private_hwc_window;
504         hwc_window_commit_handler->func = func;
505         hwc_window_commit_handler->user_data = user_data;
506
507         ret = tdm_layer_commit_internal(private_layer, _tdm_hwc_window_layer_commit_handler, user_data);
508         if (ret != TDM_ERROR_NONE) {
509                 /* LCOV_EXCL_START */
510                 TDM_ERR("failed: commit layer(window)");
511                 free(hwc_window_commit_handler);
512                 /* LCOV_EXCL_STOP */
513                 return ret;
514         }
515
516         _pthread_mutex_unlock(&private_display->lock);
517
518         return ret;
519 }
520
521 EXTERN tdm_error
522 tdm_hwc_window_video_get_capability(tdm_hwc_window *hwc_window,
523                                                                         tdm_hwc_window_video_capability *video_capability)
524 {
525         tdm_func_hwc_window *func_hwc_window = NULL;
526
527         HWC_WINDOW_FUNC_ENTRY();
528
529         TDM_RETURN_VAL_IF_FAIL(video_capability != NULL, TDM_ERROR_INVALID_PARAMETER);
530
531         _pthread_mutex_lock(&private_display->lock);
532
533         func_hwc_window = &private_display->func_hwc_window;
534
535         if (!func_hwc_window->hwc_window_video_get_capability) {
536                 /* LCOV_EXCL_START */
537                 _pthread_mutex_unlock(&private_display->lock);
538                 TDM_ERR("not implemented!!");
539                 return TDM_ERROR_NOT_IMPLEMENTED;
540                 /* LCOV_EXCL_STOP */
541         }
542
543         ret = func_hwc_window->hwc_window_video_get_capability(private_hwc_window->hwc_window_backend,
544                                                                                                                    video_capability);
545
546         _pthread_mutex_unlock(&private_display->lock);
547
548         return ret;
549 }
550
551 EXTERN tdm_error
552 tdm_hwc_window_video_get_available_properties(tdm_hwc_window *hwc_window,
553                                                                                           const tdm_prop **props, int *count)
554 {
555         tdm_func_hwc_window *func_hwc_window = NULL;
556
557         HWC_WINDOW_FUNC_ENTRY();
558
559         TDM_RETURN_VAL_IF_FAIL(props != NULL, TDM_ERROR_INVALID_PARAMETER);
560         TDM_RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
561
562         _pthread_mutex_lock(&private_display->lock);
563
564         func_hwc_window = &private_display->func_hwc_window;
565
566         if (!func_hwc_window->hwc_window_video_get_available_properties) {
567                 /* LCOV_EXCL_START */
568                 _pthread_mutex_unlock(&private_display->lock);
569                 TDM_ERR("not implemented!!");
570                 return TDM_ERROR_NOT_IMPLEMENTED;
571                 /* LCOV_EXCL_STOP */
572         }
573
574         ret = func_hwc_window->hwc_window_video_get_available_properties(private_hwc_window->hwc_window_backend,
575                                                                                                                                          props, count);
576
577         _pthread_mutex_unlock(&private_display->lock);
578
579         return ret;
580 }
581
582 EXTERN tdm_error
583 tdm_hwc_window_video_get_property(tdm_hwc_window *hwc_window,
584                                                                         unsigned int id, tdm_value *value)
585 {
586         tdm_func_hwc_window *func_hwc_window = NULL;
587
588         HWC_WINDOW_FUNC_ENTRY();
589
590         TDM_RETURN_VAL_IF_FAIL(value != NULL, TDM_ERROR_INVALID_PARAMETER);
591
592         _pthread_mutex_lock(&private_display->lock);
593
594         func_hwc_window = &private_display->func_hwc_window;
595
596         if (!func_hwc_window->hwc_window_video_get_property) {
597                 /* LCOV_EXCL_START */
598                 _pthread_mutex_unlock(&private_display->lock);
599                 TDM_ERR("not implemented!!");
600                 return TDM_ERROR_NOT_IMPLEMENTED;
601                 /* LCOV_EXCL_STOP */
602         }
603
604         ret = func_hwc_window->hwc_window_video_get_property(private_hwc_window->hwc_window_backend,
605                                                                                                                  id, value);
606
607         _pthread_mutex_unlock(&private_display->lock);
608
609         return ret;
610 }
611
612 EXTERN tdm_error
613 tdm_hwc_window_video_set_property(tdm_hwc_window *hwc_window,
614                                                                         unsigned int id, tdm_value value)
615 {
616         tdm_func_hwc_window *func_hwc_window = NULL;
617
618         HWC_WINDOW_FUNC_ENTRY();
619
620         _pthread_mutex_lock(&private_display->lock);
621
622         func_hwc_window = &private_display->func_hwc_window;
623
624         if (!func_hwc_window->hwc_window_video_set_property) {
625                 /* LCOV_EXCL_START */
626                 _pthread_mutex_unlock(&private_display->lock);
627                 TDM_ERR("not implemented!!");
628                 return TDM_ERROR_NOT_IMPLEMENTED;
629                 /* LCOV_EXCL_STOP */
630         }
631
632         ret = func_hwc_window->hwc_window_video_set_property(private_hwc_window->hwc_window_backend,
633                                                                                                                  id, value);
634
635         _pthread_mutex_unlock(&private_display->lock);
636
637         return ret;
638 }