e_plane: update the fps per planes. 04/143904/1
authorSooChan Lim <sc1.lim@samsung.com>
Sun, 13 Aug 2017 03:50:11 +0000 (12:50 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 14 Aug 2017 00:46:10 +0000 (09:46 +0900)
E20 update the screen per planes because
it uses the layer commit. Therefore the fps
has to be updated per planes.

Change-Id: I9cf2c522edaf0b8e6a2aeeb370823f1def6773d7

src/bin/e_plane.c
src/bin/e_plane.h

index 3dac73f8378f5bd941d107e00d8d6bdff2967da7..d98d852ebb7a8f0eb2df4d5cbedcacf1250a8c43 100644 (file)
@@ -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;
 }
 
index 8b160b38e7bea88360bf63fd6cfd45020a14bc35..d2a9ca52d6e92d9b4cc7a81526dc9b3e76901cfc 100644 (file)
@@ -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 {