#define TBM_UNLOCK()
#endif
+typedef enum _queue_node_type {
+ QUEUE_NODE_TYPE_NONE,
+ QUEUE_NODE_TYPE_DEQUEUE,
+ QUEUE_NODE_TYPE_ENQUEUE,
+ QUEUE_NODE_TYPE_ACQUIRE,
+ QUEUE_NODE_TYPE_RELEASE
+} Queue_Node_Type;
+
typedef struct {
struct list_head head;
int count;
struct list_head item_link;
struct list_head link;
+ Queue_Node_Type type;
+
unsigned int priv_flags; /*for each queue*/
} queue_node;
return node;
}
+static int
+_queue_has_node_type(tbm_surface_queue_h surface_queue, Queue_Node_Type type)
+{
+ queue_node *node = NULL;
+ queue_node *tmp = NULL;
+
+ LIST_FOR_EACH_ENTRY_SAFE(node, tmp, &surface_queue->list, link) {
+ if (node->type == type)
+ return 1;
+ }
+
+ return 0;
+}
+
static queue_node *
_queue_get_node(tbm_surface_queue_h surface_queue, int type,
tbm_surface_h surface, int *out_type)
return TBM_SURFACE_QUEUE_ERROR_NONE;
}
+ node->type = QUEUE_NODE_TYPE_ENQUEUE;
+
pthread_mutex_unlock(&surface_queue->lock);
pthread_cond_signal(&surface_queue->dirty_cond);
return TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE;
}
+ node->type = QUEUE_NODE_TYPE_DEQUEUE;
*surface = node->surface;
TBM_QUEUE_TRACE("tbm_surface_queue(%p) tbm_surface(%p)\n", surface_queue, *surface);
return TBM_SURFACE_QUEUE_ERROR_NONE;
}
+ node->type = QUEUE_NODE_TYPE_RELEASE;
+
pthread_mutex_unlock(&surface_queue->lock);
pthread_cond_signal(&surface_queue->free_cond);
return TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE;
}
+ node->type = QUEUE_NODE_TYPE_ACQUIRE;
+
*surface = node->surface;
TBM_QUEUE_TRACE("tbm_surface_queue(%p) tbm_surface(%p)\n", surface_queue, *surface);
if (_queue_is_empty(&surface_queue->dirty_queue)) {
if (wait) {
+ if (!_queue_has_node_type(surface_queue, QUEUE_NODE_TYPE_DEQUEUE)) {
+ TBM_LOG_E("Deosn't have dequeue type node\n");
+ pthread_mutex_unlock(&surface_queue->lock);
+ return 0;
+ }
+
pthread_cond_wait(&surface_queue->dirty_cond, &surface_queue->lock);
pthread_mutex_unlock(&surface_queue->lock);
return 1;