client: check info of queue and info of attached buffer in check_activate 12/194112/3
authorChangyeon Lee <cyeon.lee@samsung.com>
Thu, 29 Nov 2018 06:42:17 +0000 (15:42 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Thu, 29 Nov 2018 08:06:08 +0000 (17:06 +0900)
Change-Id: I03cc462fa158b4ac6557f3c890775276e9de8c4e

src/wayland-tbm-client.c

index 4c36877..be4887b 100644 (file)
@@ -1611,6 +1611,7 @@ int
 wayland_tbm_client_queue_check_activate(struct wayland_tbm_client *tbm_client, tbm_surface_queue_h queue)
 {
        struct wayland_tbm_surface_queue *queue_info = NULL;
+       struct wayland_tbm_buffer *buffer = NULL;
 
        WL_TBM_RETURN_VAL_IF_FAIL(tbm_client != NULL, 0);
        WL_TBM_RETURN_VAL_IF_FAIL(queue != NULL, 0);
@@ -1620,14 +1621,32 @@ wayland_tbm_client_queue_check_activate(struct wayland_tbm_client *tbm_client, t
 
        pthread_mutex_lock(&queue_info->lock);
 
-       if (queue_info->is_active) {
+       if (!queue_info->is_active) {
                pthread_mutex_unlock(&queue_info->lock);
-               return 1;
+               return 0;
+       }
+
+       if (queue_info->active_flush) {
+               if (wl_list_empty(&queue_info->attach_bufs)) {
+                       pthread_mutex_unlock(&queue_info->lock);
+                       return 0;
+               }
+
+               wl_list_for_each(buffer, &queue_info->attach_bufs, link) {
+                       if ((queue_info->width != buffer->width) ||
+                               (queue_info->height != buffer->height) ||
+                               (queue_info->format != buffer->format)) {
+                               pthread_mutex_unlock(&queue_info->lock);
+                               return 0;
+                       }
+
+                       break;
+               }
        }
 
        pthread_mutex_unlock(&queue_info->lock);
 
-       return 0;
+       return 1;
 }
 
 int