From f5b035b42f886ae9ca9954af38a66bc75b478d68 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 9 Aug 2019 15:59:10 +0900 Subject: [PATCH] e_info: add the -screen_info The screen_info option shows the information of the E_Screen and E_Outputs. Need to implement to show the specific information later. Change-Id: I5e5591a3d2b33745fb317b4a7e11e03954f161d0 --- src/bin/e_comp_screen.c | 51 +++++++++++++++++++++++++++++++++++++++++++ src/bin/e_comp_screen.h | 1 + src/bin/e_info_client.c | 45 ++++++++++++++++++++++++++++++++++++++ src/bin/e_info_server.c | 19 ++++++++++++++++ src/bin/e_info_shared_types.h | 8 +++++++ 5 files changed, 124 insertions(+) diff --git a/src/bin/e_comp_screen.c b/src/bin/e_comp_screen.c index 6f22583..f17e063 100644 --- a/src/bin/e_comp_screen.c +++ b/src/bin/e_comp_screen.c @@ -1598,3 +1598,54 @@ e_comp_screen_available_video_formats_get(const tbm_format **formats, int *count return EINA_TRUE; } + +EINTERN void +e_comp_screen_debug_info_get(Eldbus_Message_Iter *iter) +{ + Eldbus_Message_Iter *line_array; + E_Comp_Screen *e_comp_screen = NULL; + E_Output *output = NULL; + E_Hwc *hwc = NULL; + Eina_List *l; + char info_str[1024]; + int idx = 0; + + e_comp_screen = e_comp->e_comp_screen; + + eldbus_message_iter_arguments_append(iter, "as", &line_array); + if (!e_comp_screen) + { + eldbus_message_iter_basic_append(line_array, + 's', + "e_comp_screen not initialized.."); + eldbus_message_iter_container_close(iter, line_array); + return; + } + + eldbus_message_iter_basic_append(line_array, 's', + "===========================================================================================" + "============================================================="); + eldbus_message_iter_basic_append(line_array, 's', + " idx maker model name type status dpms subpixel align_w min max phy(mm)"); + eldbus_message_iter_basic_append(line_array, 's', + "===========================================================================================" + "============================================================="); + + EINA_LIST_FOREACH(e_comp_screen->outputs, l, output) + { + if (!output) continue; + hwc = output->hwc; + if (!output->hwc) continue; + if (e_hwc_policy_get(hwc) == E_HWC_POLICY_NONE) continue; + + // TODO: need to implement more to show the specific information + snprintf(info_str, sizeof(info_str), "%d, %s", ++idx, "NOT IMPLEMENTED YET~!!! TODO::::"); + eldbus_message_iter_basic_append(line_array, 's', info_str); + } + + eldbus_message_iter_basic_append(line_array, 's', + "===========================================================================================" + "============================================================="); + + eldbus_message_iter_container_close(iter, line_array); +} \ No newline at end of file diff --git a/src/bin/e_comp_screen.h b/src/bin/e_comp_screen.h index 821cce2..98e66cd 100644 --- a/src/bin/e_comp_screen.h +++ b/src/bin/e_comp_screen.h @@ -66,6 +66,7 @@ EINTERN Eina_Bool e_comp_screen_pp_support(void); EINTERN Eina_List * e_comp_screen_pp_available_formats_get(void); E_API Eina_Bool e_comp_screen_available_video_formats_get(const tbm_format **formats, int *count); +EINTERN void e_comp_screen_debug_info_get(Eldbus_Message_Iter *iter); #endif /*E_COMP_SCREEN_H*/ diff --git a/src/bin/e_info_client.c b/src/bin/e_info_client.c index 2df7b03..f7bf84e 100644 --- a/src/bin/e_info_client.c +++ b/src/bin/e_info_client.c @@ -5095,6 +5095,45 @@ usage: return; } +static void +_cb_screen_info_get(const Eldbus_Message *msg) +{ + const char *name = NULL, *text = NULL; + Eina_Bool res; + Eldbus_Message_Iter *lines; + char *result = NULL; + + res = eldbus_message_error_get(msg, &name, &text); + if (res) goto finish; + + res = eldbus_message_arguments_get(msg, "as", &lines); + if (!res) goto finish; + + while (eldbus_message_iter_get_and_next(lines, 's', &result)) + printf("%s\n", result); + + return; + +finish: + if ((name) || (text)) + { + printf("errname:%s errmsg:%s\n", name, text); + } +} + +static void +_e_info_client_proc_screen_info(int argc, char **argv) +{ + Eina_Bool res; + int dummy_value = 1; + + res = _e_info_client_eldbus_message_with_args("screen_info", _cb_screen_info_get, "i", dummy_value); + + EINA_SAFETY_ON_FALSE_RETURN(res); + + return; +} + typedef struct _ProcInfo { const char *option; @@ -5242,6 +5281,12 @@ static ProcInfo procs_to_printinfo[] = "Print hwc windows information", _e_info_client_proc_hwc_wins }, + { + "screen_info", + NULL, + "Print screen and output information", + _e_info_client_proc_screen_info + }, }; static ProcInfo procs_to_execute[] = diff --git a/src/bin/e_info_server.c b/src/bin/e_info_server.c index f955306..2cc072b 100644 --- a/src/bin/e_info_server.c +++ b/src/bin/e_info_server.c @@ -6139,6 +6139,24 @@ _e_info_server_cb_hwc_wins_info_get(const Eldbus_Service_Interface *iface EINA_U return reply; } +static Eldbus_Message * +_e_info_server_cb_screen_info_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) +{ + Eldbus_Message *reply; + E_Hwc_Wins_Debug_Cmd cmd; + + if (!eldbus_message_arguments_get(msg, "i", &cmd)) + { + return eldbus_message_error_new(msg, GET_CALL_MSG_ARG_ERR, + "screen_info: an attempt to get arguments from method call message failed"); + } + + reply = eldbus_message_method_return_new(msg); + e_comp_screen_debug_info_get(eldbus_message_iter_get(reply)); + + return reply; +} + //{ "method_name", arguments_from_client, return_values_to_client, _method_cb, ELDBUS_METHOD_FLAG }, static const Eldbus_Method methods[] = { { "get_window_info", NULL, ELDBUS_ARGS({"iiiiisiiia("VALUE_TYPE_FOR_TOPVWINS")", "array of ec"}), _e_info_server_cb_window_info_get, 0 }, @@ -6207,6 +6225,7 @@ static const Eldbus_Method methods[] = { { "magnifier", ELDBUS_ARGS({"i", "magnifier"}), NULL, e_info_server_cb_magnifier, 0}, { "input_region", ELDBUS_ARGS({"siiii", "options"}), ELDBUS_ARGS({"a(iiii)", "path"}), _e_info_server_cb_input_region, 0}, { "hwc_wins", ELDBUS_ARGS({"i", "option"}), ELDBUS_ARGS({"as", "hwc wins info"}), _e_info_server_cb_hwc_wins_info_get, 0 }, + { "screen_info", ELDBUS_ARGS({"i", "option"}), ELDBUS_ARGS({"as", "screen info"}), _e_info_server_cb_screen_info_get, 0 }, { NULL, NULL, NULL, NULL, 0 } }; diff --git a/src/bin/e_info_shared_types.h b/src/bin/e_info_shared_types.h index e255adc..b3c726a 100644 --- a/src/bin/e_info_shared_types.h +++ b/src/bin/e_info_shared_types.h @@ -272,4 +272,12 @@ typedef enum E_INFO_FPS_TYPE_HWC_COMP, } E_Info_Fps_Type; +/* -------------------------------------------------------------------------- */ +/* SCREEN INFO */ +/* -------------------------------------------------------------------------- */ +#define USAGE_SCREEN_INFO \ + "-screen_info\n" \ + "Example:\n" \ + "\twinfo -screen_info\n" + #endif /* end of _E_INFO_SHARED_TYPES_ */ -- 2.7.4