Add wl_display_roundtrip to wait for being done pending job by server 86/38586/1 accepted/tizen/common/20150423.074043 accepted/tizen/mobile/20150423.084802 accepted/tizen/tv/20150422.102447 accepted/tizen/wearable/20150423.084713 submit/tizen/20150422.100122
authorMinJeong Kim <minjjj.kim@samsung.com>
Tue, 21 Apr 2015 13:01:46 +0000 (22:01 +0900)
committerBoram Park <boram1288.park@samsung.com>
Wed, 22 Apr 2015 09:37:19 +0000 (18:37 +0900)
Change-Id: Iacc372c96633c69c9af97bfe93ea2fec73a1ccf0

src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
src/modules/evas/engines/wayland_shm/Evas_Engine_Wayland_Shm.h
src/modules/evas/engines/wayland_shm/evas_engine.c
src/modules/evas/engines/wayland_shm/evas_engine.h
src/modules/evas/engines/wayland_shm/evas_outbuf.c
src/modules/evas/engines/wayland_shm/evas_shm.c

index 9355e50..28b08de 100644 (file)
@@ -207,6 +207,7 @@ ecore_evas_wayland_shm_new_internal(const char *disp_name, unsigned int parent,
    if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas)))
      {
         einfo->info.wl_shm = ecore_wl_shm_get();
+        einfo->info.wl_display = ecore_wl_display_get();
         einfo->info.destination_alpha = EINA_TRUE;
         einfo->info.rotation = ee->rotation;
         einfo->info.wl_surface = ecore_wl_window_surface_create(wdata->win);
index b1cb310..1584284 100644 (file)
@@ -13,6 +13,7 @@ struct _Evas_Engine_Info_Wayland_Shm
    struct 
      {
         /* the wayland shm object used to create new shm pool */
+        struct wl_display *wl_display;
         struct wl_shm *wl_shm;
         struct wl_surface *wl_surface;
 
index ff7486b..0a2bfc4 100644 (file)
@@ -23,7 +23,7 @@ struct _Render_Engine
 
 /* LOCAL FUNCTIONS */
 Render_Engine *
-_render_engine_swapbuf_setup(int w, int h, unsigned int rotation, unsigned int depth, Eina_Bool alpha, struct wl_shm *shm, struct wl_surface *surface)
+_render_engine_swapbuf_setup(int w, int h, unsigned int rotation, unsigned int depth, Eina_Bool alpha, struct wl_shm *shm, struct wl_surface *surface, struct wl_display *display)
 {
    Render_Engine *re;
    Outbuf *ob;
@@ -33,7 +33,7 @@ _render_engine_swapbuf_setup(int w, int h, unsigned int rotation, unsigned int d
    /* try to allocate space for new render engine */
    if (!(re = calloc(1, sizeof(Render_Engine)))) return NULL;
 
-   ob = _evas_outbuf_setup(w, h, rotation, depth, alpha, shm, surface);
+   ob = _evas_outbuf_setup(w, h, rotation, depth, alpha, shm, surface, display);
    if (!ob) goto err;
 
    if (!evas_render_engine_software_generic_init(&re->generic, ob,
@@ -131,7 +131,8 @@ eng_setup(Evas *eo_evas, void *info)
                                           einfo->info.depth,
                                           einfo->info.destination_alpha,
                                           einfo->info.wl_shm,
-                                          einfo->info.wl_surface);
+                                          einfo->info.wl_surface,
+                                          einfo->info.wl_display);
 
         if (re)
           re->generic.ob->info = einfo;
@@ -146,7 +147,8 @@ eng_setup(Evas *eo_evas, void *info)
                                 einfo->info.rotation, einfo->info.depth,
                                 einfo->info.destination_alpha,
                                 einfo->info.wl_shm,
-                                einfo->info.wl_surface);
+                                einfo->info.wl_surface,
+                                einfo->info.wl_display);
         if (ob)
           {
              ob->info = einfo;
index c98fb0b..6a597b6 100644 (file)
@@ -75,6 +75,7 @@ struct _Shm_Surface
 {
    struct wl_shm *shm;
    struct wl_surface *surface;
+   struct wl_display *display;
    struct wl_callback *frame_cb;
    uint32_t flags;
    int w, h;
@@ -119,14 +120,14 @@ struct _Outbuf
      } priv;
 };
 
-Shm_Surface *_evas_shm_surface_create(struct wl_shm *shm, struct wl_surface *surface, int w, int h, int num_buff, Eina_Bool alpha);
+Shm_Surface *_evas_shm_surface_create(struct wl_shm *shm, struct wl_surface *surface, struct wl_display *display, int w, int h, int num_buff, Eina_Bool alpha);
 void _evas_shm_surface_destroy(Shm_Surface *surface);
 void _evas_shm_surface_reconfigure(Shm_Surface *surface, int dx, int dy, int w, int h, int num_buff, uint32_t flags);
 void _evas_shm_surface_swap(Shm_Surface *surface, Eina_Rectangle *rects, unsigned int count);
 void *_evas_shm_surface_data_get(Shm_Surface *surface, int *w, int *h);
 void _evas_shm_surface_redraw(Shm_Surface *surface);
 
-Outbuf *_evas_outbuf_setup(int w, int h, int rot, Outbuf_Depth depth, Eina_Bool alpha, struct wl_shm *shm, struct wl_surface *surface);
+Outbuf *_evas_outbuf_setup(int w, int h, int rot, Outbuf_Depth depth, Eina_Bool alpha, struct wl_shm *shm, struct wl_surface *surface, struct wl_display *display);
 void _evas_outbuf_free(Outbuf *ob);
 void _evas_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects, Evas_Render_Mode render_mode);
 void _evas_outbuf_idle_flush(Outbuf *ob);
index 5725663..44df4f9 100644 (file)
@@ -10,7 +10,7 @@
 #define BLUE_MASK 0x0000ff
 
 Outbuf *
-_evas_outbuf_setup(int w, int h, int rot, Outbuf_Depth depth, Eina_Bool alpha, struct wl_shm *shm, struct wl_surface *surface)
+_evas_outbuf_setup(int w, int h, int rot, Outbuf_Depth depth, Eina_Bool alpha, struct wl_shm *shm, struct wl_surface *surface, struct wl_display *display)
 {
    Outbuf *ob = NULL;
    char *num;
@@ -44,7 +44,7 @@ _evas_outbuf_setup(int w, int h, int rot, Outbuf_Depth depth, Eina_Bool alpha, s
 
    /* try to create the outbuf surface */
    if (!(ob->surface =
-         _evas_shm_surface_create(shm, surface, w, h, ob->num_buff, alpha)))
+         _evas_shm_surface_create(shm, surface, display, w, h, ob->num_buff, alpha)))
      goto surf_err;
 
    eina_array_step_set(&ob->priv.onebuf_regions, sizeof(Eina_Array), 8);
index 9c16702..3cade9a 100644 (file)
@@ -308,7 +308,7 @@ _shm_leaf_release(Shm_Leaf *leaf)
 }
 
 Shm_Surface *
