ecore_wl2: support tizen_renderer protocol 15/238015/4
authorChangyeon Lee <cyeon.lee@samsung.com>
Tue, 7 Jul 2020 09:36:18 +0000 (18:36 +0900)
committerwoochan lee <wc0917.lee@samsung.com>
Thu, 16 Jul 2020 07:26:20 +0000 (07:26 +0000)
Some target can display only specific buffer at hardware layer.
enlightenment sends buffer to render engine (egl or software engine)
of client when enlightenment wants to display at hardware layer and
enlightenment wait that client attach buffer by render engine.
but if client doesn't have change of rendering after buffer is sent,
render engine doesn't render at buffer.
tizen_renderer protocol and redraw_request event were added.
enlightenment sends redraw_request event after buffer is sent and
wants client redraws at wl_surface.

1. add event ECORE_WL2_EVENT_WINDOW_REDRAW_REQUEST and
   Ecore_Wl2_Event_Window_Redraw_Request
2. add damage to ecore_evas in callback of redraw request

Change-Id: I951b458c10d8163cc37583ededcabd4cd807531e

src/lib/ecore_wl2/Ecore_Wl2.h
src/lib/ecore_wl2/ecore_wl2.c
src/lib/ecore_wl2/ecore_wl2_display.c
src/lib/ecore_wl2/ecore_wl2_private.h
src/lib/ecore_wl2/ecore_wl2_window.c
src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c

index 404eb84..cd7eeec 100644 (file)
@@ -697,6 +697,12 @@ typedef struct _Ecore_Wl2_Event_Window_Pre_Visibility_Change
 } Ecore_Wl2_Event_Window_Pre_Visibility_Change;
 
 /** @internal */
+typedef struct _Ecore_Wl2_Event_Window_Redraw_Request
+{
+   unsigned int win;
+} Ecore_Wl2_Event_Window_Redraw_Request;
+
+/** @internal */
 typedef struct _Ecore_Wl2_Event_Dnd_Position
 {
    unsigned int win, source;
@@ -847,6 +853,7 @@ EAPI extern int ECORE_WL2_EVENT_WINDOW_DESTROY; /** @since 1.25 */
 EAPI extern int ECORE_WL2_EVENT_WINDOW_VISIBILITY_CHANGE;
 EAPI extern int ECORE_WL2_EVENT_WINDOW_PRE_VISIBILITY_CHANGE;
 EAPI extern int ECORE_WL2_EVENT_WINDOW_LOWER;
+EAPI extern int ECORE_WL2_EVENT_WINDOW_REDRAW_REQUEST;
 EAPI extern int ECORE_WL2_EVENT_DND_POSITION; /** @internal */
 EAPI extern int ECORE_WL2_EVENT_DND_OFFER; /** @internal @since 1.8, but NOT exist currenly */
 EAPI extern int ECORE_WL2_EVENT_DATA_SOURCE_CANCELLED; /** @internal @since 1.7, but NOT exist currenly */
index 826ffb0..c5d1006 100644 (file)
@@ -64,6 +64,7 @@ EAPI int ECORE_WL2_EVENT_WINDOW_DESTROY = 0;
 EAPI int ECORE_WL2_EVENT_WINDOW_VISIBILITY_CHANGE = 0;
 EAPI int ECORE_WL2_EVENT_WINDOW_PRE_VISIBILITY_CHANGE = 0;
 EAPI int ECORE_WL2_EVENT_WINDOW_LOWER = 0;
+EAPI int ECORE_WL2_EVENT_WINDOW_REDRAW_REQUEST = 0;
 EAPI int ECORE_WL2_EVENT_DND_POSITION = 0;
 EAPI int ECORE_WL2_EVENT_DND_OFFER = 0;
 EAPI int ECORE_WL2_EVENT_DATA_SOURCE_CANCELLED = 0;
@@ -226,6 +227,7 @@ ecore_wl2_init(void)
    ECORE_WL2_EVENT_WINDOW_VISIBILITY_CHANGE = ecore_event_type_new();
    ECORE_WL2_EVENT_WINDOW_PRE_VISIBILITY_CHANGE = ecore_event_type_new();
    ECORE_WL2_EVENT_WINDOW_LOWER = ecore_event_type_new();
+   ECORE_WL2_EVENT_WINDOW_REDRAW_REQUEST = ecore_event_type_new();
    ECORE_WL2_EVENT_DND_POSITION = ecore_event_type_new();
    ECORE_WL2_EVENT_DND_OFFER = ecore_event_type_new();
    ECORE_WL2_EVENT_DATA_SOURCE_CANCELLED = ecore_event_type_new();
@@ -317,6 +319,7 @@ ecore_wl2_shutdown(void)
                           ECORE_WL2_EVENT_WINDOW_VISIBILITY_CHANGE,
                           ECORE_WL2_EVENT_WINDOW_PRE_VISIBILITY_CHANGE,
                           ECORE_WL2_EVENT_WINDOW_LOWER,
+                          ECORE_WL2_EVENT_WINDOW_REDRAW_REQUEST,
                           ECORE_WL2_EVENT_DND_POSITION,
                           ECORE_WL2_EVENT_DND_OFFER,
                           ECORE_WL2_EVENT_DATA_SOURCE_CANCELLED,
index aa79d81..41783a0 100644 (file)
@@ -917,6 +917,13 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
           tizen_launch_appinfo_add_listener(ewd->wl.tz_appinfo, &_tizen_launch_appinfo_listener, ewd->wl.display);
      }
 //
