package version up to 1.18.0
[platform/core/uifw/libtdm.git] / utests / src / ut_tdm_backend_capture.cpp
1 /**************************************************************************
2  *
3  * Copyright 2016 Samsung Electronics co., Ltd. All Rights Reserved.
4  *
5  * Contact: Konstantin Drabeniuk <k.drabeniuk@samsung.com>
6  * Contact: Andrii Sokolenko <a.sokolenko@samsung.com>
7  * Contact: Roman Marchenko <r.marchenko@samsung.com>
8  *
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:
16  *
17  * The above copyright notice and this permission notice (including the
18  * next paragraph) shall be included in all copies or substantial portions
19  * of the Software.
20  *
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.
28  *
29 **************************************************************************/
30
31 #include "ut_tdm.h"
32
33 /* LCOV_EXCL_START */
34 class TDMBackendCapture : public TDMBackendDisplay
35 {
36 public:
37         bool has_capture_cap;
38
39         tdm_capture *capture;
40         tdm_capture_capability capabilities;
41         const tbm_format *formats;
42         int format_count;
43         int min_w;
44         int min_h;
45         int max_w;
46         int max_h;
47         int preferred_align;
48
49         tbm_surface_h buffers[3];
50
51         tdm_info_capture info;
52
53         tdm_output *output;
54         unsigned int pipe;
55         const tdm_output_mode *mode;
56
57         tdm_layer *dst_layer;
58         int dst_zpos;
59         int dst_layer_index;
60         tdm_pos dst_pos;
61
62         bool stream_exit;
63         int stream_count;
64
65         TDMBackendCapture();
66         void SetUp(void);
67         void TearDown(void);
68
69         bool FindLayer(int output_idx, tbm_format fmt, tdm_pos *punch);
70         bool TestPrepareDefault(void);
71         bool TestPrepare(int output_idx, int w, int h, tbm_format fmt, tdm_transform t, tdm_capture_type c, int frequency, bool stretch);
72         void TestDone(void);
73         void ShowBuffer(int b, tdm_pos *pos);
74         void HideLayer(void);
75         void DumpBuffer(int b, char *test);
76         void DestroyBuffers(void);
77 };
78
79 TDMBackendCapture::TDMBackendCapture()
80 {
81         has_capture_cap = false;
82         capture = NULL;
83         capabilities = (tdm_capture_capability)0;
84         formats = NULL;
85         format_count = 0;
86         min_w = min_h = max_w = max_h = preferred_align = -1;
87
88         for (int b = 0; b < 3; b++)
89                 buffers[b] = NULL;
90         memset(&info, 0, sizeof info);
91
92         output = NULL;
93         pipe = 0;
94         mode = NULL;
95
96         dst_layer = NULL;
97         dst_zpos = 0;
98         dst_layer_index = 0;
99         memset(&dst_pos, 0, sizeof dst_pos);
100
101         stream_exit = false;
102         stream_count = 0;
103 }
104
105 void TDMBackendCapture::SetUp(void)
106 {
107         tdm_display_capability dpy_capabilities;
108
109         TDMBackendDisplay::SetUp();
110
111         ASSERT_EQ(tdm_display_get_capabilities(dpy, &dpy_capabilities), TDM_ERROR_NONE);
112         has_capture_cap = dpy_capabilities & TDM_DISPLAY_CAPABILITY_CAPTURE;
113
114         if (!has_capture_cap)
115                 return;
116
117         ASSERT_EQ(tdm_display_get_capture_capabilities(dpy, &capabilities), TDM_ERROR_NONE);
118         ASSERT_GT(capabilities, 0);
119         ASSERT_EQ(tdm_display_get_capture_available_formats(dpy, &formats, &format_count), TDM_ERROR_NONE);
120         ASSERT_NE(formats, NULL);
121         ASSERT_GT(format_count, 0);
122         ASSERT_EQ(tdm_display_get_capture_available_size(dpy, &min_w, &min_h, &max_w, &max_h, &preferred_align), TDM_ERROR_NONE);
123         ASSERT_TRUE(min_w == -1 || min_w > 0);
124         ASSERT_TRUE(min_h == -1 || min_h > 0);
125         ASSERT_TRUE(max_w == -1 || max_w > 0);
126         ASSERT_TRUE(max_h == -1 || max_h > 0);
127         ASSERT_TRUE(preferred_align == -1 || preferred_align > 0);
128
129         for (int o = 0; o < output_count; o++) {
130                 if (!ut_tdm_output_is_connected(outputs[o]))
131                         continue;
132
133                 ASSERT_EQ(ut_tdm_output_prepare(dpy, outputs[o], true), true);
134         }
135 }
136
137 void TDMBackendCapture::TearDown(void)
138 {
139         if (capture)
140                 tdm_capture_destroy(capture);
141
142         for (int o = 0; o < output_count; o++) {
143                 if (!ut_tdm_output_is_connected(outputs[o]))
144                         continue;
145
146                 ASSERT_EQ(ut_tdm_output_unset(dpy, outputs[o]), true);
147         }
148
149         DestroyBuffers();
150
151         TDMBackendDisplay::TearDown();
152 }
153
154 bool TDMBackendCapture::FindLayer(int output_idx, tbm_format fmt, tdm_pos *punch)
155 {
156         tdm_error ret;
157         int count;
158         int primary_zpos, zpos;
159         tdm_layer *primary = ut_tdm_output_get_primary_layer(outputs[output_idx]);
160         TDM_UT_RETURN_FALSE_IF_FAIL(primary != NULL);
161         TDM_UT_RETURN_FALSE_IF_FAIL(tdm_output_get_layer_count(outputs[output_idx], &count) == TDM_ERROR_NONE);
162         TDM_UT_RETURN_FALSE_IF_FAIL(tdm_layer_get_zpos(primary, &primary_zpos) == TDM_ERROR_NONE);
163
164         dst_layer = NULL;
165
166         for (int l = 0; l < count; l++) {
167                 unsigned int usable;
168                 const tbm_format *dst_formats;
169                 int dst_format_count;
170
171                 tdm_layer *temp = tdm_output_get_layer(outputs[output_idx], l, &ret);
172                 TDM_UT_RETURN_FALSE_IF_FAIL(ret == TDM_ERROR_NONE);
173                 TDM_UT_RETURN_FALSE_IF_FAIL(temp != NULL);
174                 TDM_UT_RETURN_FALSE_IF_FAIL(tdm_layer_is_usable(temp, &usable) == TDM_ERROR_NONE);
175                 TDM_UT_RETURN_FALSE_IF_FAIL(tdm_layer_get_zpos(temp, &zpos) == TDM_ERROR_NONE);
176                 TDM_UT_RETURN_FALSE_IF_FAIL(tdm_layer_get_available_formats(temp, &dst_formats, &dst_format_count) == TDM_ERROR_NONE);
177                 TDM_UT_RETURN_FALSE_IF_FAIL(dst_formats != NULL);
178                 TDM_UT_RETURN_FALSE_IF_FAIL(dst_format_count > 0);
179
180                 if (usable) {
181                         bool found = false;
182                         for (int f = 0; f < dst_format_count; f++) {
183                                 if (dst_formats[f] == fmt) {
184                                         found = true;
185                                         break;
186                                 }
187                         }
188                         if (!found)
189                                 continue;
190                         dst_layer = temp;
191                         dst_zpos = zpos;
192                         TDM_UT_RETURN_FALSE_IF_FAIL(tdm_layer_get_index(dst_layer, &dst_layer_index) == TDM_ERROR_NONE);
193                         break;
194                 }
195         }
196
197         if (dst_layer && (dst_zpos < primary_zpos)) {
198                 tbm_surface_h displaying_buffer = tdm_layer_get_displaying_buffer(primary, &ret);
199                 TDM_UT_RETURN_FALSE_IF_FAIL(ret == TDM_ERROR_NONE);
200                 TDM_UT_RETURN_FALSE_IF_FAIL(displaying_buffer != NULL);
201                 tdm_helper_clear_buffer_pos(displaying_buffer, punch);
202         }
203
204         return true;
205 }
206
207 bool TDMBackendCapture::TestPrepareDefault(void)
208 {
209         tdm_error ret;
210
211         for (int o = 0; o < output_count; o++) {
212                 if (!ut_tdm_output_is_connected(outputs[o]))
213                         continue;
214
215                 capture = tdm_output_create_capture(outputs[o], &ret);
216                 TDM_UT_RETURN_FALSE_IF_FAIL(ret == TDM_ERROR_NONE);
217                 TDM_UT_RETURN_FALSE_IF_FAIL(capture != NULL);
218
219                 TDM_UT_RETURN_FALSE_IF_FAIL(ut_tdm_buffer_create(TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, formats[0], 0, false, 3, buffers) == true);
220                 TDM_UT_RETURN_FALSE_IF_FAIL(ut_tdm_capture_fill_info(outputs[o], buffers[0], TDM_TRANSFORM_NORMAL, TDM_CAPTURE_TYPE_ONESHOT, -1, false, &info) == true);
221                 TDM_UT_RETURN_FALSE_IF_FAIL(tdm_capture_set_info(capture, &info) == TDM_ERROR_NONE);
222
223                 output = outputs[o];
224
225                 if (capture)
226                         break;
227         }
228
229         return (capture) ? true : false;
230 }
231
232 bool TDMBackendCapture::TestPrepare(int output_idx, int w, int h, tbm_format fmt, tdm_transform t, tdm_capture_type c, int frequency, bool stretch)
233 {
234         tdm_error ret;
235         int flags = 0;
236
237         TDM_UT_RETURN_FALSE_IF_FAIL(outputs != NULL);
238         TDM_UT_RETURN_FALSE_IF_FAIL(output_count > 0);
239         TDM_UT_RETURN_FALSE_IF_FAIL(output_count >= output_idx);
240
241         TDM_UT_RETURN_FALSE_IF_FAIL(tdm_display_get_capture_capabilities(dpy, &capabilities) == TDM_ERROR_NONE);
242         TDM_UT_RETURN_FALSE_IF_FAIL(capabilities > 0);
243
244         TDM_UT_RETURN_FALSE_IF_FAIL(tdm_display_get_capture_available_size(dpy, &min_w, &min_h, &max_w, &max_h, &preferred_align) == TDM_ERROR_NONE);
245         TDM_UT_RETURN_FALSE_IF_FAIL(min_w == -1 || min_w > 0);
246         TDM_UT_RETURN_FALSE_IF_FAIL(min_h == -1 || min_h > 0);
247         TDM_UT_RETURN_FALSE_IF_FAIL(max_w == -1 || max_w > 0);
248         TDM_UT_RETURN_FALSE_IF_FAIL(max_h == -1 || max_h > 0);
249         TDM_UT_RETURN_FALSE_IF_FAIL(preferred_align == -1 || preferred_align > 0);
250
251         capture = tdm_output_create_capture(outputs[output_idx], &ret);
252         TDM_UT_RETURN_FALSE_IF_FAIL(ret == TDM_ERROR_NONE);
253         TDM_UT_RETURN_FALSE_IF_FAIL(capture != NULL);
254
255         if (dst_layer) {
256                 tdm_layer_capability capabilities;
257                 TDM_UT_RETURN_FALSE_IF_FAIL(tdm_layer_get_capabilities(dst_layer, &capabilities) == TDM_ERROR_NONE);
258                 if (capabilities & TDM_LAYER_CAPABILITY_SCANOUT)
259                         flags |= TBM_BO_SCANOUT;
260         }
261
262         TDM_UT_RETURN_FALSE_IF_FAIL(ut_tdm_buffer_create(w, h, fmt, flags, false, 3, buffers) == true);
263         TDM_UT_RETURN_FALSE_IF_FAIL(ut_tdm_capture_fill_info(outputs[output_idx], buffers[0], t, c, frequency, stretch, &info) == true);
264         TDM_UT_RETURN_FALSE_IF_FAIL(tdm_capture_set_info(capture, &info) == TDM_ERROR_NONE);
265
266         output = outputs[output_idx];
267
268         return true;
269 }
270
271 void TDMBackendCapture::TestDone(void)
272 {
273         if (capture) {
274                 tdm_capture_destroy(capture);
275                 capture = NULL;
276         }
277
278         DestroyBuffers();
279 }
280
281 void TDMBackendCapture::DumpBuffer(int b, char *test)
282 {
283         char filename[256];
284         if (test)
285                 snprintf(filename, sizeof filename, "%s_%s_%d", typeid(*this).name(), test, b);
286         else
287                 snprintf(filename, sizeof filename, "%s_%d", typeid(*this).name(), b);
288         tdm_helper_dump_buffer_str(buffers[b], NULL, filename);
289 }
290
291 void TDMBackendCapture::ShowBuffer(int b, tdm_pos *pos)
292 {
293         ASSERT_NE(output, NULL);
294         ASSERT_NE(dst_layer, NULL);
295
296         ASSERT_EQ(ut_tdm_layer_set_buffer_with_pos(dst_layer, buffers[b], pos), true);
297         ASSERT_EQ(tdm_output_commit(output, 0, NULL, NULL), TDM_ERROR_NONE);
298 }
299
300 void TDMBackendCapture::HideLayer(void)
301 {
302         ASSERT_NE(output, NULL);
303         ASSERT_NE(dst_layer, NULL);
304
305         tdm_layer_unset_buffer(dst_layer);
306         tdm_output_commit(output, 0, NULL, NULL);
307
308         dst_layer = NULL;
309 }
310
311 void TDMBackendCapture::DestroyBuffers(void)
312 {
313         for (int b = 0; b < 3; b++) {
314                 tbm_surface_destroy(buffers[b]);
315                 buffers[b] = NULL;
316         }
317 }
318
319 static void
320 _ut_tdm_capture_fit_rect(int src_w, int src_h, int dst_w, int dst_h, tdm_pos *fit)
321 {
322         float rw, rh;
323
324         if (src_w <= 0 || src_h <= 0 || dst_w <= 0 || dst_h <= 0 || !fit)
325                 return;
326
327         rw = (float)src_w / dst_w;
328         rh = (float)src_h / dst_h;
329
330         if (rw > rh) {
331                 fit->w = dst_w;
332                 fit->h = src_h / rw;
333                 fit->x = 0;
334                 fit->y = (dst_h - fit->h) / 2;
335         } else if (rw < rh) {
336                 fit->w = src_w / rh;
337                 fit->h = dst_h;
338                 fit->x = (dst_w - fit->w) / 2;
339                 fit->y = 0;
340         } else {
341                 fit->w = dst_w;
342                 fit->h = dst_h;
343                 fit->x = 0;
344                 fit->y = 0;
345         }
346
347         if (fit->x % 2)
348                 fit->x = fit->x - 1;
349 }
350
351 bool
352 ut_tdm_capture_fill_info(tdm_output *output, tbm_surface_h buffer, tdm_transform transform,
353                                                  tdm_capture_type type, int frequency, bool stretch, tdm_info_capture *info)
354 {
355         int bw, bh;
356         const tdm_output_mode *mode = NULL;
357
358         TDM_UT_RETURN_FALSE_IF_FAIL(tdm_output_get_mode(output, &mode) == TDM_ERROR_NONE);
359         TDM_UT_RETURN_FALSE_IF_FAIL(mode != NULL);
360
361         memset(info, 0, sizeof *info);
362
363         bw = bh = TDM_UT_INVALID_VALUE;
364         tdm_helper_get_buffer_full_size(buffer, &bw, &bh);
365
366         TDM_UT_RETURN_FALSE_IF_FAIL(bw != TDM_UT_INVALID_VALUE);
367         TDM_UT_RETURN_FALSE_IF_FAIL(bw >= tbm_surface_get_width(buffer));
368         TDM_UT_RETURN_FALSE_IF_FAIL(bh != TDM_UT_INVALID_VALUE);
369         TDM_UT_RETURN_FALSE_IF_FAIL(bh >= tbm_surface_get_height(buffer));
370         info->dst_config.size.h = bw;
371         info->dst_config.size.v = bh;
372
373         if (stretch) {
374                 info->dst_config.pos.x = 0;
375                 info->dst_config.pos.y = 0;
376                 info->dst_config.pos.w = tbm_surface_get_width(buffer);
377                 info->dst_config.pos.h = tbm_surface_get_height(buffer);
378         } else {
379                 _ut_tdm_capture_fit_rect(mode->hdisplay, mode->vdisplay,
380                                                                  tbm_surface_get_width(buffer), tbm_surface_get_height(buffer),
381                                                                  &info->dst_config.pos);
382         }
383
384         info->dst_config.format = tbm_surface_get_format(buffer);
385
386         info->transform = transform;
387         info->type = type;
388         info->flags = 0;
389
390         if (frequency <= 0)
391                 frequency = mode->vrefresh;
392
393         info->frequency = frequency;
394
395         TDM_UT_INFO("filling capture info done: dst_config(%dx%d: %d,%d %dx%d: %c%c%c%c) transform(%s) type(%s) freq(%d)",
396                                 info->dst_config.size.h, info->dst_config.size.v,
397                                 info->dst_config.pos.x, info->dst_config.pos.y, info->dst_config.pos.w, info->dst_config.pos.h,
398                                 FOURCC_STR(info->dst_config.format),
399                                 tdm_transform_str(info->transform), tdm_capture_type_str(info->type), info->frequency);
400
401         return true;
402 }
403
404 TEST_P(TDMBackendCapture, CaptureDispalyGetAvaiableFormats)
405 {
406         const tbm_format *formats = (const tbm_format *)TDM_UT_INVALID_VALUE;
407         int count = TDM_UT_INVALID_VALUE;
408         if (has_capture_cap) {
409                 ASSERT_EQ(tdm_display_get_capture_available_formats(dpy, &formats, &count), TDM_ERROR_NONE);
410                 ASSERT_TRUE(formats != NULL && formats != (const tbm_format *)TDM_UT_INVALID_VALUE);
411                 ASSERT_TRUE(count > 0 && count != TDM_UT_INVALID_VALUE);
412         } else {
413                 ASSERT_EQ(tdm_display_get_capture_available_formats(dpy, &formats, &count), TDM_ERROR_NO_CAPABILITY);
414                 ASSERT_EQ(formats, (const tbm_format *)TDM_UT_INVALID_VALUE);
415                 ASSERT_EQ(count, TDM_UT_INVALID_VALUE);
416         }
417 }
418
419 TEST_P(TDMBackendCapture, CaptureDispalyGetAvaiableFormatsNullObject)
420 {
421         const tbm_format *formats = (const tbm_format *)TDM_UT_INVALID_VALUE;
422         int count = TDM_UT_INVALID_VALUE;
423         ASSERT_EQ(tdm_display_get_capture_available_formats(NULL, &formats, &count), TDM_ERROR_INVALID_PARAMETER);
424         ASSERT_EQ(formats, (const tbm_format *)TDM_UT_INVALID_VALUE);
425         ASSERT_EQ(count, TDM_UT_INVALID_VALUE);
426 }
427
428 TEST_P(TDMBackendCapture, CaptureDispalyGetAvaiableFormatsNullOther)
429 {
430         ASSERT_EQ(tdm_display_get_capture_available_formats(dpy, NULL, NULL), TDM_ERROR_INVALID_PARAMETER);
431 }
432
433 TEST_P(TDMBackendCapture, CaptureDispalyGetAvaiableSize)
434 {
435         int min_w = TDM_UT_INVALID_VALUE;
436         int min_h = TDM_UT_INVALID_VALUE;
437         int max_w = TDM_UT_INVALID_VALUE;
438         int max_h = TDM_UT_INVALID_VALUE;
439         int preferred_align = TDM_UT_INVALID_VALUE;
440         if (has_capture_cap) {
441                 ASSERT_EQ(tdm_display_get_capture_available_size(dpy, &min_w, &min_h, &max_w, &max_h, &preferred_align), TDM_ERROR_NONE);
442                 ASSERT_NE(min_w, TDM_UT_INVALID_VALUE);
443                 ASSERT_NE(min_h, TDM_UT_INVALID_VALUE);
444                 ASSERT_NE(max_w, TDM_UT_INVALID_VALUE);
445                 ASSERT_NE(max_h, TDM_UT_INVALID_VALUE);
446                 ASSERT_NE(preferred_align, TDM_UT_INVALID_VALUE);
447         } else {
448                 ASSERT_EQ(tdm_display_get_capture_available_size(dpy, &min_w, &min_h, &max_w, &max_h, &preferred_align), TDM_ERROR_NO_CAPABILITY);
449                 ASSERT_EQ(min_w, TDM_UT_INVALID_VALUE);
450                 ASSERT_EQ(min_h, TDM_UT_INVALID_VALUE);
451                 ASSERT_EQ(max_w, TDM_UT_INVALID_VALUE);
452                 ASSERT_EQ(max_h, TDM_UT_INVALID_VALUE);
453                 ASSERT_EQ(preferred_align, TDM_UT_INVALID_VALUE);
454         }
455 }
456
457 TEST_P(TDMBackendCapture, CaptureDispalyGetAvaiableSizeNullObject)
458 {
459         int min_w = TDM_UT_INVALID_VALUE;
460         int min_h = TDM_UT_INVALID_VALUE;
461         int max_w = TDM_UT_INVALID_VALUE;
462         int max_h = TDM_UT_INVALID_VALUE;
463         int preferred_align = TDM_UT_INVALID_VALUE;
464         ASSERT_EQ(tdm_display_get_capture_available_size(NULL, &min_w, &min_h, &max_w, &max_h, &preferred_align), TDM_ERROR_INVALID_PARAMETER);
465         ASSERT_EQ(min_w, TDM_UT_INVALID_VALUE);
466         ASSERT_EQ(min_h, TDM_UT_INVALID_VALUE);
467         ASSERT_EQ(max_w, TDM_UT_INVALID_VALUE);
468         ASSERT_EQ(max_h, TDM_UT_INVALID_VALUE);
469         ASSERT_EQ(preferred_align, TDM_UT_INVALID_VALUE);
470 }
471
472 TEST_P(TDMBackendCapture, CaptureDispalyGetAvaiableSizeNullOther)
473 {
474         if (has_capture_cap)
475                 ASSERT_EQ(tdm_display_get_capture_available_size(dpy, NULL, NULL, NULL, NULL, NULL), TDM_ERROR_NONE);
476         else
477                 ASSERT_EQ(tdm_display_get_capture_available_size(dpy, NULL, NULL, NULL, NULL, NULL), TDM_ERROR_NO_CAPABILITY);
478 }
479
480 TEST_P(TDMBackendCapture, CaptureDestroy)
481 {
482         TDM_UT_SKIP_FLAG(has_capture_cap);
483         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_OUTPUT);
484
485         ASSERT_EQ(TestPrepareDefault(), true);
486
487         TestDone();
488 }
489
490 TEST_P(TDMBackendCapture, CaptureDestroyNullObject)
491 {
492         TDM_UT_SKIP_FLAG(has_capture_cap);
493         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_OUTPUT);
494
495         tdm_capture_destroy(NULL);
496 }
497
498 TEST_P(TDMBackendCapture, CaptureSetInfo)
499 {
500         /* tested in CaptureNoScaleNoTransformNoCSC */
501 }
502
503 TEST_P(TDMBackendCapture, CaptureSetInfoNullObject)
504 {
505         TDM_UT_SKIP_FLAG(has_capture_cap);
506         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_OUTPUT);
507
508         tdm_info_capture info;
509         memset(&info, 0, sizeof info);
510         ASSERT_EQ(tdm_capture_set_info(NULL, &info), TDM_ERROR_INVALID_PARAMETER);
511 }
512
513 TEST_P(TDMBackendCapture, CaptureSetInfoNullOther)
514 {
515         TDM_UT_SKIP_FLAG(has_capture_cap);
516         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_OUTPUT);
517
518         ASSERT_EQ(TestPrepareDefault(), true);
519
520         ASSERT_EQ(tdm_capture_set_info(capture, NULL), TDM_ERROR_INVALID_PARAMETER);
521
522         TestDone();
523 }
524
525 static void
526 _ut_tdm_capture_done_cb(tdm_capture *capture, tbm_surface_h buffer, void *user_data)
527 {
528         bool *done = (bool*)user_data;
529         if (done)
530                 *done = true;
531 }
532
533 TEST_P(TDMBackendCapture, CaptureSetDoneHandler)
534 {
535         TDM_UT_SKIP_FLAG(has_capture_cap);
536         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_OUTPUT);
537
538         ASSERT_EQ(TestPrepareDefault(), true);
539
540         ASSERT_EQ(tdm_capture_set_done_handler(capture, _ut_tdm_capture_done_cb, NULL), TDM_ERROR_NONE);
541
542         TestDone();
543 }
544
545 TEST_P(TDMBackendCapture, CaptureSetDoneHandlerNullObject)
546 {
547         TDM_UT_SKIP_FLAG(has_capture_cap);
548         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_OUTPUT);
549
550         ASSERT_EQ(tdm_capture_set_done_handler(NULL, _ut_tdm_capture_done_cb, NULL), TDM_ERROR_INVALID_PARAMETER);
551 }
552
553 TEST_P(TDMBackendCapture, CaptureSetDoneHandlerNullOther)
554 {
555         TDM_UT_SKIP_FLAG(has_capture_cap);
556         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_OUTPUT);
557
558         ASSERT_EQ(TestPrepareDefault(), true);
559
560         ASSERT_EQ(tdm_capture_set_done_handler(capture, NULL, NULL), TDM_ERROR_INVALID_PARAMETER);
561
562         TestDone();
563 }
564
565 TEST_P(TDMBackendCapture, CaptureAttach)
566 {
567         TDM_UT_SKIP_FLAG(has_capture_cap);
568         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_OUTPUT);
569
570         for (int o = 0; o < output_count; o++) {
571
572                 if (!ut_tdm_output_is_connected(outputs[o]))
573                         continue;
574
575                 for (int f = 0; f < format_count; f++) {
576                         FindLayer(o, formats[f], &dst_pos);
577
578                         ASSERT_EQ(TestPrepare(o, TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, formats[f],
579                                                                   TDM_TRANSFORM_NORMAL, TDM_CAPTURE_TYPE_ONESHOT, -1, false), true);
580
581                         for (int b = 0; b < 3; b++)
582                                 ASSERT_EQ(tdm_capture_attach(capture, buffers[b]), TDM_ERROR_NONE);
583
584                         TestDone();
585                 }
586         }
587 }
588
589 TEST_P(TDMBackendCapture, CaptureAttachNullObject)
590 {
591         TDM_UT_SKIP_FLAG(has_capture_cap);
592         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_OUTPUT);
593
594         tbm_surface_h buffer = (tbm_surface_h)TDM_UT_BUFFER_SIZE;
595
596         ASSERT_EQ(tdm_capture_attach(NULL, buffer), TDM_ERROR_INVALID_PARAMETER);
597 }
598
599 TEST_P(TDMBackendCapture, CaptureAttachNullOther)
600 {
601         TDM_UT_SKIP_FLAG(has_capture_cap);
602         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_OUTPUT);
603
604         ASSERT_EQ(TestPrepareDefault(), true);
605
606         ASSERT_EQ(tdm_capture_attach(capture, NULL), TDM_ERROR_INVALID_PARAMETER);
607
608         TestDone();
609 }
610
611 TEST_P(TDMBackendCapture, CaptureCommit)
612 {
613         TDM_UT_SKIP_FLAG(has_capture_cap);
614         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_OUTPUT);
615
616         ASSERT_EQ(TestPrepareDefault(), true);
617
618         ASSERT_EQ(tdm_capture_commit(capture), TDM_ERROR_NONE);
619
620         TestDone();
621 }
622
623 TEST_P(TDMBackendCapture, CaptureCommitNullOBject)
624 {
625         TDM_UT_SKIP_FLAG(has_capture_cap);
626         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_OUTPUT);
627
628         ASSERT_EQ(tdm_capture_commit(NULL), TDM_ERROR_INVALID_PARAMETER);
629 }
630
631 TEST_P(TDMBackendCapture, CaptureCommitDpmsOff)
632 {
633         TDM_UT_SKIP_FLAG(has_capture_cap);
634         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_OUTPUT);
635
636         ASSERT_EQ(TestPrepareDefault(), true);
637
638         ASSERT_EQ(ut_tdm_output_unset(dpy, output), true);
639
640         ASSERT_EQ(tdm_output_set_dpms(output, TDM_OUTPUT_DPMS_OFF), TDM_ERROR_NONE);
641
642         ASSERT_EQ(tdm_capture_commit(capture), TDM_ERROR_BAD_REQUEST);
643
644         TestDone();
645 }
646
647 static void
648 _ut_tdm_capture_done_cb2(tdm_capture *capture, tbm_surface_h buffer, void *user_data)
649 {
650         int *done = (int*)user_data;
651         if (done)
652                 (*done)++;
653 }
654
655 TEST_P(TDMBackendCapture, CaptureDestroyWithoutCommit)
656 {
657         TDM_UT_SKIP_FLAG(has_capture_cap);
658         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_OUTPUT);
659
660         for (int o = 0; o < output_count; o++) {
661                 const tdm_output_mode *mode = NULL;
662                 int f = 0;
663
664                 if (!ut_tdm_output_is_connected(outputs[o]))
665                         continue;
666
667                 ASSERT_EQ(tdm_output_get_mode(outputs[o], &mode), TDM_ERROR_NONE);
668
669                 FindLayer(o, formats[f], &dst_pos);
670
671                 ASSERT_EQ(TestPrepare(o, TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, formats[f],
672                                                           TDM_TRANSFORM_NORMAL, TDM_CAPTURE_TYPE_ONESHOT, -1, false), true);
673
674                 ASSERT_EQ(tdm_capture_set_done_handler(capture, _ut_tdm_capture_done_cb2, NULL), TDM_ERROR_NONE);
675
676                 for (int b = 0; b < 3; b++)
677                         ASSERT_EQ(tdm_capture_attach(capture, buffers[b]), TDM_ERROR_NONE);
678
679                 tdm_capture_destroy(capture);
680                 capture = NULL;
681
682                 TestDone();
683         }
684 }
685
686 TEST_P(TDMBackendCapture, CaptureDestroyBeforeDone)
687 {
688         TDM_UT_SKIP_FLAG(has_capture_cap);
689         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_OUTPUT);
690
691         for (int o = 0; o < output_count; o++) {
692                 const tdm_output_mode *mode = NULL;
693                 int f = 0;
694
695                 if (!ut_tdm_output_is_connected(outputs[o]))
696                         continue;
697
698                 ASSERT_EQ(tdm_output_get_mode(outputs[o], &mode), TDM_ERROR_NONE);
699
700                 FindLayer(o, formats[f], &dst_pos);
701
702                 ASSERT_EQ(TestPrepare(o, TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, formats[f],
703                                                           TDM_TRANSFORM_NORMAL, TDM_CAPTURE_TYPE_ONESHOT, -1, false), true);
704
705                 ASSERT_EQ(tdm_capture_set_done_handler(capture, _ut_tdm_capture_done_cb2, NULL), TDM_ERROR_NONE);
706
707                 for (int b = 0; b < 3; b++)
708                         ASSERT_EQ(tdm_capture_attach(capture, buffers[b]), TDM_ERROR_NONE);
709
710                 ASSERT_EQ(tdm_capture_commit(capture), TDM_ERROR_NONE);
711
712                 tdm_capture_destroy(capture);
713                 capture = NULL;
714
715                 TestDone();
716         }
717 }
718
719 TEST_P(TDMBackendCapture, CaptureOneshotLetterboxSize)
720 {
721         TDM_UT_SKIP_FLAG(has_capture_cap);
722         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_OUTPUT);
723         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_ONESHOT);
724
725         bool done;
726
727         for (int o = 0; o < output_count; o++) {
728                 const tdm_output_mode *mode = NULL;
729
730                 if (!ut_tdm_output_is_connected(outputs[o]))
731                         continue;
732
733                 ASSERT_EQ(tdm_output_get_mode(outputs[o], &mode), TDM_ERROR_NONE);
734
735                 for (int f = 0; f < format_count; f++) {
736                         int half_size = ((mode->hdisplay <= mode->vdisplay) ? mode->hdisplay : mode->vdisplay) / 2;
737
738                         dst_pos.x = (mode->hdisplay - half_size) / 2;
739                         dst_pos.y = (mode->vdisplay - half_size) / 2;
740                         dst_pos.w = half_size;
741                         dst_pos.h = half_size;
742
743                         TDM_UT_INFO("* testing for %c%c%c%c", FOURCC_STR(formats[f]));
744
745                         FindLayer(o, formats[f], &dst_pos);
746
747                         if (!dst_layer) {
748                                 TDM_UT_INFO("no proper layer for %c%c%c%c", FOURCC_STR(formats[f]));
749                                 continue;
750                         }
751
752                         ASSERT_EQ(TestPrepare(o, half_size, half_size, formats[f],
753                                                                   TDM_TRANSFORM_NORMAL, TDM_CAPTURE_TYPE_ONESHOT, -1, false), true);
754
755                         ASSERT_EQ(tdm_capture_set_done_handler(capture, _ut_tdm_capture_done_cb, &done), TDM_ERROR_NONE);
756
757 retry:
758                         for (int b = 0; b < 3; b++) {
759                                 done = false;
760                                 ASSERT_EQ(tdm_capture_attach(capture, buffers[b]), TDM_ERROR_NONE);
761                                 ASSERT_EQ(tdm_capture_commit(capture), TDM_ERROR_NONE);
762
763                                 while (!done)
764                                         ASSERT_EQ(ut_tdm_display_handle_events(dpy), TDM_ERROR_NONE);
765
766 #if 0
767                                 char temp[256];
768                                 snprintf(temp, sizeof temp, "f%d_b%d", f, b);
769                                 DumpBuffer(b, temp);
770 #endif
771                                 ShowBuffer(b, &dst_pos);
772                         }
773
774                         TDM_UT_ASK_YNR("* Successed to capture a output to a '%c%c%c%c' buffer as letterbox size and show? (output: %d, layer: %d)",
775                                                    FOURCC_STR(formats[f]), pipe, dst_layer_index);
776
777
778                         HideLayer();
779
780                         TestDone();
781                 }
782         }
783 }
784
785 TEST_P(TDMBackendCapture, CaptureOneshotFullSize)
786 {
787         TDM_UT_SKIP_FLAG(has_capture_cap);
788         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_OUTPUT);
789         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_ONESHOT);
790
791         bool done;
792
793         for (int o = 0; o < output_count; o++) {
794                 const tdm_output_mode *mode = NULL;
795
796                 if (!ut_tdm_output_is_connected(outputs[o]))
797                         continue;
798
799                 ASSERT_EQ(tdm_output_get_mode(outputs[o], &mode), TDM_ERROR_NONE);
800
801                 for (int f = 0; f < format_count; f++) {
802                         int half_size = ((mode->hdisplay <= mode->vdisplay) ? mode->hdisplay : mode->vdisplay) / 2;
803
804                         dst_pos.x = (mode->hdisplay - half_size) / 2;
805                         dst_pos.y = (mode->vdisplay - half_size) / 2;
806                         dst_pos.w = half_size;
807                         dst_pos.h = half_size;
808
809                         TDM_UT_INFO("* testing for %c%c%c%c", FOURCC_STR(formats[f]));
810
811                         FindLayer(o, formats[f], &dst_pos);
812
813                         if (!dst_layer) {
814                                 TDM_UT_INFO("no proper layer for %c%c%c%c", FOURCC_STR(formats[f]));
815                                 continue;
816                         }
817
818                         ASSERT_EQ(TestPrepare(o, half_size, half_size, formats[f],
819                                                                   TDM_TRANSFORM_NORMAL, TDM_CAPTURE_TYPE_ONESHOT, -1, true), true);
820
821                         ASSERT_EQ(tdm_capture_set_done_handler(capture, _ut_tdm_capture_done_cb, &done), TDM_ERROR_NONE);
822
823 retry:
824                         for (int b = 0; b < 3; b++) {
825                                 done = false;
826                                 ASSERT_EQ(tdm_capture_attach(capture, buffers[b]), TDM_ERROR_NONE);
827                                 ASSERT_EQ(tdm_capture_commit(capture), TDM_ERROR_NONE);
828
829                                 while (!done)
830                                         ASSERT_EQ(ut_tdm_display_handle_events(dpy), TDM_ERROR_NONE);
831
832 #if 0
833                                 char temp[256];
834                                 snprintf(temp, sizeof temp, "f%d_b%d", f, b);
835                                 DumpBuffer(b, temp);
836 #endif
837                                 ShowBuffer(b, &dst_pos);
838                         }
839
840                         TDM_UT_ASK_YNR("* Successed to capture a output to a '%c%c%c%c' buffer as full size and show? (output: %d, layer: %d)",
841                                                    FOURCC_STR(formats[f]), pipe, dst_layer_index);
842
843
844                         HideLayer();
845
846                         TestDone();
847                 }
848         }
849 }
850
851 TEST_P(TDMBackendCapture, CaptureOneshotAttachFewTimesInOneCommit)
852 {
853         TDM_UT_SKIP_FLAG(has_capture_cap);
854         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_OUTPUT);
855         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_ONESHOT);
856
857         int done;
858
859         for (int o = 0; o < output_count; o++) {
860                 const tdm_output_mode *mode = NULL;
861
862                 if (!ut_tdm_output_is_connected(outputs[o]))
863                         continue;
864
865                 ASSERT_EQ(tdm_output_get_mode(outputs[o], &mode), TDM_ERROR_NONE);
866
867                 for (int f = 0; f < format_count; f++) {
868                         int half_size = ((mode->hdisplay <= mode->vdisplay) ? mode->hdisplay : mode->vdisplay) / 2;
869
870                         dst_pos.x = (mode->hdisplay - half_size) / 2;
871                         dst_pos.y = (mode->vdisplay - half_size) / 2;
872                         dst_pos.w = half_size;
873                         dst_pos.h = half_size;
874
875                         TDM_UT_INFO("* testing for %c%c%c%c", FOURCC_STR(formats[f]));
876
877                         FindLayer(o, formats[f], &dst_pos);
878
879                         if (!dst_layer) {
880                                 TDM_UT_INFO("no proper layer for %c%c%c%c", FOURCC_STR(formats[f]));
881                                 continue;
882                         }
883
884                         ASSERT_EQ(TestPrepare(o, half_size, half_size, formats[f],
885                                                                   TDM_TRANSFORM_NORMAL, TDM_CAPTURE_TYPE_ONESHOT, -1, false), true);
886
887                         done = 0;
888                         ASSERT_EQ(tdm_capture_set_done_handler(capture, _ut_tdm_capture_done_cb2, &done), TDM_ERROR_NONE);
889
890 retry:
891                         for (int b = 0; b < 3; b++)
892                                 ASSERT_EQ(tdm_capture_attach(capture, buffers[b]), TDM_ERROR_NONE);
893
894                         ASSERT_EQ(tdm_capture_commit(capture), TDM_ERROR_NONE);
895
896                         while (done != 3)
897                                 ASSERT_EQ(ut_tdm_display_handle_events(dpy), TDM_ERROR_NONE);
898
899                         for (int b = 0; b < 3; b++) {
900 #if 0
901                                 char temp[256];
902                                 snprintf(temp, sizeof temp, "f%d_b%d", f, b);
903                                 DumpBuffer(b, temp);
904 #endif
905                                 ShowBuffer(b, &dst_pos);
906                         }
907
908                         TDM_UT_ASK_YNR("* Successed to capture a output to a '%c%c%c%c' buffer as letterbox size and show? (output: %d, layer: %d)",
909                                                    FOURCC_STR(formats[f]), pipe, dst_layer_index);
910
911
912                         HideLayer();
913
914                         TestDone();
915                 }
916         }
917 }
918
919 static void
920 _ut_tdm_backend_capture_buffer_release_cb(tbm_surface_h buffer, void *user_data)
921 {
922         TDMBackendCapture *backend_capture = (TDMBackendCapture*)user_data;
923
924         tdm_buffer_remove_release_handler(buffer, _ut_tdm_backend_capture_buffer_release_cb, backend_capture);
925
926         ASSERT_EQ(tdm_capture_attach(backend_capture->capture, buffer), TDM_ERROR_NONE);
927         ASSERT_EQ(tdm_capture_commit(backend_capture->capture), TDM_ERROR_NONE);
928 }
929
930 static void
931 _ut_tdm_capture_stream_done_cb(tdm_capture *capture, tbm_surface_h buffer, void *user_data)
932 {
933         TDMBackendCapture *backend_capture = (TDMBackendCapture*)user_data;
934
935         for (int b = 0; b < 3; b++) {
936                 if (backend_capture->buffers[b] == buffer) {
937 #if 0
938                         char temp[256];
939                         snprintf(temp, sizeof temp, "f%d_b%d", f, b);
940                         DumpBuffer(b, temp);
941 #endif
942                         tdm_buffer_add_release_handler(buffer, _ut_tdm_backend_capture_buffer_release_cb, (void*)backend_capture);
943                         backend_capture->ShowBuffer(b, &backend_capture->dst_pos);
944                         break;
945                 }
946         }
947
948         if (--backend_capture->stream_count == 0) {
949                 backend_capture->stream_exit = 1;
950         }
951 }
952
953 TEST_P(TDMBackendCapture, CaptureStreamLetterboxSize)
954 {
955         TDM_UT_SKIP_FLAG(has_capture_cap);
956         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_OUTPUT);
957         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_STREAM);
958
959         for (int o = 0; o < output_count; o++) {
960                 const tdm_output_mode *mode = NULL;
961
962                 if (!ut_tdm_output_is_connected(outputs[o]))
963                         continue;
964
965                 ASSERT_EQ(tdm_output_get_mode(outputs[o], &mode), TDM_ERROR_NONE);
966
967                 for (int f = 0; f < format_count; f++) {
968                         int half_size = ((mode->hdisplay <= mode->vdisplay) ? mode->hdisplay : mode->vdisplay) / 2;
969
970                         dst_pos.x = (mode->hdisplay - half_size) / 2;
971                         dst_pos.y = (mode->vdisplay - half_size) / 2;
972                         dst_pos.w = half_size;
973                         dst_pos.h = half_size;
974
975                         TDM_UT_INFO("* testing for %c%c%c%c", FOURCC_STR(formats[f]));
976
977                         FindLayer(o, formats[f], &dst_pos);
978
979                         if (!dst_layer) {
980                                 TDM_UT_INFO("no proper layer for %c%c%c%c", FOURCC_STR(formats[f]));
981                                 continue;
982                         }
983
984                         ASSERT_EQ(TestPrepare(o, half_size, half_size, formats[f],
985                                                                   TDM_TRANSFORM_NORMAL, TDM_CAPTURE_TYPE_STREAM, -1, false), true);
986
987                         ASSERT_EQ(tdm_capture_set_done_handler(capture, _ut_tdm_capture_stream_done_cb, (void*)this), TDM_ERROR_NONE);
988
989                         for (int b = 0; b < 3; b++)
990                                 ASSERT_EQ(tdm_capture_attach(capture, buffers[b]), TDM_ERROR_NONE);
991
992 retry:
993
994                         stream_exit = false;
995                         stream_count = 30;
996
997                         ASSERT_EQ(tdm_capture_commit(capture), TDM_ERROR_NONE);
998
999                         while (!stream_exit)
1000                                 ASSERT_EQ(ut_tdm_display_handle_events(dpy), TDM_ERROR_NONE);
1001
1002                         TDM_UT_ASK_YNR("* Successed to capture a output to a '%c%c%c%c' buffer as letterbox size and show? (output: %d, layer: %d)",
1003                                                    FOURCC_STR(formats[f]), pipe, dst_layer_index);
1004
1005
1006                         HideLayer();
1007
1008                         TestDone();
1009                 }
1010         }
1011 }
1012
1013 TEST_P(TDMBackendCapture, CaptureStreamFullSize)
1014 {
1015         TDM_UT_SKIP_FLAG(has_capture_cap);
1016         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_OUTPUT);
1017         TDM_UT_SKIP_FLAG(capabilities & TDM_CAPTURE_CAPABILITY_STREAM);
1018
1019         for (int o = 0; o < output_count; o++) {
1020                 const tdm_output_mode *mode = NULL;
1021
1022                 if (!ut_tdm_output_is_connected(outputs[o]))
1023                         continue;
1024
1025                 ASSERT_EQ(tdm_output_get_mode(outputs[o], &mode), TDM_ERROR_NONE);
1026
1027                 for (int f = 0; f < format_count; f++) {
1028                         int half_size = ((mode->hdisplay <= mode->vdisplay) ? mode->hdisplay : mode->vdisplay) / 2;
1029
1030                         dst_pos.x = (mode->hdisplay - half_size) / 2;
1031                         dst_pos.y = (mode->vdisplay - half_size) / 2;
1032                         dst_pos.w = half_size;
1033                         dst_pos.h = half_size;
1034
1035                         TDM_UT_INFO("* testing for %c%c%c%c", FOURCC_STR(formats[f]));
1036
1037                         FindLayer(o, formats[f], &dst_pos);
1038
1039                         if (!dst_layer) {
1040                                 TDM_UT_INFO("no proper layer for %c%c%c%c", FOURCC_STR(formats[f]));
1041                                 continue;
1042                         }
1043
1044                         ASSERT_EQ(TestPrepare(o, half_size, half_size, formats[f],
1045                                                                   TDM_TRANSFORM_NORMAL, TDM_CAPTURE_TYPE_STREAM, -1, true), true);
1046
1047                         ASSERT_EQ(tdm_capture_set_done_handler(capture, _ut_tdm_capture_stream_done_cb, (void*)this), TDM_ERROR_NONE);
1048
1049                         for (int b = 0; b < 3; b++)
1050                                 ASSERT_EQ(tdm_capture_attach(capture, buffers[b]), TDM_ERROR_NONE);
1051
1052 retry:
1053
1054                         stream_exit = false;
1055                         stream_count = 30;
1056
1057                         ASSERT_EQ(tdm_capture_commit(capture), TDM_ERROR_NONE);
1058
1059                         while (!stream_exit)
1060                                 ASSERT_EQ(ut_tdm_display_handle_events(dpy), TDM_ERROR_NONE);
1061
1062                         TDM_UT_ASK_YNR("* Successed to capture a output to a '%c%c%c%c' buffer as full size and show? (output: %d, layer: %d)",
1063                                                    FOURCC_STR(formats[f]), pipe, dst_layer_index);
1064
1065
1066                         HideLayer();
1067
1068                         TestDone();
1069                 }
1070         }
1071 }
1072
1073 #ifdef TDM_UT_TEST_WITH_PARAMS
1074 INSTANTIATE_TEST_CASE_P(TDMBackendCaptureParams,
1075                                                 TDMBackendCapture,
1076                                                 Combine(Bool(), Bool(), Values(TDM_DEFAULT_MODULE)));
1077 #else
1078 INSTANTIATE_TEST_CASE_P(TDMBackendCaptureParams,
1079                                                 TDMBackendCapture,
1080                                                 Values(TDM_DEFAULT_MODULE));
1081 #endif
1082
1083 /* LCOV_EXCL_END */