From 127bec02ad4d6c6aa1fd9aead380cd7c23f0e9d1 Mon Sep 17 00:00:00 2001 From: Juyeon Lee Date: Fri, 17 Jun 2016 13:36:21 +0900 Subject: [PATCH] enlightenment_info: add hwc info 1. -topvwins print hw plane zpos at every displaying ec on screen" 2. -hwc [0:off, 1:on] switch on/off hwc in runtime Change-Id: I31c7df38c41a97bfa5cf2a8f5041b1f9d5d2be00 --- src/bin/e_comp.c | 25 +++++++++------ src/bin/e_comp.h | 2 ++ src/bin/e_comp_hwc.c | 2 +- src/bin/e_info_client.c | 83 ++++++++++++++++++++++++++++++++++++++++--------- src/bin/e_info_server.c | 73 ++++++++++++++++++++++++++++++++++--------- src/bin/e_pointer.c | 4 +-- 6 files changed, 147 insertions(+), 42 deletions(-) diff --git a/src/bin/e_comp.c b/src/bin/e_comp.c index f958902..17f595f 100644 --- a/src/bin/e_comp.c +++ b/src/bin/e_comp.c @@ -749,10 +749,12 @@ _e_comp_hwc_cb_begin_timeout(void *data EINA_UNUSED) } return EINA_FALSE; } +#endif // end of ENABLE_HWC_MULTI -void -_e_comp_hwc_end(const char *location) +E_API void +e_comp_hwc_end(const char *location) { +#ifdef ENABLE_HWC_MULTI Eina_Bool mode_set = EINA_FALSE; E_Zone *zone; Eina_List *l; @@ -775,10 +777,10 @@ _e_comp_hwc_end(const char *location) if (!mode_set) return; INF("HWC : End... at %s", location); - - e_comp_render_queue(); +#else + e_comp_nocomp_end(__FUNCTION__); +#endif // end of ENABLE_HWC_MULTI } -#endif // end of ENABLE_HWC_MULTI static void _e_comp_client_update(E_Client *ec) @@ -873,7 +875,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; } @@ -885,7 +887,7 @@ setup_hwcompose: // FIXME : will remove out this condition // new(ec at prepared list) and current(ec on e_plane) if (_e_comp_hwc_changed()) - _e_comp_hwc_end("overlay surface changed"); + e_comp_hwc_end("overlay surface changed"); } else { @@ -907,7 +909,7 @@ setup_hwcompose: } else { - if (_e_comp_hwc_is_on()) _e_comp_hwc_end(__FUNCTION__); + if (_e_comp_hwc_is_on()) e_comp_hwc_end(__FUNCTION__); } #else ec = _e_comp_fullscreen_check(); @@ -1424,6 +1426,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 @@ -1673,7 +1677,10 @@ E_API void e_comp_override_add() { e_comp->nocomp_override++; - if ((e_comp->nocomp_override > 0) && (e_comp->nocomp)) e_comp_nocomp_end(__FUNCTION__); + if ((e_comp->nocomp_override > 0) && (e_comp->nocomp)) + { + e_comp_hwc_end(__FUNCTION__); + } } E_API E_Comp * diff --git a/src/bin/e_comp.h b/src/bin/e_comp.h index c0ecc94..0c4c4b0 100644 --- a/src/bin/e_comp.h +++ b/src/bin/e_comp.h @@ -156,6 +156,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. @@ -235,6 +236,7 @@ E_API void e_comp_post_update_purge(E_Client *ec); E_API E_Comp_Hook *e_comp_hook_add(E_Comp_Hook_Point hookpoint, E_Comp_Hook_Cb func, const void *data); E_API void e_comp_hook_del(E_Comp_Hook *ph); EINTERN Eina_Bool e_comp_is_on_overlay(E_Client *ec); +E_API void e_comp_hwc_end(const char *location); #endif #endif diff --git a/src/bin/e_comp_hwc.c b/src/bin/e_comp_hwc.c index db52aec..40d56cc 100644 --- a/src/bin/e_comp_hwc.c +++ b/src/bin/e_comp_hwc.c @@ -1587,7 +1587,7 @@ e_comp_hwc_display_client(E_Client *ec) if (cdata->sub.below_list || cdata->sub.below_list_pending) { if (!e_comp_wl_video_client_has(ec)) - e_comp_nocomp_end(__FUNCTION__); + e_comp_hwc_end(__FUNCTION__); } } else diff --git a/src/bin/e_info_client.c b/src/bin/e_info_client.c index 18a9ee5..14827a2 100644 --- a/src/bin/e_info_client.c +++ b/src/bin/e_info_client.c @@ -35,10 +35,11 @@ typedef struct _E_Win_Info int iconic; int focused; int hwc; + int pl_zpos; const char *layer_name; // layer name } E_Win_Info; -#define VALUE_TYPE_FOR_TOPVWINS "uuisiiiiibbiibbis" +#define VALUE_TYPE_FOR_TOPVWINS "uuisiiiiibbiibbiis" #define VALUE_TYPE_REQUEST_RESLIST "ui" #define VALUE_TYPE_REPLY_RESLIST "ssi" #define VALUE_TYPE_FOR_INPUTDEV "ssi" @@ -51,7 +52,7 @@ static Eina_Bool _e_info_client_eldbus_message(const char *method, E_Info_Messag static Eina_Bool _e_info_client_eldbus_message_with_args(const char *method, E_Info_Message_Cb cb, const char *signature, ...); static E_Win_Info * -_e_win_info_new(Ecore_Window id, uint32_t res_id, int pid, Eina_Bool alpha, int opaque, const char *name, int x, int y, int w, int h, int layer, int visible, int visibility, int iconic, int focused, int hwc, const char *layer_name) +_e_win_info_new(Ecore_Window id, uint32_t res_id, int pid, Eina_Bool alpha, int opaque, const char *name, int x, int y, int w, int h, int layer, int visible, int visibility, int iconic, int focused, int hwc, int pl_zpos, const char *layer_name) { E_Win_Info *win = NULL; @@ -74,6 +75,7 @@ _e_win_info_new(Ecore_Window id, uint32_t res_id, int pid, Eina_Bool alpha, int win->iconic = iconic; win->focused = focused; win->hwc = hwc; + win->pl_zpos = pl_zpos; win->layer_name = eina_stringshare_add(layer_name); return win; @@ -110,7 +112,7 @@ _cb_window_info_get(const Eldbus_Message *msg) { const char *win_name; const char *layer_name; - int x, y, w, h, layer, visibility, opaque, hwc; + int x, y, w, h, layer, visibility, opaque, hwc, pl_zpos; Eina_Bool visible, alpha, iconic, focused; Ecore_Window id; uint32_t res_id; @@ -134,6 +136,7 @@ _cb_window_info_get(const Eldbus_Message *msg) &iconic, &focused, &hwc, + &pl_zpos, &layer_name); if (!res) { @@ -141,7 +144,7 @@ _cb_window_info_get(const Eldbus_Message *msg) continue; } - win = _e_win_info_new(id, res_id, pid, alpha, opaque, win_name, x, y, w, h, layer, visible, visibility, iconic, focused, hwc, layer_name); + win = _e_win_info_new(id, res_id, pid, alpha, opaque, win_name, x, y, w, h, layer, visible, visibility, iconic, focused, hwc, pl_zpos, layer_name); e_info_client.win_list = eina_list_append(e_info_client.win_list, win); } @@ -392,16 +395,17 @@ _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; - E_Win_Info *nocomp_win = NULL; if (!_e_info_client_eldbus_message("get_window_info", _cb_window_info_get)) return; printf("%d Top level windows\n", eina_list_count(e_info_client.win_list)); - printf("--------------------------------------[ topvwins ]----------------------------------------------------------\n"); - printf(" No Win_ID RcsID PID w h x y Focus Depth Opaq Visi Icon Map_State Title \n"); - printf("------------------------------------------------------------------------------------------------------------\n"); + printf("--------------------------------------[ topvwins ]--------------------------------------------------------------\n"); + printf(" No Win_ID RcsID PID w h x y Focus Depth Opaq Visi Icon Map_State PL@ZPos Title \n"); + printf("----------------------------------------------------------------------------------------------------------------\n"); if (!e_info_client.win_list) { @@ -412,26 +416,43 @@ _e_info_client_proc_topvwins_info(int argc, char **argv) EINA_LIST_FOREACH(e_info_client.win_list, l, win) { if (!win) return; + char tmp[20]; i++; if (win->layer != prev_layer) { if (prev_layer != -1) - printf("------------------------------------------------------------------------------------------------------------[%s]\n", + printf("--------------------------------------------------------------------------------------------------------------[%s]\n", prev_layer_name ? prev_layer_name : " "); prev_layer = win->layer; prev_layer_name = win->layer_name; } - printf("%3d 0x%08x %5d %5d %5d %5d %6d %6d %c %5d %d ", i, win->id, win->res_id, win->pid, win->w, win->h, win->x, win->y, win->focused ? 'O':' ', win->alpha? 32:24, win->opaque); - printf("%2d %d %-11s %s\n", win->visibility, win->iconic, win->vis? "Viewable":"NotViewable", win->name?:"No Name"); - if(win->hwc == 2) nocomp_win = win; + + if (win->hwc >= 0) + { + 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 // hwc is not initialized or hwc_fs deactivated + { + hwc_off = 1; + snprintf(tmp, sizeof(tmp), " - "); + } + + printf("%3d 0x%08x %5d %5d %5d %5d %4d %4d %c %5d %d ", i, win->id, win->res_id, win->pid, win->w, win->h, win->x, win->y, win->focused ? 'O':' ', win->alpha? 32:24, win->opaque); + printf("%2d %d %-11s %-8s %s\n", win->visibility, win->iconic, win->vis? "Viewable":"NotViewable", tmp, win->name?:"No Name"); } if (prev_layer_name) - printf("------------------------------------------------------------------------------------------------------------[%s]\n", + printf("--------------------------------------------------------------------------------------------------------------[%s]\n", prev_layer_name ? prev_layer_name : " "); - if(nocomp_win) - printf("\nNocomp : %s(0x%08x)\n\n", nocomp_win->name?:"No Name", nocomp_win->id); + if(hwc_off) + printf("\nHWC is disabled\n\n"); E_FREE_LIST(e_info_client.win_list, _e_win_info_free); } @@ -1278,6 +1299,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; @@ -1396,6 +1443,12 @@ static struct "module_info", NULL, "Print information maintained by extra modules", _e_info_client_proc_module_info + }, + { + "hwc", + "[on: 1, off: 0]", + "On/Off the hw composite", + _e_info_client_proc_hwc } }; diff --git a/src/bin/e_info_server.c b/src/bin/e_info_server.c index c0a265d..da66bb5 100644 --- a/src/bin/e_info_server.c +++ b/src/bin/e_info_server.c @@ -27,10 +27,6 @@ struct wl_resource void wl_map_for_each(struct wl_map *map, void *func, void *data); -#ifdef HAVE_HWC -#include "e_comp_hwc.h" -#endif - #define BUS "org.enlightenment.wm" #define PATH "/org/enlightenment/wm" #define IFACE "org.enlightenment.wm.info" @@ -71,7 +67,7 @@ static Eina_List *module_hook = NULL; str_r -= str_l; \ } while(0) -#define VALUE_TYPE_FOR_TOPVWINS "uuisiiiiibbiibbis" +#define VALUE_TYPE_FOR_TOPVWINS "uuisiiiiibbiibbiis" #define VALUE_TYPE_REQUEST_RESLIST "ui" #define VALUE_TYPE_REPLY_RESLIST "ssi" #define VALUE_TYPE_FOR_INPUTDEV "ssi" @@ -99,7 +95,7 @@ _msg_clients_append(Eldbus_Message_Iter *iter) uint32_t res_id = 0; pid_t pid = -1; char layer_name[32]; - int hwc = -1; + int hwc = 0, pl_zpos = -999; ec = evas_object_data_get(o, "E_Client"); if (!ec) continue; @@ -122,16 +118,31 @@ _msg_clients_append(Eldbus_Message_Iter *iter) } } - if (e_comp->hwc) + if (e_comp->hwc && e_comp->hwc_fs) { - // TODO: print plane number - if (!e_comp->nocomp_ec) - hwc = 1; // comp mode - else if (e_comp->nocomp_ec == ec) - hwc = 2; // a client occupied scanout buff - else - hwc = 0; +#ifdef ENABLE_HWC_MULTI + Eina_List *l, *ll; + E_Output * eout; + E_Plane *ep; + + eout = e_output_find(ec->zone->output_id); + EINA_LIST_FOREACH_SAFE(eout->planes, l, ll, ep) + { + E_Client *overlay_ec = ep->ec; + if (e_plane_is_primary(ep)) pl_zpos = ep->zpos; + if (overlay_ec == ec) + { + hwc = 1; + pl_zpos = ep->zpos; + } + } +#else + 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); @@ -142,7 +153,7 @@ _msg_clients_append(Eldbus_Message_Iter *iter) pid, e_client_util_name_get(ec) ?: "NO NAME", ec->x, ec->y, ec->w, ec->h, ec->layer, - ec->visible, ec->argb, ec->visibility.opaque, ec->visibility.obscured, ec->iconic, ec->focused, hwc, layer_name); + ec->visible, ec->argb, ec->visibility.opaque, ec->visibility.obscured, ec->iconic, ec->focused, hwc, pl_zpos, layer_name); eldbus_message_iter_container_close(array_of_ec, struct_of_ec); } @@ -1483,6 +1494,37 @@ e_info_server_cb_effect_control(const Eldbus_Service_Interface *iface EINA_UNUSE return reply; } +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) + { + e_comp_hwc_end("in runtime by e_info.."); + 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 }, @@ -1509,6 +1551,7 @@ static const Eldbus_Method methods[] = { { "effect_control", ELDBUS_ARGS({"i", "effect_control"}), NULL, e_info_server_cb_effect_control, 0}, { "get_keygrab_status", ELDBUS_ARGS({"s", "get_keygrab_status"}), NULL, _e_info_server_cb_keygrab_status_get, 0}, { "get_module_info", ELDBUS_ARGS({"ss", "get_module_info"}), NULL, _e_info_server_cb_module_info_get, 0}, + { "hwc", ELDBUS_ARGS({"i", "hwc"}), NULL, e_info_server_cb_hwc, 0}, { NULL, NULL, NULL, NULL, 0 } }; diff --git a/src/bin/e_pointer.c b/src/bin/e_pointer.c index d03eaba..0444a76 100644 --- a/src/bin/e_pointer.c +++ b/src/bin/e_pointer.c @@ -718,7 +718,7 @@ e_pointer_object_set(E_Pointer *ptr, Evas_Object *obj, int x, int y) ecore_evas_object_cursor_set(ptr->ee, obj, E_LAYER_MAX - 1, x, y); if (e_pointer_is_hidden(ptr)) { - e_comp_nocomp_end("re_cursor_set"); + e_comp_hwc_end("re_cursor_set"); } return; } @@ -740,7 +740,7 @@ e_pointer_object_set(E_Pointer *ptr, Evas_Object *obj, int x, int y) if (e_pointer_is_hidden(ptr)) { - e_comp_nocomp_end("cursor_set"); + e_comp_hwc_end("cursor_set"); } } -- 2.7.4