e_comp_wl: Deprecate frames 97/315797/1
authorSeunghun Lee <shiin.lee@samsung.com>
Thu, 22 Aug 2024 09:28:43 +0000 (18:28 +0900)
committerSeunghun Lee <shiin@samsung.com>
Wed, 4 Dec 2024 23:45:31 +0000 (08:45 +0900)
This deprecates frames field of E_Comp_Wl_Surface_State and
E_Comp_Wl_Client_Data. The e_surface_frame_done_send() should be used
instead.

Change-Id: I86016717c58e6eb94d04a4d4d0ea30d65e3852f8

src/bin/server/e_comp_wl.c
src/bin/server/e_comp_wl_rsm.c
src/bin/server/e_compositor.c
src/include/e_comp_wl.h

index 2ef1e29dedff2cd5e8951276824064b2227c402d..0e97e4223e95595513a0a92d00764d576fba3d78 100644 (file)
@@ -2735,11 +2735,6 @@ _e_comp_wl_surface_state_init(E_Comp_Wl_Surface_State *state, int w, int h)
 static void
 _e_comp_wl_surface_state_finish(E_Comp_Wl_Surface_State *state)
 {
-   struct wl_resource *cb;
-
-   EINA_LIST_FREE(state->frames, cb)
-     wl_resource_destroy(cb);
-
    if (state->buffer) wl_list_remove(&state->buffer_destroy_listener.link);
    state->buffer = NULL;
 
@@ -3199,14 +3194,6 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
    state->sy = 0;
    state->new_attach = EINA_FALSE;
 
-   e_surface_frame_done_send(surface);
-
-   /* insert state frame callbacks into comp_data->frames
-    * NB: This clears state->frames list */
-   cdata->frames = eina_list_merge(cdata->frames,
-                                           state->frames);
-   state->frames = NULL;
-
    if (e_client_view_get(ec))
      _e_comp_wl_surface_damage_update(ec);
 
index d3454b0d25c9eb16d2c6597078f1953c707ed4f8..6dbe4cf58fe6247002f92c372162fc533c856d05 100644 (file)
@@ -3037,12 +3037,6 @@ _e_comp_wl_remote_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *st
    state->sy = 0;
    state->new_attach = EINA_FALSE;
 
-   e_surface_frame_done_send(e_surface_from_ec(ec));
-
-   ec->comp_data->frames = eina_list_merge(ec->comp_data->frames,
-                                           state->frames);
-   state->frames = NULL;
-
    state->buffer_viewport.changed = 0;
 
    wl_signal_emit(&cdata->state_commit_signal, &cdata->surface);
index 227b251ff2923ebd4a6fc7afe53dd03e8295f1ea..89a174c9fcb1a03f69bfbf5113dfa319d2b13489 100644 (file)
@@ -43,6 +43,8 @@ struct _E_Surface
 
    E_Client_Hook *client_del_hook;
 
+   struct wl_list frames;
+
    struct wl_listener destroy;
    struct wl_listener precommit_to_cache;
    struct wl_listener precommit_from_cache;
@@ -611,10 +613,9 @@ e_surface_has_subsurfaces(E_Surface *surface)
 EINTERN void
 e_surface_frame_done_send(E_Surface *surface)
 {
-   struct wl_resource *resource;
-   Eina_List *l, *ll;
+   struct wl_resource *resource, *tmp;
 
-   EINA_LIST_FOREACH_SAFE(surface->base.frames, l, ll, resource)
+   wl_resource_for_each_safe(resource, tmp, &surface->frames)
      {
         wl_callback_send_done(resource, (unsigned int)(ecore_loop_time_get() * 1000));
         wl_resource_destroy(resource);
@@ -863,6 +864,8 @@ _e_surface_create(E_Client *ec)
    wl_signal_init(&surface->base.apply_viewport_signal);
    wl_signal_init(&surface->base.state_commit_signal);
 
+   wl_list_init(&surface->frames);
+
    e_comp_wl_surface_state_init(&surface->base.pending, ec->w, ec->h);
 
    /* set initial client data properties */
@@ -890,8 +893,8 @@ _e_surface_create(E_Client *ec)
 static void
 _e_surface_destroy(E_Surface *surface)
 {
-   struct wl_resource *cb;
    E_Comp_Wl_Data *comp_wl;
+   struct wl_resource *resource, *tmp;
 
    ELOGF("COMPOSITOR", "Desroy E_Surface %p", surface->ec, surface);
 
@@ -903,8 +906,8 @@ _e_surface_destroy(E_Surface *surface)
 
    e_comp_wl_buffer_reference(&surface->base.buffer_ref, NULL);
 
-   EINA_LIST_FREE(surface->base.frames, cb)
-     wl_resource_destroy(cb);
+   wl_resource_for_each_safe(resource, tmp, &surface->frames)
+     wl_resource_destroy(resource);
 
    if (surface->base.aux_hint.hints)
      {
@@ -1076,58 +1079,19 @@ _e_surface_pending_buffer_scale_update(E_Surface *surface)
 }
 
 static void
-_frame_callback_cb_destroy(struct wl_listener *listener, void *data)
-{
-   struct wl_resource *resource = data;
-   E_Frame_Callback *frame_callback;
-   E_Surface *surface;
-
-   frame_callback = wl_container_of(listener, frame_callback, destroy);
-   surface = frame_callback->surface;
-
-   if (surface->base.frames)
-     surface->base.frames = eina_list_remove(surface->base.frames, resource);
-
-   if (surface->base.pending.frames)
-     surface->base.pending.frames = eina_list_remove(surface->base.pending.frames, resource);
-
-   wl_list_remove(&frame_callback->destroy.link);
-   free(frame_callback);
-}
-
-static Eina_Bool
-_e_surface_pending_frame_callback_add(E_Surface *surface, struct wl_resource *resource)
-{
-   E_Frame_Callback *frame_callback;
-
-   frame_callback = E_NEW(E_Frame_Callback, 1);
-   if (!frame_callback)
-     return EINA_FALSE;
-
-   frame_callback->surface = surface;
-
-   frame_callback->destroy.notify = _frame_callback_cb_destroy;
-   wl_resource_add_destroy_listener(resource, &frame_callback->destroy);
-
-   surface->base.pending.frames = eina_list_prepend(surface->base.pending.frames, resource);
-
-   return EINA_TRUE;
-}
-
-static void
-_e_surface_pending_frame_callback_update(E_Surface *surface)
+_e_surface_frame_callback_list_update(E_Surface *surface)
 {
    struct ds_surface *ds_surface = surface->ds_surface;
-   struct wl_resource *resource, *tmp;
 
-   wl_resource_for_each_safe(resource, tmp, &ds_surface->current.frame_callback_list)
-     {
-        if (_e_surface_pending_frame_callback_add(surface, resource))
-          {
-             wl_list_remove(wl_resource_get_link(resource));
-             wl_list_init(wl_resource_get_link(resource));
-          }
-     }
+   // FIXME
+   // flush frame callback events to fix the problem that some application
+   // historically had without this.
+   // If we remove it we can use ds_surface_send_frame_done() and remove
+   // frames field from E_Surface.
+   e_surface_frame_done_send(surface);
+
+   wl_list_insert_list(&surface->frames, &ds_surface->current.frame_callback_list);
+   wl_list_init(&ds_surface->current.frame_callback_list);
 }
 
 static void
@@ -1228,7 +1192,7 @@ _e_surface_pending_update(E_Surface *surface)
      _e_surface_pending_buffer_scale_update(surface);
 
    if (ds_surface->current.committed & DS_SURFACE_STATE_FRAME_CALLBACK_LIST)
-     _e_surface_pending_frame_callback_update(surface);
+     _e_surface_frame_callback_list_update(surface);
 
    if (ds_surface->current.committed & DS_SURFACE_STATE_VIEWPORT)
      _e_surface_pending_viewport_update(surface);
index a9553d7718a93d1b20cf76c64a44e68f445308d7..155248cd67f497fbc2a754c1bdc2cff95b204ece 100644 (file)
@@ -184,7 +184,7 @@ struct _E_Comp_Wl_Surface_State
    E_Comp_Wl_Buffer *buffer;
    struct wl_listener buffer_destroy_listener;
    EINA_DEPRECATED Eina_List *damages, *buffer_damages;
-   Eina_List *frames;
+   EINA_DEPRECATED Eina_List *frames;
    EINA_DEPRECATED Eina_Tiler *input;
    EINA_DEPRECATED Eina_Tiler *opaque;
    E_Comp_Wl_Buffer_Viewport buffer_viewport;
@@ -444,7 +444,7 @@ struct _E_Comp_Wl_Client_Data
    E_Comp_Wl_Buffer_Ref buffer_ref;
    E_Comp_Wl_Surface_State pending;
 
-   Eina_List *frames;
+   EINA_DEPRECATED Eina_List *frames;
    E_Presentation_Time_Container presentation_container;
 
    struct