tpl_wayland_egl(_thread): Implemented a few lines releated to set_window_serial. 41/188941/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Wed, 12 Sep 2018 03:03:56 +0000 (12:03 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Wed, 12 Sep 2018 03:03:56 +0000 (12:03 +0900)
Change-Id: I01df22d47a6add48fcb97a2aa50b96bb87e269fd
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
src/tpl_wayland_egl.c
src/tpl_wayland_egl_thread.c

index 01be90d..490518f 100644 (file)
@@ -45,6 +45,8 @@ struct _tpl_wayland_egl_surface {
        tdm_client_vblank *tdm_vblank; /* vblank object for each wl_surface */
        tpl_bool_t vblank_done;
        tpl_bool_t is_activated;
+       tpl_bool_t set_serial_is_used; /* Will be deprecated */
+       unsigned int serial;
        int latest_transform;
        tpl_list_t *attached_buffers; /* list for tracking [ACQ]~[REL] buffers */
        tpl_list_t *dequeued_buffers; /* list for tracking [DEQ]~[ENQ] buffers */
@@ -432,6 +434,10 @@ __cb_client_window_set_frontbuffer_mode(struct wl_egl_window *wl_egl_window,
                                                                                void *private, int set);
 
 static void
+__cb_client_window_set_window_serial_callback(struct wl_egl_window *wl_egl_window,
+                                                                                         void *private, unsigned int serial);
+
+static void
 __cb_tbm_surface_queue_reset_callback(tbm_surface_queue_h surface_queue,
                                                                          void *data)
 {
@@ -529,6 +535,8 @@ __tpl_wayland_egl_surface_init(tpl_surface_t *surface)
        wayland_egl_surface->is_activated = TPL_FALSE;
        wayland_egl_surface->current_buffer = NULL;
        wayland_egl_surface->latest_transform = wl_egl_window->transform;
+       wayland_egl_surface->set_serial_is_used = TPL_FALSE;
+       wayland_egl_surface->serial = 0;
 
        wayland_egl_surface->attached_buffers = __tpl_list_alloc();
        if (!wayland_egl_surface->attached_buffers) {
@@ -592,6 +600,8 @@ __tpl_wayland_egl_surface_init(tpl_surface_t *surface)
                        __cb_client_window_get_rotation_capability;
        wl_egl_window->set_frontbuffer_callback = (void *)
                        __cb_client_window_set_frontbuffer_mode;
+       wl_egl_window->set_window_serial_callback = (void *)
+                       __cb_client_window_set_window_serial_callback;
 
        /* tdm_vblank object decide to be maintained every tpl_wayland_egl_surface
           for the case where the several surfaces is created in one display connection. */
@@ -1314,8 +1324,12 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou
 
        wl_display_flush(wayland_egl_display->wl_dpy);
 
-       ++wl_egl_window->serial;
-       wayland_egl_buffer->serial = wl_egl_window->serial;
+       if (wayland_egl_surface->set_serial_is_used) {
+               wayland_egl_buffer->serial = wayland_egl_surface->serial;
+       } else {
+               ++wl_egl_window->serial;
+               wayland_egl_buffer->serial = wl_egl_window->serial;
+       }
 
        wayland_egl_buffer->dx = wl_egl_window->dx;
        wayland_egl_buffer->dy = wl_egl_window->dy;
@@ -1599,6 +1613,25 @@ __cb_client_window_set_frontbuffer_mode(struct wl_egl_window *wl_egl_window,
                surface->is_frontbuffer_mode = TPL_FALSE;
 }
 
+static void
+__cb_client_window_set_window_serial_callback(struct wl_egl_window *wl_egl_window,
+                                                                                         void *private, unsigned int serial)
+{
+       TPL_ASSERT(private);
+       TPL_ASSERT(wl_egl_window);
+
+       tpl_surface_t *surface = (tpl_surface_t *)private;
+
+       TPL_ASSERT(surface->backend.data);
+
+       tpl_wayland_egl_surface_t *wayland_egl_surface =
+               (tpl_wayland_egl_surface_t *)surface->backend.data;
+
+       wayland_egl_surface->set_serial_is_used = TPL_TRUE;
+       wayland_egl_surface->serial = serial;
+}
+
+
 #define IMPL_TIZEN_SURFACE_SHM_VERSION 2
 
 void
index 37e222e..12b7315 100644 (file)
@@ -111,6 +111,8 @@ struct _twe_wl_surf_source {
        tdm_client_vblank *vblank;
        tpl_bool_t vblank_done;
        tpl_bool_t is_destroying;
+       tpl_bool_t set_serial_is_used; /* Will be deprecated */
+       unsigned int serial;
        struct tizen_surface_shm_flusher *tss_flusher;
        tbm_surface_queue_h tbm_queue;
        twe_wl_disp_source *disp_source;
@@ -1150,6 +1152,19 @@ __cb_get_rotation_capability(struct wl_egl_window *wl_egl_window,
        return rotation_capability;
 }
 
+static void
+__cb_set_window_serial_callback(struct wl_egl_window *wl_egl_window,
+                                                               void *private, unsigned int serial)
+{
+       TPL_ASSERT(private);
+       TPL_ASSERT(wl_egl_window);
+
+       twe_wl_surf_source *source = (twe_wl_surf_source *)private;
+
+       source->set_serial_is_used = TPL_TRUE;
+       source->serial = serial;
+}
+
 static void __cb_tss_flusher_flush_callback(void *data,
                struct tizen_surface_shm_flusher *tss_flusher)
 {
@@ -1317,8 +1332,12 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source,
                        buf_info->transform = wl_egl_window->transform;
                        buf_info->dx = wl_egl_window->dx;
                        buf_info->dy = wl_egl_window->dy;
-                       ++wl_egl_window->serial;
-                       buf_info->serial = wl_egl_window->serial;
+                       if (surf_source->set_serial_is_used) {
+                               buf_info->serial = surf_source->serial;
+                       } else {
+                               ++wl_egl_window->serial;
+                               buf_info->serial = wl_egl_window->serial;
+                       }
                }
 
                if (buf_info->rects) {
@@ -1383,8 +1402,13 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source,
                }
 
                buf_info->transform = wl_egl_window->transform;
-               ++wl_egl_window->serial;
-               buf_info->serial = wl_egl_window->serial;
+
+               if (surf_source->set_serial_is_used) {
+                       buf_info->serial = surf_source->serial;
+               } else {
+                       ++wl_egl_window->serial;
+                       buf_info->serial = wl_egl_window->serial;
+               }
 
                if (surf_source->in_use_buffers) {
                        g_mutex_lock(&surf_source->surf_mutex);
@@ -2421,6 +2445,9 @@ twe_surface_add(twe_thread* thread,
        source->vk_sub_thread = NULL;
        source->draw_done_count = 0;
 
+       source->set_serial_is_used = TPL_FALSE;
+       source->serial = 0;
+
        if (!disp_source->is_vulkan_dpy) {
                struct wl_egl_window *wl_egl_window =
                        (struct wl_egl_window *)native_handle;
@@ -2431,6 +2458,8 @@ twe_surface_add(twe_thread* thread,
                wl_egl_window->rotate_callback = (void *)__cb_rotate_callback;
                wl_egl_window->get_rotation_capability = (void *)
                        __cb_get_rotation_capability;
+               wl_egl_window->set_window_serial_callback = (void *)
+                       __cb_set_window_serial_callback;
 
                source->wl_egl_window = wl_egl_window;
                source->surf = wl_egl_window->surface;