1 /**************************************************************************
5 * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
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>
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:
22 * The above copyright notice and this permission notice (including the
23 * next paragraph) shall be included in all copies or substantial portions
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.
34 **************************************************************************/
42 #include <tbm_surface.h>
43 #include <tbm_surface_internal.h>
49 #include "tdm_private.h"
50 #include "tdm_helper.h"
54 static const char *file_exts[2] = {"png", "yuv"};
59 tdm_helper_get_time_in_millis(void)
63 if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
64 return (tp.tv_sec * 1000) + (tp.tv_nsec / 1000000L);
70 tdm_helper_get_time_in_micros(void)
74 if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
75 return (tp.tv_sec * 1000000) + (tp.tv_nsec / 1000L);
81 _tdm_helper_dump_raw(const char *file, void *data1, int size1, void *data2,
82 int size2, void *data3, int size3)
85 FILE *fp = fopen(file, "w+");
86 TDM_RETURN_IF_FAIL(fp != NULL);
88 blocks = (unsigned int *)data1;
89 fwrite(blocks, 1, size1, fp);
92 blocks = (unsigned int *)data2;
93 fwrite(blocks, 1, size2, fp);
97 blocks = (unsigned int *)data3;
98 fwrite(blocks, 1, size3, fp);
105 _tdm_helper_dump_png(const char *file, const void *data, int width,
108 FILE *fp = fopen(file, "wb");
109 TDM_RETURN_IF_FAIL(fp != NULL);
111 png_structp pPngStruct =
112 png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
118 png_infop pPngInfo = png_create_info_struct(pPngStruct);
120 png_destroy_write_struct(&pPngStruct, NULL);
125 png_init_io(pPngStruct, fp);
126 png_set_IHDR(pPngStruct,
133 PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
135 png_set_bgr(pPngStruct);
136 png_write_info(pPngStruct, pPngInfo);
138 const int pixel_size = 4; // RGBA
139 png_bytep *row_pointers =
140 png_malloc(pPngStruct, height * sizeof(png_byte *));
142 unsigned int *blocks = (unsigned int *)data;
146 for (; y < height; ++y) {
148 png_malloc(pPngStruct, sizeof(png_byte) * width * pixel_size);
149 row_pointers[y] = (png_bytep)row;
150 for (x = 0; x < width; ++x) {
151 unsigned int curBlock = blocks[y * width + x];
152 row[x * pixel_size] = (curBlock & 0xFF);
153 row[1 + x * pixel_size] = (curBlock >> 8) & 0xFF;
154 row[2 + x * pixel_size] = (curBlock >> 16) & 0xFF;
155 row[3 + x * pixel_size] = (curBlock >> 24) & 0xFF;
159 png_write_image(pPngStruct, row_pointers);
160 png_write_end(pPngStruct, pPngInfo);
162 for (y = 0; y < height; y++)
163 png_free(pPngStruct, row_pointers[y]);
164 png_free(pPngStruct, row_pointers);
166 png_destroy_write_struct(&pPngStruct, &pPngInfo);
172 tdm_helper_dump_buffer_str(tbm_surface_h buffer, const char *str)
174 tbm_surface_info_s info;
175 const char *dir = "/tmp/dump-tdm";
177 char file[TDM_PATH_LEN];
180 TDM_RETURN_IF_FAIL(buffer != NULL);
181 TDM_RETURN_IF_FAIL(str != NULL);
183 ret = tbm_surface_get_info(buffer, &info);
184 TDM_RETURN_IF_FAIL(ret == TBM_SURFACE_ERROR_NONE);
186 if (info.format == TBM_FORMAT_ARGB8888 || info.format == TBM_FORMAT_XRGB8888) {
188 bw = info.planes[0].stride >> 2;
191 bw = info.planes[0].stride;
194 snprintf(file, TDM_PATH_LEN, "%s/%c%c%c%c_%dx%d_%s.%s",
195 dir, FOURCC_STR(info.format), bw, info.height, str, ext);
197 tdm_helper_dump_buffer(buffer, file);
201 tdm_helper_dump_buffer(tbm_surface_h buffer, const char *file)
203 tbm_surface_info_s info;
207 TDM_RETURN_IF_FAIL(buffer != NULL);
208 TDM_RETURN_IF_FAIL(file != NULL);
210 ret = tbm_surface_map(buffer, TBM_OPTION_READ, &info);
211 TDM_RETURN_IF_FAIL(ret == TBM_SURFACE_ERROR_NONE);
213 len = strnlen(file, 1024);
214 if (info.format == TBM_FORMAT_ARGB8888 || info.format == TBM_FORMAT_XRGB8888)
219 if (strncmp(file + (len - 3), ext, 3)) {
220 TDM_ERR("can't dump to '%s' file", file + (len - 3));
221 tbm_surface_unmap(buffer);
225 switch (info.format) {
226 case TBM_FORMAT_ARGB8888:
227 case TBM_FORMAT_XRGB8888:
228 _tdm_helper_dump_png(file, info.planes[0].ptr,
229 info.planes[0].stride >> 2, info.height);
231 case TBM_FORMAT_YVU420:
232 case TBM_FORMAT_YUV420:
233 _tdm_helper_dump_raw(file,
235 info.planes[0].stride * info.height,
237 info.planes[1].stride * (info.height >> 1),
239 info.planes[2].stride * (info.height >> 1));
241 case TBM_FORMAT_NV12:
242 case TBM_FORMAT_NV21:
243 _tdm_helper_dump_raw(file,
245 info.planes[0].stride * info.height,
247 info.planes[1].stride * (info.height >> 1), NULL,
250 case TBM_FORMAT_YUYV:
251 case TBM_FORMAT_UYVY:
252 _tdm_helper_dump_raw(file,
254 info.planes[0].stride * info.height, NULL, 0,
258 TDM_ERR("can't dump %c%c%c%c buffer", FOURCC_STR(info.format));
259 tbm_surface_unmap(buffer);
263 tbm_surface_unmap(buffer);
265 TDM_INFO("dump %s", file);
269 tdm_helper_get_fd(const char *env)
272 int fd, newfd, flags, ret;
274 value = (const char*)getenv(env);
278 ret = sscanf(value, "%d", &fd);
280 TDM_ERR("sscanf failed: %m");
284 flags = fcntl(fd, F_GETFD);
286 TDM_ERR("fcntl failed: %m");
292 TDM_ERR("dup failed: %m");
296 TDM_INFO("%s: fd(%d) newfd(%d)", env, fd, newfd);
298 fcntl(newfd, F_SETFD, flags | FD_CLOEXEC);
304 tdm_helper_set_fd(const char *env, int fd)
309 snprintf(buf, sizeof(buf), "%d", fd);
311 ret = setenv(env, (const char*)buf, 1);
313 TDM_ERR("setenv failed: %m");
318 TDM_INFO("%s: fd(%d)", env, fd);
322 tdm_helper_dump_start(char *dumppath, int *count)
324 if (dumppath == NULL || count == NULL) {
325 TDM_DBG("tdm_helper_dump dumppath or count is null.");
331 TDM_DBG("tdm_helper_dump start.(path : %s)", dumppath);
335 tdm_helper_dump_stop(void)
339 TDM_DBG("tdm_helper_dump stop.");
342 static pixman_format_code_t
343 _tdm_helper_pixman_format_get(tbm_format format)
346 case TBM_FORMAT_ARGB8888:
347 return PIXMAN_a8r8g8b8;
348 case TBM_FORMAT_XRGB8888:
349 return PIXMAN_x8r8g8b8;
358 _tdm_helper_buffer_convert(tbm_surface_h srcbuf, tbm_surface_h dstbuf,
359 int dx, int dy, int dw, int dh, int count)
361 pixman_image_t *src_img = NULL, *dst_img = NULL;
362 pixman_format_code_t src_format, dst_format;
363 pixman_transform_t t;
364 struct pixman_f_transform ft;
366 tbm_surface_info_s src_info = {0, };
367 tbm_surface_info_s dst_info = {0, };
369 double scale_x, scale_y;
371 TDM_RETURN_VAL_IF_FAIL(srcbuf != NULL, TDM_ERROR_INVALID_PARAMETER);
372 TDM_RETURN_VAL_IF_FAIL(dstbuf != NULL, TDM_ERROR_INVALID_PARAMETER);
374 if (tbm_surface_map(srcbuf, TBM_SURF_OPTION_READ, &src_info)
375 != TBM_SURFACE_ERROR_NONE) {
376 TDM_ERR("cannot mmap srcbuf\n");
377 return TDM_ERROR_OPERATION_FAILED;
380 if (tbm_surface_map(dstbuf, TBM_SURF_OPTION_WRITE, &dst_info)
381 != TBM_SURFACE_ERROR_NONE) {
382 TDM_ERR("cannot mmap dstbuf\n");
383 tbm_surface_unmap(srcbuf);
384 return TDM_ERROR_OPERATION_FAILED;
386 TDM_GOTO_IF_FAIL(src_info.num_planes == 1, cant_convert);
387 TDM_GOTO_IF_FAIL(dst_info.num_planes == 1, cant_convert);
390 src_format = _tdm_helper_pixman_format_get(src_info.format);
391 TDM_GOTO_IF_FAIL(src_format > 0, cant_convert);
393 width = src_info.planes[0].stride / 4;
394 stride = src_info.planes[0].stride;
395 src_img = pixman_image_create_bits(src_format, width, src_info.height,
396 (uint32_t*)src_info.planes[0].ptr, stride);
397 TDM_GOTO_IF_FAIL(src_img != NULL, cant_convert);
400 dst_format = _tdm_helper_pixman_format_get(dst_info.format);
401 TDM_GOTO_IF_FAIL(dst_format > 0, cant_convert);
403 width = dst_info.planes[0].stride / 4;
404 stride = dst_info.planes[0].stride;
405 dst_img = pixman_image_create_bits(dst_format, width, dst_info.height,
406 (uint32_t*)dst_info.planes[0].ptr, stride);
407 TDM_GOTO_IF_FAIL(dst_img != NULL, cant_convert);
409 pixman_f_transform_init_identity(&ft);
411 scale_x = (double)src_info.width / dw;
412 scale_y = (double)src_info.height / dh;
414 pixman_f_transform_scale(&ft, NULL, scale_x, scale_y);
415 pixman_f_transform_translate(&ft, NULL, 0, 0);
416 pixman_transform_from_pixman_f_transform(&t, &ft);
417 pixman_image_set_transform(src_img, &t);
424 pixman_image_composite(op, src_img, NULL, dst_img,
425 0, 0, 0, 0, dx, dy, dw, dh);
428 pixman_image_unref(src_img);
430 pixman_image_unref(dst_img);
432 tbm_surface_unmap(srcbuf);
433 tbm_surface_unmap(dstbuf);
435 return TDM_ERROR_NONE;
439 pixman_image_unref(src_img);
441 tbm_surface_unmap(srcbuf);
442 tbm_surface_unmap(dstbuf);
444 return TDM_ERROR_OPERATION_FAILED;
448 tdm_helper_capture_output(tdm_output *output, tbm_surface_h dst_buffer,
449 int x, int y, int w, int h,
450 tdm_helper_capture_handler func, void *data)
452 tbm_surface_h surface;
454 int i, count, first = 0;
456 TDM_RETURN_VAL_IF_FAIL(output != NULL, TDM_ERROR_INVALID_PARAMETER);
457 TDM_RETURN_VAL_IF_FAIL(dst_buffer != NULL, TDM_ERROR_INVALID_PARAMETER);
458 TDM_RETURN_VAL_IF_FAIL(x >= 0, TDM_ERROR_INVALID_PARAMETER);
459 TDM_RETURN_VAL_IF_FAIL(y >= 0, TDM_ERROR_INVALID_PARAMETER);
460 TDM_RETURN_VAL_IF_FAIL(w >= 0, TDM_ERROR_INVALID_PARAMETER);
461 TDM_RETURN_VAL_IF_FAIL(h >= 0, TDM_ERROR_INVALID_PARAMETER);
462 TDM_RETURN_VAL_IF_FAIL(func != NULL, TDM_ERROR_INVALID_PARAMETER);
463 TDM_RETURN_VAL_IF_FAIL(data != NULL, TDM_ERROR_INVALID_PARAMETER);
465 err = tdm_output_get_layer_count(output, &count);
466 if (err != TDM_ERROR_NONE) {
467 TDM_ERR("tdm_output_get_layer_count fail(%d)\n", err);
468 return TDM_ERROR_OPERATION_FAILED;
471 TDM_ERR("tdm_output_get_layer_count err(%d, %d)\n", err, count);
472 return TDM_ERROR_BAD_MODULE;
475 for (i = count - 1; i >= 0; i--) {
476 tdm_layer *layer = tdm_output_get_layer(output, i, NULL);
478 surface = tdm_layer_get_displaying_buffer(layer, &err);
479 if (err != TDM_ERROR_NONE)
482 err = _tdm_helper_buffer_convert(surface, dst_buffer, x, y, w, h, first++);
483 if (err != TDM_ERROR_NONE)
484 TDM_DBG("convert fail %d-layer buffer\n", i);
486 TDM_DBG("convert success %d-layer buffer\n", i);
489 func(dst_buffer, data);
491 return TDM_ERROR_NONE;
495 tdm_helper_get_display_information(tdm_display *dpy, char *reply, int *len)
497 tdm_private_display *private_display;
498 tdm_backend_module *module_data;
499 tdm_func_output *func_output;
500 tdm_func_layer *func_layer;
501 tdm_private_output *private_output = NULL;
502 tdm_private_layer *private_layer = NULL;
503 tdm_private_pp *private_pp = NULL;
504 tdm_private_capture *private_capture = NULL;
508 TDM_DBG_RETURN_IF_FAIL(dpy != NULL);
510 private_display = dpy;
511 func_output = &private_display->func_output;
512 func_layer = &private_display->func_layer;
513 _pthread_mutex_lock(&private_display->lock);
515 /* module information */
516 module_data = private_display->module_data;
517 TDM_SNPRINTF(reply, len, "[TDM backend information]\n");
518 TDM_SNPRINTF(reply, len, "name: %s\n", module_data->name);
519 TDM_SNPRINTF(reply, len, "vendor: %s\n", module_data->vendor);
520 TDM_SNPRINTF(reply, len, "version: %d.%d\n\n",
521 (int)TDM_BACKEND_GET_ABI_MAJOR(module_data->abi_version),
522 (int)TDM_BACKEND_GET_ABI_MINOR(module_data->abi_version));
524 /* output information */
525 TDM_SNPRINTF(reply, len, "[Output information]\n");
526 TDM_SNPRINTF(reply, len, "--------------------------------------------------------------------------------------------\n");
527 TDM_SNPRINTF(reply, len, "idx maker model name type status dpms subpixel align_w min max phy(mm)\n");
528 TDM_SNPRINTF(reply, len, "--------------------------------------------------------------------------------------------\n");
529 LIST_FOR_EACH_ENTRY(private_output, &private_display->output_list, link) {
530 TDM_SNPRINTF(reply, len, "%d %s %s %s %s %s %s %d %d %dx%d %dx%d %dx%d\n",
531 private_output->index, private_output->caps.maker,
532 private_output->caps.model, private_output->caps.name,
533 tdm_conn_str(private_output->caps.type),
534 tdm_status_str(private_output->caps.status),
535 tdm_dpms_str(private_output->current_dpms_value),
536 private_output->caps.subpixel,
537 private_output->caps.preferred_align,
538 private_output->caps.min_w, private_output->caps.min_h,
539 private_output->caps.max_w, private_output->caps.max_h,
540 private_output->caps.mmWidth, private_output->caps.mmHeight);
542 TDM_SNPRINTF(reply, len, "\t%d modes:\n", private_output->caps.mode_count);
544 if (private_output->caps.mode_count > 0) {
545 const tdm_output_mode *current_mode = NULL;
547 TDM_DBG_GOTO_IF_FAIL(func_output->output_get_mode, unlock);
548 ret = func_output->output_get_mode(private_output->output_backend, ¤t_mode);
549 TDM_DBG_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, unlock);
551 TDM_SNPRINTF(reply, len, "\t\t name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot\n");
552 for (i = 0; i < private_output->caps.mode_count; i++) {
553 char *current = (current_mode == private_output->caps.modes + i) ? "*" : " ";
554 TDM_SNPRINTF(reply, len, "\t\t%s%s %d %d %d %d %d %d %d %d %d ",
556 private_output->caps.modes[i].name,
557 private_output->caps.modes[i].vrefresh,
558 private_output->caps.modes[i].hdisplay,
559 private_output->caps.modes[i].hsync_start,
560 private_output->caps.modes[i].hsync_end,
561 private_output->caps.modes[i].htotal,
562 private_output->caps.modes[i].vdisplay,
563 private_output->caps.modes[i].vsync_start,
564 private_output->caps.modes[i].vsync_end,
565 private_output->caps.modes[i].vtotal);
566 tdm_mode_flag_str(private_output->caps.modes[i].flags, &reply, len);
567 TDM_SNPRINTF(reply, len, " ");
568 tdm_mode_type_str(private_output->caps.modes[i].type, &reply, len);
569 TDM_SNPRINTF(reply, len, "\n");
573 TDM_SNPRINTF(reply, len, "\t%d properties:\n", private_output->caps.prop_count);
574 if (private_output->caps.prop_count > 0) {
575 TDM_SNPRINTF(reply, len, "\t\tname\tidx\tvalue\n");
576 for (i = 0; i < private_output->caps.prop_count; i++) {
578 TDM_DBG_GOTO_IF_FAIL(func_output->output_get_property, unlock);
579 ret = func_output->output_get_property(private_output->output_backend,
580 private_output->caps.props[i].id,
582 TDM_DBG_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, unlock);
583 TDM_SNPRINTF(reply, len, "\t\t%s\t%d\t%d\n",
584 private_output->caps.props[i].name,
585 private_output->caps.props[i].id,
590 TDM_SNPRINTF(reply, len, "\n");
592 /* layer information */
593 TDM_SNPRINTF(reply, len, "[Layer information]\n");
594 TDM_SNPRINTF(reply, len, "-----------------------------------------------------------------------\n");
595 TDM_SNPRINTF(reply, len, "idx output zpos buf format size crop geometry transform\n");
596 TDM_SNPRINTF(reply, len, "-----------------------------------------------------------------------\n");
597 LIST_FOR_EACH_ENTRY(private_output, &private_display->output_list, link) {
598 LIST_FOR_EACH_ENTRY(private_layer, &private_output->layer_list, link) {
599 if (!private_layer->usable) {
603 tbm_surface_info_s buf_info;
605 TDM_DBG_GOTO_IF_FAIL(func_layer->layer_get_info, unlock);
606 memset(&info, 0, sizeof info);
607 ret = func_layer->layer_get_info(private_layer->layer_backend, &info);
608 TDM_DBG_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, unlock);
610 format = tbm_surface_get_format(private_layer->showing_buffer);
611 tbm_surface_get_info(private_layer->showing_buffer, &buf_info);
614 size.h = buf_info.planes[0].stride >> 2;
616 size.h = buf_info.planes[0].stride;
617 size.v = tbm_surface_get_height(private_layer->showing_buffer);
619 if (info.src_config.format)
620 format = (info.src_config.format)?:format;
622 TDM_SNPRINTF(reply, len, "%d %d %d %p %c%c%c%c %dx%d %dx%d+%d+%d %dx%d+%d+%d %s\n",
623 private_layer->index,
624 private_output->index,
625 private_layer->caps.zpos,
626 private_layer->showing_buffer, FOURCC_STR(format), size.h, size.v,
627 info.src_config.pos.w, info.src_config.pos.h, info.src_config.pos.x, info.src_config.pos.y,
628 info.dst_pos.w, info.dst_pos.h, info.dst_pos.x, info.dst_pos.y,
629 tdm_transform_str(info.transform));
631 TDM_SNPRINTF(reply, len, "%d %d %d -\n",
632 private_layer->index,
633 private_output->index,
634 private_layer->caps.zpos);
637 TDM_SNPRINTF(reply, len, "\tcaps\t: ");
638 tdm_layer_caps_str(private_layer->caps.capabilities, &reply, len);
639 TDM_SNPRINTF(reply, len, "\n");
641 TDM_SNPRINTF(reply, len, "\tformats\t: ");
642 if (private_layer->caps.format_count > 0) {
643 const char *sep = "";
644 for (i = 0; i < private_layer->caps.format_count; i++) {
645 TDM_SNPRINTF(reply, len, "%s%c%c%c%c", sep, FOURCC_STR(private_layer->caps.formats[i]));
648 TDM_SNPRINTF(reply, len, "\n");
651 TDM_SNPRINTF(reply, len, "\t%d properties:\n", private_layer->caps.prop_count);
652 if (private_layer->caps.prop_count > 0) {
653 TDM_SNPRINTF(reply, len, "\t\tname\tidx\tvalue\n");
654 for (i = 0; i < private_layer->caps.prop_count; i++) {
656 TDM_DBG_GOTO_IF_FAIL(func_layer->layer_get_property, unlock);
657 ret = func_layer->layer_get_property(private_layer->layer_backend,
658 private_layer->caps.props[i].id,
660 TDM_DBG_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, unlock);
661 TDM_SNPRINTF(reply, len, "\t\t%s\t%d\t%d\n",
662 private_layer->caps.props[i].name,
663 private_layer->caps.props[i].id,
669 TDM_SNPRINTF(reply, len, "\n");
671 if (private_display->capabilities & TDM_DISPLAY_CAPABILITY_PP) {
672 const char *sep = "";
673 TDM_SNPRINTF(reply, len, "[PP information]\n");
674 TDM_SNPRINTF(reply, len, "caps\t: ");
675 tdm_pp_caps_str(private_display->caps_pp.capabilities, &reply, len);
676 TDM_SNPRINTF(reply, len, "\n");
677 TDM_SNPRINTF(reply, len, "formats\t: ");
678 for (i = 0; i < private_display->caps_pp.format_count; i++) {
679 TDM_SNPRINTF(reply, len, "%s%c%c%c%c", sep, FOURCC_STR(private_display->caps_pp.formats[i]));
682 TDM_SNPRINTF(reply, len, "\n");
683 TDM_SNPRINTF(reply, len, "size\t: min(%dx%d) max(%dx%d) align_w(%d)\n",
684 private_display->caps_pp.min_w, private_display->caps_pp.min_h,
685 private_display->caps_pp.max_w, private_display->caps_pp.max_h,
686 private_display->caps_pp.preferred_align);
687 if (!LIST_IS_EMPTY(&private_display->pp_list)) {
688 TDM_SNPRINTF(reply, len, "-------------------------------------------------------------\n");
689 TDM_SNPRINTF(reply, len, "src(format size crop) | dst(format size crop) | transform\n");
690 TDM_SNPRINTF(reply, len, "-------------------------------------------------------------\n");
691 LIST_FOR_EACH_ENTRY(private_pp, &private_display->pp_list, link) {
692 TDM_SNPRINTF(reply, len, "%c%c%c%c %dx%d %dx%d+%d+%d | %c%c%c%c %dx%d %dx%d+%d+%d | %s\n",
693 FOURCC_STR(private_pp->info.src_config.format),
694 private_pp->info.src_config.size.h,
695 private_pp->info.src_config.size.v,
696 private_pp->info.src_config.pos.x, private_pp->info.src_config.pos.y,
697 private_pp->info.src_config.pos.w, private_pp->info.src_config.pos.h,
698 FOURCC_STR(private_pp->info.dst_config.format),
699 private_pp->info.dst_config.size.h,
700 private_pp->info.dst_config.size.v,
701 private_pp->info.dst_config.pos.x, private_pp->info.dst_config.pos.y,
702 private_pp->info.dst_config.pos.w, private_pp->info.dst_config.pos.h,
703 tdm_transform_str(private_pp->info.transform));
707 TDM_SNPRINTF(reply, len, "[No PP capability]\n");
709 TDM_SNPRINTF(reply, len, "\n");
711 if (private_display->capabilities & TDM_DISPLAY_CAPABILITY_CAPTURE) {
712 const char *sep = "";
713 TDM_SNPRINTF(reply, len, "[Capture information]\n");
714 TDM_SNPRINTF(reply, len, "caps\t: ");
715 tdm_capture_caps_str(private_display->caps_capture.capabilities, &reply, len);
716 TDM_SNPRINTF(reply, len, "\n");
717 TDM_SNPRINTF(reply, len, "formats\t: ");
718 for (i = 0; i < private_display->caps_capture.format_count; i++) {
719 TDM_SNPRINTF(reply, len, "%s%c%c%c%c", sep, FOURCC_STR(private_display->caps_capture.formats[i]));
722 TDM_SNPRINTF(reply, len, "\n");
723 TDM_SNPRINTF(reply, len, "size\t: min(%dx%d) max(%dx%d) align_w(%d)\n",
724 private_display->caps_capture.min_w, private_display->caps_capture.min_h,
725 private_display->caps_capture.max_w, private_display->caps_capture.max_h,
726 private_display->caps_capture.preferred_align);
727 if (!LIST_IS_EMPTY(&private_display->capture_list)) {
728 TDM_SNPRINTF(reply, len, "-----------------------------------\n");
729 TDM_SNPRINTF(reply, len, "dst(format size crop) | transform\n");
730 TDM_SNPRINTF(reply, len, "-----------------------------------\n");
731 LIST_FOR_EACH_ENTRY(private_capture, &private_display->capture_list, link) {
732 TDM_SNPRINTF(reply, len, "%c%c%c%c %dx%d %dx%d+%d+%d | %s\n",
733 FOURCC_STR(private_capture->info.dst_config.format),
734 private_capture->info.dst_config.size.h,
735 private_capture->info.dst_config.size.v,
736 private_capture->info.dst_config.pos.x, private_capture->info.dst_config.pos.y,
737 private_capture->info.dst_config.pos.w, private_capture->info.dst_config.pos.h,
738 tdm_transform_str(private_capture->info.transform));
742 TDM_SNPRINTF(reply, len, "[No Capture capability]\n");
744 TDM_SNPRINTF(reply, len, "\n");
747 _pthread_mutex_unlock(&private_display->lock);