__tbm_queue_sequence_enqueue: enqueue only one the surface 58/147758/4
authorKonstantin Drabeniuk <k.drabeniuk@samsung.com>
Tue, 5 Sep 2017 11:57:04 +0000 (14:57 +0300)
committerKonstantin Drabeniuk <k.drabeniuk@samsung.com>
Tue, 5 Sep 2017 12:50:27 +0000 (15:50 +0300)
For example you dequeued the surfaces 1, 2.
If you enqueue the surface 2 the enqueue operation will be failed but
the priv_flags will remain 0. Then when you enqueue the surface 1 the
enqueue operation will be successful but you have enqueued the surface 2
too because the priv_flags for the surface 2 is 0. But you got the error
for the enqueue operation of surface 2. And you can try again to enqueue
the surface 2. But you will get the
TBM_SURFACE_QUEUE_ERROR_ALREADY_EXIST
error.
So I think we need enqueue only one the surface if it is first in the
dequeue_list

Change-Id: I055f9c565dd4697d6d3495058d9e3fa986cc1a13
Signed-off-by: Konstantin Drabeniuk <k.drabeniuk@samsung.com>
src/tbm_surface_queue.c

index fb80c3d..66ebfa5 100644 (file)
@@ -2075,16 +2075,17 @@ __tbm_queue_sequence_enqueue(tbm_surface_queue_h surface_queue,
                             queue_node *node)
 {
        tbm_queue_sequence *data = (tbm_queue_sequence *)surface_queue->impl_data;
-       queue_node *next = NULL, *tmp;
+       queue_node *first = NULL;
+
+       first = container_of(data->dequeue_list.head.next, first, item_link);
+       if (first != node) {
+               return;
+       }
 
        node->priv_flags = 0;
 
-       LIST_FOR_EACH_ENTRY_SAFE(next, tmp, &data->dequeue_list.head, item_link) {
-               if (next->priv_flags)
-                       break;
-               _queue_node_pop(&data->dequeue_list, next);
-               _tbm_surface_queue_enqueue(surface_queue, next, 1);
-       }
+       _queue_node_pop(&data->dequeue_list, node);
+       _tbm_surface_queue_enqueue(surface_queue, node, 1);
 }
 
 static void