5dd71a3b3743015aaef2e3b85a5dce03b42597e6
[platform/core/uifw/libtdm.git] / src / tdm_hwc.c
1 /**************************************************************************
2  *
3  * libtdm
4  *
5  * Copyright 2018 Samsung Electronics co., Ltd. All Rights Reserved.
6  *
7  * Contact: SooChan Lim <sc1.lim@samsung.com>,
8  *          Boram Park <boram1288.park@samsung.com>,
9  *          Changyeon Lee <cyeon.lee@samsung.com>,
10  *          Sangjin Lee <lsj119@samsung.com>
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining a
13  * copy of this software and associated documentation files (the
14  * "Software"), to deal in the Software without restriction, including
15  * without limitation the rights to use, copy, modify, merge, publish,
16  * distribute, sub license, and/or sell copies of the Software, and to
17  * permit persons to whom the Software is furnished to do so, subject to
18  * the following conditions:
19  *
20  * The above copyright notice and this permission notice (including the
21  * next paragraph) shall be included in all copies or substantial portions
22  * of the Software.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
27  * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
28  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
29  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
30  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31  *
32 **************************************************************************/
33
34 #ifdef HAVE_CONFIG_H
35 #include "config.h"
36 #endif
37
38 #include "tdm_private.h"
39
40 #define HWC_FUNC_ENTRY() \
41         tdm_private_display *private_display; \
42         tdm_private_output *private_output; \
43         tdm_private_hwc *private_hwc; \
44         tdm_error ret = TDM_ERROR_NONE; /* default TDM_ERROR_NONE */\
45         TDM_RETURN_VAL_IF_FAIL(hwc != NULL, TDM_ERROR_INVALID_PARAMETER); \
46         private_hwc = (tdm_private_hwc*)hwc; \
47         private_output = private_hwc->private_output; \
48         TDM_RETURN_VAL_IF_FAIL(private_output != NULL, TDM_ERROR_INVALID_PARAMETER); \
49         private_display = private_output->private_display
50
51 #define HWC_FUNC_ENTRY_ERROR() \
52         tdm_private_display *private_display; \
53         tdm_private_output *private_output; \
54         tdm_private_hwc *private_hwc; \
55         tdm_error ret = TDM_ERROR_NONE; /* default TDM_ERROR_NONE */\
56         TDM_RETURN_VAL_IF_FAIL_WITH_ERROR(hwc != NULL, TDM_ERROR_INVALID_PARAMETER, NULL); \
57         private_hwc = (tdm_private_hwc*)hwc; \
58         private_output = private_hwc->private_output; \
59         TDM_RETURN_VAL_IF_FAIL_WITH_ERROR(private_output != NULL, TDM_ERROR_INVALID_PARAMETER, NULL); \
60         private_display = private_output->private_display
61
62 #define HWC_FUNC_ENTRY_VOID_RETURN() \
63         tdm_private_display *private_display; \
64         tdm_private_output *private_output; \
65         tdm_private_hwc *private_hwc; \
66         tdm_error ret = TDM_ERROR_NONE; /* default TDM_ERROR_NONE */\
67         TDM_RETURN_IF_FAIL(hwc != NULL); \
68         private_hwc = (tdm_private_hwc*)hwc; \
69         private_output = private_hwc->private_output; \
70         TDM_RETURN_IF_FAIL(private_output != NULL); \
71         private_display = private_output->private_display
72
73
74 static tdm_private_hwc_window *
75 _tdm_hwc_find_private_hwc_window(tdm_private_hwc *private_hwc, tdm_hwc_window *hwc_window_backend)
76 {
77         tdm_private_hwc_window *private_hwc_window = NULL;
78
79         LIST_FOR_EACH_ENTRY(private_hwc_window, &private_hwc->hwc_window_list, link) {
80                 if (private_hwc_window->hwc_window_backend == hwc_window_backend)
81                         return private_hwc_window;
82         }
83
84         return NULL;
85 }
86
87 static void
88 _tdm_hwc_thread_cb_commit(tdm_private_display *private_display, void *object,
89                                 tdm_thread_cb_base *cb_base, void *user_data)
90 {
91         tdm_thread_cb_hwc_commit *hwc_commit = (tdm_thread_cb_hwc_commit *)cb_base;
92         tdm_private_hwc_commit_handler *hwc_commit_handler = hwc_commit->base.data;
93         tdm_private_hwc *private_hwc = object;
94
95         TDM_RETURN_IF_FAIL(TDM_MUTEX_IS_LOCKED());
96
97         if (!hwc_commit_handler)
98                 return;
99
100         assert(hwc_commit_handler->owner_tid == syscall(SYS_gettid));
101
102         tdm_thread_cb_remove(private_hwc, TDM_THREAD_CB_HWC_COMMIT, hwc_commit_handler,
103                                         _tdm_hwc_thread_cb_commit, NULL);
104
105         LIST_DEL(&hwc_commit_handler->link);
106
107         if (tdm_debug_module & TDM_DEBUG_COMMIT) {
108                 TDM_INFO("----------------------------------------- hwc(%d) committed", private_hwc->index);
109                 TDM_INFO("handler(%p)", hwc_commit_handler);
110         }
111
112         if (hwc_commit_handler->func) {
113                 _pthread_mutex_unlock(&private_display->lock);
114                 hwc_commit_handler->func(private_hwc,
115                                                                         hwc_commit->sequence,
116                                                                         hwc_commit->tv_sec,
117                                                                         hwc_commit->tv_usec,
118                                                                         hwc_commit_handler->user_data);
119                 _pthread_mutex_lock(&private_display->lock);
120         }
121
122         free(hwc_commit_handler);
123
124         if (tdm_debug_module & TDM_DEBUG_COMMIT)
125                 TDM_INFO("-----------------------------------------...");
126 }
127
128 static void
129 _tdm_hwc_cb_commit(tdm_hwc *hwc_backend, unsigned int sequence,
130                                           unsigned int tv_sec, unsigned int tv_usec, void *user_data)
131 {
132         tdm_private_hwc_commit_handler *hwc_commit_handler = user_data;
133         tdm_private_hwc *private_hwc;
134         tdm_thread_cb_hwc_commit hwc_commit;
135         tdm_error ret;
136
137         if (hwc_commit_handler)
138                 private_hwc = hwc_commit_handler->private_hwc;
139         else
140                 private_hwc = tdm_display_find_private_hwc(tdm_display_get(), hwc_backend);
141
142         memset(&hwc_commit, 0, sizeof hwc_commit);
143         hwc_commit.base.type = TDM_THREAD_CB_HWC_COMMIT;
144         hwc_commit.base.length = sizeof hwc_commit;
145         hwc_commit.base.object_stamp = private_hwc->stamp;
146         hwc_commit.base.data = hwc_commit_handler;
147         hwc_commit.base.sync = 0;
148         hwc_commit.sequence = sequence;
149         hwc_commit.tv_sec = tv_sec;
150         hwc_commit.tv_usec = tv_usec;
151
152         ret = tdm_thread_cb_call(private_hwc, &hwc_commit.base, 1);
153         TDM_WARNING_IF_FAIL(ret == TDM_ERROR_NONE);
154 }
155
156 INTERN tdm_error
157 tdm_hwc_init(tdm_private_display *private_display)
158 {
159         tdm_thread_cb_set_find_func(TDM_THREAD_CB_HWC_COMMIT, tdm_display_find_hwc_stamp);
160
161         return TDM_ERROR_NONE;
162 }
163
164 EXTERN tdm_hwc_window *
165 tdm_hwc_create_window(tdm_hwc *hwc, tdm_error *error)
166 {
167         tdm_hwc_window *hwc_window = NULL;
168
169         HWC_FUNC_ENTRY_ERROR();
170
171         _pthread_mutex_lock(&private_display->lock);
172
173         hwc_window = (tdm_hwc_window *)tdm_hwc_window_create_internal(private_hwc, error);
174
175         _pthread_mutex_unlock(&private_display->lock);
176
177         return hwc_window;
178 }
179
180 EXTERN tdm_error
181 tdm_hwc_get_video_supported_formats(tdm_hwc *hwc, const tbm_format **formats, int *count)
182 {
183         tdm_private_module *private_module;
184         tdm_func_hwc *func_hwc;
185
186         HWC_FUNC_ENTRY();
187
188         TDM_RETURN_VAL_IF_FAIL(formats != NULL, TDM_ERROR_INVALID_PARAMETER);
189         TDM_RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
190
191         _pthread_mutex_lock(&private_display->lock);
192
193         private_module = private_output->private_module;
194         func_hwc = &private_module->func_hwc;
195
196         if (!func_hwc->hwc_get_video_supported_formats) {
197                 /* LCOV_EXCL_START */
198                 _pthread_mutex_unlock(&private_display->lock);
199                 TDM_WRN("not implemented!!");
200                 return TDM_ERROR_NOT_IMPLEMENTED;
201                 /* LCOV_EXCL_STOP */
202         }
203
204         ret = func_hwc->hwc_get_video_supported_formats(private_hwc->hwc_backend, formats, count);
205
206         _pthread_mutex_unlock(&private_display->lock);
207
208         return ret;
209 }
210
211 EXTERN tdm_error
212 tdm_hwc_get_video_capability(tdm_hwc *hwc,
213                                                         tdm_hwc_video_capability *video_capability)
214 {
215         tdm_private_module *private_module;
216         tdm_func_hwc *func_hwc;
217
218         HWC_FUNC_ENTRY();
219
220         _pthread_mutex_lock(&private_display->lock);
221
222         private_module = private_output->private_module;
223         func_hwc = &private_module->func_hwc;
224
225         if (!func_hwc->hwc_get_video_capability) {
226                 _pthread_mutex_unlock(&private_display->lock);
227                 TDM_WRN("not implemented!!");
228                 return TDM_ERROR_NOT_IMPLEMENTED;
229         }
230
231         ret = func_hwc->hwc_get_video_capability(private_hwc->hwc_backend,
232                                                                                         video_capability);
233
234         _pthread_mutex_unlock(&private_display->lock);
235
236         return ret;
237 }
238
239 EXTERN tdm_error
240 tdm_hwc_get_available_properties(tdm_hwc *hwc, const tdm_prop **props, int *count)
241 {
242         tdm_private_module *private_module;
243         tdm_func_hwc *func_hwc = NULL;
244
245         HWC_FUNC_ENTRY();
246
247         TDM_RETURN_VAL_IF_FAIL(props != NULL, TDM_ERROR_INVALID_PARAMETER);
248         TDM_RETURN_VAL_IF_FAIL(count != NULL, TDM_ERROR_INVALID_PARAMETER);
249
250         _pthread_mutex_lock(&private_display->lock);
251
252         private_module = private_output->private_module;
253         func_hwc = &private_module->func_hwc;
254
255         if (!func_hwc->hwc_get_available_properties) {
256                 /* LCOV_EXCL_START */
257                 _pthread_mutex_unlock(&private_display->lock);
258                 TDM_WRN("not implemented!!");
259                 return TDM_ERROR_NOT_IMPLEMENTED;
260                 /* LCOV_EXCL_STOP */
261         }
262
263         ret = func_hwc->hwc_get_available_properties(private_hwc->hwc_backend, props, count);
264
265         _pthread_mutex_unlock(&private_display->lock);
266
267         return ret;
268 }
269
270 EXTERN tbm_surface_queue_h
271 tdm_hwc_get_client_target_buffer_queue(tdm_hwc *hwc, tdm_error *error)
272 {
273         tdm_private_module *private_module;
274         tdm_func_hwc *func_hwc = NULL;
275         tbm_surface_queue_h queue = NULL;
276
277         HWC_FUNC_ENTRY_ERROR();
278
279         _pthread_mutex_lock(&private_display->lock);
280
281         private_module = private_hwc->private_module;
282         func_hwc = &private_module->func_hwc;
283
284         if (!func_hwc->hwc_get_client_target_buffer_queue) {
285                 /* LCOV_EXCL_START */
286                 _pthread_mutex_unlock(&private_display->lock);
287                 TDM_WRN("not implemented!!");
288                 return NULL;
289                 /* LCOV_EXCL_STOP */
290         }
291
292         queue = func_hwc->hwc_get_client_target_buffer_queue(private_hwc->hwc_backend, error);
293
294         _pthread_mutex_unlock(&private_display->lock);
295
296         return queue;
297 }
298
299 EXTERN tdm_error
300 tdm_hwc_set_client_target_buffer(tdm_hwc *hwc, tbm_surface_h target_buffer, tdm_region damage)
301 {
302         tdm_private_module *private_module;
303         tdm_func_hwc *func_hwc = NULL;
304
305         HWC_FUNC_ENTRY();
306
307         _pthread_mutex_lock(&private_display->lock);
308
309         if (tdm_debug_dump & TDM_DUMP_FLAG_WINDOW) {
310                 /* LCOV_EXCL_START */
311                 char str[TDM_PATH_LEN];
312                 static int i;
313                 snprintf(str, TDM_PATH_LEN, "target_window_%03d", i++);
314                 tdm_helper_dump_buffer_str(target_buffer, tdm_debug_dump_dir, str);
315                 /* LCOV_EXCL_STOP */
316         }
317
318         private_module = private_hwc->private_module;
319         func_hwc = &private_module->func_hwc;
320
321         if (!func_hwc->hwc_set_client_target_buffer) {
322                 /* LCOV_EXCL_START */
323                 _pthread_mutex_unlock(&private_display->lock);
324                 TDM_WRN("not implemented!!");
325                 return TDM_ERROR_NOT_IMPLEMENTED;
326                 /* LCOV_EXCL_STOP */
327         }
328
329         ret = func_hwc->hwc_set_client_target_buffer(private_hwc->hwc_backend, target_buffer, damage);
330
331         _pthread_mutex_unlock(&private_display->lock);
332
333         return ret;
334 }
335
336
337 EXTERN tdm_error
338 tdm_hwc_validate(tdm_hwc *hwc, tdm_hwc_window **composited_wnds, uint32_t num_wnds, uint32_t *num_types)
339 {
340         tdm_private_module *private_module;
341         tdm_func_hwc *func_hwc = NULL;
342         tdm_private_hwc_window **composited_wnds_frontend = NULL;
343         tdm_hwc_window **composited_wnds_backend = NULL;
344         int i;
345
346         HWC_FUNC_ENTRY();
347
348         TDM_RETURN_VAL_IF_FAIL(num_types != NULL, TDM_ERROR_INVALID_PARAMETER);
349
350         _pthread_mutex_lock(&private_display->lock);
351
352         private_module = private_hwc->private_module;
353         func_hwc = &private_module->func_hwc;
354
355         if (!func_hwc->hwc_validate) {
356                 /* LCOV_EXCL_START */
357                 _pthread_mutex_unlock(&private_display->lock);
358                 TDM_WRN("not implemented!!");
359                 return TDM_ERROR_NOT_IMPLEMENTED;
360                 /* LCOV_EXCL_STOP */
361         }
362
363         if (num_wnds == 0) {
364                 ret = func_hwc->hwc_validate(private_hwc->hwc_backend, NULL, 0, num_types);
365
366                 _pthread_mutex_unlock(&private_display->lock);
367                 return ret;
368         }
369
370         composited_wnds_backend = calloc(num_wnds, sizeof(tdm_hwc_window *));
371         if (!composited_wnds_backend) {
372                 /* LCOV_EXCL_START */
373                 _pthread_mutex_unlock(&private_display->lock);
374                 return TDM_ERROR_OUT_OF_MEMORY;
375                 /* LCOV_EXCL_STOP */
376         }
377
378         composited_wnds_frontend = (tdm_private_hwc_window **)composited_wnds;
379
380         for (i = 0; i < num_wnds; i++)
381                 composited_wnds_backend[i] = composited_wnds_frontend[i]->hwc_window_backend;
382
383         ret = func_hwc->hwc_validate(private_hwc->hwc_backend, composited_wnds_backend,
384                                                                 num_wnds, num_types);
385
386         free(composited_wnds_backend);
387
388         _pthread_mutex_unlock(&private_display->lock);
389
390         return ret;
391 }
392
393 EXTERN tdm_error
394 tdm_hwc_get_changed_composition_types(tdm_hwc *hwc, uint32_t *num_elements,
395                                                                 tdm_hwc_window **hwc_window,
396                                                                 tdm_hwc_window_composition *composition_types)
397 {
398         tdm_private_module *private_module;
399         tdm_func_hwc *func_hwc = NULL;
400         tdm_private_hwc_window * private_hwc_window = NULL;
401         int i = 0;
402
403         HWC_FUNC_ENTRY();
404
405         TDM_RETURN_VAL_IF_FAIL(num_elements != NULL, TDM_ERROR_INVALID_PARAMETER);
406
407         _pthread_mutex_lock(&private_display->lock);
408
409         private_module = private_hwc->private_module;
410         func_hwc = &private_module->func_hwc;
411
412         if (!func_hwc->hwc_get_changed_composition_types) {
413                 /* LCOV_EXCL_START */
414                 _pthread_mutex_unlock(&private_display->lock);
415                 TDM_WRN("not implemented!!");
416                 return TDM_ERROR_NOT_IMPLEMENTED;
417                 /* LCOV_EXCL_STOP */
418         }
419
420         ret = func_hwc->hwc_get_changed_composition_types(private_hwc->hwc_backend,
421                                                         num_elements, hwc_window, composition_types);
422         if (ret != TDM_ERROR_NONE) {
423                 /* LCOV_EXCL_START */
424                 _pthread_mutex_unlock(&private_display->lock);
425                 return ret;
426                 /* LCOV_EXCL_STOP */
427         }
428
429         if (hwc_window == NULL || composition_types == NULL) {
430                 _pthread_mutex_unlock(&private_display->lock);
431                 return TDM_ERROR_NONE;
432         }
433
434         for (i = 0; i < *num_elements; i++) {
435                 private_hwc_window = _tdm_hwc_find_private_hwc_window(private_hwc, hwc_window[i]);
436                 if (private_hwc_window == NULL) {
437                         /* LCOV_EXCL_START */
438                         TDM_ERR("failed! This should never happen!");
439                         tdm_hwc_window_destroy_internal(private_hwc_window);
440                         *num_elements = 0;
441                         _pthread_mutex_unlock(&private_display->lock);
442                         return TDM_ERROR_OPERATION_FAILED;
443                         /* LCOV_EXCL_STOP */
444                 }
445
446                 hwc_window[i] = (tdm_hwc_window*)private_hwc_window;
447         }
448
449         _pthread_mutex_unlock(&private_display->lock);
450
451         return ret;
452 }
453
454 EXTERN tdm_error
455 tdm_hwc_accept_validation(tdm_hwc *hwc)
456 {
457         tdm_private_module *private_module;
458         tdm_func_hwc *func_hwc = NULL;
459
460         HWC_FUNC_ENTRY();
461
462         _pthread_mutex_lock(&private_display->lock);
463
464         private_module = private_hwc->private_module;
465         func_hwc = &private_module->func_hwc;
466
467         if (!func_hwc->hwc_validate) {
468                 /* LCOV_EXCL_START */
469                 _pthread_mutex_unlock(&private_display->lock);
470                 TDM_WRN("not implemented!!");
471                 return TDM_ERROR_NOT_IMPLEMENTED;
472                 /* LCOV_EXCL_STOP */
473         }
474
475         ret = func_hwc->hwc_accept_validation(private_hwc->hwc_backend);
476
477         _pthread_mutex_unlock(&private_display->lock);
478
479         return ret;
480 }
481
482 /* temporary prototype to avoid build break */
483 tdm_error
484 tdm_hwc_accept_changes(tdm_hwc *hwc)
485 {
486    return tdm_hwc_accept_validation(hwc);
487 }
488
489 EXTERN tdm_error
490 tdm_hwc_commit(tdm_hwc *hwc, int sync, tdm_hwc_commit_handler func, void *user_data)
491 {
492         tdm_private_module *private_module;
493         tdm_func_hwc *func_hwc = NULL;
494         tdm_private_hwc_commit_handler *hwc_commit_handler = NULL;
495
496         HWC_FUNC_ENTRY();
497
498         _pthread_mutex_lock(&private_display->lock);
499
500         private_module = private_hwc->private_module;
501         func_hwc = &private_module->func_hwc;
502
503         if (!func_hwc->hwc_commit) {
504                 /* LCOV_EXCL_START */
505                 TDM_WRN("not implemented!!");
506                 _pthread_mutex_unlock(&private_display->lock);
507                 return TDM_ERROR_NOT_IMPLEMENTED;
508                 /* LCOV_EXCL_STOP */
509         }
510
511 //TODO: I am not sure yet whether we have to check the dpms at hwc_commit.
512 #if 0
513         /* check if the dpms is off */
514         if (TDM_OUTPUT_DPMS_VSYNC_IS_OFF(private_output->current_dpms_value)) {
515                 TDM_ERR("hwc(%d) dpms: %s", private_hwc->index,
516                                 tdm_dpms_str(private_output->current_dpms_value));
517                 _pthread_mutex_unlock(&private_display->lock);
518                 return TDM_ERROR_DPMS_OFF;
519         }
520 #endif
521
522         if (tdm_debug_module & TDM_DEBUG_COMMIT)
523                 TDM_INFO("hwc(%d) commit", private_hwc->index);
524
525         if (!private_hwc->regist_commit_cb) {
526                 private_hwc->regist_commit_cb = 1;
527                 ret = func_hwc->hwc_set_commit_handler(private_hwc->hwc_backend, _tdm_hwc_cb_commit);
528                 /* LCOV_EXCL_START */
529                 if (ret != TDM_ERROR_NONE) {
530                         private_hwc->regist_commit_cb = 0;
531                         TDM_ERR("hwc(%d) fail to set hwc_set_commit_handler", private_hwc->index);
532                         _pthread_mutex_unlock(&private_display->lock);
533                         return ret;
534                 /* LCOV_EXCL_STOP */
535                 }
536         }
537
538         hwc_commit_handler = calloc(1, sizeof(tdm_private_hwc_commit_handler));
539         if (!hwc_commit_handler) {
540                 /* LCOV_EXCL_START */
541                 TDM_ERR("failed: alloc memory");
542                 _pthread_mutex_unlock(&private_display->lock);
543                 return TDM_ERROR_OUT_OF_MEMORY;
544                 /* LCOV_EXCL_STOP */
545         }
546
547         ret = tdm_thread_cb_add(private_hwc, TDM_THREAD_CB_HWC_COMMIT, hwc_commit_handler,
548                                         _tdm_hwc_thread_cb_commit, NULL);
549         if (ret != TDM_ERROR_NONE) {
550                 TDM_ERR("tdm_thread_cb_add failed");
551                 free(hwc_commit_handler);
552                 _pthread_mutex_unlock(&private_display->lock);
553                 return ret;
554         }
555
556         LIST_ADDTAIL(&hwc_commit_handler->link, &private_hwc->hwc_commit_handler_list);
557         hwc_commit_handler->private_hwc = private_hwc;
558         hwc_commit_handler->func = func;
559         hwc_commit_handler->user_data = user_data;
560         hwc_commit_handler->owner_tid = syscall(SYS_gettid);
561
562         ret = func_hwc->hwc_commit(private_hwc->hwc_backend, sync, hwc_commit_handler);
563         TDM_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, commit_failed);
564
565         if (tdm_debug_module & TDM_DEBUG_COMMIT)
566                 TDM_INFO("hwc(%d) backend commit: handle(%p) func(%p) user_data(%p)",
567                                 private_hwc->index, hwc_commit_handler, func, user_data);
568
569         _pthread_mutex_unlock(&private_display->lock);
570
571         return ret;
572
573 commit_failed:
574         /* LCOV_EXCL_START */
575         if (hwc_commit_handler) {
576                 tdm_thread_cb_remove(private_hwc, TDM_THREAD_CB_HWC_COMMIT, hwc_commit_handler,
577                                                 _tdm_hwc_thread_cb_commit, NULL);
578                 LIST_DEL(&hwc_commit_handler->link);
579                 free(hwc_commit_handler);
580         }
581
582         _pthread_mutex_unlock(&private_display->lock);
583
584         return ret;
585         /* LCOV_EXCL_STOP */
586 }