tpl_wayland_egl: Do unreference the attached buffers when the flushing of buffer... 50/91150/3 accepted/tizen/3.0/ivi/20161028.151244 accepted/tizen/3.0/mobile/20161028.143140 accepted/tizen/3.0/tv/20161028.143451 accepted/tizen/3.0/wearable/20161028.150819 accepted/tizen/common/20161019.145632 accepted/tizen/ivi/20161019.141942 accepted/tizen/mobile/20161019.141926 accepted/tizen/tv/20161019.141932 accepted/tizen/wearable/20161019.141937 submit/tizen/20161019.023529 submit/tizen_3.0/20161028.062323 submit/tizen_3.0/20161028.092423 submit/tizen_3.0_common/20161104.104000 submit/work91/20161019.023152
authorjoonbum.ko <joonbum.ko@samsung.com>
Thu, 6 Oct 2016 05:45:16 +0000 (14:45 +0900)
committerGwan-gyeong Mun <kk.moon@samsung.com>
Fri, 7 Oct 2016 07:20:44 +0000 (00:20 -0700)
Change-Id: Iaf880e86807af33e75ad7ee41e682628db4216e1
Signed-off-by: joonbum.ko <joonbum.ko@samsung.com>
src/tpl_wayland_egl.c

index 99b957f..0323dfc 100644 (file)
@@ -1357,6 +1357,23 @@ static void __cb_tizen_surface_shm_flusher_flush_callback(void *data,
        }
 
        tbm_surface_queue_flush(wayland_egl_surface->tbm_queue);
+
+       /* Only when client call tpl_surface_dequeue_buffer(), client can do
+        * unreference tbm_surface although there are release events in the event queue,
+        * After tbm_surface_queue_flush, queue has no tbm_surface, client can do
+        * unreference attached buffers using the list of attached_buffers.
+        * Then, client does not need to wait for release_callback to unreference
+        * attached buffer.
+        */
+       if (wayland_egl_surface->attached_buffers) {
+               TPL_OBJECT_LOCK(&wayland_egl_surface->base);
+               while (!__tpl_list_is_empty(wayland_egl_surface->attached_buffers)) {
+                       tbm_surface_h tbm_surface =
+                               __tpl_list_pop_front(wayland_egl_surface->attached_buffers, NULL);
+                       tbm_surface_internal_unref(tbm_surface);
+               }
+               TPL_OBJECT_UNLOCK(&wayland_egl_surface->base);
+       }
 }
 
 static const struct tizen_surface_shm_flusher_listener