tpl_wayland_egl: check latest_transform in surface_commit 67/212667/3
authorChangyeon Lee <cyeon.lee@samsung.com>
Mon, 26 Aug 2019 03:51:30 +0000 (12:51 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Fri, 8 Nov 2019 02:20:04 +0000 (02:20 +0000)
if rotated buffer is canceled dequeue,
wl_surface_set_buffer_transform isn't called

Change-Id: I19e9b363bf21a532ae05aa6bd0dd7644e88a72ab

src/tpl_wayland_egl.c
src/tpl_wayland_egl_thread.c

index 70e37a5581b4fc19b0b4d8c1423265087bcc3580..71f90c739ee428ee446dfb00151e0152e08ce384 100644 (file)
@@ -63,7 +63,6 @@ struct _tpl_wayland_egl_buffer {
        int window_transform;
        tbm_bo bo;
        tpl_bool_t w_rotated; /* TRUE if need to call wayland_tbm_client_set_buffer_transform */
-       tpl_bool_t rotated; /* TRUE if need to call wl_surface_set_buffer_transform */
        tpl_bool_t is_new; /* for frontbuffer mode */
        tpl_bool_t need_to_release; /* for checking need release */
        struct wl_proxy *wl_proxy; /* wl_buffer proxy */
@@ -878,10 +877,10 @@ __tpl_wayland_egl_surface_commit(tpl_surface_t *surface,
                wayland_egl_buffer->w_rotated = TPL_FALSE;
        }
 
-       if (wayland_egl_buffer->rotated == TPL_TRUE) {
+       if (wayland_egl_surface->latest_transform != wayland_egl_buffer->transform) {
+               wayland_egl_surface->latest_transform = wayland_egl_buffer->transform;
                wl_surface_set_buffer_transform(wl_egl_window->surface,
                                                                                wayland_egl_buffer->transform);
-               wayland_egl_buffer->rotated = TPL_FALSE;
        }
 
        wl_surface_attach(wl_egl_window->surface, (void *)wayland_egl_buffer->wl_proxy,
@@ -1324,6 +1323,7 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou
                wayland_egl_buffer->dy = wl_egl_window->dy;
                wayland_egl_buffer->width = wl_egl_window->width;
                wayland_egl_buffer->height = wl_egl_window->height;
+               wayland_egl_buffer->transform = tizen_private->transform;
 
                if (wayland_egl_buffer->window_transform != tizen_private->window_transform) {
                        wayland_egl_buffer->window_transform = tizen_private->window_transform;
@@ -1332,14 +1332,6 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou
                        wayland_egl_buffer->w_rotated = TPL_FALSE;
                }
 
-               if (wayland_egl_surface->latest_transform != tizen_private->transform) {
-                       wayland_egl_surface->latest_transform = tizen_private->transform;
-                       wayland_egl_buffer->transform = tizen_private->transform;
-                       wayland_egl_buffer->rotated = TPL_TRUE;
-               } else {
-                       wayland_egl_buffer->rotated = TPL_FALSE;
-               }
-
                if (wayland_egl_surface->is_activated != is_activated)
                        wayland_egl_buffer->is_new = TPL_TRUE;
 
@@ -1360,10 +1352,11 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou
                                  wayland_egl_buffer->wl_proxy,
                                  tbm_surface, tbm_bo_export(wayland_egl_buffer->bo));
                TPL_LOG_B("WL_EGL",
-                                 "[DEQ] size(%dx%d) transform(%d) rotated(%s)",
+                                 "[DEQ] size(%dx%d) transform(%d) w_transform(%d) w_rotated(%s)",
                                  wayland_egl_buffer->width, wayland_egl_buffer->height,
                                  wayland_egl_buffer->transform,
-                                 wayland_egl_buffer->rotated ? "[TRUE]" : "[FALSE]");
+                                 wayland_egl_buffer->window_transform,
+                                 wayland_egl_buffer->w_rotated ? "[TRUE]" : "[FALSE]");
 
                if (lock_res == 0) pthread_mutex_unlock(&wayland_egl_display->wl_event_mutex);
                return tbm_surface;
@@ -1412,7 +1405,6 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou
        wayland_egl_buffer->bo = tbm_surface_internal_get_bo(tbm_surface, 0);
        wayland_egl_buffer->wayland_egl_surface = wayland_egl_surface;
        wayland_egl_buffer->transform = tizen_private->transform;
-       wayland_egl_buffer->rotated = TPL_TRUE;
 
        if (wayland_egl_buffer->window_transform != tizen_private->window_transform) {
                wayland_egl_buffer->window_transform = tizen_private->window_transform;
@@ -1421,13 +1413,6 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou
                wayland_egl_buffer->w_rotated = TPL_FALSE;
        }
 
-       if (wayland_egl_surface->latest_transform != tizen_private->transform) {
-               wayland_egl_surface->latest_transform = tizen_private->transform;
-               wayland_egl_buffer->rotated = TPL_TRUE;
-       } else {
-               wayland_egl_buffer->rotated = TPL_FALSE;
-       }
-
        /* 'is_new' flag is to check wheter it is a new buffer need to commit
         * in frontbuffer mode. */
        wayland_egl_buffer->is_new = TPL_TRUE;
@@ -1448,10 +1433,11 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou
                          tbm_bo_export(wayland_egl_buffer->bo));
 
        TPL_LOG_B("WL_EGL",
-                         "[DEQ] size(%dx%d) transform(%d) rotated(%s)",
+                         "[DEQ] size(%dx%d) transform(%d) w_transform(%d) w_rotated(%s)",
                          wayland_egl_buffer->width, wayland_egl_buffer->height,
                          wayland_egl_buffer->transform,
-                         wayland_egl_buffer->rotated ? "[TRUE]" : "[FALSE]");
+                         wayland_egl_buffer->window_transform,
+                         wayland_egl_buffer->w_rotated ? "[TRUE]" : "[FALSE]");
 
        if (wayland_egl_surface->dequeued_buffers) {
                TPL_OBJECT_LOCK(&wayland_egl_surface->base);
index 1c5d5bf1a49c3a548d42ddc1366030efa12954fd..99b36b2fa9cb038816e8361736f3825dcbd9529c 100644 (file)
@@ -145,7 +145,6 @@ struct _twe_wl_buffer_info {
        tpl_bool_t w_rotated;
        /* for wl_surface_set_buffer_transform */
        int transform;
-       tpl_bool_t rotated;
        /* for damage region */
        int num_rects;
        int *rects;
@@ -1382,11 +1381,6 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source,
                                buf_info->w_rotated = TPL_TRUE;
                        }
 
-                       if (surf_source->latest_transform != tizen_private->transform) {
-                               surf_source->latest_transform = tizen_private->transform;
-                               buf_info->rotated = TPL_TRUE;
-                       }
-
                        buf_info->transform = tizen_private->transform;
                        buf_info->dx = wl_egl_window->dx;
                        buf_info->dy = wl_egl_window->dy;
@@ -1419,10 +1413,12 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source,
                                   tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0)));
 
                TPL_LOG_T(BACKEND,
-                                 "[REUSE_BUF] buf_info(%p) tbm_surface(%p) bo(%d) (%dx%d) transform(%d)",
+                                 "[REUSE_BUF] buf_info(%p) tbm_surface(%p) bo(%d) (%dx%d) "
+                                 "transform(%d) w_transform(%d)",
                                  buf_info, tbm_surface,
                                  tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0)),
