[cogl/wip/rib/frame-synchronization: 196/206] rename CoglFrameTimings to CoglSwapInfo



commit 2619778124ba347343fb62bd5c9b22e8bbdcabc2
Author: Robert Bragg <robert linux intel com>
Date:   Mon Dec 3 23:00:15 2012 +0000

    rename CoglFrameTimings to CoglSwapInfo
    
    The aim is to pass an opaque structure to the swap buffers notification
    callbacks and enable access to frame timing information this way. Since
    there could be numerous non-timing related things to report here too
    this gives the structure a more general name.
    
    TODO: fold this back into owen's patch

 cogl/Makefile.am                                   |    6 +-
 cogl/cogl-glx-display-private.h                    |    2 +-
 cogl/cogl-onscreen-private.h                       |   22 +++---
 cogl/cogl-onscreen.c                               |   60 +++++++++---------
 cogl/cogl-onscreen.h                               |   54 ++++++++--------
 ...-timings-private.h => cogl-swap-info-private.h} |   12 ++--
 cogl/{cogl-frame-timings.c => cogl-swap-info.c}    |   40 ++++++------
 cogl/{cogl-frame-timings.h => cogl-swap-info.h}    |   52 ++++++++--------
 cogl/winsys/cogl-winsys-glx.c                      |   65 ++++++++++---------
 9 files changed, 158 insertions(+), 155 deletions(-)
---
diff --git a/cogl/Makefile.am b/cogl/Makefile.am
index b3db4ca..53b42e9 100644
--- a/cogl/Makefile.am
+++ b/cogl/Makefile.am
@@ -110,7 +110,7 @@ cogl_experimental_h = \
 	$(srcdir)/cogl-attribute.h 		\
 	$(srcdir)/cogl-primitive.h 		\
 	$(srcdir)/cogl-clip-state.h		\
-	$(srcdir)/cogl-frame-timings.h		\
+	$(srcdir)/cogl-swap-info.h		\
 	$(srcdir)/cogl-framebuffer.h		\
 	$(srcdir)/cogl-onscreen.h		\
 	$(srcdir)/cogl-output.h			\
@@ -385,8 +385,8 @@ cogl_sources_c = \
 	$(srcdir)/cogl-spans.c				\
 	$(srcdir)/cogl-journal-private.h		\
 	$(srcdir)/cogl-journal.c			\
-	$(srcdir)/cogl-frame-timings-private.h		\
-	$(srcdir)/cogl-frame-timings.c			\
+	$(srcdir)/cogl-swap-info-private.h		\
+	$(srcdir)/cogl-swap-info.c			\
 	$(srcdir)/cogl-framebuffer-private.h		\
 	$(srcdir)/cogl-framebuffer.c 			\
 	$(srcdir)/cogl-onscreen-private.h		\
diff --git a/cogl/cogl-glx-display-private.h b/cogl/cogl-glx-display-private.h
index cb0fd0d..5721d76 100644
--- a/cogl/cogl-glx-display-private.h
+++ b/cogl/cogl-glx-display-private.h
@@ -52,7 +52,7 @@ typedef struct _CoglGLXDisplay
   Window dummy_xwin;
   CoglBool pending_swap_notify;
   CoglBool pending_resize_notify;
-  CoglBool pending_frame_timings_notify;
+  CoglBool pending_swap_info_notify;
 } CoglGLXDisplay;
 
 #endif /* __COGL_DISPLAY_GLX_PRIVATE_H */
diff --git a/cogl/cogl-onscreen-private.h b/cogl/cogl-onscreen-private.h
index 8c35f30..08fd5ec 100644
--- a/cogl/cogl-onscreen-private.h
+++ b/cogl/cogl-onscreen-private.h
@@ -33,7 +33,7 @@
 #include <windows.h>
 #endif
 
-#define COGL_ONSCREEN_MAX_FRAME_TIMINGS 16
+#define COGL_ONSCREEN_MAX_SWAP_INFOS 16
 
 typedef struct _CoglSwapBuffersNotifyEntry CoglSwapBuffersNotifyEntry;
 
@@ -61,15 +61,15 @@ struct _CoglResizeNotifyEntry
   unsigned int id;
 };
 
-typedef struct _CoglFrameTimingsCallbackEntry CoglFrameTimingsCallbackEntry;
+typedef struct _CoglSwapInfoCallbackEntry CoglSwapInfoCallbackEntry;
 
-COGL_TAILQ_HEAD (CoglFrameTimingsCallbackList, CoglFrameTimingsCallbackEntry);
+COGL_TAILQ_HEAD (CoglSwapInfoCallbackList, CoglSwapInfoCallbackEntry);
 
