From: SooChan Lim Date: Sun, 13 Aug 2017 03:50:11 +0000 (+0900) Subject: e_plane: update the fps per planes. X-Git-Tag: submit/tizen_3.0/20170816.103654~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=189237e968b4f59edd4519707b4ece280c4d14e7;p=platform%2Fupstream%2Fenlightenment.git e_plane: update the fps per planes. E20 update the screen per planes because it uses the layer commit. Therefore the fps has to be updated per planes. Change-Id: I9cf2c522edaf0b8e6a2aeeb370823f1def6773d7 --- diff --git a/src/bin/e_plane.c b/src/bin/e_plane.c index 3dac73f837..d98d852ebb 100644 --- a/src/bin/e_plane.c +++ b/src/bin/e_plane.c @@ -1377,6 +1377,40 @@ _e_plane_fb_target_change_check(E_Plane *plane) return; } +static void +_e_plane_update_fps(E_Plane *plane) +{ + static double time = 0.0; + static double lapse = 0.0; + static int cframes = 0; + static int flapse = 0; + + if (e_comp->calc_fps) + { + double dt; + double tim = ecore_time_get(); + + dt = tim - plane->frametimes[0]; + plane->frametimes[0] = tim; + + time += dt; + cframes++; + + if (lapse == 0.0) + { + lapse = tim; + flapse = cframes; + } + else if ((tim - lapse) >= 0.5) + { + plane->fps = (cframes - flapse) / (tim - lapse); + lapse = tim; + flapse = cframes; + time = 0.0; + } + } +} + EINTERN Eina_Bool e_plane_offscreen_commit(E_Plane *plane) { @@ -1448,6 +1482,8 @@ e_plane_commit(E_Plane *plane) plane->wait_commit = EINA_TRUE; + _e_plane_update_fps(plane); + return EINA_TRUE; } diff --git a/src/bin/e_plane.h b/src/bin/e_plane.h index 8b160b38e7..d2a9ca52d6 100644 --- a/src/bin/e_plane.h +++ b/src/bin/e_plane.h @@ -109,6 +109,10 @@ struct _E_Plane E_Plane_Renderer *renderer; E_Client *ec; } display_info; + + double fps; + double old_fps; + double frametimes[122]; }; struct _E_Plane_Commit_Data {