e_info: switch on/off hwc in runtime
authorJuyeon Lee <juyeonne.lee@samsung.com>
Fri, 10 Jun 2016 03:52:20 +0000 (12:52 +0900)
committerJuyeon Lee <juyeonne.lee@samsung.com>
Fri, 10 Jun 2016 03:52:33 +0000 (12:52 +0900)
enlightenment_info -hwc [0: off | 1: on]

Change-Id: I2f79ec8beedede4304cbae045883380de27808e8

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

index 943c179e35314cfa3fdb562e8f82019324a25651..6f6fcaa346c6a6ef8e815d4e3b7d931c18599230 100644 (file)
@@ -864,7 +864,7 @@ _e_comp_cb_update(void)
 setup_hwcompose:
    // TO DO :
    // query if selective HWC plane can be used
-   if (!e_comp_gl_get() && !e_comp->hwc)
+   if (!e_comp_gl_get() || !e_comp->hwc || !e_comp->hwc_fs)
      {
         goto end;
      }
@@ -1464,6 +1464,8 @@ e_comp_init(void)
         e_comp->hwc = e_comp_hwc_init();
         if (!e_comp->hwc)
           WRN("fail to init hwc.");
+        else 
+          e_comp->hwc_fs = EINA_TRUE; // 1: active hwc policy
      }
 #endif
 
index 5b03f39d4c7607b6e37d732c4c6f2c1ebf6b3ac1..d96f044e58394a2531e2b08a1cae0b76ada18fa4 100644 (file)
@@ -157,6 +157,7 @@ struct _E_Comp
    Eina_Bool       shape_queue_blocked : 1;
    Eina_Bool       calc_fps : 1;
    Eina_Bool       hwc : 1;
+   Eina_Bool       hwc_fs : 1; // active hwc policy
 
    Eina_List      *connected_clients;
    Eina_List      *launchscrns; // list of dummy clients for launchscreen image.
index 3e11aa768a163741eb04daea9207dfe2e328c345..38a60ad5a065e05e02ba31c849ae7d0bb2081ca7 100644 (file)
@@ -394,6 +394,8 @@ _e_info_client_proc_topvwins_info(int argc, char **argv)
    Eina_List *l;
    int i = 0;
    int prev_layer = -1;
+   int hwc_off = 0;
+
    const char *prev_layer_name = NULL;
 
    if (!_e_info_client_eldbus_message("get_window_info", _cb_window_info_get))
@@ -424,13 +426,19 @@ _e_info_client_proc_topvwins_info(int argc, char **argv)
              prev_layer_name = win->layer_name;
           }
 
-        if (win->visibility == 0)
+        if (win->hwc >= 0)
           {
-             if (win->hwc) snprintf(tmp, sizeof(tmp), "hwc@%i", win->pl_zpos);
-             else snprintf(tmp, sizeof(tmp), "comp@%i", win->pl_zpos);
+             if (win->visibility == 0)
+               {
+                  if (win->hwc) snprintf(tmp, sizeof(tmp), "hwc@%i", win->pl_zpos);
+                  else snprintf(tmp, sizeof(tmp), "comp@%i", win->pl_zpos);
+               }
+             else
+               snprintf(tmp, sizeof(tmp), " - ");
           }
-        else
+        else // hwc is not initialized or hwc_fs deactivated
           {
+             hwc_off = 1;
              snprintf(tmp, sizeof(tmp), " - ");
           }
 
@@ -442,6 +450,9 @@ _e_info_client_proc_topvwins_info(int argc, char **argv)
       printf("--------------------------------------------------------------------------------------------------------------[%s]\n",
              prev_layer_name ? prev_layer_name : " ");
 
+   if(hwc_off)
+     printf("\nHWC is disabled\n\n");
+
    E_FREE_LIST(e_info_client.win_list, _e_win_info_free);
 }
 
@@ -1229,6 +1240,32 @@ _e_info_client_proc_effect_control(int argc, char **argv)
      printf("Error Check Args: enlightenment_info -effect [1: on, 0: off]\n");
 }
 
