e_info: added show_pending_commit and show_plane_state 84/116284/3
authorChangyeon Lee <cyeon.lee@samsung.com>
Wed, 22 Feb 2017 12:38:44 +0000 (21:38 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Fri, 24 Feb 2017 08:26:31 +0000 (00:26 -0800)
- show_pending_commit: show list pending e_plane_commit_data
- show_plane_state: print e_plane and e_plane_renderer state

Change-Id: I2945cf00b981f6c87f3975a2a39a2c0c3c2e40d8

src/bin/e_info_client.c
src/bin/e_info_server.c
src/bin/e_plane.c
src/bin/e_plane.h
src/bin/e_plane_renderer.c
src/bin/e_plane_renderer.h

index e61d71ff71cf5073226ae4be2db88b649f3859d6..b42d69e833b3f246521cac2a21e18044ae20b0d1 100644 (file)
@@ -22,6 +22,9 @@ typedef struct _E_Info_Client
    /* output mode */
    Eina_List         *mode_list;
    int               gl;
+
+   /* pending_commit */
+   Eina_List         *pending_commit_list;
 } E_Info_Client;
 
 typedef struct _E_Win_Info
@@ -54,10 +57,19 @@ typedef struct output_mode_info
    const char *name;
 } E_Info_Output_Mode;
 
+typedef struct _E_Pending_Commit_Info
+{
+   unsigned int plane;
+   int zpos;
+   unsigned int data;
+   unsigned int tsurface;
+} E_Pending_Commit_Info;
+
 #define VALUE_TYPE_FOR_TOPVWINS "uuisiiiiibbiibbbiis"
 #define VALUE_TYPE_REQUEST_RESLIST "ui"
 #define VALUE_TYPE_REPLY_RESLIST "ssi"
 #define VALUE_TYPE_FOR_INPUTDEV "ssi"
+#define VALUE_TYPE_FOR_PENDING_COMMIT "uiuu"
 
 static E_Info_Client e_info_client;
 
@@ -2136,6 +2148,114 @@ _e_info_client_proc_hwc(int argc, char **argv)
      printf("Error Check Args: enlightenment_info -hwc [1: on, 0: off]\n");
 
 }
+
+static void
+_e_info_client_proc_show_plane_state(int argc, char **argv)
+{
+   if (!_e_info_client_eldbus_message("show_plane_state", NULL))
+     return;
+
+   printf("e20 print planes state with eina_log\n");
+}
+
+static E_Pending_Commit_Info *
+_e_pending_commit_info_new(unsigned int plane, int zpos, unsigned int data, unsigned int tsurface)
+{
+   E_Pending_Commit_Info *pending_commit = NULL;
+
+   pending_commit = E_NEW(E_Pending_Commit_Info, 1);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(pending_commit, NULL);
+
+   pending_commit->plane = plane;
+   pending_commit->zpos = zpos;
+   pending_commit->data = data;
+   pending_commit->tsurface = tsurface;
+
+   return pending_commit;
+}
+
+static void
+_e_pending_commit_info_free(E_Pending_Commit_Info *pending_commit)
+{
+   E_FREE(pending_commit);
+}
+
+static void
+_cb_pending_commit_info_get(const Eldbus_Message *msg)
+{
+   const char *name = NULL, *text = NULL;
+   Eldbus_Message_Iter *array, *eldbus_msg;
+   Eina_Bool res;
+
+   res = eldbus_message_error_get(msg, &name, &text);
+   EINA_SAFETY_ON_TRUE_GOTO(res, finish);
+
+   res = eldbus_message_arguments_get(msg, "a("VALUE_TYPE_FOR_PENDING_COMMIT")", &array);
+   EINA_SAFETY_ON_FALSE_GOTO(res, finish);
+
+   while (eldbus_message_iter_get_and_next(array, 'r', &eldbus_msg))
+     {
+        E_Pending_Commit_Info *pending_commit = NULL;
+        unsigned int plane, tsurface, data;
+        int zpos;
+        res = eldbus_message_iter_arguments_get(eldbus_msg,
+                                                VALUE_TYPE_FOR_PENDING_COMMIT,
+                                                &plane,
+                                                &zpos,
+                                                &data,
+                                                &tsurface);
+        if (!res)
+          {
+             printf("Failed to get pending_commit info\n");
+             continue;
+          }
+
+        pending_commit = _e_pending_commit_info_new(plane, zpos, data, tsurface);
+        if (!pending_commit) continue;
+
+        e_info_client.pending_commit_list = eina_list_append(e_info_client.pending_commit_list, pending_commit);
+     }
+
+finish:
+   if ((name) || (text))
+     {
+        printf("errname:%s errmsg:%s\n", name, text);
+     }
+}
+
+static void
+_e_info_client_proc_show_pending_commit(int argc, char **argv)
+{
+   Eina_List *l;
+   int i = 0;
+   E_Pending_Commit_Info *pending_commit;
+
+   if (!_e_info_client_eldbus_message("show_pending_commit", _cb_pending_commit_info_get))
+     return;
+
+   printf("----------------------------[ pending commit ]-----------------------------------\n");
+   printf(" No          Plane          Zpos          Data          tsurface\n");
+   printf("---------------------------------------------------------------------------------\n");
+
+   if (!e_info_client.pending_commit_list)
+     {
+        printf("no peding commit\n");
+        return;
+     }
+
+   EINA_LIST_FOREACH(e_info_client.pending_commit_list, l, pending_commit)
+     {
+        i++;
+        printf("%3d        %12p   %5d         %12p  %12p\n",
+               i,
+               (void *)pending_commit->plane,
+               pending_commit->zpos,
+               (void *)pending_commit->data,
+               (void *)pending_commit->tsurface);
+     }
+
+   E_FREE_LIST(e_info_client.pending_commit_list, _e_pending_commit_info_free);
+}
 #endif
 
 static void
