[cogl/wip/wl-list: 4/7] Use CoglList instead of COGL_TAILQ_* for fences



commit 537bd76ab62df24d9d28b7417c775afb2607ab5b
Author: Neil Roberts <neil linux intel com>
Date:   Sun Jun 9 01:36:09 2013 +0100

    Use CoglList instead of COGL_TAILQ_* for fences
    
    This is part of ongoing work to remove the BSD embedded list
    implementation in favour of the simpler Wayland implementation.

 cogl/cogl-context-private.h |    2 +-
 cogl/cogl-context.c         |    2 +-
 cogl/cogl-fence-private.h   |    6 ++----
 cogl/cogl-fence.c           |   25 ++++++++++++-------------
 cogl/cogl-journal-private.h |    2 +-
 cogl/cogl-journal.c         |    8 ++++----
 6 files changed, 21 insertions(+), 24 deletions(-)
---
diff --git a/cogl/cogl-context-private.h b/cogl/cogl-context-private.h
index 5243aaa..c5f215d 100644
--- a/cogl/cogl-context-private.h
+++ b/cogl/cogl-context-private.h
@@ -274,7 +274,7 @@ struct _CoglContext
   int n_uniform_names;
 
   CoglPollSource *fences_poll_source;
-  CoglFenceList fences;
+  CoglList fences;
 
   /* This defines a list of function pointers that Cogl uses from
      either GL or GLES. All functions are accessed indirectly through
diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c
index bdfdf1e..26fe85c 100644
--- a/cogl/cogl-context.c
+++ b/cogl/cogl-context.c
@@ -431,7 +431,7 @@ cogl_context_new (CoglDisplay *display,
       cogl_has_feature (context, COGL_FEATURE_ID_POINT_SPRITE))
     GE (context, glEnable (GL_POINT_SPRITE));
 
-  COGL_TAILQ_INIT (&context->fences);
+  _cogl_list_init (&context->fences);
 
   return context;
 }
diff --git a/cogl/cogl-fence-private.h b/cogl/cogl-fence-private.h
index 0817b7d..7a41c51 100644
--- a/cogl/cogl-fence-private.h
+++ b/cogl/cogl-fence-private.h
@@ -25,11 +25,9 @@
 #define __COGL_FENCE_PRIVATE_H__
 
 #include "cogl-fence.h"
-#include "cogl-queue.h"
+#include "cogl-list.h"
 #include "cogl-winsys-private.h"
 
-COGL_TAILQ_HEAD (CoglFenceList, CoglFenceClosure);
-
 typedef enum
 {
   FENCE_TYPE_PENDING,
@@ -42,7 +40,7 @@ typedef enum
 
 struct _CoglFenceClosure
 {
-  COGL_TAILQ_ENTRY (CoglFenceClosure) list;
+  CoglList link;
   CoglFramebuffer *framebuffer;
 
   CoglFenceType type;
diff --git a/cogl/cogl-fence.c b/cogl/cogl-fence.c
index 2055ac4..77469d7 100644
--- a/cogl/cogl-fence.c
+++ b/cogl/cogl-fence.c
@@ -73,9 +73,9 @@ static void
 _cogl_fence_poll_dispatch (void *source, int revents)
 {
   CoglContext *context = source;
-  CoglFenceClosure *fence, *next;
+  CoglFenceClosure *fence, *tmp;
 
-  COGL_TAILQ_FOREACH_SAFE (fence, &context->fences, list, next)
+  _cogl_list_for_each_safe (fence, tmp, &context->fences, link)
     _cogl_fence_check (fence);
 }
 
@@ -92,11 +92,11 @@ _cogl_fence_poll_prepare (void *source)
     {
       CoglFramebuffer *fb = l->data;
 
-      if (!COGL_TAILQ_EMPTY (&fb->journal->pending_fences))
+      if (!_cogl_list_empty (&fb->journal->pending_fences))
         _cogl_framebuffer_flush_journal (fb);
     }
 
-  if (!COGL_TAILQ_EMPTY (&context->fences))
+  if (!_cogl_list_empty (&context->fences))
     return FENCE_CHECK_TIMEOUT;
   else
     return -1;
@@ -134,7 +134,7 @@ _cogl_fence_submit (CoglFenceClosure *fence)
 #endif
 
  done:
-  COGL_TAILQ_INSERT_TAIL (&context->fences, fence, list);
+  _cogl_list_insert (context->fences.prev, &fence->link);
 
   if (!context->fences_poll_source)
     {
@@ -166,7 +166,7 @@ cogl_framebuffer_add_fence_callback (CoglFramebuffer *framebuffer,
 
   if (journal->entries->len)
     {
-      COGL_TAILQ_INSERT_TAIL (&journal->pending_fences, fence, list);
+      _cogl_list_insert (journal->pending_fences.prev, &fence->link);
       fence->type = FENCE_TYPE_PENDING;
     }
   else
@@ -179,16 +179,15 @@ void
 cogl_framebuffer_cancel_fence_callback (CoglFramebuffer *framebuffer,
                                         CoglFenceClosure *fence)
 {
-  CoglJournal *journal = framebuffer->journal;
   CoglContext *context = framebuffer->context;
 
   if (fence->type == FENCE_TYPE_PENDING)
     {
-      COGL_TAILQ_REMOVE (&journal->pending_fences, fence, list);
+      _cogl_list_remove (&fence->link);
     }
   else
     {
-      COGL_TAILQ_REMOVE (&context->fences, fence, list);
+      _cogl_list_remove (&fence->link);
 
       if (fence->type == FENCE_TYPE_WINSYS)
         {
@@ -212,15 +211,15 @@ _cogl_fence_cancel_fences_for_framebuffer (CoglFramebuffer *framebuffer)
 {
   CoglJournal *journal = framebuffer->journal;
   CoglContext *context = framebuffer->context;
-  CoglFenceClosure *fence, *next;
+  CoglFenceClosure *fence, *tmp;
 
-  while (!COGL_TAILQ_EMPTY (&journal->pending_fences))
+  while (!_cogl_list_empty (&journal->pending_fences))
     {
-      fence = COGL_TAILQ_FIRST (&journal->pending_fences);
+      fence = _cogl_container_of (journal->pending_fences.next, fence, link);
       cogl_framebuffer_cancel_fence_callback (framebuffer, fence);
     }
 
-  COGL_TAILQ_FOREACH_SAFE (fence, &context->fences, list, next)
+  _cogl_list_for_each_safe (fence, tmp, &context->fences, link)
     {
       if (fence->framebuffer == framebuffer)
         cogl_framebuffer_cancel_fence_callback (framebuffer, fence);
diff --git a/cogl/cogl-journal-private.h b/cogl/cogl-journal-private.h
index b73fbd1..63cbc23 100644
--- a/cogl/cogl-journal-private.h
+++ b/cogl/cogl-journal-private.h
@@ -59,7 +59,7 @@ typedef struct _CoglJournal
 
   int fast_read_pixel_count;
 
-  CoglFenceList pending_fences;
+  CoglList pending_fences;
 
 } CoglJournal;
 
diff --git a/cogl/cogl-journal.c b/cogl/cogl-journal.c
index 518a797..703f162 100644
--- a/cogl/cogl-journal.c
+++ b/cogl/cogl-journal.c
@@ -153,7 +153,7 @@ _cogl_journal_new (CoglFramebuffer *framebuffer)
   journal->entries = g_array_new (FALSE, FALSE, sizeof (CoglJournalEntry));
   journal->vertices = g_array_new (FALSE, FALSE, sizeof (float));
 
-  COGL_TAILQ_INIT (&journal->pending_fences);
+  _cogl_list_init (&journal->pending_fences);
 
   return _cogl_journal_object_new (journal);
 }
@@ -1262,11 +1262,11 @@ _cogl_journal_all_entries_within_bounds (CoglJournal *journal,
 static void
 post_fences (CoglJournal *journal)
 {
-  CoglFenceClosure *fence, *next;
+  CoglFenceClosure *fence, *tmp;
 
-  COGL_TAILQ_FOREACH_SAFE (fence, &journal->pending_fences, list, next)
+  _cogl_list_for_each_safe (fence, tmp, &journal->pending_fences, link)
     {
-      COGL_TAILQ_REMOVE (&journal->pending_fences, fence, list);
+      _cogl_list_remove (&fence->link);
       _cogl_fence_submit (fence);
     }
 }


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