{
return wl_resource_get_user_data(surface_resource);
}
+
+EINTERN void
+e_client_fps_update(E_Client *ec)
+{
+ double dt;
+ double tim;
+
+ EINA_SAFETY_ON_NULL_RETURN(ec);
+
+ if (!ec->fps.enabled) return;
+
+ tim = ecore_time_get();
+
+ dt = tim - ec->fps.frametimes[0];
+
+ ec->fps.frametimes[0] = tim;
+ ec->fps.time += dt;
+ ec->fps.cframes++;
+
+ if (ec->fps.lapse == 0.0)
+ {
+ ec->fps.lapse = tim;
+ ec->fps.flapse = ec->fps.cframes;
+ }
+ else if ((tim - ec->fps.lapse) >= 0.5)
+ {
+ ec->fps.fps = (ec->fps.cframes - ec->fps.flapse) /
+ (tim - ec->fps.lapse);
+ ec->fps.lapse = tim;
+ ec->fps.flapse = ec->fps.cframes;
+ ec->fps.time = 0.0;
+ }
+}
+
+EINTERN Eina_Bool
+e_client_fps_get(E_Client *ec, double *fps)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
+
+ if (ec->fps.old_fps == ec->fps.fps)
+ return EINA_FALSE;
+
+ if (ec->fps.fps > 0.0)
+ {
+ *fps = ec->fps.fps;
+ ec->fps.old_fps = ec->fps.fps;
+ return EINA_TRUE;
+ }
+
+ return EINA_FALSE;
+}
+
+EINTERN void
+e_client_fps_enable(E_Client *ec, Eina_Bool enable)
+{
+ EINA_SAFETY_ON_NULL_RETURN(ec);
+
+ ec->fps.enabled = enable;
+}
}
}
+#define FPS_USAGE \
+ "[COMMAND] [ARG]...\n" \
+ "\t-help : print this message.\n" \
+ "\t-win_id : print client fps.\n" \
+ "Example:\n" \
+ "\twinfo -fps\n" \
+ "\twinfo -fps -win_id [win_id]\n" \
+
static void
_e_info_client_proc_fps_info(int argc, char **argv)
{
+ char *win_id = "none";
+
+ if (argc == 2)
+ {
+ if (!strcmp(argv[1], "-help"))
+ {
+ printf(FPS_USAGE);
+ return;
+ }
+ }
+ else if (argc == 4)
+ {
+ if (!strcmp(argv[2], "-win_id"))
+ {
+ win_id = argv[3];
+ }
+ else
+ {
+ printf("Invalid argument: %s\n", argv[1]);
+ printf(FPS_USAGE);
+ return;
+ }
+ }
+ else
+ {
+ printf("Invalid argument: %s\n", argv[1]);
+ printf(FPS_USAGE);
+ return;
+ }
+
do
{
Eina_List *l;
E_Fps_Info *fps;
- if (!_e_info_client_eldbus_message("get_fps_info", _cb_fps_info_get))
+ if (!_e_info_client_eldbus_message_with_args("get_fps_info", _cb_fps_info_get,
+ "s", win_id))
return;
if (!e_info_client.fps_list)
fps->output,
fps->fps);
}
+ else if (fps->type == E_INFO_FPS_TYPE_CLIENT_WIN)
+ {
+ printf("Client-Win_ID(0x%x)...%3.1f\n",
+ fps->window,
+ fps->fps);
+ }
}
E_FREE_LIST(e_info_client.fps_list, _e_fps_info_free);
_e_info_client_proc_show_pending_commit
},
{
- "fps", NULL,
+ "fps",
+ FPS_USAGE,
"Print FPS in every sec per",
_e_info_client_proc_fps_info
},
return reply;
}
+static E_Client *
+_e_info_server_find_client_by_win_id(uint64_t win_id)
+{
+ Ecore_Window win;
+ Evas_Object *o;
+ E_Client *ec;
+
+ for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
+ {
+ ec = evas_object_data_get(o, "E_Client");
+ if (!ec) continue;
+
+ win = e_client_util_win_get(ec);
+ if (win == win_id)
+ return ec;
+ }
+
+ return NULL;
+}
+
static void
-_msg_fps_append(Eldbus_Message_Iter *iter)
+_msg_client_fps_append(Eldbus_Message_Iter *iter, E_Client *ec)
+{
+ Eldbus_Message_Iter *array_of_fps, *struct_of_fps;
+ double fps = 0.0;
+
+ eldbus_message_iter_arguments_append(iter, "a("VALUE_TYPE_FOR_FPS")", &array_of_fps);
+
+ if (e_client_fps_get(ec, &fps))
+ {
+ eldbus_message_iter_arguments_append(array_of_fps, "("VALUE_TYPE_FOR_FPS")", &struct_of_fps);
+ eldbus_message_iter_arguments_append(struct_of_fps,
+ VALUE_TYPE_FOR_FPS,
+ E_INFO_FPS_TYPE_CLIENT_WIN,
+ "none",
+ -999,
+ e_client_util_win_get(ec),
+ fps);
+ eldbus_message_iter_container_close(array_of_fps, struct_of_fps);
+ }
+
+ eldbus_message_iter_container_close(iter, array_of_fps);
+}
+
+static void
+_msg_output_fps_append(Eldbus_Message_Iter *iter)
{
Eina_List *output_l, *plane_l, *hwc_l;
Eldbus_Message_Iter *array_of_fps;
static Eldbus_Message *
_e_info_server_cb_fps_info_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
{
+ const char *win_str;
+ uint64_t win_id = 0;
+ unsigned long tmp;
+ E_Client *ec;
Eldbus_Message *reply = eldbus_message_method_return_new(msg);
- if (!e_comp->calc_fps)
+ if (!eldbus_message_arguments_get(msg, "s", &win_str))
{
- e_comp->calc_fps = 1;
+ ERR("Error getting arguments");
+ return reply;
}
- _msg_fps_append(eldbus_message_iter_get(reply));
+ if (e_util_strcmp(win_str, "none"))
+ {
+ if (!e_util_string_to_ulong(win_str, &tmp, 16))
+ return reply;
+
+ win_id = (uint64_t)tmp;
+
+ ec = _e_info_server_find_client_by_win_id(win_id);
+ if (!ec) return reply;
+
+ e_client_fps_enable(ec, EINA_TRUE);
+ _msg_client_fps_append(eldbus_message_iter_get(reply), ec);
+ }
+ else
+ {
+ e_comp->calc_fps = 1;
+ _msg_output_fps_append(eldbus_message_iter_get(reply));
+ }
return reply;
}
{ "hwc", ELDBUS_ARGS({"i", "hwc"}), NULL, e_info_server_cb_hwc, 0},
{ "show_plane_state", NULL, NULL, e_info_server_cb_show_plane_state, 0},
{ "show_pending_commit", NULL, ELDBUS_ARGS({"a("VALUE_TYPE_FOR_PENDING_COMMIT")", "array of pending commit"}), e_info_server_cb_show_pending_commit, 0},
- { "get_fps_info", NULL, ELDBUS_ARGS({"a("VALUE_TYPE_FOR_FPS")", "array of fps"}), _e_info_server_cb_fps_info_get, 0},
+ { "get_fps_info", ELDBUS_ARGS({"s", "fps request"}), ELDBUS_ARGS({"a("VALUE_TYPE_FOR_FPS")", "array of fps"}), _e_info_server_cb_fps_info_get, 0},
{ "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},
{ "quickpanel_control", ELDBUS_ARGS({"i", "operation"}, {"s","window id" }), NULL, e_info_server_cb_quickpanel_control, 0},