+static void
+_e_info_client_proc_hwc(int argc, char **argv)
+{
+   uint32_t onoff;
+
+   if (argc < 3)
+     {
+        printf("Error Check Args: enlightenment_info -hwc [1: on, 0: off]\n");
+        return;
+     }
+
+   onoff = atoi(argv[2]);
+
+   if (onoff == 1 || onoff == 0)
+     {
+        if (!_e_info_client_eldbus_message_with_args("hwc", NULL, "i", onoff))
+          {
+             printf("_e_info_client_eldbus_message_with_args error");
+             return;
+          }
+     }
+   else
+     printf("Error Check Args: enlightenment_info -hwc [1: on, 0: off]\n");
+
+}
+
 static struct
 {
    const char *option;
@@ -1337,6 +1374,12 @@ static struct
       "[on: 1, off: 0]",
       "On/Off the window effect",
       _e_info_client_proc_effect_control
+   },
+   {
+      "hwc",
+      "[on: 1, off: 0]",
+      "On/Off the hw composite",
+      _e_info_client_proc_hwc
    }
 };
 
index 6734b06b7e2b980817e5f9eb2fd818a0f83fd88f..d25f154af2df05bafe67b18017e896f5800c5ce8 100644 (file)
@@ -109,7 +109,7 @@ _msg_clients_append(Eldbus_Message_Iter *iter)
                }
           }
 
-        if (e_comp->hwc)
+        if (e_comp->hwc && e_comp->hwc_fs)
           {
 #ifdef ENABLE_HWC_MULTI
              Eina_List *l, *ll;
@@ -127,14 +127,14 @@ _msg_clients_append(Eldbus_Message_Iter *iter)
                        pl_zpos = ep->zpos;
                     }
                }
-          }
 #else
-        if (e_comp->nocomp_ec == ec)
-          {
-             hwc = 1;
+             if (e_comp->nocomp_ec == ec) hwc = 1;
              pl_zpos = 0;
-          }
 #endif
+          }
+        else
+           hwc = -1;
+
         eldbus_message_iter_arguments_append(array_of_ec, "("VALUE_TYPE_FOR_TOPVWINS")", &struct_of_ec);
 
         eldbus_message_iter_arguments_append
@@ -1303,6 +1303,42 @@ e_info_server_cb_effect_control(const Eldbus_Service_Interface *iface EINA_UNUSE
    return reply;
 }
 
+static int override = 0;
+static Eldbus_Message *
+e_info_server_cb_hwc(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
+{
+   Eldbus_Message *reply = eldbus_message_method_return_new(msg);
+   uint32_t onoff;
+
+   if (!eldbus_message_arguments_get(msg, "i", &onoff))
+     {
+        ERR("Error getting arguments.");
+        return reply;
+     }
+
+   if (!e_comp->hwc)
+     {
+        ERR("Error HWC is not initialized.");
+        return reply;
+     }
+
+   if (onoff == 1)
+     {
+        e_comp->hwc_fs = EINA_TRUE;
+     }
+   else if (onoff == 0)
+     {
+#ifdef ENABLE_HWC_MULTI
+        _e_comp_hwc_end("in runtime by e_info..");
+#else
+        e_comp_nocomp_end("in runtime by e_info..");
+#endif  // end of ENABLE_HWC_MULTI
+        e_comp->hwc_fs = EINA_FALSE;
+     }
+
+   return reply;
+}
+
 static const Eldbus_Method methods[] = {
    { "get_window_info", NULL, ELDBUS_ARGS({"a("VALUE_TYPE_FOR_TOPVWINS")", "array of ec"}), _e_info_server_cb_window_info_get, 0 },
    { "dump_topvwins", ELDBUS_ARGS({"s", "directory"}), NULL, _e_info_server_cb_topvwins_dump, 0 },
@@ -1327,6 +1363,7 @@ static const Eldbus_Method methods[] = {
 #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},
+   { "hwc", ELDBUS_ARGS({"i", "hwc"}), NULL, e_info_server_cb_hwc, 0},
    { NULL, NULL, NULL, NULL, 0 }
 };