Eina_Bool pp_output_commit;
E_Hwc_Window_Commit_Data *pp_output_commit_data;
Eina_Rectangle pp_rect;
+
+ /* for fps */
+ double fps;
+ double old_fps;
+ double frametimes[122];
+ double time;
+ double lapse;
+ int cframes;
+ int flapse;
};
EINTERN E_Hwc *e_hwc_new(E_Output *output);
static Eina_Bool _e_hwc_windows_pp_output_data_commit(E_Hwc *hwc, E_Hwc_Window_Commit_Data *data);
static Eina_Bool _e_hwc_windows_pp_window_commit(E_Hwc *hwc, E_Hwc_Window *hwc_window);
+static void
+_e_hwc_windows_update_fps(E_Hwc *hwc)
+{
+ if (e_comp->calc_fps)
+ {
+ double dt;
+ double tim = ecore_time_get();
+
+ dt = tim - hwc->frametimes[0];
+ hwc->frametimes[0] = tim;
+
+ hwc->time += dt;
+ hwc->cframes++;
+
+ if (hwc->lapse == 0.0)
+ {
+ hwc->lapse = tim;
+ hwc->flapse = hwc->cframes;
+ }
+ else if ((tim - hwc->lapse) >= 0.5)
+ {
+ hwc->fps = (hwc->cframes - hwc->flapse) / (tim - hwc->lapse);
+ hwc->lapse = tim;
+ hwc->flapse = hwc->cframes;
+ hwc->time = 0.0;
+ }
+ }
+}
+
static E_Hwc_Mode
_e_hwc_windows_hwc_mode_update(E_Hwc *hwc, int num_client, int num_device, int num_video)
{
}
else
{
+ _e_hwc_windows_update_fps(hwc);
+
error = tdm_hwc_commit(hwc->thwc, 0, _e_hwc_windows_commit_handler, hwc);
if (error != TDM_ERROR_NONE)
{
EHWSTRACE(" add ehw:%p ts:%p to the render_list -- {%25s}.", ec, hwc_window,
hwc_window->buffer.tsurface, e_hwc_window_name_get(hwc_window));
}
+
+EINTERN Eina_Bool
+e_hwc_windows_fps_get(E_Hwc *hwc, double *fps)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(hwc, EINA_FALSE);
+
+ if (hwc->old_fps == hwc->fps)
+ return EINA_FALSE;
+
+ if (hwc->fps > 0.0)
+ {
+ *fps = hwc->fps;
+ hwc->old_fps = hwc->fps;
+ return EINA_TRUE;
+ }
+
+ return EINA_FALSE;
+}
EINTERN Eina_Bool e_hwc_windows_pp_commit_possible_check(E_Hwc *hwc);
EINTERN Eina_Bool e_hwc_windows_zoom_set(E_Hwc *hwc, Eina_Rectangle *rect);
EINTERN void e_hwc_windows_zoom_unset(E_Hwc *hwc);
+EINTERN Eina_Bool e_hwc_windows_fps_get(E_Hwc *hwc, double *fps);
#endif
#endif
strncpy(output_name, output->id, sizeof(char)*30);
- EINA_LIST_FOREACH(output->planes, plane_l, plane)
+ if (output->hwc)
{
- if (!plane) continue;
- if (!e_plane_fps_get(plane, &fps)) continue;
+ if (!e_hwc_windows_fps_get(output->hwc, &fps)) continue;
Eldbus_Message_Iter* struct_of_layer_fps;
eldbus_message_iter_arguments_append(array_of_layer_fps, "("VALUE_TYPE_FOR_LAYER_FPS")", &struct_of_layer_fps);
eldbus_message_iter_arguments_append
- (struct_of_layer_fps, VALUE_TYPE_FOR_LAYER_FPS,
- output_name,
- plane->zpos,
- plane->fps);
+ (struct_of_layer_fps, VALUE_TYPE_FOR_LAYER_FPS,
+ output_name,
+ -999,
+ fps);
+
+ eldbus_message_iter_container_close(array_of_layer_fps, struct_of_layer_fps);
+ }
+ else
+ {
+ EINA_LIST_FOREACH(output->planes, plane_l, plane)
+ {
+ if (!plane) continue;
+ if (!e_plane_fps_get(plane, &fps)) continue;
+
+ Eldbus_Message_Iter* struct_of_layer_fps;
+
+ eldbus_message_iter_arguments_append(array_of_layer_fps, "("VALUE_TYPE_FOR_LAYER_FPS")", &struct_of_layer_fps);
- eldbus_message_iter_container_close(array_of_layer_fps, struct_of_layer_fps);
+ eldbus_message_iter_arguments_append
+ (struct_of_layer_fps, VALUE_TYPE_FOR_LAYER_FPS,
+ output_name,
+ plane->zpos,
+ plane->fps);
+
+ eldbus_message_iter_container_close(array_of_layer_fps, struct_of_layer_fps);
+ }
}
memset(output_name, 0x0, sizeof(char)*30);
}