-struct _CoglFrameTimingsCallbackEntry
+struct _CoglSwapInfoCallbackEntry
 {
-  COGL_TAILQ_ENTRY (CoglFrameTimingsCallbackEntry) list_node;
+  COGL_TAILQ_ENTRY (CoglSwapInfoCallbackEntry) list_node;
 
-  CoglFrameTimingsCallback callback;
+  CoglSwapInfoCallback callback;
   void *user_data;
   unsigned int id;
 };
@@ -95,15 +95,15 @@ struct _CoglOnscreen
   CoglBool resizable;
   CoglResizeNotifyList resize_callbacks;
 
-  CoglFrameTimingsCallbackList frame_timings_callbacks;
+  CoglSwapInfoCallbackList swap_info_callbacks;
 
   int64_t frame_counter;
   int64_t swap_frame_counter; /* frame counter at last all to
                                * cogl_onscreen_swap_region() or
                                * cogl_onscreen_swap_buffers() */
-  CoglFrameTimings *frame_timings[COGL_ONSCREEN_MAX_FRAME_TIMINGS];
-  int current_frame_timings;
-  int n_frame_timings;
+  CoglSwapInfo *swap_info[COGL_ONSCREEN_MAX_SWAP_INFOS];
+  int current_swap_info;
+  int n_swap_infos;
 
   void *winsys;
 };
@@ -122,6 +122,6 @@ void
 _cogl_onscreen_notify_resize (CoglOnscreen *onscreen);
 
 void
-_cogl_onscreen_notify_frame_timings (CoglOnscreen *onscreen);
+_cogl_onscreen_notify_swap_info (CoglOnscreen *onscreen);
 
 #endif /* __COGL_ONSCREEN_PRIVATE_H */
diff --git a/cogl/cogl-onscreen.c b/cogl/cogl-onscreen.c
index 5e25287..8d60722 100644
--- a/cogl/cogl-onscreen.c
+++ b/cogl/cogl-onscreen.c
@@ -27,7 +27,7 @@
 
 #include "cogl-util.h"
 #include "cogl-onscreen-private.h"
-#include "cogl-frame-timings-private.h"
+#include "cogl-swap-info-private.h"
 #include "cogl-framebuffer-private.h"
 #include "cogl-onscreen-template-private.h"
 #include "cogl-context-private.h"
