wayland: Reduce number of unneccessary display flushes
authorDerek Foreman <derekf@osg.samsung.com>
Thu, 18 Jan 2018 23:21:27 +0000 (17:21 -0600)
committerWonki Kim <wonki_.kim@samsung.com>
Tue, 3 Apr 2018 07:12:24 +0000 (16:12 +0900)
b48781aa6c85c72f620c57cebff96580ddd67899 fixed multiple bugs where the
display wasn't flushed correctly, however it was a little overzealous.

Some of the flushes were added after calls that only updated internal
state, some in internal functions in which the caller was already going
to flush, and some were after wayland protocol calls that are double
buffered anyway and won't do anything until a following commit.

Also, I've removes at least one long standing flush where the recently
added flush is in a better location than the original.

src/lib/ecore_wl2/ecore_wl2_buffer.c
src/lib/ecore_wl2/ecore_wl2_input.c
src/lib/ecore_wl2/ecore_wl2_output.c
src/lib/ecore_wl2/ecore_wl2_subsurf.c
src/lib/ecore_wl2/ecore_wl2_window.c

index bf2fe5f..4fa905e 100644 (file)
@@ -749,7 +749,6 @@ _ecore_wl2_buffer_test(Ecore_Wl2_Display *ewd)
    zwp_linux_buffer_params_v1_add_listener(dp, &params_listener, ewd);
    zwp_linux_buffer_params_v1_create(dp, buf->w, buf->h,
                                      DRM_FORMAT_ARGB8888, 0);
-   ecore_wl2_display_flush(ewd);
 
    ecore_wl2_buffer_destroy(buf);
 
index 0be2eb9..ce0eda1 100644 (file)
@@ -2277,7 +2277,6 @@ _ecore_wl2_input_add(Ecore_Wl2_Display *display, unsigned int id, unsigned int v
      wl_data_device_manager_get_data_device(display->wl.data_device_manager,
                                             input->wl.seat);
    wl_data_device_add_listener(input->data.device, &_data_listener, input);
-   ecore_wl2_display_flush(input->display);
 }
 
 void
index 0f44c43..f2a879f 100644 (file)
@@ -96,7 +96,6 @@ _ecore_wl2_output_add(Ecore_Wl2_Display *display, unsigned int id)
      eina_inlist_append(display->outputs, EINA_INLIST_GET(output));
 
    wl_output_add_listener(output->wl_output, &_output_listener, output);
-   ecore_wl2_display_flush(display);
 
 //TIZEN_ONLY: ecore_wl2: dispatch the output geometry event
    wl_display_roundtrip(display->wl.display);
index c5ecf99..980c2ee 100644 (file)
@@ -106,7 +106,6 @@ ecore_wl2_subsurface_position_set(Ecore_Wl2_Subsurface *subsurface, int x, int y
    subsurface->y = y;
 
    wl_subsurface_set_position(subsurface->wl.subsurface, x, y);
-   ecore_wl2_display_flush(subsurface->parent->display);
 }
 
 EAPI void
@@ -125,7 +124,6 @@ ecore_wl2_subsurface_place_above(Ecore_Wl2_Subsurface *subsurface, struct wl_sur
    EINA_SAFETY_ON_NULL_RETURN(surface);
 
    wl_subsurface_place_above(subsurface->wl.subsurface, surface);
-   ecore_wl2_display_flush(subsurface->parent->display);
 }
 
 EAPI void
@@ -135,7 +133,6 @@ ecore_wl2_subsurface_place_below(Ecore_Wl2_Subsurface *subsurface, struct wl_sur
    EINA_SAFETY_ON_NULL_RETURN(surface);
 
    wl_subsurface_place_below(subsurface->wl.subsurface, surface);
-   ecore_wl2_display_flush(subsurface->parent->display);
 }
 
 EAPI void
@@ -153,7 +150,6 @@ ecore_wl2_subsurface_sync_set(Ecore_Wl2_Subsurface *subsurface, Eina_Bool sync)
      wl_subsurface_set_sync(subsurface->wl.subsurface);
    else
      wl_subsurface_set_desync(subsurface->wl.subsurface);
-   ecore_wl2_display_flush(subsurface->parent->display);
 }
 
 EAPI void
