comp fps debug - show separate input and output fps

devs/bu5hm4n/netstart_fixes
Carsten Haitzler 2 years ago
parent 1f4c6b41d8
commit 9abcae15f6
  1. 242
      src/bin/e_comp.c
  2. 4
      src/bin/e_comp.h
  3. 48
      src/bin/e_comp_canvas.c
  4. 2
      src/bin/e_comp_canvas.h
  5. 2
      src/bin/e_comp_cfdata.c
  6. 1
      src/bin/e_comp_cfdata.h
  7. 1
      src/bin/e_comp_object.c
  8. 14
      src/bin/e_int_config_comp.c

@ -192,10 +192,11 @@ _e_comp_fps_update(void)
if (e_comp->canvas->fps_bg) return;
e_comp->canvas->fps_bg = evas_object_rectangle_add(e_comp->evas);
evas_object_color_set(e_comp->canvas->fps_bg, 0, 0, 0, 128);
evas_object_color_set(e_comp->canvas->fps_bg, 0, 0, 0, 192);
evas_object_layer_set(e_comp->canvas->fps_bg, E_LAYER_MAX);
evas_object_name_set(e_comp->canvas->fps_bg, "e_comp->canvas->fps_bg");
evas_object_lower(e_comp->canvas->fps_bg);
evas_object_pass_events_set(e_comp->canvas->fps_bg, EINA_TRUE);
evas_object_show(e_comp->canvas->fps_bg);
e_comp->canvas->fps_fg = evas_object_text_add(e_comp->evas);
@ -203,14 +204,27 @@ _e_comp_fps_update(void)
evas_object_text_text_set(e_comp->canvas->fps_fg, "???");
evas_object_color_set(e_comp->canvas->fps_fg, 255, 255, 255, 255);
evas_object_layer_set(e_comp->canvas->fps_fg, E_LAYER_MAX);
evas_object_name_set(e_comp->canvas->fps_bg, "e_comp->canvas->fps_fg");
evas_object_name_set(e_comp->canvas->fps_fg, "e_comp->canvas->fps_fg");
evas_object_stack_above(e_comp->canvas->fps_fg, e_comp->canvas->fps_bg);
evas_object_pass_events_set(e_comp->canvas->fps_fg, EINA_TRUE);
evas_object_show(e_comp->canvas->fps_fg);
e_comp->canvas->fps_gr = evas_object_image_filled_add(e_comp->evas);
evas_object_image_smooth_scale_set(e_comp->canvas->fps_gr, EINA_FALSE);
evas_object_image_alpha_set(e_comp->canvas->fps_gr, EINA_TRUE);
evas_object_image_size_set(e_comp->canvas->fps_gr, 500, 3);
evas_object_color_set(e_comp->canvas->fps_gr, 255, 255, 255, 255);
evas_object_layer_set(e_comp->canvas->fps_gr, E_LAYER_MAX);
evas_object_name_set(e_comp->canvas->fps_gr, "e_comp->canvas->fps_gr");
evas_object_stack_above(e_comp->canvas->fps_gr, e_comp->canvas->fps_fg);
evas_object_pass_events_set(e_comp->canvas->fps_gr, EINA_TRUE);
evas_object_show(e_comp->canvas->fps_gr);
}
else
{
E_FREE_FUNC(e_comp->canvas->fps_fg, evas_object_del);
E_FREE_FUNC(e_comp->canvas->fps_bg, evas_object_del);
E_FREE_FUNC(e_comp->canvas->fps_gr, evas_object_del);
}
}
@ -365,6 +379,172 @@ _e_comp_nocomp_end(void)
E_FREE_FUNC(e_comp->nocomp_ec, e_object_unref);
}
static double
_e_comp_fps_calc(double *frametimes, int count)
{
int i;
double t0 = frametimes[0], dt;
for (i = 1; i < count; i++)
{
dt = t0 - frametimes[i];
if ((dt > 0.5) || (i >= (count - 1)))
{
if (dt > 0.0) return ((double)i) / dt;
}
}
return 0.0;
}
E_API void
e_comp_client_frame_add(Evas_Object *obj EINA_UNUSED)
{
int i;
double t = ecore_time_get();
for (i = 121; i >= 1; i--)
e_comp->client_frametimes[i] = e_comp->client_frametimes[i - 1];
e_comp->client_frametimes[0] = t;
}
E_API void
e_comp_fps_update(void)
{
char buf[128];
double fps, comp_fps;
Evas_Coord x = 0, y = 0, w = 0, h = 0;
Evas_Coord gx = 0, gy = 0, gw = 0, gh = 0;
Evas_Coord bx = 0, by = 0, bw = 0, bh = 0;
E_Zone *z;
e_comp->frameskip++;
if (e_comp->frameskip >= 15)
{
unsigned int *pix, *pixrow;
int pixw, pixh, pixstride, i, px, pixscale;
double t;
t = ecore_time_get();
e_comp->frameskip = 0;
fps = _e_comp_fps_calc(e_comp->frametimes, 122);
comp_fps = _e_comp_fps_calc(e_comp->comp_frametimes, 122);
snprintf(buf, sizeof(buf), "FPS: (in) %1.1f (out) %1.1f", fps, comp_fps);
evas_object_text_text_set(e_comp->canvas->fps_fg, buf);
evas_object_geometry_get(e_comp->canvas->fps_fg, NULL, NULL, &w, &h);
w += 16;
h += 16;
z = e_zone_current_get();
if (z)
{
switch (conf->fps_corner)
{
case 3: // bottom-right
x = z->x + z->w - w;
y = z->y + z->h - h;
gw = 500;
gh = 3 * 5;
gx = x - gw;
gy = y - h - gh;
bw = (gw > bw) ? gw : bw;
bh = h + gh + 8;
bx = (x > bx) ? bx: x;
by = gy;
break;
case 2: // bottom-left
x = z->x;
y = z->y + z->h - h;
gw = 500;
gh = 3 * 5;
gx = x;
gy = y - h - gh;
bw = (gw > bw) ? gw : bw;
bh = h + gh + 8;
bx = x;
by = gy;
break;
case 1: // top-right
x = z->x + z->w - w;
y = z->y;
gw = 500;
gh = 3 * 5;
gx = x - gw;
gy = y + h;
bw = (gw > bw) ? gw : bw;
bh = h + gh + 8;
bx = (x > bx) ? bx: x;
by = y;
break;
case 0: // top-left
default:
x = z->x;
y = z->y;
gw = 500;
gh = 3 * 5;
gx = x;
gy = y + h;
bw = (gw > bw) ? gw : bw;
bh = h + gh + 8;
bx = x;
by = y;
break;
}
}
pixscale = 1000;
pixw = 500;
pixh = 3;
evas_object_image_size_set(e_comp->canvas->fps_gr, pixw, pixh);
evas_object_image_alpha_set(e_comp->canvas->fps_gr, EINA_TRUE);
pixstride = evas_object_image_stride_get(e_comp->canvas->fps_gr);
pix = evas_object_image_data_get(e_comp->canvas->fps_gr, EINA_TRUE);
memset(pix, 0, pixstride * pixh);
// comp render done...
pixrow = pix + (0 * (pixstride / 4));
for (i = 0; i < 122; i++)
{
px = (t - e_comp->comp_frametimes[i]) * pixscale;
if (px >= pixw) break;
pixrow[pixw - 1 - px] = 0xffff5533;
}
// client update jobs done...
pixrow = pix + (1 * (pixstride / 4));
for (i = 0; i < 122; i++)
{
px = (t - e_comp->frametimes[i]) * pixscale;
if (px >= pixw) break;
pixrow[pixw - 1 - px] = 0xff55ff33;
}
// client updates
pixrow = pix + (2 * (pixstride / 4));
for (i = 0; i < 122; i++)
{
px = (t - e_comp->client_frametimes[i]) * pixscale;
if (px >= pixw) break;
pixrow[pixw - 1 - px] = 0xff3355ff;
}
evas_object_image_data_set(e_comp->canvas->fps_gr, pix);
evas_object_image_data_update_add(e_comp->canvas->fps_gr,
0, 0, pixw, pixh);
evas_object_color_set(e_comp->canvas->fps_bg, 0, 0, 0, 192);
evas_object_geometry_set(e_comp->canvas->fps_bg, bx, by, bw, bh);
evas_object_geometry_set(e_comp->canvas->fps_gr, gx, gy, gw, gh);
evas_object_move(e_comp->canvas->fps_fg, x + 8, y + 8);
}
}
static Eina_Bool
_e_comp_cb_update(void)
{
@ -373,8 +553,6 @@ _e_comp_cb_update(void)
// static int doframeinfo = -1;
if (!e_comp) return EINA_FALSE;
if (e_comp->update_job)
e_comp->update_job = NULL;
DBG("UPDATE ALL");
if (e_comp->nocomp) goto nocomp;
// if (conf->grab && (!e_comp->grabbed))
@ -395,62 +573,13 @@ _e_comp_cb_update(void)
_e_comp_fps_update();
if (conf->fps_show)
{
char buf[128];
double fps = 0.0, t, dt;
int i;
Evas_Coord x = 0, y = 0, w = 0, h = 0;
E_Zone *z;
t = ecore_loop_time_get();
if (conf->fps_average_range < 1)
conf->fps_average_range = 30;
else if (conf->fps_average_range > 120)
conf->fps_average_range = 120;
dt = t - e_comp->frametimes[conf->fps_average_range - 1];
if (dt > 0.0) fps = (double)conf->fps_average_range / dt;
else fps = 0.0;
if (fps > 0.0) snprintf(buf, sizeof(buf), "FPS: %1.1f", fps);
else snprintf(buf, sizeof(buf), "N/A");
double t = ecore_loop_time_get();
for (i = 121; i >= 1; i--)
e_comp->frametimes[i] = e_comp->frametimes[i - 1];
e_comp->frametimes[0] = t;
e_comp->frameskip++;
if (e_comp->frameskip >= conf->fps_average_range)
{
e_comp->frameskip = 0;
evas_object_text_text_set(e_comp->canvas->fps_fg, buf);
}
evas_object_geometry_get(e_comp->canvas->fps_fg, NULL, NULL, &w, &h);
w += 8;
h += 8;
z = e_zone_current_get();
if (z)
{
switch (conf->fps_corner)
{
case 3: // bottom-right
x = z->x + z->w - w;
y = z->y + z->h - h;
break;
case 2: // bottom-left
x = z->x;
y = z->y + z->h - h;
break;
case 1: // top-right
x = z->x + z->w - w;
y = z->y;
break;
default: // 0 // top-left
x = z->x;
y = z->y;
break;
}
}
evas_object_move(e_comp->canvas->fps_bg, x, y);
evas_object_resize(e_comp->canvas->fps_bg, w, h);
evas_object_move(e_comp->canvas->fps_fg, x + 4, y + 4);
e_comp_fps_update();
}
/*
if (doframeinfo == -1)
@ -520,6 +649,7 @@ static void
_e_comp_cb_job(void *data EINA_UNUSED)
{
DBG("UPDATE ALL JOB...");
if (e_comp->update_job) e_comp->update_job = NULL;
_e_comp_cb_update();
}

@ -87,6 +87,7 @@ typedef struct E_Comp_Canvas
Evas_Object *resize_object; //object to monitor for comp canvas resizes
Evas_Object *fps_bg;
Evas_Object *fps_fg;
Evas_Object *fps_gr;
Evas_Object *gadget_site; //desktop gadget site
} E_Comp_Canvas;
@ -146,6 +147,8 @@ struct _E_Comp
Ecore_Timer *nocomp_override_timer; //delay before overriding nocomp in x11
int animating; //number of animating comp objects
double frametimes[122]; //used for calculating fps
double comp_frametimes[122]; //used for calculating fps
double client_frametimes[122]; //used for calculating fps
int frameskip;
int nocomp_override; //number of times nocomp override has been requested
@ -222,6 +225,7 @@ E_API Eina_Bool e_comp_grab_input(Eina_Bool mouse, Eina_Bool kbd);
E_API void e_comp_ungrab_input(Eina_Bool mouse, Eina_Bool kbd);
E_API void e_comp_gl_set(Eina_Bool set);
E_API Eina_Bool e_comp_gl_get(void);
E_API void e_comp_client_frame_add(Evas_Object *obj);
E_API void e_comp_button_bindings_grab_all(void);
E_API void e_comp_button_bindings_ungrab_all(void);

@ -39,23 +39,24 @@ _e_comp_canvas_cb_first_frame(void *data EINA_UNUSED, Evas *e, void *event_info
evas_event_callback_del_full(e, EVAS_CALLBACK_RENDER_POST, _e_comp_canvas_cb_first_frame, NULL);
}
static Ecore_Job *_e_comp_update_job = NULL;
static void
_e_comp_canvas_render_post(void *data EINA_UNUSED, Evas *e EINA_UNUSED, void *event_info EINA_UNUSED)
_e_comp_canvas_fps_update_job(void *data EINA_UNUSED)
{
E_Comp_Config *conf = e_comp_config_get();
E_Client *ec;
//Evas_Event_Render_Post *ev = event_info;
//Eina_List *l;
//Eina_Rectangle *r;
_e_comp_update_job = NULL;
if (conf->fps_show) e_comp_fps_update();
}
//if (ev)
//{
//EINA_LIST_FOREACH(ev->updated_area, l, r)
//INF("POST RENDER: %d,%d %dx%d", r->x, r->y, r->w, r->h);
//}
static Ecore_Job *_e_comp_post_render_job = NULL;
e_comp->rendering = EINA_FALSE;
static void
_e_comp_canvas_render_post_job(void *data EINA_UNUSED)
{
E_Client *ec;
_e_comp_post_render_job = NULL;
EINA_LIST_FREE(e_comp->post_updates, ec)
{
//INF("POST %p", ec);
@ -66,6 +67,30 @@ _e_comp_canvas_render_post(void *data EINA_UNUSED, Evas *e EINA_UNUSED, void *ev
UNREFD(ec, 111);
e_object_unref(E_OBJECT(ec));
}
}
static void
_e_comp_canvas_render_post(void *data EINA_UNUSED, Evas *e EINA_UNUSED, void *event_info EINA_UNUSED)
{
E_Comp_Config *conf = e_comp_config_get();
double t = ecore_time_get();
int i;
// NOTE: don't modify objects here as we may lose updates - defer...
for (i = 121; i >= 1; i--)
e_comp->comp_frametimes[i] = e_comp->comp_frametimes[i - 1];
e_comp->comp_frametimes[0] = t;
if (conf->fps_show)
{
if (_e_comp_update_job) ecore_job_del(_e_comp_update_job);
ecore_job_add(_e_comp_canvas_fps_update_job, NULL);
}
e_comp->rendering = EINA_FALSE;
if (_e_comp_post_render_job) ecore_job_del(_e_comp_post_render_job);
_e_comp_post_render_job = ecore_job_add(_e_comp_canvas_render_post_job, NULL);
if (conf->grab && e_comp->grabbed)
{
if (e_comp->grab_cb) e_comp->grab_cb();
@ -507,6 +532,7 @@ e_comp_canvas_clear(void)
E_FREE_FUNC(e_comp->canvas->fps_fg, evas_object_del);
E_FREE_FUNC(e_comp->canvas->fps_bg, evas_object_del);
E_FREE_FUNC(e_comp->canvas->fps_gr, evas_object_del);
E_FREE_FUNC(e_comp->autoclose.rect, evas_object_del);
E_FREE_FUNC(e_comp->shape_job, ecore_job_del);
E_FREE_FUNC(e_comp->pointer, e_object_del);

@ -31,6 +31,8 @@ E_API void e_comp_canvas_keys_ungrab(void);
E_API void e_comp_canvas_feed_mouse_up(unsigned int activate_time);
E_API void e_comp_canvas_notidle(void);
E_API Evas_Object *e_comp_canvas_event_grabber_add(void);
E_API void e_comp_fps_update(void);
EINTERN void e_comp_canvas_intercept(void);
/* the following functions are used for adjusting root window coordinates

@ -37,7 +37,6 @@ e_comp_cfdata_edd_init(E_Config_DD **conf_edd, E_Config_DD **match_edd)
//E_CONFIG_VAL(D, T, max_unmapped_pixels, INT);
E_CONFIG_VAL(D, T, max_unmapped_time, INT);
E_CONFIG_VAL(D, T, min_unmapped_time, INT);
E_CONFIG_VAL(D, T, fps_average_range, INT);
E_CONFIG_VAL(D, T, fps_corner, UCHAR);
E_CONFIG_VAL(D, T, fps_show, UCHAR);
E_CONFIG_VAL(D, T, indirect, UCHAR);
@ -74,7 +73,6 @@ e_comp_cfdata_config_new(void)
cfg->max_unmapped_pixels = 32 * 1024; // implement
cfg->max_unmapped_time = 10 * 3600; // implement
cfg->min_unmapped_time = 5 * 60; // implement
cfg->fps_average_range = 30;
cfg->fps_corner = 0;
cfg->fps_show = 0;
cfg->indirect = 0;

@ -14,7 +14,6 @@ struct _E_Comp_Config
int max_unmapped_pixels;
int max_unmapped_time;
int min_unmapped_time;
int fps_average_range;
unsigned char fps_corner;
unsigned char fps_show;
unsigned char indirect;

@ -3800,6 +3800,7 @@ e_comp_object_render_update_add(Evas_Object *obj)
cw->update = 1;
e_comp->updates = eina_list_append(e_comp->updates, cw->ec);
}
e_comp_client_frame_add(obj);
e_comp_render_queue();
}

@ -44,7 +44,6 @@ struct _E_Config_Dialog_Data
int fps_show;
int fps_corner;
int fps_average_range;
double first_draw_delay;
int enable_advanced_features;
};
@ -119,11 +118,7 @@ _create_data(E_Config_Dialog *cfd EINA_UNUSED)
cfdata->fps_show = conf->fps_show;
cfdata->fps_corner = conf->fps_corner;
cfdata->fps_average_range = conf->fps_average_range;
if (cfdata->fps_average_range < 1) cfdata->fps_average_range = 12;
else if (cfdata->fps_average_range > 120)
cfdata->fps_average_range = 120;
cfdata->first_draw_delay = conf->first_draw_delay;
return cfdata;
@ -366,11 +361,6 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
ob = e_widget_check_add(evas, _("Show Framerate"), &(cfdata->fps_show));
e_widget_list_object_append(ol, ob, 1, 1, 0.5);
ob = e_widget_label_add(evas, _("Rolling average frame count"));
e_widget_list_object_append(ol, ob, 1, 1, 0.5);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f Frames"), 1, 120, 1, 0,
NULL, &(cfdata->fps_average_range), 240);
e_widget_list_object_append(ol, ob, 1, 1, 0.5);
of = e_widget_frametable_add(evas, _("Corner"), 0);
e_widget_frametable_content_align_set(of, 0.5, 0.5);
@ -415,7 +405,6 @@ _advanced_apply_data(E_Config_Dialog *cfd EINA_UNUSED,
(cfdata->send_dump != conf->send_dump) ||
(cfdata->fps_show != conf->fps_show) ||
(cfdata->fps_corner != conf->fps_corner) ||
(cfdata->fps_average_range != conf->fps_average_range) ||
(!EINA_DBL_EQ(cfdata->first_draw_delay, conf->first_draw_delay)) ||
(conf->enable_advanced_features != cfdata->enable_advanced_features)
)
@ -434,7 +423,6 @@ _advanced_apply_data(E_Config_Dialog *cfd EINA_UNUSED,
conf->send_dump = cfdata->send_dump;
conf->fps_show = cfdata->fps_show;
conf->fps_corner = cfdata->fps_corner;
conf->fps_average_range = cfdata->fps_average_range;
conf->first_draw_delay = cfdata->first_draw_delay;
if (conf->shadow_style)
eina_stringshare_del(conf->shadow_style);
@ -567,7 +555,6 @@ _basic_apply_data(E_Config_Dialog *cfd EINA_UNUSED,
(cfdata->send_dump != conf->send_dump) ||
(cfdata->fps_show != conf->fps_show) ||
(cfdata->fps_corner != conf->fps_corner) ||
(cfdata->fps_average_range != conf->fps_average_range) ||
(!EINA_DBL_EQ(cfdata->first_draw_delay, conf->first_draw_delay))
)
{
@ -585,7 +572,6 @@ _basic_apply_data(E_Config_Dialog *cfd EINA_UNUSED,
conf->send_dump = cfdata->send_dump;
conf->fps_show = cfdata->fps_show;
conf->fps_corner = cfdata->fps_corner;
conf->fps_average_range = cfdata->fps_average_range;
conf->first_draw_delay = cfdata->first_draw_delay;
if (conf->shadow_style)
eina_stringshare_del(conf->shadow_style);

Loading…
Cancel
Save