From 5fd366dd8c8e882db91851d9c5c45508e703c589 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Wed, 20 Jul 2016 13:43:45 +0900 Subject: [PATCH] enhance the display information Change-Id: Ie6a52cda9734137d9a76b4f0f1605869e108d454 --- src/tdm.c | 61 -------- src/tdm_helper.c | 387 ++++++++++++++++++++++++++---------------------- src/tdm_macro.h | 16 ++ tools/tdm_test_server.c | 5 +- 4 files changed, 224 insertions(+), 245 deletions(-) diff --git a/src/tdm.c b/src/tdm.c index d73e816..647230b 100644 --- a/src/tdm.c +++ b/src/tdm.c @@ -222,11 +222,6 @@ _tdm_display_update_caps_pp(tdm_private_display *private_display, tdm_caps_pp *caps) { tdm_func_display *func_display = &private_display->func_display; - char buf[1024]; - int bufsize = sizeof(buf); - char *str_buf = buf; - int *len_buf = &bufsize; - int i; tdm_error ret; if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_PP)) @@ -243,15 +238,6 @@ _tdm_display_update_caps_pp(tdm_private_display *private_display, return TDM_ERROR_BAD_MODULE; } - TDM_DBG("pp capabilities: %x", caps->capabilities); - buf[0] = '\0'; - for (i = 0; i < caps->format_count; i++) - TDM_SNPRINTF(str_buf, len_buf, "%c%c%c%c ", FOURCC_STR(caps->formats[i])); - TDM_DBG("pp formats: %s", buf); - TDM_DBG("pp min : %dx%d", caps->min_w, caps->min_h); - TDM_DBG("pp max : %dx%d", caps->max_w, caps->max_h); - TDM_DBG("pp align: %d", caps->preferred_align); - return TDM_ERROR_NONE; } @@ -260,11 +246,6 @@ _tdm_display_update_caps_capture(tdm_private_display *private_display, tdm_caps_capture *caps) { tdm_func_display *func_display = &private_display->func_display; - char buf[1024]; - int bufsize = sizeof(buf); - char *str_buf = buf; - int *len_buf = &bufsize; - int i; tdm_error ret; if (!(private_display->capabilities & TDM_DISPLAY_CAPABILITY_CAPTURE)) @@ -281,11 +262,6 @@ _tdm_display_update_caps_capture(tdm_private_display *private_display, return TDM_ERROR_BAD_MODULE; } - buf[0] = '\0'; - for (i = 0; i < caps->format_count; i++) - TDM_SNPRINTF(str_buf, len_buf, "%c%c%c%c ", FOURCC_STR(caps->formats[i])); - TDM_DBG("capture formats: %s", buf); - return TDM_ERROR_NONE; } @@ -294,11 +270,6 @@ _tdm_display_update_caps_layer(tdm_private_display *private_display, tdm_layer *layer_backend, tdm_caps_layer *caps) { tdm_func_layer *func_layer = &private_display->func_layer; - char buf[1024]; - int bufsize = sizeof(buf); - char *str_buf = buf; - int *len_buf = &bufsize; - int i; tdm_error ret; if (!func_layer->layer_get_capability) { @@ -312,15 +283,6 @@ _tdm_display_update_caps_layer(tdm_private_display *private_display, return TDM_ERROR_BAD_MODULE; } - TDM_DBG("layer capabilities: %x", caps->capabilities); - TDM_DBG("layer zpos : %d", caps->zpos); - buf[0] = '\0'; - for (i = 0; i < caps->format_count; i++) - TDM_SNPRINTF(str_buf, len_buf, "%c%c%c%c ", FOURCC_STR(caps->formats[i])); - TDM_DBG("layer formats: %s", buf); - for (i = 0; i < caps->prop_count; i++) - TDM_DBG("layer props: %d, %s", caps->props[i].id, caps->props[i].name); - return TDM_ERROR_NONE; } @@ -330,7 +292,6 @@ _tdm_display_update_caps_output(tdm_private_display *private_display, int pipe, { tdm_func_output *func_output = &private_display->func_output; char temp[TDM_NAME_LEN]; - int i; tdm_error ret; if (!func_output->output_get_capability) { @@ -348,28 +309,6 @@ _tdm_display_update_caps_output(tdm_private_display *private_display, int pipe, snprintf(temp, TDM_NAME_LEN, "%s-%d", caps->model, pipe); snprintf(caps->model, TDM_NAME_LEN, "%s", temp); - TDM_DBG("output maker: %s", caps->maker); - TDM_DBG("output model: %s", caps->model); - TDM_DBG("output name: %s", caps->name); - TDM_DBG("output status: %d", caps->status); - TDM_DBG("output type : %d", caps->type); - for (i = 0; i < caps->prop_count; i++) - TDM_DBG("output props: %d, %s", caps->props[i].id, caps->props[i].name); - for (i = 0; i < caps->mode_count; i++) { - TDM_DBG("output modes: name(%s), clock(%d) vrefresh(%d), flags(%x), type(%d)", - caps->modes[i].name, caps->modes[i].clock, caps->modes[i].vrefresh, - caps->modes[i].flags, caps->modes[i].type); - TDM_DBG("\t\t %d, %d, %d, %d, %d", - caps->modes[i].hdisplay, caps->modes[i].hsync_start, caps->modes[i].hsync_end, - caps->modes[i].htotal, caps->modes[i].hskew); - TDM_DBG("\t\t %d, %d, %d, %d, %d", - caps->modes[i].vdisplay, caps->modes[i].vsync_start, caps->modes[i].vsync_end, - caps->modes[i].vtotal, caps->modes[i].vscan); - } - TDM_DBG("output min : %dx%d", caps->min_w, caps->min_h); - TDM_DBG("output max : %dx%d", caps->max_w, caps->max_h); - TDM_DBG("output align: %d", caps->preferred_align); - return TDM_ERROR_NONE; } diff --git a/src/tdm_helper.c b/src/tdm_helper.c index b9ad240..f2955ec 100644 --- a/src/tdm_helper.c +++ b/src/tdm_helper.c @@ -494,230 +494,255 @@ tdm_helper_capture_output(tdm_output *output, tbm_surface_h dst_buffer, EXTERN void tdm_helper_get_display_information(tdm_display *dpy, char *reply, int *len) { - const char *name, *vendor; - int major, minor; + tdm_private_display *private_display; + tdm_backend_module *module_data; + tdm_func_output *func_output; + tdm_func_layer *func_layer; + tdm_private_output *private_output = NULL; + tdm_private_layer *private_layer = NULL; + tdm_private_pp *private_pp = NULL; + tdm_private_capture *private_capture = NULL; tdm_error ret; - int i, count; - tdm_output *output; - const tdm_prop *props; - int min_w, min_h, max_w, max_h, preferred_align; - const tbm_format *formats; - tdm_display_capability display_caps; + int i; - ret = tdm_display_get_backend_info(dpy, &name, &vendor, &major, &minor); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); + TDM_DBG_RETURN_IF_FAIL(dpy != NULL); - TDM_SNPRINTF(reply, len, "TDM backend name: %s\n", name); - TDM_SNPRINTF(reply, len, "TDM backend vendor: %s\n", vendor); - TDM_SNPRINTF(reply, len, "TDM backend version: %d.%d\n\n", major, minor); + private_display = dpy; + func_output = &private_display->func_output; + func_layer = &private_display->func_layer; + _pthread_mutex_lock(&private_display->lock); - ret = tdm_display_get_output_count(dpy, &count); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); + /* module information */ + module_data = private_display->module_data; + TDM_SNPRINTF(reply, len, "[TDM backend information]\n"); + TDM_SNPRINTF(reply, len, "name: %s\n", module_data->name); + TDM_SNPRINTF(reply, len, "vendor: %s\n", module_data->vendor); + TDM_SNPRINTF(reply, len, "version: %d.%d\n\n", + (int)TDM_BACKEND_GET_ABI_MAJOR(module_data->abi_version), + (int)TDM_BACKEND_GET_ABI_MINOR(module_data->abi_version)); + /* output information */ TDM_SNPRINTF(reply, len, "[Output information]\n"); - TDM_SNPRINTF(reply, len, "-------------------------------------------------------------------------------------------\n"); - TDM_SNPRINTF(reply, len, "idx maker model name type status dpms subpix prefer min max phy\n"); - TDM_SNPRINTF(reply, len, "-------------------------------------------------------------------------------------------\n"); - - for (i = 0; i < count; i++) { - /* idx maker model name type status dpms subpix prefer min max phy */ - const char *maker, *model, *name; - tdm_output_type type; - tdm_output_conn_status status; - unsigned int subpixel; - unsigned int mmWidth, mmHeight; - tdm_output_dpms dpms; - const tdm_output_mode *mode, *modes; - int j, cnt; - - output = tdm_display_get_output(dpy, i, &ret); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - ret = tdm_output_get_model_info(output, &maker, &model, &name); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - ret = tdm_output_get_output_type(output, &type); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - ret = tdm_output_get_conn_status(output, &status); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - ret = tdm_output_get_dpms(output, &dpms); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - ret = tdm_output_get_subpixel(output, &subpixel); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - ret = tdm_output_get_available_size(output, &min_w, &min_h, &max_w, &max_h, &preferred_align); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - ret = tdm_output_get_physical_size(output, &mmWidth, &mmHeight); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - + TDM_SNPRINTF(reply, len, "--------------------------------------------------------------------------------------------\n"); + TDM_SNPRINTF(reply, len, "idx maker model name type status dpms subpixel align_w min max phy(mm)\n"); + TDM_SNPRINTF(reply, len, "--------------------------------------------------------------------------------------------\n"); + LIST_FOR_EACH_ENTRY(private_output, &private_display->output_list, link) { TDM_SNPRINTF(reply, len, "%d %s %s %s %s %s %s %d %d %dx%d %dx%d %dx%d\n", - i, maker, model, name, tdm_conn_str(type), tdm_status_str(status), - tdm_dpms_str(dpms), subpixel, preferred_align, - min_w, min_h, max_w, max_h, mmWidth, mmHeight); - - ret = tdm_output_get_mode(output, &mode); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - - ret = tdm_output_get_available_modes(output, &modes, &cnt); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - - TDM_SNPRINTF(reply, len, "\t%d modes:\n", cnt); - - if (cnt > 0) { - TDM_SNPRINTF(reply, len, "\t\tname refresh (Hz) hdisp hss hse htot vdisp vss vse vtot\n"); - for (j = 0; j < cnt; j++) { - char *current = (mode == modes + j) ? "*" : " "; + private_output->index, private_output->caps.maker, + private_output->caps.model, private_output->caps.name, + tdm_conn_str(private_output->caps.type), + tdm_status_str(private_output->caps.status), + tdm_dpms_str(private_output->current_dpms_value), + private_output->caps.subpixel, + private_output->caps.preferred_align, + private_output->caps.min_w, private_output->caps.min_h, + private_output->caps.max_w, private_output->caps.max_h, + private_output->caps.mmWidth, private_output->caps.mmHeight); + + TDM_SNPRINTF(reply, len, "\t%d modes:\n", private_output->caps.mode_count); + + if (private_output->caps.mode_count > 0) { + const tdm_output_mode *current_mode = NULL; + + TDM_DBG_GOTO_IF_FAIL(func_output->output_get_mode, unlock); + ret = func_output->output_get_mode(private_output->output_backend, ¤t_mode); + TDM_DBG_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, unlock); + + TDM_SNPRINTF(reply, len, "\t\t name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot\n"); + for (i = 0; i < private_output->caps.mode_count; i++) { + char *current = (current_mode == private_output->caps.modes + i) ? "*" : " "; TDM_SNPRINTF(reply, len, "\t\t%s%s %d %d %d %d %d %d %d %d %d ", current, - modes[j].name, - modes[j].vrefresh, - modes[j].hdisplay, - modes[j].hsync_start, - modes[j].hsync_end, - modes[j].htotal, - modes[j].vdisplay, - modes[j].vsync_start, - modes[j].vsync_end, - modes[j].vtotal); - tdm_mode_flag_str(modes[j].flags, &reply, len); + private_output->caps.modes[i].name, + private_output->caps.modes[i].vrefresh, + private_output->caps.modes[i].hdisplay, + private_output->caps.modes[i].hsync_start, + private_output->caps.modes[i].hsync_end, + private_output->caps.modes[i].htotal, + private_output->caps.modes[i].vdisplay, + private_output->caps.modes[i].vsync_start, + private_output->caps.modes[i].vsync_end, + private_output->caps.modes[i].vtotal); + tdm_mode_flag_str(private_output->caps.modes[i].flags, &reply, len); TDM_SNPRINTF(reply, len, " "); - tdm_mode_type_str(modes[j].type, &reply, len); + tdm_mode_type_str(private_output->caps.modes[i].type, &reply, len); TDM_SNPRINTF(reply, len, "\n"); } } - ret = tdm_output_get_available_properties(output, &props, &cnt); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - - TDM_SNPRINTF(reply, len, "\t%d properties:\n", cnt); - if (cnt > 0) { - TDM_SNPRINTF(reply, len, "\t\tname idx value\n"); - for (j = 0; j < cnt; j++) { + TDM_SNPRINTF(reply, len, "\t%d properties:\n", private_output->caps.prop_count); + if (private_output->caps.prop_count > 0) { + TDM_SNPRINTF(reply, len, "\t\tname\tidx\tvalue\n"); + for (i = 0; i < private_output->caps.prop_count; i++) { tdm_value value; - ret = tdm_output_get_property(output, props[j].id, &value); - TDM_SNPRINTF(reply, len, "\t\t%s %d %d\n", - props[j].name, - props[j].id, + TDM_DBG_GOTO_IF_FAIL(func_output->output_get_property, unlock); + ret = func_output->output_get_property(private_output->output_backend, + private_output->caps.props[i].id, + &value); + TDM_DBG_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, unlock); + TDM_SNPRINTF(reply, len, "\t\t%s\t%d\t%d\n", + private_output->caps.props[i].name, + private_output->caps.props[i].id, value.u32); } } - TDM_SNPRINTF(reply, len, "\n"); } + TDM_SNPRINTF(reply, len, "\n"); + /* layer information */ TDM_SNPRINTF(reply, len, "[Layer information]\n"); - for (i = 0; i < count; i++) { - int j, cnt; - - output = tdm_display_get_output(dpy, i, &ret); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - - ret = tdm_output_get_layer_count(output, &cnt); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - - if (cnt > 0) { - TDM_SNPRINTF(reply, len, "-----------------------------------------------------\n"); - TDM_SNPRINTF(reply, len, "idx output zpos buf info caps\n"); - TDM_SNPRINTF(reply, len, "-----------------------------------------------------\n"); - for (j = 0; j < cnt; j++) { - tdm_layer *layer; - tbm_surface_h buf; - tdm_layer_capability layer_caps; - int k, c, zpos; + TDM_SNPRINTF(reply, len, "-----------------------------------------------------------------------\n"); + TDM_SNPRINTF(reply, len, "idx output zpos buf format size crop geometry transform\n"); + TDM_SNPRINTF(reply, len, "-----------------------------------------------------------------------\n"); + LIST_FOR_EACH_ENTRY(private_output, &private_display->output_list, link) { + LIST_FOR_EACH_ENTRY(private_layer, &private_output->layer_list, link) { + if (!private_layer->usable) { tdm_info_layer info; + unsigned int format; + tdm_size size; + tbm_surface_info_s buf_info; + TDM_DBG_GOTO_IF_FAIL(func_layer->layer_get_info, unlock); memset(&info, 0, sizeof info); + ret = func_layer->layer_get_info(private_layer->layer_backend, &info); + TDM_DBG_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, unlock); - layer = tdm_output_get_layer(output, j, &ret); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - ret = tdm_layer_get_capabilities(layer, &layer_caps); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - ret = tdm_layer_get_zpos(layer, &zpos); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); + format = tbm_surface_get_format(private_layer->showing_buffer); + tbm_surface_get_info(private_layer->showing_buffer, &buf_info); - ret = tdm_layer_get_info(layer, &info); - buf = tdm_layer_get_displaying_buffer(layer, &ret); + if (IS_RGB(format)) + size.h = buf_info.planes[0].stride >> 2; + else + size.h = buf_info.planes[0].stride; + size.v = tbm_surface_get_height(private_layer->showing_buffer); if (info.src_config.format) - TDM_SNPRINTF(reply, len, "%d %d %d %p %c%c%c%c %dx%d (%d,%d %dx%d) (%d,%d %dx%d) trans(%d) ", - j, i, zpos, buf, - FOURCC_STR(info.src_config.format), info.src_config.size.h, info.src_config.size.v, - info.src_config.pos.x, info.src_config.pos.y, info.src_config.pos.w, info.src_config.pos.h, - info.dst_pos.x, info.dst_pos.y, info.dst_pos.w, info.dst_pos.h, - info.transform); - else - TDM_SNPRINTF(reply, len, "%d %d %d %p %c%c%c%c %dx%d (%d,%d %dx%d) (%d,%d %dx%d) trans(%d) ", - j, i, zpos, buf, - 'N', 'O', 'N', 'E', info.src_config.size.h, info.src_config.size.v, - info.src_config.pos.x, info.src_config.pos.y, info.src_config.pos.w, info.src_config.pos.h, - info.dst_pos.x, info.dst_pos.y, info.dst_pos.w, info.dst_pos.h, - info.transform); - tdm_layer_caps_str(layer_caps, &reply, len); - TDM_SNPRINTF(reply, len, "\n"); + format = (info.src_config.format)?:format; + + TDM_SNPRINTF(reply, len, "%d %d %d %p %c%c%c%c %dx%d %dx%d+%d+%d %dx%d+%d+%d %s\n", + private_layer->index, + private_output->index, + private_layer->caps.zpos, + private_layer->showing_buffer, FOURCC_STR(format), size.h, size.v, + info.src_config.pos.w, info.src_config.pos.h, info.src_config.pos.x, info.src_config.pos.y, + info.dst_pos.w, info.dst_pos.h, info.dst_pos.x, info.dst_pos.y, + tdm_transform_str(info.transform)); + } else { + TDM_SNPRINTF(reply, len, "%d %d %d -\n", + private_layer->index, + private_output->index, + private_layer->caps.zpos); + } - ret = tdm_layer_get_available_properties(layer, &props, &c); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - TDM_SNPRINTF(reply, len, "\t%d properties:\n", c); - if (c > 0) { - TDM_SNPRINTF(reply, len, "\t\tname idx value\n"); - for (k = 0; k < c; k++) { - tdm_value value; - ret = tdm_layer_get_property(layer, props[k].id, &value); - TDM_SNPRINTF(reply, len, "\t\t%s %d %d\n", - props[k].name, - props[k].id, - value.u32); - } - } + TDM_SNPRINTF(reply, len, "\tcaps\t: "); + tdm_layer_caps_str(private_layer->caps.capabilities, &reply, len); + TDM_SNPRINTF(reply, len, "\n"); - ret = tdm_layer_get_available_formats(layer, &formats, &c); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - TDM_SNPRINTF(reply, len, "\tformats:"); - for (k = 0; k < c; k++) - TDM_SNPRINTF(reply, len, " %c%c%c%c", FOURCC_STR(formats[k])); + TDM_SNPRINTF(reply, len, "\tformats\t: "); + if (private_layer->caps.format_count > 0) { + const char *sep = ""; + for (i = 0; i < private_layer->caps.format_count; i++) { + TDM_SNPRINTF(reply, len, "%s%c%c%c%c", sep, FOURCC_STR(private_layer->caps.formats[i])); + sep = ","; + } TDM_SNPRINTF(reply, len, "\n"); } + + TDM_SNPRINTF(reply, len, "\t%d properties:\n", private_layer->caps.prop_count); + if (private_layer->caps.prop_count > 0) { + TDM_SNPRINTF(reply, len, "\t\tname\tidx\tvalue\n"); + for (i = 0; i < private_layer->caps.prop_count; i++) { + tdm_value value; + TDM_DBG_GOTO_IF_FAIL(func_layer->layer_get_property, unlock); + ret = func_layer->layer_get_property(private_layer->layer_backend, + private_layer->caps.props[i].id, + &value); + TDM_DBG_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, unlock); + TDM_SNPRINTF(reply, len, "\t\t%s\t%d\t%d\n", + private_layer->caps.props[i].name, + private_layer->caps.props[i].id, + value.u32); + } + } } } - TDM_SNPRINTF(reply, len, "\n"); - ret = tdm_display_get_capabilities(dpy, &display_caps); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - - if (display_caps & TDM_DISPLAY_CAPABILITY_PP) { - tdm_pp_capability pp_caps; - - ret = tdm_display_get_pp_capabilities(dpy, &pp_caps); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - ret = tdm_display_get_pp_available_formats(dpy, &formats, &count); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - ret = tdm_display_get_pp_available_size(dpy, &min_w, &min_h, &max_w, &max_h, &preferred_align); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - + if (private_display->capabilities & TDM_DISPLAY_CAPABILITY_PP) { + const char *sep = ""; TDM_SNPRINTF(reply, len, "[PP information]\n"); - TDM_SNPRINTF(reply, len, "caps: "); - tdm_pp_caps_str(pp_caps, &reply, len); + TDM_SNPRINTF(reply, len, "caps\t: "); + tdm_pp_caps_str(private_display->caps_pp.capabilities, &reply, len); TDM_SNPRINTF(reply, len, "\n"); - TDM_SNPRINTF(reply, len, "formats: "); - for (i = 0; i < count; i++) - TDM_SNPRINTF(reply, len, " %c%c%c%c", FOURCC_STR(formats[i])); + TDM_SNPRINTF(reply, len, "formats\t: "); + for (i = 0; i < private_display->caps_pp.format_count; i++) { + TDM_SNPRINTF(reply, len, "%s%c%c%c%c", sep, FOURCC_STR(private_display->caps_pp.formats[i])); + sep = ","; + } TDM_SNPRINTF(reply, len, "\n"); - TDM_SNPRINTF(reply, len, "size: min(%dx%d) max(%dx%d) preferred(%d)\n", - min_w, min_h, max_w, max_h, preferred_align); + TDM_SNPRINTF(reply, len, "size\t: min(%dx%d) max(%dx%d) align_w(%d)\n", + private_display->caps_pp.min_w, private_display->caps_pp.min_h, + private_display->caps_pp.max_w, private_display->caps_pp.max_h, + private_display->caps_pp.preferred_align); + if (!LIST_IS_EMPTY(&private_display->pp_list)) { + TDM_SNPRINTF(reply, len, "-------------------------------------------------------------\n"); + TDM_SNPRINTF(reply, len, "src(format size crop) | dst(format size crop) | transform\n"); + TDM_SNPRINTF(reply, len, "-------------------------------------------------------------\n"); + LIST_FOR_EACH_ENTRY(private_pp, &private_display->pp_list, link) { + 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", + FOURCC_STR(private_pp->info.src_config.format), + private_pp->info.src_config.size.h, + private_pp->info.src_config.size.v, + private_pp->info.src_config.pos.x, private_pp->info.src_config.pos.y, + private_pp->info.src_config.pos.w, private_pp->info.src_config.pos.h, + FOURCC_STR(private_pp->info.dst_config.format), + private_pp->info.dst_config.size.h, + private_pp->info.dst_config.size.v, + private_pp->info.dst_config.pos.x, private_pp->info.dst_config.pos.y, + private_pp->info.dst_config.pos.w, private_pp->info.dst_config.pos.h, + tdm_transform_str(private_pp->info.transform)); + } + } + } else { + TDM_SNPRINTF(reply, len, "[No PP capability]\n"); } + TDM_SNPRINTF(reply, len, "\n"); - if (display_caps & TDM_DISPLAY_CAPABILITY_CAPTURE) { - tdm_capture_capability capture_caps; - - ret = tdm_display_get_capture_capabilities(dpy, &capture_caps); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - ret = tdm_display_get_catpure_available_formats(dpy, &formats, &count); - TDM_DBG_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); - + if (private_display->capabilities & TDM_DISPLAY_CAPABILITY_CAPTURE) { + const char *sep = ""; TDM_SNPRINTF(reply, len, "[Capture information]\n"); - TDM_SNPRINTF(reply, len, "caps: "); - tdm_capture_caps_str(capture_caps, &reply, len); + TDM_SNPRINTF(reply, len, "caps\t: "); + tdm_capture_caps_str(private_display->caps_capture.capabilities, &reply, len); TDM_SNPRINTF(reply, len, "\n"); - TDM_SNPRINTF(reply, len, "formats: "); - for (i = 0; i < count; i++) - TDM_SNPRINTF(reply, len, " %c%c%c%c", FOURCC_STR(formats[i])); + TDM_SNPRINTF(reply, len, "formats\t: "); + for (i = 0; i < private_display->caps_capture.format_count; i++) { + TDM_SNPRINTF(reply, len, "%s%c%c%c%c", sep, FOURCC_STR(private_display->caps_capture.formats[i])); + sep = ","; + } TDM_SNPRINTF(reply, len, "\n"); + TDM_SNPRINTF(reply, len, "size\t: min(%dx%d) max(%dx%d) align_w(%d)\n", + private_display->caps_capture.min_w, private_display->caps_capture.min_h, + private_display->caps_capture.max_w, private_display->caps_capture.max_h, + private_display->caps_capture.preferred_align); + if (!LIST_IS_EMPTY(&private_display->capture_list)) { + TDM_SNPRINTF(reply, len, "-----------------------------------\n"); + TDM_SNPRINTF(reply, len, "dst(format size crop) | transform\n"); + TDM_SNPRINTF(reply, len, "-----------------------------------\n"); + LIST_FOR_EACH_ENTRY(private_capture, &private_display->capture_list, link) { + TDM_SNPRINTF(reply, len, "%c%c%c%c %dx%d %dx%d+%d+%d | %s\n", + FOURCC_STR(private_capture->info.dst_config.format), + private_capture->info.dst_config.size.h, + private_capture->info.dst_config.size.v, + private_capture->info.dst_config.pos.x, private_capture->info.dst_config.pos.y, + private_capture->info.dst_config.pos.w, private_capture->info.dst_config.pos.h, + tdm_transform_str(private_capture->info.transform)); + } + } + } else { + TDM_SNPRINTF(reply, len, "[No Capture capability]\n"); } + TDM_SNPRINTF(reply, len, "\n"); + +unlock: + _pthread_mutex_unlock(&private_display->lock); } diff --git a/src/tdm_macro.h b/src/tdm_macro.h index fe762c2..bc4c0bd 100644 --- a/src/tdm_macro.h +++ b/src/tdm_macro.h @@ -200,12 +200,28 @@ static struct tdm_type_name tdm_conn_names[] = { }; TDM_TYPE_NAME_FN(conn) +static struct tdm_type_name tdm_transform_names[] = { + { TDM_TRANSFORM_NORMAL, "none" }, + { TDM_TRANSFORM_90, "90" }, + { TDM_TRANSFORM_180, "180" }, + { TDM_TRANSFORM_270, "270" }, + { TDM_TRANSFORM_FLIPPED, "flipped" }, + { TDM_TRANSFORM_FLIPPED_90, "90,flipped" }, + { TDM_TRANSFORM_FLIPPED_180, "180,flipped" }, + { TDM_TRANSFORM_FLIPPED_270, "270,flipped" }, +}; +TDM_TYPE_NAME_FN(transform) + #define TDM_BIT_NAME_FB(res) \ static inline const char * tdm_##res##_str(int type, char **reply, int *len) \ { \ unsigned int i; \ const char *sep = ""; \ + if (type == 0) { \ + TDM_SNPRINTF(*reply, len, "none"); \ + return NULL; \ + } \ for (i = 0; i < TDM_ARRAY_SIZE(tdm_##res##_names); i++) { \ if (type & (1 << i)) { \ TDM_SNPRINTF(*reply, len, "%s%s", sep, tdm_##res##_names[i]); \ diff --git a/tools/tdm_test_server.c b/tools/tdm_test_server.c index aec7aee..95d78c0 100644 --- a/tools/tdm_test_server.c +++ b/tools/tdm_test_server.c @@ -709,10 +709,9 @@ print_args(tdm_test_server *data) tdm_test_server_capture *c = NULL; tdm_test_server_prop *w = NULL; - if (data->do_query) { - printf("query\n"); + if (data->do_query) return; - } + LIST_FOR_EACH_ENTRY(o, &data->output_list, link) { printf("output %d: %s", o->idx, o->mode); if (o->refresh > 0) -- 2.7.4