e_info: add the -screen_info 95/211795/2
authorSooChan Lim <sc1.lim@samsung.com>
Fri, 9 Aug 2019 06:59:10 +0000 (15:59 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Fri, 9 Aug 2019 10:20:35 +0000 (10:20 +0000)
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
src/bin/e_comp_screen.h
src/bin/e_info_client.c
src/bin/e_info_server.c
src/bin/e_info_shared_types.h

index 6f22583b22f7416c5465e7a0bd902cc385b72f29..f17e0635f142bcf1c35b33e04fc92295990233b4 100644 (file)
@@ -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
index 821cce2de4aaf8a19c108c9d636877b4754dbfb6..98e66cd34cb004ba358426239f13ce2c4b69d7cc 100644 (file)
@@ -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*/
 
index 2df7b035abb5e2201ad5fa93c4cbe450b1d2374b..f7bf84e74d222d6301d651420ad231a2f6c7e64b 100644 (file)
@@ -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[] =
index f955306ba0ea34128c7b794e2dfc6c6a49cfda30..2cc072b1fc54516d27d11ecc462e383799494ad8 100644 (file)
@@ -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 }
 };
 
index e255adcccd5ba1261601ec5aec09a1b92779fbda..b3c726ad2ba2548981c778dfb0e7718854aba032 100644 (file)
@@ -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_ */