#endif /* HAVE_REMOTE_SURFACE */
}
+EINTERN void
+e_comp_wl_remote_surface_debug_info_get(Eldbus_Message_Iter *iter)
+{
+#ifdef HAVE_REMOTE_SURFACE
+ Eldbus_Message_Iter *line_array;
+ Eina_Iterator *hash_iter;
+ E_Comp_Wl_Remote_Provider *provider;
+ E_Comp_Wl_Remote_Source *source;
+ int idx = 0;
+ char info_str[1024];
+
+ eldbus_message_iter_arguments_append(iter, "as", &line_array);
+ if (!_rsm)
+ {
+ eldbus_message_iter_basic_append(line_array,
+ 's',
+ "Remote Surface not initialized..");
+ eldbus_message_iter_container_close(iter, line_array);
+ return;
+ }
+
+ /* PROVIDER */
+ hash_iter = eina_hash_iterator_data_new(_rsm->provider_hash);
+ EINA_ITERATOR_FOREACH(hash_iter, provider)
+ {
+ E_Client *ec = provider->ec;
+ E_Comp_Wl_Remote_Surface *remote_surface;
+ Eina_List *l;
+
+ if (!ec) continue;
+
+ snprintf(info_str, sizeof(info_str),
+ "%10s [%d] 0x%08x win(0x%08x) res(%d) pid(%d) vis(%d) name(%s)",
+ "PROVIDER", idx++, (unsigned int)provider,
+ e_client_util_win_get(ec),
+ e_pixmap_res_id_get(ec->pixmap),
+ ec->netwm.pid,
+ provider->vis_ref,
+ e_client_util_name_get(ec)?:ec->icccm.class?:"NO NAME");
+ eldbus_message_iter_basic_append(line_array, 's', info_str);
+
+ if (provider->surfaces)
+ {
+ snprintf(info_str, sizeof(info_str), "%7s", "│");
+ eldbus_message_iter_basic_append(line_array, 's', info_str);
+ }
+
+ EINA_LIST_FOREACH(provider->surfaces, l, remote_surface)
+ {
+ struct wl_client *wc = NULL;
+ E_Client *owner = NULL;
+ pid_t pid = -1;
+ int s_idx = 0;
+ Eina_Bool is_last = 0;
+
+ if (!remote_surface->resource) continue;
+
+ owner = remote_surface->owner;
+ if (!owner)
+ owner = remote_surface->bind_ec;
+
+ wc = wl_resource_get_client(remote_surface->resource);
+ if (wc)
+ wl_client_get_credentials(wc, &pid, NULL, NULL);
+
+ if ((eina_list_last(provider->surfaces) == l))
+ is_last = EINA_TRUE;
+
+ snprintf(info_str, sizeof(info_str),
+ "%10s CONSUMER [%d] 0x%08x ec(0x%08x) win(0x%08x) pid(%d) vis(%d) redirected(%d) name(%s)",
+ is_last? "└─" : "├─", s_idx++, (unsigned int)remote_surface,
+ (unsigned int)owner?:0,
+ owner?e_client_util_win_get(owner):0,
+ pid,
+ remote_surface->visible,
+ remote_surface->redirect,
+ owner? e_client_util_name_get(owner)?:owner->icccm.class?:"NO NAME":"NO OWNER"
+ );
+ eldbus_message_iter_basic_append(line_array, 's', info_str);
+ }
+ eldbus_message_iter_basic_append(line_array, 's', "");
+ }
+ eina_iterator_free(hash_iter);
+
+ /* SOURCE */
+ idx = 0;
+ hash_iter = eina_hash_iterator_data_new(_rsm->source_hash);
+ EINA_ITERATOR_FOREACH(hash_iter, source)
+ {
+ E_Client *ec = source->ec;
+ E_Comp_Wl_Remote_Surface *remote_surface;
+ Eina_List *l;
+
+ if (!ec) continue;
+ snprintf(info_str, sizeof(info_str),
+ "%10s [%d] 0x%08x win(0x%08x) res(%d) pid(%d) offscreen(%d) name(%s)",
+ "SOURCE", idx++, (unsigned int)source,
+ e_client_util_win_get(ec),
+ e_pixmap_res_id_get(ec->pixmap),
+ ec->netwm.pid,
+ source->offscreen_ref,
+ e_client_util_name_get(ec)?:ec->icccm.class?:"NO NAME");
+ eldbus_message_iter_basic_append(line_array, 's', info_str);
+
+ if (source->surfaces)
+ {
+ snprintf(info_str, sizeof(info_str), "%7s", "│");
+ eldbus_message_iter_basic_append(line_array, 's', info_str);
+ }
+
+ EINA_LIST_FOREACH(source->surfaces, l, remote_surface)
+ {
+ struct wl_client *wc = NULL;
+ E_Client *owner = NULL;
+ pid_t pid = -1;
+ int s_idx = 0;
+ Eina_Bool is_last = 0;
+
+ if (!remote_surface->resource) continue;
+
+ owner = remote_surface->owner;
+ if (!owner)
+ owner = remote_surface->bind_ec;
+
+ wc = wl_resource_get_client(remote_surface->resource);
+ if (wc)
+ wl_client_get_credentials(wc, &pid, NULL, NULL);
+
+ if ((eina_list_last(source->surfaces) == l))
+ is_last = EINA_TRUE;
+
+ snprintf(info_str, sizeof(info_str),
+ "%10s CONSUMER [%d] 0x%08x ec(0x%08x) win(0x%08x) pid(%d) vis(%d) redirected(%d) name(%s)",
+ is_last? "└─" : "├─", s_idx++, (unsigned int)remote_surface,
+ (unsigned int)owner?:0,
+ owner?e_client_util_win_get(owner):0,
+ pid,
+ remote_surface->visible,
+ remote_surface->redirect,
+ owner? e_client_util_name_get(owner)?:owner->icccm.class?:"NO NAME":"NO OWNER"
+ );
+ eldbus_message_iter_basic_append(line_array, 's', info_str);
+ }
+ eldbus_message_iter_basic_append(line_array, 's', "");
+ }
+ eina_iterator_free(hash_iter);
+
+ eldbus_message_iter_container_close(iter, line_array);
+#else
+ Eldbus_Message_Iter *line_array;
+
+ eldbus_message_iter_arguments_append(iter, "as", &line_array);
+ eldbus_message_iter_basic_append(line_array,
+ 's',
+ "Enlightenment doesn't support remote surface");
+ eldbus_message_iter_container_close(iter, line_array);
+#endif
+}
+
#undef E_CLIENT_HOOK_APPEND
#define E_CLIENT_HOOK_APPEND(l, t, cb, d) \
do \
printf("_e_info_client_eldbus_message_with_args error");
}
+static void
+_e_info_client_cb_remote_surface(const Eldbus_Message *msg)
+{
+ const char *name = NULL, *text = NULL;
+ Eina_Bool res;
+ Eldbus_Message_Iter *lines;
+ char *result = NULL;
+
+ res = eldbus_message_error_get(msg, &name, &text);
+ if (res) goto finish;
+
+ res = eldbus_message_arguments_get(msg, "as", &lines);
+ if (!res) goto finish;
+
+ while (eldbus_message_iter_get_and_next(lines, 's', &result))
+ printf("%s\n", result);
+
+ return;
+finish:
+ if ((name) || (text))
+ {
+ printf("errname:%s errmsg:%s\n", name, text);
+ }
+}
+
+static void
+_e_info_client_proc_remote_surface(int argc, char **argv)
+{
+ Eina_Bool res;
+ int i;
+ int dump = -1, query = 0;
+
+ if (argc < 3) goto arg_err;
+ for (i = 2; i < argc; i++)
+ {
+ if (eina_streq(argv[i], "dump"))
+ {
+ if (argc == i + 1)
+ goto arg_err;
+
+ dump = atoi(argv[i+1]);
+ i = i + 1;
+ }
+
+ if (eina_streq(argv[i], "info"))
+ {
+ query = 1;
+ }
+ }
+
+ if (dump == -1 && query == 0)
+ goto arg_err;
+
+ res = _e_info_client_eldbus_message_with_args("remote_surface",
+ _e_info_client_cb_remote_surface,
+ "ii",
+ dump, query);
+ EINA_SAFETY_ON_FALSE_RETURN(res);
+ return;
+arg_err:
+ printf("%s\n", USAGE_REMOTE_SURFACE);
+}
+
static struct
{
const char *option;
"to rotate screen",
_e_info_client_proc_screen_rotation
},
+ {
+ "remote_surface",
+ USAGE_REMOTE_SURFACE,
+ "for remote surface debugging",
+ _e_info_client_proc_remote_surface
+ }
};
static void
static char *e_info_dump_path;
static int e_info_dump_running;
static int e_info_dump_count;
+static int e_info_dump_remote_surface = 0;
//FILE pointer for protocol_trace
static FILE *log_fp_ptrace = NULL;
}
if (e_client_util_ignored_get(ec))
{
- ERR("%s: e_client_util_ignored_get(ec) true. return\n", __func__);
- return ECORE_CALLBACK_PASS_ON;
+ if (!e_info_dump_remote_surface || !ec->remote_surface.provider)
+ {
+ ERR("%s: e_client_util_ignored_get(ec) true. return\n", __func__);
+ return ECORE_CALLBACK_PASS_ON;
+ }
}
buffer = e_pixmap_resource_get(ec->pixmap);
return reply;
}
+static Eldbus_Message *
+_e_info_server_cb_remote_surface(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
+{
+ Eldbus_Message *reply = eldbus_message_method_return_new(msg);
+ int dump_request, info_query;
+ Eina_Bool res;
+ Eldbus_Message_Iter *iter, *line_array;
+
+ res = eldbus_message_arguments_get(msg,
+ "ii", &dump_request, &info_query);
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(res, reply);
+
+ if (info_query)
+ {
+ e_comp_wl_remote_surface_debug_info_get(eldbus_message_iter_get(reply));
+ }
+ else if (dump_request != -1)
+ {
+ char reply_msg[1024] = "";
+
+ e_info_dump_remote_surface = dump_request;
+
+ snprintf(reply_msg, sizeof(reply_msg), "Switch %s remote surface dump",
+ dump_request? "ON":"OFF");
+
+ iter = eldbus_message_iter_get(reply);
+ eldbus_message_iter_arguments_append(iter, "as", &line_array);
+ eldbus_message_iter_basic_append(line_array, 's', reply_msg);
+ eldbus_message_iter_container_close(iter, line_array);
+ }
+
+ return reply;
+}
+
+//{ "method_name", arguments_from_client, return_values_to_client, _method_cb, ELDBUS_METHOD_FLAG },
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 },
{ "compobjs", NULL, ELDBUS_ARGS({"a("SIGNATURE_COMPOBJS_CLIENT")", "array of comp objs"}), _e_info_server_cb_compobjs, 0 },
{ "desk_zoom", ELDBUS_ARGS({"ddii", "Zoom"}), NULL, _e_info_server_cb_desk_zoom, 0},
{ "frender", ELDBUS_ARGS({"i", "frender"}), ELDBUS_ARGS({"s", "force_render_result"}), _e_info_server_cb_force_render, 0},
{ "screen_rotation", ELDBUS_ARGS({"i", "value"}), NULL, _e_info_server_cb_screen_rotation, 0},
+ { "remote_surface", ELDBUS_ARGS({"ii", "remote surface query"}), ELDBUS_ARGS({"as", "remote surfac information"}), _e_info_server_cb_remote_surface, 0},
{ NULL, NULL, NULL, NULL, 0 }
};