[cogl/wip/rib/frame-synchronization: 203/206] frame-info: s/_refresh_interval/_refresh_rate/



commit 11141f35ca1d042f6bd2880ec526a2508172fe3e
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         |   11 +++++------
 cogl/winsys/cogl-winsys-glx.c  |    9 ++++-----
 4 files changed, 12 insertions(+), 14 deletions(-)
---
diff --git a/cogl/cogl-frame-info-private.h b/cogl/cogl-frame-info-private.h
index 5d8ac13..e9bf1f4 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 presentation_time;
-  int64_t refresh_interval;
+  float refresh_rate;
 
   CoglOutput *output;
 };
diff --git a/cogl/cogl-frame-info.c b/cogl/cogl-frame-info.c
index efb2adf..a130f8d 100644
--- a/cogl/cogl-frame-info.c
+++ b/cogl/cogl-frame-info.c
@@ -60,9 +60,9 @@ 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;
 }
 
 CoglOutput *
diff --git a/cogl/cogl-frame-info.h b/cogl/cogl-frame-info.h
index c5a7c5a..2cb4e00 100644
--- a/cogl/cogl-frame-info.h
+++ b/cogl/cogl-frame-info.h
@@ -95,21 +95,20 @@ int64_t cogl_frame_info_get_presentation_time (CoglFrameInfo *info);
  * cogl_frame_info_get_refresh_interval:
  * @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.
  *
  * <note>Some platforms can't associate a #CoglOutput with a
- * #CoglFrameInfo object but are able to report a refresh_interval via
+ * #CoglFrameInfo object but are able to report a refresh rate via
  * this api. Therefore if you need this information then this api is
  * more reliable than using cogl_frame_info_get_output() followed by
  * cogl_output_get_refresh_rate().</note>
  *
- * 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);
 
 /**
  * cogl_frame_info_get_output:
diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c
index 8fe812d..1a56bb9 100644
--- a/cogl/winsys/cogl-winsys-glx.c
+++ b/cogl/winsys/cogl-winsys-glx.c
@@ -1444,15 +1444,14 @@ _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)
 {
-#warning "XXX: why not be consistent and also report a refresh_rate for the FrameInfo?"
   float refresh_rate = cogl_output_get_refresh_rate (output);
   if (refresh_rate != 0.0)
     {
       CoglFrameInfo *info = g_queue_peek_tail (&onscreen->pending_frame_infos);
-      info->refresh_interval = (int)(0.5 + (1000000. / refresh_rate));
+      info->refresh_rate = refresh_rate;
     }
 }
 
@@ -1657,7 +1656,7 @@ _cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen,
                                                   y_max - y_min);
 
       if (info->output)
-        set_refresh_interval_from_output (onscreen, info->output);
+        set_refresh_rate_from_output (onscreen, info->output);
     }
 }
 



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