-                                 buf_info->width, buf_info->height, buf_info->transform);
+                                 buf_info->width, buf_info->height,
+                                 buf_info->transform, buf_info->w_transform);
                return;
        }
 
@@ -1454,11 +1450,6 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source,
                        buf_info->w_rotated = TPL_TRUE;
                }
 
-               if (surf_source->latest_transform != tizen_private->transform) {
-                       surf_source->latest_transform = tizen_private->transform;
-                       buf_info->rotated = TPL_TRUE;
-               }
-
                buf_info->transform = tizen_private->transform;
 
                if (surf_source->set_serial_is_used) {
@@ -1481,7 +1472,7 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source,
                buf_info->height = surf_source->swapchain_properties.height;
                buf_info->w_transform = 0;
                buf_info->w_rotated = TPL_FALSE;
-               buf_info->rotated = TPL_FALSE;
+               buf_info->transform = 0;
                buf_info->serial = 0;
        }
 
@@ -1522,10 +1513,12 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source,
        TRACE_MARK("[SET_BUFFER_INFO] BO(%d)",
                           tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0)));
        TPL_LOG_T(BACKEND,
-                         "[NEW_BUF] buf_info(%p) tbm_surface(%p) bo(%d) (%dx%d) transform(%d)",
+                         "[NEW_BUF] buf_info(%p) tbm_surface(%p) bo(%d) (%dx%d) "
+                         "transform(%d) w_transform(%d)",
                          buf_info, tbm_surface,
                          tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0)),
-                         buf_info->width, buf_info->height, buf_info->transform);
+                         buf_info->width, buf_info->height,
+                         buf_info->transform, buf_info->w_transform);
 }
 
 static void
@@ -1881,9 +1874,9 @@ _twe_thread_wl_surface_commit(twe_wl_surf_source *surf_source,
                buf_info->w_rotated = TPL_FALSE;
        }
 
-       if (buf_info->rotated == TPL_TRUE) {
+       if (surf_source->latest_transform != buf_info->transform) {
+               surf_source->latest_transform = buf_info->transform;
                wl_surface_set_buffer_transform(wl_surface, buf_info->transform);
-               buf_info->rotated = TPL_FALSE;
        }
 
        if (wl_egl_window) {