ecore_drm/ecore_evas_drm : add HWC condition on pageFlip 29/62529/3 submit/tizen/20160316.130158
authorJuyeon Lee <juyeonne.lee@samsung.com>
Wed, 16 Mar 2016 10:58:37 +0000 (19:58 +0900)
committerJuyeon Lee <juyeonne.lee@samsung.com>
Wed, 16 Mar 2016 12:53:22 +0000 (21:53 +0900)
Change-Id: I2757b8246d7f292435ee7b2359acc790f7368a28

src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
src/modules/evas/engines/gl_drm/Evas_Engine_GL_Drm.h
src/modules/evas/engines/gl_drm/evas_outbuf.c

index 25c9979..af86c44 100644 (file)
@@ -1030,6 +1030,23 @@ _ecore_evas_drm_aspect_set(Ecore_Evas *ee, double aspect)
    ee->prop.aspect = aspect;
 }
 
+#ifdef BUILD_ECORE_EVAS_GL_DRM
+static Eina_Bool
+_ecore_evas_drm_render_check_skip(Ecore_Evas *ee)
+{
+   Evas_Engine_Info_GL_Drm *einfo;
+   einfo = (Evas_Engine_Info_GL_Drm *)evas_engine_info_get(ee->evas);
+   if (!einfo) return EINA_TRUE;
+   if (!einfo->info.hwc_enable) return EINA_FALSE;
+
+   /* HWC: wait_for_showup is set by enlightenment */
+   if (einfo->info.wait_for_showup)
+     INF("HWC: skip to render the ecore_evas.\n");
+
+   return einfo->info.wait_for_showup;
+}
+#endif
+
 static int
 _ecore_evas_drm_render(Ecore_Evas *ee)
 {
@@ -1045,6 +1062,11 @@ _ecore_evas_drm_render(Ecore_Evas *ee)
         return 0;
      }
 
+#ifdef BUILD_ECORE_EVAS_GL_DRM
+   /* HWC: check if the ecore_evas is skipped or not */
+   if (_ecore_evas_drm_render_check_skip(ee)) return 0;
+#endif
+
    EINA_LIST_FOREACH(ee->sub_ecore_evas, l, ee2)
      {
         if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
index 71ab60c..4238ba3 100644 (file)
@@ -26,6 +26,12 @@ struct _Evas_Engine_Info_GL_Drm
      {
         struct gbm_device *gbm;
 
+        /* HWC: for hwc */
+        struct gbm_surface *surface;
+        Eina_Bool wait_for_showup : 1;
+        Eina_Bool outbuf_flushed : 1;
+        Eina_Bool hwc_enable : 1;
+
         unsigned int rotation, depth;
         unsigned int crtc_id, conn_id, buffer_id;
         unsigned int format, flags;
index f7bb0c7..2f826f2 100644 (file)
@@ -473,6 +473,9 @@ evas_outbuf_new(Evas_Engine_Info_GL_Drm *info, int w, int h, Render_Engine_Swap_
         return NULL;
      }
 
+   /* HWC: set the gbm_surface to the engine_info */
+   if (info->info.hwc_enable) info->info.surface =  ob->surface;
+
    return ob;
 }
 
@@ -849,34 +852,44 @@ evas_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects, Evas_Render_Mode render_mode)
           }
      }
    else
-      eglSwapBuffers(ob->egl.disp, ob->egl.surface[0]);
+     eglSwapBuffers(ob->egl.disp, ob->egl.surface[0]);
 
    if (ob->info->callback.post_swap)
      ob->info->callback.post_swap(ob->info->callback.data, ob->evas);
 
-   if (rects)
+   /* HWC: do not display the ecore_evas at gl_drm engine
+      hwc at enlightenment will update the display device */
+   if (ob->info->info.hwc_enable)
      {
-        Tilebuf_Rect *r;
-        Eina_Rectangle *res;
-        int num, i = 0;
-
-        num = eina_inlist_count(EINA_INLIST_GET(rects));
-        res = alloca(sizeof(Eina_Rectangle) * num);
-        EINA_INLIST_FOREACH(EINA_INLIST_GET(rects), r)
-          {
-             res[i].x = r->x;
-             res[i].y = r->y;
-             res[i].w = r->w;
-             res[i].h = r->h;
-             i++;
-          }
-
-        _evas_outbuf_buffer_swap(ob, res, num);
+        /* The pair of evas_outbuf_flush and post_render has to be matched */
+        ob->info->info.outbuf_flushed = EINA_TRUE;
+        INF("HWC: evas outbuf flushed");
      }
    else
-     //Flush GL Surface data to Framebuffer
-     _evas_outbuf_buffer_swap(ob, NULL, 0);
+     {
+        if (rects)
+          {
+             Tilebuf_Rect *r;
+             Eina_Rectangle *res;
+             int num, i = 0;
 
+             num = eina_inlist_count(EINA_INLIST_GET(rects));
+             res = alloca(sizeof(Eina_Rectangle) * num);
+             EINA_INLIST_FOREACH(EINA_INLIST_GET(rects), r)
+               {
+                  res[i].x = r->x;
+                  res[i].y = r->y;
+                  res[i].w = r->w;
+                  res[i].h = r->h;
+                  i++;
+               }
+
+             _evas_outbuf_buffer_swap(ob, res, num);
+          }
+        else
+          //Flush GL Surface data to Framebuffer
+          _evas_outbuf_buffer_swap(ob, NULL, 0);
+     }
    ob->priv.frame_cnt++;
 
 end: