[cogl/wip/frame-synchronization: 215/223] frame-info: s/_refresh_interval/_refresh_rate/



commit 0dd495d28418db0ad6ffd0d8078a27f01c2eba42
Author: Robert Bragg <robert linux intel com>
Date:   Tue Jan 15 15:37:49 2013 +0000

    frame-info: s/_refresh_interval/_refresh_rate/
    
    For consistency this reworks the cogl_frame_info_get_refresh_interval
    api to instead be cogl_frame_info_get_refresh_rate() and return a
    frequency in Hertz instead of an interval in milliseconds. This is
    consistent with cogl_output_get_refresh_rate().

 cogl/cogl-frame-info-private.h |    2 +-
 cogl/cogl-frame-info.c         |    4 ++--
 cogl/cogl-frame-info.h         |   12 +++++-------
 cogl/winsys/cogl-winsys-glx.c  |   10 +++++-----
 4 files changed, 13 insertions(+), 15 deletions(-)
---
diff --git a/cogl/cogl-frame-info-private.h b/cogl/cogl-frame-info-private.h
index 85a86c8..12073e4 100644
--- a/cogl/cogl-frame-info-private.h
+++ b/cogl/cogl-frame-info-private.h
@@ -34,7 +34,7 @@ struct _CoglFrameInfo
   int64_t frame_counter;
   int64_t frame_time;
   int64_t presentation_time;
-  int64_t refresh_interval;
+  float refresh_rate;
 
   unsigned int complete : 1;
 };
diff --git a/cogl/cogl-frame-info.c b/cogl/cogl-frame-info.c
index 2a2e4ff..a13eba0 100644
--- a/cogl/cogl-frame-info.c
+++ b/cogl/cogl-frame-info.c
@@ -72,7 +72,7 @@ cogl_frame_info_get_presentation_time (CoglFrameInfo *info)
 }
 
 int64_t
-cogl_frame_info_get_refresh_interval (CoglFrameInfo *info)
+cogl_frame_info_get_refresh_rate (CoglFrameInfo *info)
 {
-  return info->refresh_interval;
+  return info->refresh_rate;
 }
diff --git a/cogl/cogl-frame-info.h b/cogl/cogl-frame-info.h
index 725d1f8..75c0148 100644
--- a/cogl/cogl-frame-info.h
+++ b/cogl/cogl-frame-info.h
@@ -111,19 +111,17 @@ int64_t cogl_frame_info_get_frame_time (CoglFrameInfo *info);
 int64_t cogl_frame_info_get_presentation_time (CoglFrameInfo *info);
 
 /**
- * cogl_frame_info_get_refresh_interval:
+ * cogl_frame_info_get_refresh_rate:
  * @info: a #CoglFrameInfo object
  *
- * Gets the refresh interval for the output that the frame was on at the
- * time the frame was presented. This is the number of microseconds between
- * refreshes of the screen, and is equal to 1000000 / refresh_rate.
+ * Gets the refresh rate in Hertz for the output that the frame was on
+ * at the time the frame was presented.
  *
- * Return value: the refresh interval, in microsecoonds.
- *  .
+ * Return value: the refresh rate in Hertz
  * Since: 2.0
  * Stability: unstable
  */
-int64_t cogl_frame_info_get_refresh_interval (CoglFrameInfo *info);
+int64_t cogl_frame_info_get_refresh_rate (CoglFrameInfo *info);
 
 G_END_DECLS
 
diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c
index 9843466..75052a4 100644
--- a/cogl/winsys/cogl-winsys-glx.c
+++ b/cogl/winsys/cogl-winsys-glx.c
@@ -1457,8 +1457,8 @@ _cogl_winsys_get_vsync_counter (CoglContext *ctx)
 }
 
 static void
-set_refresh_interval_from_output (CoglOnscreen *onscreen,
-                                  CoglOutput   *output)
+set_refresh_rate_from_output (CoglOnscreen *onscreen,
+                              CoglOutput *output)
 {
   float refresh_rate = cogl_output_get_refresh_rate (output);
   if (refresh_rate != 0.0)
@@ -1466,7 +1466,7 @@ set_refresh_interval_from_output (CoglOnscreen *onscreen,
       int frame_counter = cogl_onscreen_get_frame_counter (onscreen);
       CoglFrameInfo *info = cogl_onscreen_get_frame_info (onscreen, frame_counter);
 
-      info->refresh_interval = (int)(0.5 + (1000000. / refresh_rate));
+      info->refresh_rate = refresh_rate;
     }
 }
 
@@ -1667,7 +1667,7 @@ _cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen,
                                                          xlib_onscreen->x + x_min, xlib_onscreen->y + y_min,
                                                          x_max - x_min, y_max - y_min);
       if (output)
-        set_refresh_interval_from_output (onscreen, output);
+        set_refresh_rate_from_output (onscreen, output);
     }
 
   set_info_complete (onscreen);
@@ -1752,7 +1752,7 @@ _cogl_winsys_onscreen_swap_buffers (CoglOnscreen *onscreen)
       _cogl_winsys_get_vsync_counter (context);
 
   if (xlib_onscreen->output)
-    set_refresh_interval_from_output (onscreen, xlib_onscreen->output);
+    set_refresh_rate_from_output (onscreen, xlib_onscreen->output);
 
   if (!(glx_renderer->glXSwapInterval &&
         _cogl_winsys_has_feature (COGL_WINSYS_FEATURE_VBLANK_WAIT)))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]