@@ -2397,6 +2517,18 @@ static struct
       "On/Off the hw composite",
       _e_info_client_proc_hwc
    },
+   {
+      "show_plane_state",
+      NULL,
+      "show state of plane",
+      _e_info_client_proc_show_plane_state
+   },
+   {
+      "show_pending_commit",
+      NULL,
+      "show state of pending commit",
+      _e_info_client_proc_show_pending_commit
+   },
 #endif
    {
       "keymap", NULL,
index 5628f310b85b183ebd76763d38ab98e289335217..4a58ffaf10495016174315b41c6b47a5d0580054 100644 (file)
@@ -85,6 +85,7 @@ static Eina_List *module_hook = NULL;
 #define VALUE_TYPE_REQUEST_RESLIST "ui"
 #define VALUE_TYPE_REPLY_RESLIST "ssi"
 #define VALUE_TYPE_FOR_INPUTDEV "ssi"
+#define VALUE_TYPE_FOR_PENDING_COMMIT "uiuu"
 
 static E_Info_Transform *_e_info_transform_new(E_Client *ec, int id, int enable, int x, int y, int sx, int sy, int degree, int background);
 static E_Info_Transform *_e_info_transform_find(E_Client *ec, int id);
@@ -2569,6 +2570,86 @@ e_info_server_cb_hwc(const Eldbus_Service_Interface *iface EINA_UNUSED, const El
    return reply;
 }
 
+static Eldbus_Message *
+e_info_server_cb_show_plane_state(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
+{
+   Eina_List *output_l, *plane_l;
+   E_Comp_Screen *e_comp_screen = NULL;
+   E_Output *output = NULL;
+   E_Plane *plane = NULL;
+   Eldbus_Message *reply = eldbus_message_method_return_new(msg);
+
+   e_comp_screen = e_comp->e_comp_screen;
+
+   EINA_LIST_FOREACH(e_comp_screen->outputs, output_l, output)
+     {
+        if (!output) continue;
+
+        EINA_LIST_FOREACH(output->planes, plane_l, plane)
+          {
+             if (!plane) continue;
+
+             e_plane_show_state(plane);
+          }
+     }
+
+   return reply;
+}
+
+static void
+_msg_show_pending_commit_append(Eldbus_Message_Iter *iter)
+{
+   Eina_List *output_l, *plane_l, *data_l;
+   Eldbus_Message_Iter *array_of_pending_commit;
+   E_Comp_Screen *e_comp_screen = NULL;
+   E_Output *output = NULL;
+   E_Plane *plane = NULL;
+   E_Plane_Commit_Data *data = NULL;
+
+   eldbus_message_iter_arguments_append(iter, "a("VALUE_TYPE_FOR_PENDING_COMMIT")", &array_of_pending_commit);
+
+   e_comp_screen = e_comp->e_comp_screen;
+
+   EINA_LIST_FOREACH(e_comp_screen->outputs, output_l, output)
+     {
+        if (!output) continue;
+
+        EINA_LIST_FOREACH(output->planes, plane_l, plane)
+          {
+             if (!plane) continue;
+
+             EINA_LIST_FOREACH(plane->pending_commit_data_list, data_l, data)
+               {
+                  Eldbus_Message_Iter* struct_of_pending_commit;
+
+                  if (!data) continue;
+
+                  eldbus_message_iter_arguments_append(array_of_pending_commit, "("VALUE_TYPE_FOR_PENDING_COMMIT")", &struct_of_pending_commit);
+
+                  eldbus_message_iter_arguments_append
+                    (struct_of_pending_commit, VALUE_TYPE_FOR_PENDING_COMMIT,
+                      (unsigned int)plane,
+                      plane->zpos,
+                      (unsigned int)data,
+                      (unsigned int)data->tsurface);
+
+                  eldbus_message_iter_container_close(array_of_pending_commit, struct_of_pending_commit);
+               }
+          }
+     }
+
+   eldbus_message_iter_container_close(iter, array_of_pending_commit);
+}
+
+static Eldbus_Message *
+e_info_server_cb_show_pending_commit(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
+{
+   Eldbus_Message *reply = eldbus_message_method_return_new(msg);
+
+   _msg_show_pending_commit_append(eldbus_message_iter_get(reply));
+
+   return reply;
+}
 #endif
 
 static Eldbus_Message *
@@ -2683,6 +2764,8 @@ static const Eldbus_Method methods[] = {
 #ifdef ENABLE_HWC_MULTI
    { "hwc_trace_message", ELDBUS_ARGS({"i", "hwc_trace_message"}), NULL, e_info_server_cb_hwc_trace_message, 0},
    { "hwc", ELDBUS_ARGS({"i", "hwc"}), NULL, e_info_server_cb_hwc, 0},
+   { "show_plane_state", NULL, NULL, e_info_server_cb_show_plane_state, 0},
+   { "show_pending_commit", NULL, ELDBUS_ARGS({"a("VALUE_TYPE_FOR_PENDING_COMMIT")", "array of pending commit"}), e_info_server_cb_show_pending_commit, 0},
 #endif
    { "get_keymap", NULL, ELDBUS_ARGS({"hi", "keymap fd"}), _e_info_server_cb_keymap_info_get, 0},
    { "effect_control", ELDBUS_ARGS({"i", "effect_control"}), NULL, e_info_server_cb_effect_control, 0},
index 646c61cbdf2564fb36012e041ddfec587651e4ba..bad2363bbb484647540ba1fdbad68ca57d5d503f 100644 (file)
@@ -878,6 +878,8 @@ e_plane_commit(E_Plane *plane)
      ELOGF("E_PLANE", "Commit  Plane(%p)     tsurface(%p) tqueue(%p) data(%p)",
            NULL, NULL, plane, data->tsurface, plane->renderer ? plane->renderer->tqueue : NULL, data);
 
+   plane->pending_commit_data_list = eina_list_append(plane->pending_commit_data_list, data);
+
    error = tdm_layer_commit(plane->tlayer, _e_plane_commit_hanler, data);
    if (error != TDM_ERROR_NONE)
      {
@@ -984,6 +986,7 @@ e_plane_commit_data_release(E_Plane_Commit_Data *data)
              plane->displaying_buffer_tsurface = NULL;
           }
 
+        plane->pending_commit_data_list = eina_list_remove(plane->pending_commit_data_list, data);
         free(data);
         return;
      }
@@ -1087,6 +1090,7 @@ e_plane_commit_data_release(E_Plane_Commit_Data *data)
      }
 
    tbm_surface_internal_unref(tsurface);
+   plane->pending_commit_data_list = eina_list_remove(plane->pending_commit_data_list, data);
    free(data);
 }
 
@@ -1363,3 +1367,15 @@ e_plane_is_fb_target(E_Plane *plane)
 
    return EINA_FALSE;
 }
