add the function to show the hwc information for debugging 56/69856/2
authorSooChan Lim <sc1.lim@samsung.com>
Mon, 16 May 2016 12:04:46 +0000 (21:04 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Tue, 17 May 2016 07:42:43 +0000 (16:42 +0900)
Change-Id: I93c8ef023832dc40536742d9678536d9c7029bb1

src/bin/e_comp_hwc.c
src/bin/e_comp_hwc.h
src/bin/e_info_client.c
src/bin/e_info_server.c

index cdc99a1a210cbbc41bd0bb32b4955e4a0e0989eb..e05da0fa03465e4e9e911776640e72cb30c66075 100644 (file)
@@ -1667,7 +1667,7 @@ fail:
    return EINA_FALSE;
 }
 
-void
+EINTERN void
 e_comp_hwc_trace_debug(Eina_Bool onoff)
 {
    EINA_SAFETY_ON_NULL_RETURN(g_hwc);
@@ -1677,6 +1677,72 @@ e_comp_hwc_trace_debug(Eina_Bool onoff)
    INF("HWC: hwc trace_debug is %s", onoff?"ON":"OFF");
 }
 
+static char *
+_layer_cap_to_str(tdm_layer_capability layer_capabilities, tdm_layer_capability caps)
+{
+   if (layer_capabilities & caps)
+     {
+        if (caps == TDM_LAYER_CAPABILITY_CURSOR) return "cursor ";
+        else if (caps == TDM_LAYER_CAPABILITY_PRIMARY) return "primary ";
+        else if (caps == TDM_LAYER_CAPABILITY_OVERLAY) return "overlay ";
+        else if (caps == TDM_LAYER_CAPABILITY_GRAPHIC) return "graphics ";
+        else if (caps == TDM_LAYER_CAPABILITY_VIDEO) return "video ";
+        else if (caps == TDM_LAYER_CAPABILITY_TRANSFORM) return "transform ";
+        else if (caps == TDM_LAYER_CAPABILITY_RESEVED_MEMORY) return "reserved_memory ";
+        else if (caps == TDM_LAYER_CAPABILITY_NO_CROP) return "no_crop ";
+        else return "unkown";
+     }
+   return "";
+}
+
+EINTERN void
+e_comp_hwc_info_debug(void)
+{
+   EINA_SAFETY_ON_NULL_RETURN(g_hwc);
+
+   E_Comp_Hwc_Output *hwc_output;
+   E_Comp_Hwc_Layer *hwc_layer;
+   Eina_List *l_o, *ll_o;
+   Eina_List *l_l, *ll_l;
+   tdm_output_conn_status conn_status;
+   int output_idx = 0;
+   tdm_layer_capability layer_capabilities;
+   char layer_cap[4096] = {0, };
+
+   INF("HWC: HWC Information ==========================================================");
+   EINA_LIST_FOREACH_SAFE(g_hwc->hwc_outputs, l_o, ll_o, hwc_output)
+     {
+        if (!hwc_output) continue;
+        tdm_output_get_conn_status(hwc_output->toutput, &conn_status);
+        // TODO: check TDM_OUTPUT_CONN_STATUS_MODE_SETTED
+        if (conn_status != TDM_OUTPUT_CONN_STATUS_CONNECTED) continue;
+        INF("HWC: HWC Output(%d):(x, y, w, h)=(%d, %d, %d, %d) Information.",
+            ++output_idx, hwc_output->x, hwc_output->y, hwc_output->w, hwc_output->h);
+        INF("HWC:  num_layers=%d", hwc_output->num_layers);
+        EINA_LIST_FOREACH_SAFE(hwc_output->hwc_layers, l_l, ll_l, hwc_layer)
+          {
+              if (!hwc_layer) continue;
+              CLEAR(layer_capabilities);
+              memset(layer_cap, 0, 4096 * sizeof (char));
+              tdm_layer_get_capabilities(hwc_layer->tlayer, &layer_capabilities);
+              snprintf(layer_cap, sizeof(layer_cap), "%s%s%s%s%s%s%s%s",
+                       _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_CURSOR),
+                       _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_PRIMARY),
+                       _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_OVERLAY),
+                       _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_GRAPHIC),
+                       _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_VIDEO),
+                       _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_TRANSFORM),
+                       _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_RESEVED_MEMORY),
+                       _layer_cap_to_str(layer_capabilities, TDM_LAYER_CAPABILITY_NO_CROP));
+              INF("HWC:  index=%d zpos=%d ec=%p %s",
+                  hwc_layer->index, hwc_layer->zpos,
+                  hwc_layer->ec?hwc_layer->ec:NULL,
+                  layer_cap);
+          }
+     }
+   INF("HWC: =========================================================================");
+}
+
 static Eina_Bool
 _e_comp_hwc_check_buffer_scanout(E_Client *ec)
 {
@@ -1826,7 +1892,6 @@ e_comp_hwc_client_unset_layer(int zorder)
           }
      }
 }
