From: Juyeon Lee Date: Thu, 24 Aug 2017 05:28:48 +0000 (+0900) Subject: e_info: replace -dump_topvwins to -dump topvwins | ns X-Git-Tag: submit/tizen/20170825.070217~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=48c9ce6c007e906c501893d16a4bb7fd1a369f90;p=platform%2Fupstream%2Fenlightenment.git e_info: replace -dump_topvwins to -dump topvwins | ns -dump topvwins: enables to dump top visible surfaces on commit -dump ns : enables to dump native surface on evas object Change-Id: I0ea6c174d52ef5cfdb7f7158f4380883bdc2ed2c --- diff --git a/src/bin/e_info_client.c b/src/bin/e_info_client.c index 85d2b23e38..d3c80b6dce 100644 --- a/src/bin/e_info_client.c +++ b/src/bin/e_info_client.c @@ -1225,7 +1225,7 @@ _e_info_client_proc_keygrab_status(int argc, char **argv) } static char * -_directory_make(char *path) +_directory_make(char *type, char *path) { char dir[PATH_MAX], curdir[PATH_MAX], stamp[PATH_MAX]; time_t timer; @@ -1290,9 +1290,9 @@ _directory_make(char *path) snprintf(stamp, PATH_MAX, "%04d%02d%02d.%02d%02d%02d", t->tm_year+1900, t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); if (strlen(dir) == 1 && dir[0] == '/') - snprintf(fullpath, PATH_MAX, "/topvwins-%s", stamp); + snprintf(fullpath, PATH_MAX, "/%s-%s", type, stamp); else - snprintf(fullpath, PATH_MAX, "%s/topvwins-%s", dir, stamp); + snprintf(fullpath, PATH_MAX, "%s/%s-%s", dir, type, stamp); free (buf); @@ -1309,18 +1309,32 @@ _directory_make(char *path) } static void -_e_info_client_proc_topvwins_shot(int argc, char **argv) +_e_info_client_proc_wins_shot(int argc, char **argv) { - char *directory = _directory_make(argv[2]); - EINA_SAFETY_ON_NULL_RETURN(directory); + char *directory = NULL; + char *type = NULL; - if (!_e_info_client_eldbus_message_with_args("dump_topvwins", NULL, "s", directory)) + if (argc == 3) + directory = _directory_make(argv[2], NULL); + else if (argc == 4) + directory = _directory_make(argv[2], argv[3]); + else + goto arg_err; + + if (!directory) goto arg_err; + + type = argv[2]; + if (!_e_info_client_eldbus_message_with_args("dump_wins", NULL, SIGNATURE_DUMP_WINS, type, directory)) { free(directory); return; } free(directory); + + return; +arg_err: + printf("Usage: enlightenment_info -dump %s\n", USAGE_DUMPIMAGE); } static void @@ -4180,9 +4194,10 @@ static struct _e_info_client_proc_subsurface }, { - "dump_topvwins", "[directory_path]", - "Dump top-level visible windows (default directory_path : current working directory)", - _e_info_client_proc_topvwins_shot + "dump", + USAGE_DUMPIMAGE, + "Dump window images with options", + _e_info_client_proc_wins_shot }, { "eina_log_levels", "[mymodule1:5,mymodule2:2]", diff --git a/src/bin/e_info_server.c b/src/bin/e_info_server.c index eafc591c7c..b55770b1de 100644 --- a/src/bin/e_info_server.c +++ b/src/bin/e_info_server.c @@ -2360,19 +2360,10 @@ _e_info_server_cb_window_prop_get(const Eldbus_Service_Interface *iface EINA_UNU return _msg_window_prop_append(msg, mode, value, property_name, property_value); } -static Eldbus_Message * -_e_info_server_cb_topvwins_dump(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) +static void _e_info_server_cb_wins_dump_topvwins(const char *dir) { - Eldbus_Message *reply = eldbus_message_method_return_new(msg); - const char *dir; Evas_Object *o; - if (!eldbus_message_arguments_get(msg, "s", &dir)) - { - ERR("Error getting arguments."); - return reply; - } - for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o)) { E_Client *ec = evas_object_data_get(o, "E_Client"); @@ -2390,6 +2381,96 @@ _e_info_server_cb_topvwins_dump(const Eldbus_Service_Interface *iface EINA_UNUSE e_info_server_dump_client(ec, fname); } +} + +static void _e_info_server_cb_wins_dump_ns(const char *dir) +{ + Evas_Object *o; + + for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o)) + { + Ecore_Window win; + E_Client *ec; + Evas_Native_Surface *ns = NULL; + Evas_Object *co = NULL; // native surface set + tbm_surface_h tbm_surface = NULL; + char fname[PATH_MAX]; + const char *bltin_t = NULL; + + ec = evas_object_data_get(o, "E_Client"); + win = e_client_util_win_get(ec); + + // find obj which have native surface set + bltin_t = evas_object_type_get(o); + if (!e_util_strcmp(bltin_t, "image")) + { + // builtin types "image" could have cw->obj + ns = evas_object_image_native_surface_get(o); + if (ns) co = o; + } + + if (!ns) + { + if (!co) co = evas_object_name_child_find(o, "cw->obj", -1); + if (co) ns = evas_object_image_native_surface_get(co); + } + + if (!ns) + { + Eina_List *ll; + Evas_Object *c = NULL; + + if (evas_object_smart_data_get(o)) + { + //find smart obj members + EINA_LIST_REVERSE_FOREACH(evas_object_smart_members_get(o), ll, c) + { + if (!co) co = evas_object_name_child_find(c, "cw->obj", -1); + if (co) ns = evas_object_image_native_surface_get(co); + if (ns) break; + } + } + } + + if (!ns) continue; + + switch (ns->type) + { + case EVAS_NATIVE_SURFACE_WL: + snprintf(fname, sizeof(fname), "%s/0x%08x_wl_%p.png", dir, win, co); + if (ns->data.wl.legacy_buffer) + tbm_surface = wayland_tbm_server_get_surface(NULL, ns->data.wl.legacy_buffer); + if (tbm_surface) + tdm_helper_dump_buffer(tbm_surface, fname); + break; + case EVAS_NATIVE_SURFACE_TBM: + snprintf(fname, sizeof(fname), "%s/0x%08x_tbm_%p.png", dir, win, co); + if (ns->data.tbm.buffer) + tdm_helper_dump_buffer(ns->data.tbm.buffer, fname); + break; + default: + break; + } + } +} + +static Eldbus_Message * +_e_info_server_cb_wins_dump(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) +{ + Eldbus_Message *reply = eldbus_message_method_return_new(msg); + const char *type; + const char *dir; + + if (!eldbus_message_arguments_get(msg, SIGNATURE_DUMP_WINS, &type, &dir)) + { + ERR("Error getting arguments."); + return reply; + } + + if (!e_util_strcmp(type, "topvwins")) + _e_info_server_cb_wins_dump_topvwins(dir); + else if (!e_util_strcmp(type, "ns")) + _e_info_server_cb_wins_dump_ns(dir); return reply; } @@ -5021,7 +5102,7 @@ static const Eldbus_Method methods[] = { { "get_all_window_info", NULL, ELDBUS_ARGS({"a("VALUE_TYPE_FOR_TOPVWINS")", "array of ec"}), _e_info_server_cb_all_window_info_get, 0 }, { "compobjs", NULL, ELDBUS_ARGS({"a("SIGNATURE_COMPOBJS_CLIENT")", "array of comp objs"}), _e_info_server_cb_compobjs, 0 }, { "subsurface", NULL, ELDBUS_ARGS({"a("SIGNATURE_SUBSURFACE")", "array of ec"}), _e_info_server_cb_subsurface, 0 }, - { "dump_topvwins", ELDBUS_ARGS({"s", "directory"}), NULL, _e_info_server_cb_topvwins_dump, 0 }, + { "dump_wins", ELDBUS_ARGS({SIGNATURE_DUMP_WINS, "directory"}), NULL, _e_info_server_cb_wins_dump, 0 }, { "eina_log_levels", ELDBUS_ARGS({"s", "eina log levels"}), NULL, _e_info_server_cb_eina_log_levels, 0 }, { "eina_log_path", ELDBUS_ARGS({"s", "eina log path"}), NULL, _e_info_server_cb_eina_log_path, 0 }, #ifdef HAVE_DLOG diff --git a/src/bin/e_info_shared_types.h b/src/bin/e_info_shared_types.h index d95734f3f9..896155793f 100644 --- a/src/bin/e_info_shared_types.h +++ b/src/bin/e_info_shared_types.h @@ -201,4 +201,14 @@ typedef enum "\tenlightenment_info -remote_surface dump 0\n" \ "\tenlightenment_info -remote_surface dump 1\n" +/* -------------------------------------------------------------------------- */ +/* DUMP WINS */ +/* -------------------------------------------------------------------------- */ +#define SIGNATURE_DUMP_WINS "ss" +#define USAGE_DUMPIMAGE \ + "[Option..] [DIR]\n" \ + "\ttopvwins : Dump buffer commit on top visible clients\n" \ + "\tns : Dump native surfaces set on clients\n" + + #endif /* end of _E_INFO_SHARED_TYPES_ */