+
+EINTERN void
+e_plane_show_state(E_Plane *plane)
+{
+   EINA_SAFETY_ON_NULL_RETURN(plane);
+
+   ELOGF("E_PLANE", "Plane(%p) zpos(%d) ec(%p) display tsurface(%p)",
+             NULL, NULL, plane, plane->zpos, plane->ec, plane->displaying_buffer_tsurface);
+
+   if (plane->renderer)
+      e_plane_renderer_show_state(plane->renderer);
+}
\ No newline at end of file
index 5deec6380de5c6d0235226b6b3104ad40f0a5099..e2e6f717c933269749e905858ca15ef26f292073 100644 (file)
@@ -65,6 +65,7 @@ struct _E_Plane
 
    unsigned int          buffer_flags;
    Eina_Bool             pending_commit;
+   Eina_List             *pending_commit_data_list;
    Eina_Bool             need_to_unset_commit;
 
    /* true if plane's ec is set or unset.
@@ -104,6 +105,7 @@ EINTERN void                 e_plane_reserved_set(E_Plane *plane, Eina_Bool set)
 EINTERN void                 e_plane_hwc_trace_debug(Eina_Bool onoff);
 EINTERN Eina_Bool            e_plane_render(E_Plane *plane);
 EINTERN Eina_Bool            e_plane_commit(E_Plane *plane);
+EINTERN void                 e_plane_show_state(E_Plane *plane);
 
 E_API Eina_Bool              e_plane_type_set(E_Plane *plane, E_Plane_Type type);
 E_API E_Plane_Type           e_plane_type_get(E_Plane *plane);
index b0875bc0586522c60cb9b0322c531d49a4fea886..cf44e33be5cbf16a4165f03944fc3eea93e09c99 100644 (file)
@@ -1702,3 +1702,53 @@ e_plane_renderer_hwc_trace_debug(Eina_Bool onoff)
    renderer_trace_debug = onoff;
    INF("Renderer: hwc trace_debug is %s", onoff?"ON":"OFF");
 }
+
+EINTERN void
+e_plane_renderer_show_state(E_Plane_Renderer *renderer)
+{
+   tbm_surface_h tmp_tsurface = NULL;
+   Eina_List *l = NULL;
+   E_Plane_Renderer_Client *renderer_client = NULL;
+
+   EINA_SAFETY_ON_NULL_RETURN(renderer);
+
+   ELOGF("E_PLANE_RENDERER", "Renderer(%p) Plane(%p) ec(%p) state(%d) mode_chage_age(%d)",
+         NULL, NULL, renderer, renderer->plane, renderer->ec, renderer->state, renderer->mode_change_age);
+
+   EINA_LIST_FOREACH(renderer->disp_surfaces, l, tmp_tsurface)
+     {
+        if (!tmp_tsurface) continue;
+
+        ELOGF("E_PLANE_RENDERER", "Dispay Surfaces tsurface(%p)", NULL, NULL, tmp_tsurface);
+     }
+
+   ELOGF("E_PLANE_RENDERER", "Displaying tsurface(%p)", NULL, NULL, renderer->displaying_tsurface);
+   ELOGF("E_PLANE_RENDERER", "Previous  tsurface(%p)", NULL, NULL, renderer->previous_tsurface);
+
+   EINA_LIST_FOREACH(renderer->exported_surfaces, l, tmp_tsurface)
+     {
+        if (!tmp_tsurface) continue;
+
+        ELOGF("E_PLANE_RENDERER", "Exported tsurface(%p)", NULL, NULL, tmp_tsurface);
+     }
+
+   EINA_LIST_FOREACH(renderer->released_surfaces, l, tmp_tsurface)
+     {
+        if (!tmp_tsurface) continue;
+
+        ELOGF("E_PLANE_RENDERER", "Released tsurface(%p)", NULL, NULL, tmp_tsurface);
+     }
+
+   if (renderer->ec)
+     {
+        renderer_client = e_plane_renderer_client_get(renderer->ec);
+        EINA_SAFETY_ON_NULL_RETURN(renderer_client);
+
+        EINA_LIST_FOREACH(renderer_client->exported_surfaces, l, tmp_tsurface)
+          {
+              if (!tmp_tsurface) continue;
+
+              ELOGF("E_PLANE_RENDERER", "Client ec(%p) exported tsurface(%p)", NULL, NULL, renderer->ec, tmp_tsurface);
+          }
+     }
+}
index 174f4a1a84c204b7bcc1efb0d35dada41796696d..30b5ba5365ef42be9613c9e0dc28759028c2bac8 100644 (file)
@@ -88,6 +88,7 @@ EINTERN void                       e_plane_renderer_sent_surface_recevie(E_Plane
 EINTERN Eina_Bool                  e_plane_renderer_ec_valid_check(E_Plane_Renderer *renderer, E_Client *ec);
 
 EINTERN void                       e_plane_renderer_hwc_trace_debug(Eina_Bool onoff);
+EINTERN void                       e_plane_renderer_show_state(E_Plane_Renderer *renderer);
 
 #endif
 #endif