@@ -50,7 +50,7 @@ _cogl_onscreen_init_from_template (CoglOnscreen *onscreen,
 
   COGL_TAILQ_INIT (&onscreen->swap_callbacks);
   COGL_TAILQ_INIT (&onscreen->resize_callbacks);
-  COGL_TAILQ_INIT (&onscreen->frame_timings_callbacks);
+  COGL_TAILQ_INIT (&onscreen->swap_info_callbacks);
 
   framebuffer->config = onscreen_template->config;
   cogl_object_ref (framebuffer->config.swap_chain);
@@ -80,7 +80,7 @@ _cogl_onscreen_new (void)
   COGL_FRAMEBUFFER (onscreen)->allocated = TRUE;
 
   onscreen->frame_counter = -1;
-  onscreen->current_frame_timings = COGL_ONSCREEN_MAX_FRAME_TIMINGS - 1;
+  onscreen->current_swap_info = COGL_ONSCREEN_MAX_SWAP_INFOS - 1;
 
   /* XXX: Note we don't initialize onscreen->winsys in this case. */
 
@@ -474,16 +474,16 @@ cogl_onscreen_begin_frame (CoglOnscreen *onscreen,
                            gint64        frame_time)
 {
   onscreen->frame_counter++;
-  onscreen->current_frame_timings = (onscreen->current_frame_timings + 1) % COGL_ONSCREEN_MAX_FRAME_TIMINGS;
+  onscreen->current_swap_info = (onscreen->current_swap_info + 1) % COGL_ONSCREEN_MAX_SWAP_INFOS;
 
-  if (onscreen->n_frame_timings < COGL_ONSCREEN_MAX_FRAME_TIMINGS)
-    onscreen->n_frame_timings++;
+  if (onscreen->n_swap_infos < COGL_ONSCREEN_MAX_SWAP_INFOS)
+    onscreen->n_swap_infos++;
   else
-    cogl_object_unref (onscreen->frame_timings[onscreen->current_frame_timings]);
+    cogl_object_unref (onscreen->swap_info[onscreen->current_swap_info]);
 
-  onscreen->frame_timings[onscreen->current_frame_timings] = _cogl_frame_timings_new ();
-  onscreen->frame_timings[onscreen->current_frame_timings]->frame_counter = onscreen->frame_counter;
-  onscreen->frame_timings[onscreen->current_frame_timings]->frame_time = frame_time;
+  onscreen->swap_info[onscreen->current_swap_info] = _cogl_swap_info_new ();
+  onscreen->swap_info[onscreen->current_swap_info]->frame_counter = onscreen->frame_counter;
+  onscreen->swap_info[onscreen->current_swap_info]->frame_time = frame_time;
 }
 
 static void
@@ -498,11 +498,11 @@ cogl_onscreen_before_swap (CoglOnscreen *onscreen)
 int64_t
 cogl_onscreen_get_frame_history_start (CoglOnscreen *onscreen)
 {
-  return onscreen->frame_counter - onscreen->n_frame_timings;
+  return onscreen->frame_counter - onscreen->n_swap_infos;
 }
 
-CoglFrameTimings *
-cogl_onscreen_get_frame_timings (CoglOnscreen *onscreen,
+CoglSwapInfo *
+cogl_onscreen_get_swap_info (CoglOnscreen *onscreen,
                                  int64_t       frame_counter)
 {
   int pos;
@@ -510,57 +510,57 @@ cogl_onscreen_get_frame_timings (CoglOnscreen *onscreen,
   if (frame_counter > onscreen->frame_counter)
     return NULL;
 
-  if (frame_counter <= onscreen->frame_counter - onscreen->n_frame_timings)
+  if (frame_counter <= onscreen->frame_counter - onscreen->n_swap_infos)
     return NULL;
 
-  pos = ((onscreen->current_frame_timings -
-          (onscreen->frame_counter - frame_counter) + COGL_ONSCREEN_MAX_FRAME_TIMINGS)
-         % COGL_ONSCREEN_MAX_FRAME_TIMINGS);
+  pos = ((onscreen->current_swap_info -
+          (onscreen->frame_counter - frame_counter) + COGL_ONSCREEN_MAX_SWAP_INFOS)
+         % COGL_ONSCREEN_MAX_SWAP_INFOS);
 
-  return onscreen->frame_timings[pos];
+  return onscreen->swap_info[pos];
 }
 
 unsigned int
-cogl_onscreen_add_frame_timings_callback (CoglOnscreen *onscreen,
-                                          CoglFrameTimingsCallback callback,
+cogl_onscreen_add_swap_info_callback (CoglOnscreen *onscreen,
+                                          CoglSwapInfoCallback callback,
                                           void *user_data)
 {
-  CoglFrameTimingsCallbackEntry *entry = g_slice_new (CoglFrameTimingsCallbackEntry);
+  CoglSwapInfoCallbackEntry *entry = g_slice_new (CoglSwapInfoCallbackEntry);
   static int next_resize_callback_id = 0;
 
   entry->callback = callback;
   entry->user_data = user_data;
   entry->id = next_resize_callback_id++;
 
-  COGL_TAILQ_INSERT_TAIL (&onscreen->frame_timings_callbacks, entry, list_node);
+  COGL_TAILQ_INSERT_TAIL (&onscreen->swap_info_callbacks, entry, list_node);
 
   return entry->id;
 }
 
 void
-cogl_onscreen_remove_frame_timings_callback (CoglOnscreen *onscreen,
+cogl_onscreen_remove_swap_info_callback (CoglOnscreen *onscreen,
                                              unsigned int id)
 {
-  CoglFrameTimingsCallbackEntry *entry;
+  CoglSwapInfoCallbackEntry *entry;
 
-  COGL_TAILQ_FOREACH (entry, &onscreen->frame_timings_callbacks, list_node)
+  COGL_TAILQ_FOREACH (entry, &onscreen->swap_info_callbacks, list_node)
     {
       if (entry->id == id)
         {
-          COGL_TAILQ_REMOVE (&onscreen->frame_timings_callbacks, entry, list_node);
-          g_slice_free (CoglFrameTimingsCallbackEntry, entry);
+          COGL_TAILQ_REMOVE (&onscreen->swap_info_callbacks, entry, list_node);
+          g_slice_free (CoglSwapInfoCallbackEntry, entry);
           break;
         }
     }
 }
 
 void
-_cogl_onscreen_notify_frame_timings (CoglOnscreen *onscreen)
+_cogl_onscreen_notify_swap_info (CoglOnscreen *onscreen)
 {
-  CoglFrameTimingsCallbackEntry *entry, *tmp;
+  CoglSwapInfoCallbackEntry *entry, *tmp;
 
   COGL_TAILQ_FOREACH_SAFE (entry,
-                           &onscreen->frame_timings_callbacks,
+                           &onscreen->swap_info_callbacks,
                            list_node,
                            tmp)
     entry->callback (onscreen, entry->user_data);
diff --git a/cogl/cogl-onscreen.h b/cogl/cogl-onscreen.h
index 2891a4a..b2f6a5f 100644
--- a/cogl/cogl-onscreen.h
+++ b/cogl/cogl-onscreen.h
@@ -34,7 +34,7 @@
 
 #include <cogl/cogl-context.h>
 #include <cogl/cogl-framebuffer.h>
-#include <cogl/cogl-frame-timings.h>
+#include <cogl/cogl-swap-info.h>
 
 COGL_BEGIN_DECLS
 
@@ -554,23 +554,23 @@ cogl_onscreen_get_frame_counter (CoglOnscreen *onscreen);
  *   content for this frame.
  *
  * Marks the beginning of a frame. This increases the frame
- * counter value and creates a new #CoglFrameTimings objeect.
+ * counter value and creates a new #CoglSwapInfo objeect.
  *
  * Since: 2.0
  */
 void
 cogl_onscreen_begin_frame (CoglOnscreen *onscreen,
-                           gint64        frame_time);
+                           gint64 frame_time);
 
 /**
  * cogl_onscreen_get_frame_history_start:
  * @onscreen: a #CoglOnscreen framebuffer
  *
- * Gets the frame counter for the oldest #CoglFrameTiming that is
- * being kept in the history. cogl_onscreen_get_frame_timings() will
+ * Gets the frame counter for the oldest #CoglSwapInfo that is
+ * being kept in the history. cogl_onscreen_get_swap_info() will
  * always return %NULl for any frame counter before this.
  *
- * Return value: the frame counter for the oldest #CoglFrameTimings
+ * Return value: the frame counter for the oldest #CoglSwapInfo
  *  in the history.
  * Since: 2.0
  */
@@ -579,31 +579,31 @@ cogl_onscreen_get_frame_history_start (CoglOnscreen *onscreen);
 
 
 /**
- * cogl_onscreen_get_frame_timings:
+ * cogl_onscreen_get_swap_info:
  * @onscreen: A #CoglOnscreen framebuffer
  * @frame_counter: the value of cogl_onscreen_get_frame_counter()
  *       when the frame finished drawing.
  *
  * Gets frame timing information for a particular frame.
  *
- * Return value: a #CoglFrameTiming object, or %NULL if frame timing
+ * Return value: a #CoglSwapInfo object, or %NULL if swap info
  *   information is not available for the given frame.
  * Since: 2.0
  */
-CoglFrameTimings *
-cogl_onscreen_get_frame_timings (CoglOnscreen *onscreen,
-                                 int64_t       frame_counter);
+CoglSwapInfo *
+cogl_onscreen_get_swap_info (CoglOnscreen *onscreen,
+                             int64_t frame_counter);
 
 /**
- * CoglFrameTimingsCallback:
+ * CoglSwapInfoCallback:
  * @onscreen: A #CoglOnscreen framebuffer that has updated timing information
  * @user_data: The private passed to
- *             cogl_onscreen_add_frame_timings_callback()
+ *             cogl_onscreen_add_swap_info_callback()
  *
  * Is a callback type used with the
- * cogl_onscreen_add_frame_timings_callback() allowing applications to be
+ * cogl_onscreen_add_swap_info_callback() allowing applications to be
  * notified whenever new frame timings information is available
- * via cogl_onscreen_get_frame_timings().
+ * via cogl_onscreen_get_swap_info().
  *
  * <note>A frame timings callback will only ever be called while dispatching
  * Cogl events from the system mainloop; so for example during
@@ -613,17 +613,17 @@ cogl_onscreen_get_frame_timings (CoglOnscreen *onscreen,
  *
  * Since: 2.0
  */
-typedef void (*CoglFrameTimingsCallback) (CoglOnscreen *onscreen,
-                                          void         *user_data);
+typedef void (*CoglSwapInfoCallback) (CoglOnscreen *onscreen,
+                                      void *user_data);
 
 /**
- * cogl_onscreen_add_frame_timings_callback:
+ * cogl_onscreen_add_swap_info_callback:
  * @onscreen: A #CoglOnscreen framebuffer
  * @callback: A callback function to call when new frame timings information is available
  * @user_data: A private pointer to be passed to @callback
  *
  * Installs a @callback function that should be called whenever new data
- * is available via cogl_onscreen_get_frame_timings().
+ * is available via cogl_onscreen_get_swap_info().
  *
  * Return value: a unique identifier that can be used to remove to remove
  *               the callback later.
@@ -631,24 +631,24 @@ typedef void (*CoglFrameTimingsCallback) (CoglOnscreen *onscreen,
  * Stability: unstable
  */
 unsigned int
-cogl_onscreen_add_frame_timings_callback (CoglOnscreen            *onscreen,
-                                          CoglFrameTimingsCallback callback,
-                                          void                    *user_data);
+cogl_onscreen_add_swap_info_callback (CoglOnscreen *onscreen,
+                                      CoglSwapInfoCallback callback,
+                                      void *user_data);
 
 /**
- * cogl_onscreen_remove_frame_timings_callback:
+ * cogl_onscreen_remove_swap_info_callback:
  * @onscreen: A #CoglOnscreen framebuffer
- * @id: An identifier returned from cogl_onscreen_add_frame_timings_callback()
+ * @id: An identifier returned from cogl_onscreen_add_swap_info_callback()
  *
  * Removes a callback that was previously registered
- * using cogl_onscreen_add_frame_timings_callback().
+ * using cogl_onscreen_add_swap_info_callback().
  *
  * Since: 1.10
  * Stability: unstable
  */
 void
-cogl_onscreen_remove_frame_timings_callback (CoglOnscreen *onscreen,
-                                             unsigned int  id);
+cogl_onscreen_remove_swap_info_callback (CoglOnscreen *onscreen,
+                                         unsigned int id);
 
 COGL_END_DECLS
 
diff --git a/cogl/cogl-frame-timings-private.h b/cogl/cogl-swap-info-private.h
similarity index 81%
rename from cogl/cogl-frame-timings-private.h
rename to cogl/cogl-swap-info-private.h
index b17cd34..8241beb 100644
--- a/cogl/cogl-frame-timings-private.h
+++ b/cogl/cogl-swap-info-private.h
@@ -21,13 +21,13 @@
  *
  */
 
-#ifndef __COGL_FRAME_TIMINGS_PRIVATE_H
-#define __COGL_FRAME_TIMINGS_PRIVATE_H
+#ifndef __COGL_SWAP_INFO_PRIVATE_H
+#define __COGL_SWAP_INFO_PRIVATE_H
 
-#include "cogl-frame-timings.h"
+#include "cogl-swap-info.h"
 #include "cogl-object-private.h"
 
-struct _CoglFrameTimings
+struct _CoglSwapInfo
 {
   CoglObject _parent;
 
@@ -39,6 +39,6 @@ struct _CoglFrameTimings
   guint complete : 1;
 };
 
-CoglFrameTimings *_cogl_frame_timings_new (void);
+CoglSwapInfo *_cogl_swap_info_new (void);
 
-#endif /* __COGL_FRAME_TIMINGS_PRIVATE_H */
+#endif /* __COGL_SWAP_INFO_PRIVATE_H */
diff --git a/cogl/cogl-frame-timings.c b/cogl/cogl-swap-info.c
similarity index 50%
rename from cogl/cogl-frame-timings.c
rename to cogl/cogl-swap-info.c
index ba8003e..1ee4302 100644
--- a/cogl/cogl-frame-timings.c
+++ b/cogl/cogl-swap-info.c
@@ -25,54 +25,54 @@
 #include "config.h"
 #endif
 
-#include "cogl-frame-timings-private.h"
+#include "cogl-swap-info-private.h"
 
-static void _cogl_frame_timings_free (CoglFrameTimings *frame_timings);
+static void _cogl_swap_info_free (CoglSwapInfo *info);
 
-COGL_OBJECT_DEFINE (FrameTimings, frame_timings);
+COGL_OBJECT_DEFINE (SwapInfo, swap_info);
 
-CoglFrameTimings *
-_cogl_frame_timings_new (void)
+CoglSwapInfo *
+_cogl_swap_info_new (void)
 {
-  CoglFrameTimings *timings;
+  CoglSwapInfo *info;
 
-  timings = g_slice_new0 (CoglFrameTimings);
+  info = g_slice_new0 (CoglSwapInfo);
 
-  return _cogl_frame_timings_object_new (timings);
+  return _cogl_swap_info_object_new (info);
 }
 
 static void
-_cogl_frame_timings_free (CoglFrameTimings *timings)
+_cogl_swap_info_free (CoglSwapInfo *info)
 {
-  g_slice_free (CoglFrameTimings, timings);
+  g_slice_free (CoglSwapInfo, info);
 }
 
 CoglBool
-cogl_frame_timings_get_complete (CoglFrameTimings *timings)
+cogl_swap_info_get_complete (CoglSwapInfo *info)
 {
-  return timings->complete;
+  return info->complete;
 }
 
 gint64
-cogl_frame_timings_get_frame_counter (CoglFrameTimings *timings)
+cogl_swap_info_get_frame_counter (CoglSwapInfo *info)
 {
-  return timings->frame_counter;
+  return info->frame_counter;
 }
 
 gint64
-cogl_frame_timings_get_frame_time (CoglFrameTimings *timings)
+cogl_swap_info_get_frame_time (CoglSwapInfo *info)
 {
-  return timings->frame_time;
+  return info->frame_time;
 }
 
 gint64
-cogl_frame_timings_get_presentation_time (CoglFrameTimings *timings)
+cogl_swap_info_get_presentation_time (CoglSwapInfo *info)
 {
-  return timings->presentation_time;
+  return info->presentation_time;
 }
 
 gint64
-cogl_frame_timings_get_refresh_interval (CoglFrameTimings *timings)
+cogl_swap_info_get_refresh_interval (CoglSwapInfo *info)
 {
-  return timings->refresh_interval;
+  return info->refresh_interval;
 }
diff --git a/cogl/cogl-frame-timings.h b/cogl/cogl-swap-info.h
similarity index 65%
rename from cogl/cogl-frame-timings.h
rename to cogl/cogl-swap-info.h
index c00e920..710d005 100644
--- a/cogl/cogl-frame-timings.h
+++ b/cogl/cogl-swap-info.h
@@ -28,48 +28,48 @@
 #error "Only <cogl/cogl.h> can be included directly."
 #endif
 
-#ifndef __COGL_FRAME_TIMINGS_H
-#define __COGL_FRAME_TIMINGS_H
+#ifndef __COGL_SWAP_INFO_H
+#define __COGL_SWAP_INFO_H
 
 #include <cogl/cogl-types.h>
 #include <glib.h>
 
 G_BEGIN_DECLS
 
-typedef struct _CoglFrameTimings CoglFrameTimings;
-#define COGL_FRAME_TIMINGS(X) ((CoglFrameTimings *)(X))
+typedef struct _CoglSwapInfo CoglSwapInfo;
+#define COGL_SWAP_INFO(X) ((CoglSwapInfo *)(X))
 
 /**
- * cogl_is_frame_timings:
+ * cogl_is_swap_info:
  * @object: A #CoglObject pointer
  *
- * Gets whether the given object references a #CoglFrameTimings.
+ * Gets whether the given object references a #CoglSwapInfo.
  *
- * Return value: %TRUE if the object references a #CoglFrameTimings
+ * Return value: %TRUE if the object references a #CoglSwapInfo
  *   and %FALSE otherwise.
  * Since: 2.0
  * Stability: unstable
  */
 CoglBool
-cogl_is_frame_timings (void *object);
+cogl_is_swap_info (void *object);
 
 /**
- * cogl_frame_timings_get_complete:
- * @timings: a #CoglFrameTimings object
+ * cogl_swap_info_get_complete:
+ * @info: a #CoglSwapInfo object
  *
  * Gets whether all information that will potentially be provided for
- * the frame has been provided. Once a frame timings object is complete,
+ * the frame has been provided. Once a swap info object is complete,
  * no further changes will be made to it.
  *
- * Return value: whether the frame timings object is complete.
+ * Return value: whether the swap info object is complete.
  * Since: 2.0
  * Stability: unstable
  */
-CoglBool cogl_frame_timings_get_complete (CoglFrameTimings *timings);
+CoglBool cogl_swap_info_get_complete (CoglSwapInfo *info);
 
 /**
- * cogl_frame_timings_get_frame_counter:
- * @timings: a #CoglFrameTimings object
+ * cogl_swap_info_get_frame_counter:
+ * @info: a #CoglSwapInfo object
  *
  * Gets the frame counter for the #CoglOnscreen that corresponds
  * to this frame.
@@ -78,11 +78,11 @@ CoglBool cogl_frame_timings_get_complete (CoglFrameTimings *timings);
  * Since: 2.0
  * Stability: unstable
  */
-int64_t cogl_frame_timings_get_frame_counter (CoglFrameTimings *timings);
+int64_t cogl_swap_info_get_frame_counter (CoglSwapInfo *info);
 
 /**
- * cogl_frame_timings_get_frame_time:
- * @timings: a #CoglFrameTimings object
+ * cogl_swap_info_get_frame_time:
+ * @info: a #CoglSwapInfo object
  *
  * Gets the time used for creating content for the frame. This
  * is determined by the time passed to cogl_onscreen_begin_frame(),
@@ -94,11 +94,11 @@ int64_t cogl_frame_timings_get_frame_counter (CoglFrameTimings *timings);
  * Since: 2.0
  * Stability: unstable
  */
-int64_t cogl_frame_timings_get_frame_time (CoglFrameTimings *timings);
+int64_t cogl_swap_info_get_frame_time (CoglSwapInfo *info);
 
 /**
- * cogl_frame_timings_get_presentation_time:
- * @timings: a #CoglFrameTimings object
+ * cogl_swap_info_get_presentation_time:
+ * @info: a #CoglSwapInfo object
  *
  * Gets the presentation time for the frame. This is the time at which
  * the frame became visible to the user.
@@ -108,11 +108,11 @@ int64_t cogl_frame_timings_get_frame_time (CoglFrameTimings *timings);
  * Since: 2.0
  * Stability: unstable
  */
-int64_t cogl_frame_timings_get_presentation_time (CoglFrameTimings *timings);
+int64_t cogl_swap_info_get_presentation_time (CoglSwapInfo *info);
 
 /**
- * cogl_frame_timings_get_refresh_interval:
- * @timings: a #CoglFrameTimings object
+ * cogl_swap_info_get_refresh_interval:
+ * @info: a #CoglSwapInfo 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
@@ -123,11 +123,11 @@ int64_t cogl_frame_timings_get_presentation_time (CoglFrameTimings *timings);
  * Since: 2.0
  * Stability: unstable
  */
-int64_t cogl_frame_timings_get_refresh_interval (CoglFrameTimings *timings);
+int64_t cogl_swap_info_get_refresh_interval (CoglSwapInfo *info);
 
 G_END_DECLS
 
-#endif /* __COGL_FRAME_TIMINGS_H */
+#endif /* __COGL_SWAP_INFO_H */
 
 
 
diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c
index 558dc63..6b82935 100644
--- a/cogl/winsys/cogl-winsys-glx.c
+++ b/cogl/winsys/cogl-winsys-glx.c
@@ -42,7 +42,7 @@
 #include "cogl-texture-2d-private.h"
 #include "cogl-texture-rectangle-private.h"
 #include "cogl-pipeline-opengl-private.h"
-#include "cogl-frame-timings-private.h"
+#include "cogl-swap-info-private.h"
 #include "cogl-framebuffer-private.h"
 #include "cogl-onscreen-private.h"
 #include "cogl-swap-chain-private.h"
@@ -85,7 +85,7 @@ typedef struct _CoglOnscreenGLX
   uint32_t last_swap_vsync_counter;
   CoglBool pending_swap_notify;
   CoglBool pending_resize_notify;
-  CoglBool pending_frame_timings_notify;
+  CoglBool pending_swap_info_notify;
 } CoglOnscreenGLX;
 
 typedef struct _CoglTexturePixmapGLX
@@ -277,18 +277,18 @@ ust_to_monotonic_time (CoglRenderer *renderer,
 }
 
 static void
-set_timings_complete (CoglOnscreen *onscreen)
+set_info_complete (CoglOnscreen *onscreen)
 {
   CoglOnscreenGLX *glx_onscreen = onscreen->winsys;
   CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context;
   CoglGLXDisplay *glx_display = context->display->winsys;
-  CoglFrameTimings *timings = cogl_onscreen_get_frame_timings (onscreen,
-                                                               cogl_onscreen_get_frame_counter (onscreen));
+  int frame_counter = cogl_onscreen_get_frame_counter (onscreen);
+  CoglSwapInfo *info = cogl_onscreen_get_swap_info (onscreen, frame_counter);
 
-  timings->complete = TRUE;
+  info->complete = TRUE;
 
-  glx_display->pending_frame_timings_notify = TRUE;
-  glx_onscreen->pending_frame_timings_notify = TRUE;
+  glx_display->pending_swap_info_notify = TRUE;
+  glx_onscreen->pending_swap_info_notify = TRUE;
 }
 
 static void
@@ -298,7 +298,8 @@ notify_swap_buffers (CoglContext *context, GLXBufferSwapComplete *swap_event)
   CoglDisplay *display = context->display;
   CoglGLXDisplay *glx_display = display->winsys;
   CoglOnscreenGLX *glx_onscreen;
-  CoglFrameTimings *timings;
+  int frame_counter;
+  CoglSwapInfo *info;
 
   if (!onscreen)
     return;
@@ -310,14 +311,14 @@ notify_swap_buffers (CoglContext *context, GLXBufferSwapComplete *swap_event)
   glx_display->pending_swap_notify = TRUE;
   glx_onscreen->pending_swap_notify = TRUE;
 
-  timings = cogl_onscreen_get_frame_timings (onscreen,
-                                             cogl_onscreen_get_frame_counter (onscreen));
+  frame_counter = cogl_onscreen_get_frame_counter (onscreen);
+  info = cogl_onscreen_get_swap_info (onscreen, frame_counter);
   if (swap_event->ust != 0)
-    timings->presentation_time = ust_to_monotonic_time (context->display->renderer,
+    info->presentation_time = ust_to_monotonic_time (context->display->renderer,
                                                         glx_onscreen->glxwin,
                                                         swap_event->ust);
 
-  set_timings_complete (onscreen);
+  set_info_complete (onscreen);
 }
 
 static void
@@ -1406,10 +1407,11 @@ _cogl_winsys_wait_for_vblank (CoglOnscreen *onscreen)
   if (glx_renderer->glXWaitForMsc ||
       glx_renderer->glXGetVideoSync)
     {
-      CoglFrameTimings *timings;
+      int frame_counter;
+      CoglSwapInfo *info;
 
-      timings = cogl_onscreen_get_frame_timings (onscreen,
-                                                 cogl_onscreen_get_frame_counter (onscreen));
+      frame_counter = cogl_onscreen_get_frame_counter (onscreen);
+      info = cogl_onscreen_get_swap_info (onscreen, frame_counter);
 
       if (glx_renderer->glXWaitForMsc)
         {
@@ -1424,9 +1426,9 @@ _cogl_winsys_wait_for_vblank (CoglOnscreen *onscreen)
           glx_renderer->glXWaitForMsc (xlib_renderer->xdpy, drawable,
                                        0, 2, (msc + 1) % 2,
                                        &ust, &msc, &sbc);
-          timings->presentation_time = ust_to_monotonic_time (ctx->display->renderer,
-                                                              drawable,
-                                                              ust);
+          info->presentation_time = ust_to_monotonic_time (ctx->display->renderer,
+                                                           drawable,
+                                                           ust);
         }
       else
         {
@@ -1436,7 +1438,7 @@ _cogl_winsys_wait_for_vblank (CoglOnscreen *onscreen)
           glx_renderer->glXWaitVideoSync (2,
                                           (current_count + 1) % 2,
                                           &current_count);
-          timings->presentation_time = g_get_monotonic_time ();
+          info->presentation_time = g_get_monotonic_time ();
         }
     }
 }
@@ -1461,9 +1463,10 @@ set_refresh_interval_from_output (CoglOnscreen *onscreen,
   float refresh_rate = cogl_output_get_refresh_rate (output);
   if (refresh_rate != 0.0)
     {
-      CoglFrameTimings *timings = cogl_onscreen_get_frame_timings (onscreen,
-                                                                   cogl_onscreen_get_frame_counter (onscreen));
-      timings->refresh_interval = (int)(0.5 + (1000000. / refresh_rate));
+      int frame_counter = cogl_onscreen_get_frame_counter (onscreen);
+      CoglSwapInfo *info = cogl_onscreen_get_swap_info (onscreen, frame_counter);
+
+      info->refresh_interval = (int)(0.5 + (1000000. / refresh_rate));
     }
 }
 
@@ -1667,7 +1670,7 @@ _cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen,
         set_refresh_interval_from_output (onscreen, output);
     }
 
-  set_timings_complete (onscreen);
+  set_info_complete (onscreen);
 }
 
 static void
@@ -1753,7 +1756,7 @@ _cogl_winsys_onscreen_swap_buffers (CoglOnscreen *onscreen)
 
   if (!(glx_renderer->glXSwapInterval &&
         _cogl_winsys_has_feature (COGL_WINSYS_FEATURE_VBLANK_WAIT)))
-    set_timings_complete (onscreen);
+    set_info_complete (onscreen);
 }
 
 static uint32_t