+//TIZEN_ONLY(20200626): support tizen_renderer
+   else if (!strcmp(interface, "tizen_renderer"))
+     {
+        ewd->wl.tz_renderer =
+           wl_registry_bind(registry, id, &tizen_renderer_interface, 1);
+     }
+//
    //
 
 event:
@@ -1031,6 +1038,7 @@ _ecore_wl2_display_globals_cleanup(Ecore_Wl2_Display *ewd)
    if (ewd->wl.tz_screen_rotation) tizen_screen_rotation_destroy(ewd->wl.tz_screen_rotation);
    if (ewd->wl.tz_moveresize) tizen_move_resize_destroy(ewd->wl.tz_moveresize);
    if (ewd->wl.tz_video) tizen_video_destroy(ewd->wl.tz_video);
+   if (ewd->wl.tz_renderer) tizen_renderer_destroy(ewd->wl.tz_renderer);
 //
 
    if (ewd->wl.registry) wl_registry_destroy(ewd->wl.registry);
index 87071ae..efd5145 100644 (file)
@@ -138,6 +138,9 @@ struct _Ecore_Wl2_Display
         // TIZEN_ONLY(20200601): support sync between ui and video
         struct tizen_video *tz_video;
         //
+        // TIZEN_ONLY(20200601): support tizen_renderer
+        struct tizen_renderer *tz_renderer;
+        //
 
         int compositor_version;
      } wl;
@@ -409,6 +412,10 @@ struct _Ecore_Wl2_Window
         Eina_Bool sync : 1;
      } video;
    //
+
+   // TIZEN_ONLY(20200601): support tizen_renderer_surface
+   struct tizen_renderer_surface *tz_renderer_surface;
+   //
 };
 
 struct _Ecore_Wl2_Output
index c81c4f5..04d199e 100644 (file)
@@ -747,6 +747,26 @@ static const struct tizen_resource_listener _tizen_resource_listener =
 };
 //
 
+//TIZEN_ONLY(20200707): support tizen_renderer_surface
+static void
+_tizen_renderer_surface_cb_redraw_request(void *data, struct tizen_renderer_surface *renderer_surface EINA_UNUSED)
+{
+   Ecore_Wl2_Window *win;
+   Ecore_Wl2_Event_Window_Redraw_Request *ev;
+
+   if (!(win = data)) return;
+   if (!(ev = calloc(1, sizeof(Ecore_Wl2_Event_Window_Redraw_Request)))) return;
+
+   ev->win = win->id;
+
+   ecore_event_add(ECORE_WL2_EVENT_WINDOW_REDRAW_REQUEST, ev, NULL, NULL);
+}
+
+static const struct tizen_renderer_surface_listener _tizen_renderer_surface_listener =
+{
+   _tizen_renderer_surface_cb_redraw_request,
+};
+//
 
 // TIZEN_ONLY(20171112) : support tizen protocols
 // to initialize wayland tizen extention protocols after surface creation
@@ -901,6 +921,16 @@ _ecore_wl2_window_tz_ext_init(Ecore_Wl2_Window *window)
                tizen_policy_set_parent(window->display->wl.tz_policy, window->surface, window->parent->surface);
           }
      }
+
+   if (window->display->wl.tz_renderer && !window->tz_renderer_surface)
+     {
+        window->tz_renderer_surface =
+          tizen_renderer_get_renderer_surface(window->display->wl.tz_renderer, window->surface);
+        if (!window->tz_renderer_surface) return;
+
+        tizen_renderer_surface_add_listener(window->tz_renderer_surface,
+                                    &_tizen_renderer_surface_listener, window);
+     }
 }
 // END of TIZEN_ONLY(20171112) : support tizen protocols
 
index 2accc60..dfbed2b 100644 (file)
@@ -1756,6 +1756,25 @@ _ecore_evas_wl_common_cb_window_visibility_change(void *data EINA_UNUSED, int ty
 }
 //
 
+//TIZEN_ONLY(20200707): support tizen_renderer_surface
+static Eina_Bool
+_ecore_evas_wl_common_cb_window_redraw_request(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
+{
+   Ecore_Evas *ee;
+   Ecore_Wl2_Event_Window_Redraw_Request *ev;
+
+   ev = event;
+   ee = ecore_event_window_match(ev->win);
+
+   if (!ee) return ECORE_CALLBACK_PASS_ON;
+   if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+
+   _ecore_evas_wl_common_damage_add(ee);
+
+   return ECORE_CALLBACK_PASS_ON;
+}
+//
+
 static int
 _ecore_evas_wl_common_init(void)
 {
@@ -1860,6 +1879,12 @@ _ecore_evas_wl_common_init(void)
    eina_array_push(_ecore_evas_wl_event_hdls, h);
    //
 
+   // TIZEN_ONLY(20200707): support redraw request event
+   h = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_REDRAW_REQUEST,
+                               _ecore_evas_wl_common_cb_window_redraw_request, NULL);
+   eina_array_push(_ecore_evas_wl_event_hdls, h);
+   //
+
    ecore_event_evas_init();
 
    return _ecore_evas_wl_init_count;