-_evas_shm_surface_create(struct wl_shm *shm, struct wl_surface *surface, int w, int h, int num_buff, Eina_Bool alpha)
+_evas_shm_surface_create(struct wl_shm *shm, struct wl_surface *surface, struct wl_display *display, int w, int h, int num_buff, Eina_Bool alpha)
 {
    Shm_Surface *surf;
    int i = 0;
@@ -323,6 +323,7 @@ _evas_shm_surface_create(struct wl_shm *shm, struct wl_surface *surface, int w,
    surf->h = h;
    surf->shm = shm;
    surf->surface = surface;
+   surf->display = display;
    surf->num_buff = num_buff;
    surf->alpha = alpha;
    surf->flags = 0;
@@ -477,8 +478,27 @@ _evas_shm_surface_data_get(Shm_Surface *surface, int *w, int *h)
 
    if (!leaf)
      {
-        /* WRN("All buffers held by server"); */
+        if (surface->display)
+          {
+             if (wl_display_roundtrip(surface->display) != -1)
+               {
+                  for (i = 0; i < surface->num_buff; i++)
+                    {
+                       if (surface->leaf[i].busy) continue;
+                       if ((!leaf) || (leaf->valid))
+                         {
+                            leaf = &surface->leaf[i];
+                            break;
+                         }
+                    }
+               }
+
+          }
+        if (!leaf)
+          {
+             /* WRN("All buffers held by server"); */
              return NULL;
+          }
      }
 
    /* DBG("Leaf Data Get %d", (int)(leaf - &surface->leaf[0])); */