@@ -2418,7 +2421,7 @@ _cogl_winsys_poll_get_info (CoglContext *context,
      immediately */
   if (glx_display->pending_swap_notify ||
       glx_display->pending_resize_notify ||
-      glx_display->pending_frame_timings_notify)
+      glx_display->pending_swap_info_notify)
     *timeout = 0;
 }
 
@@ -2445,10 +2448,10 @@ flush_pending_notifications_cb (void *data,
           glx_onscreen->pending_resize_notify = FALSE;
         }
 
-      if (glx_onscreen->pending_frame_timings_notify)
+      if (glx_onscreen->pending_swap_info_notify)
         {
-          _cogl_onscreen_notify_frame_timings (onscreen);
-          glx_onscreen->pending_frame_timings_notify = FALSE;
+          _cogl_onscreen_notify_swap_info (onscreen);
+          glx_onscreen->pending_swap_info_notify = FALSE;
         }
     }
 }
@@ -2467,14 +2470,14 @@ _cogl_winsys_poll_dispatch (CoglContext *context,
 
   if (glx_display->pending_swap_notify ||
       glx_display->pending_resize_notify ||
-      glx_display->pending_frame_timings_notify)
+      glx_display->pending_swap_info_notify)
     {
       g_list_foreach (context->framebuffers,
                       flush_pending_notifications_cb,
                       NULL);
       glx_display->pending_swap_notify = FALSE;
       glx_display->pending_resize_notify = FALSE;
-      glx_display->pending_frame_timings_notify = FALSE;
+      glx_display->pending_swap_info_notify = FALSE;
     }
 }
 



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