@@ -186,5 +182,4 @@ ecore_wl2_subsurface_opaque_region_set(Ecore_Wl2_Subsurface *subsurface, int x,
      }
    else
      wl_surface_set_opaque_region(subsurface->wl.surface, NULL);
-   ecore_wl2_display_flush(subsurface->parent->display);
 }
index 6e94f11..4e3b187 100644 (file)
@@ -918,7 +918,6 @@ _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window)
           }
         else
           zwp_e_session_recovery_get_uuid(window->display->wl.session_recovery, window->surface);
-        ecore_wl2_display_flush(window->display);
      }
 }
 
@@ -1282,7 +1281,6 @@ ecore_wl2_window_raise(Ecore_Wl2_Window *window)
                                     window->set_config.geometry.w,
                                     window->set_config.geometry.h, &states);
         wl_array_release(&states);
-        ecore_wl2_display_flush(window->display);
      }
 */
    if ((window->surface) && (window->display->wl.tz_policy))
@@ -1442,7 +1440,6 @@ ecore_wl2_window_alpha_set(Ecore_Wl2_Window *window, Eina_Bool alpha)
                                         window->opaque.h);
    else
      ecore_wl2_window_opaque_region_set(window, 0, 0, 0, 0);
-   ecore_wl2_display_flush(window->display);
 }
 
 EAPI void
@@ -1466,7 +1463,6 @@ ecore_wl2_window_transparent_set(Ecore_Wl2_Window *window, Eina_Bool transparent
    else if (window->surface)
      wl_surface_set_opaque_region(window->surface, NULL);
 //
-   ecore_wl2_display_flush(window->display);
 }
 
 // TIZEN_ONLY(20171108) : Get a window's transparent property
@@ -1915,6 +1911,7 @@ ecore_wl2_window_iconified_set(Ecore_Wl2_Window *window, Eina_Bool iconified)
           xdg_toplevel_set_minimized(window->xdg_toplevel);
         if (window->zxdg_toplevel)
           zxdg_toplevel_v6_set_minimized(window->zxdg_toplevel);
+        ecore_wl2_display_flush(window->display);
      }
    else
      {
@@ -1948,7 +1945,6 @@ ecore_wl2_window_iconified_set(Ecore_Wl2_Window *window, Eina_Bool iconified)
    */
    _ecore_wl2_window_iconified_set(window, iconified, EINA_TRUE);
    //
-   ecore_wl2_display_flush(window->display);
 }
 
 // TIZEN_ONLY(20151231) : handling iconic state on tizen
@@ -2119,7 +2115,6 @@ ecore_wl2_window_buffer_transform_set(Ecore_Wl2_Window *window, int transform)
    EINA_SAFETY_ON_NULL_RETURN(window);
 
    wl_surface_set_buffer_transform(window->surface, transform);
-   ecore_wl2_display_flush(window->display);
 }
 
 EAPI void
@@ -2841,7 +2836,6 @@ _maximized_set(Ecore_Wl2_Window *window)
         if (window->zxdg_toplevel)
           zxdg_toplevel_v6_unset_maximized(window->zxdg_toplevel);
      }
-   ecore_wl2_display_flush(window->display);
 }
 
 static void
@@ -2864,7 +2858,6 @@ _fullscreen_set(Ecore_Wl2_Window *window)
         if (window->zxdg_toplevel)
           zxdg_toplevel_v6_unset_fullscreen(window->zxdg_toplevel);
      }
-   ecore_wl2_display_flush(window->display);
 }
 
 static void
@@ -2891,7 +2884,6 @@ _input_set(Ecore_Wl2_Window *window)
                  window->input_rect.w, window->input_rect.h);
    wl_surface_set_input_region(window->surface, region);
    wl_region_destroy(region);
-   ecore_wl2_display_flush(window->display);
 }
 
 static void
@@ -2916,7 +2908,6 @@ _opaque_set(Ecore_Wl2_Window *window)
                  window->opaque.w, window->opaque.h);
    wl_surface_set_opaque_region(window->surface, region);
    wl_region_destroy(region);
-   ecore_wl2_display_flush(window->display);
 }
 
 EAPI void