-
 #else /* HAVE_HWC */
 EINTERN Eina_Bool
 e_comp_hwc_init(void)
@@ -1858,6 +1923,12 @@ e_comp_hwc_trace_debug(Eina_Bool onoff)
    ;
 }
 
+EINTERN void
+e_comp_hwc_info_debug(void)
+{
+   ;
+}
+
 EINTERN Eina_Bool
 e_comp_hwc_native_surface_set(E_Client *ec)
 {
index 79be8bf38ad95a7bb9f1798aec99ce728903142e..8b8e780449595ecb5a48e502ba576c29a16031c9 100755 (executable)
@@ -18,6 +18,7 @@ EINTERN void      e_comp_hwc_shutdown(void);
 EINTERN Eina_Bool e_comp_hwc_mode_nocomp(E_Client *ec);
 EINTERN void      e_comp_hwc_display_client(E_Client *ec);
 EINTERN void      e_comp_hwc_trace_debug(Eina_Bool onoff);
+EINTERN void      e_comp_hwc_info_debug(void);
 EINTERN Eina_Bool e_comp_hwc_native_surface_set(E_Client *ec);
 EINTERN void      e_comp_hwc_client_commit(E_Client *ec);
 
index a84e7ead929c3fdf23e24d8801736e8c201ebc1a..97395b9e04a2fb255fe0df90cdb9be2ba064b97b 100644 (file)
@@ -1107,13 +1107,13 @@ _e_info_client_proc_hwc_trace(int argc, char **argv)
 
    if (argc < 3)
      {
-        printf("Error Check Args: enlightenment_info -hwc_trace [0/1]\n");
+        printf("Error Check Args: enlightenment_info -hwc_trace [0/1/2]\n");
         return;
      }
 
    onoff = atoi(argv[2]);
 
-   if (onoff == 1 || onoff == 0)
+   if (onoff == 1 || onoff == 0 || onoff == 2)
      {
         if (!_e_info_client_eldbus_message_with_args("hwc_trace_message", NULL, "i", onoff))
           {
@@ -1122,7 +1122,7 @@ _e_info_client_proc_hwc_trace(int argc, char **argv)
           }
      }
    else
-     printf("Error Check Args: enlightenment_info -hwc_trace [0/1]\n");
+     printf("Error Check Args: enlightenment_info -hwc_trace [0/1/2]\n");
 }
 #endif
 
@@ -1213,7 +1213,7 @@ static struct
 #ifdef HAVE_HWC
    {
       "hwc_trace",
-      "[on: 1, off: 0]",
+      "[off: 0, on: 1, info:2]",
       "Show the hwc trace log",
       _e_info_client_proc_hwc_trace
    },
index 616d34d2d8788f6e1f100397dc2fd68ce26de2c0..d968c544f25f140d174bf7579caa5125185899b6 100644 (file)
@@ -1204,8 +1204,10 @@ e_info_server_cb_hwc_trace_message(const Eldbus_Service_Interface *iface EINA_UN
         return reply;
      }
 
-   if (onoff == 1 || onoff == 0)
+   if (onoff == 0 || onoff == 1)
      e_comp_hwc_trace_debug(onoff);
+   if (onoff == 2)
+     e_comp_hwc_info_debug();
 
    return reply;
 }