derekf pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=aa3479570d0ee48865a1beeeff95fd280178d2d7

commit aa3479570d0ee48865a1beeeff95fd280178d2d7
Author: Derek Foreman <der...@osg.samsung.com>
Date:   Fri Nov 18 09:41:52 2016 -0600

    ecore_drm2: Add a panic mode to drm2_fb_release
    
    Previously we'd call this only when we absolutely needed to, so it made
    sense to always attempt to free a buffer, including ones on scanout or
    pending flip.
    
    However, it's useful to have a way to release the "next" only, so we can
    do that before starting a render to free up the buffer that's never going
    to be scanned out.
---
 src/lib/ecore_drm2/Ecore_Drm2.h               | 13 ++++++++-----
 src/lib/ecore_drm2/ecore_drm2_fb.c            |  3 ++-
 src/modules/evas/engines/drm/evas_outbuf.c    |  2 +-
 src/modules/evas/engines/gl_drm/evas_outbuf.c |  2 +-
 4 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/lib/ecore_drm2/Ecore_Drm2.h b/src/lib/ecore_drm2/Ecore_Drm2.h
index 7712643..50408be 100644
--- a/src/lib/ecore_drm2/Ecore_Drm2.h
+++ b/src/lib/ecore_drm2/Ecore_Drm2.h
@@ -829,16 +829,19 @@ EAPI void ecore_drm2_fb_busy_set(Ecore_Drm2_Fb *fb, 
Eina_Bool busy);
 /**
  * Try to force a framebuffer release for an output
  *
- * This tries to release the next, pending, or current buffer from
- * the output.  If successful there will be a release callback to
- * the registered handler, and the fb will no longer be flagged busy.
+ * This tries to release the next or optionally pending, or current
+ * buffer from the output.  If successful there will be a release callback
+ * to the registered handler, and the fb will no longer be flagged busy.
  *
- * @param output The output to force release
+ * Releasing buffers committed to scanout will potentially cause flicker,
+ * so this is only done when the panic flag is set.
  *
+ * @param output The output to force release
+ * @param panic Try to release even buffers committed to scanout
  * @ingroup Ecore_Drm2_Fb_Group
  * @since 1.19
  */
-EAPI void ecore_drm2_fb_release(Ecore_Drm2_Output *o);
+EAPI void ecore_drm2_fb_release(Ecore_Drm2_Output *o, Eina_Bool panic);
 
 /**
  * Set the user data for the output's page flip handler
diff --git a/src/lib/ecore_drm2/ecore_drm2_fb.c 
b/src/lib/ecore_drm2/ecore_drm2_fb.c
index 3f7b9ef..3737bdf 100644
--- a/src/lib/ecore_drm2/ecore_drm2_fb.c
+++ b/src/lib/ecore_drm2/ecore_drm2_fb.c
@@ -456,7 +456,7 @@ ecore_drm2_fb_busy_set(Ecore_Drm2_Fb *fb, Eina_Bool busy)
 }
 
 EAPI void
-ecore_drm2_fb_release(Ecore_Drm2_Output *o)
+ecore_drm2_fb_release(Ecore_Drm2_Output *o, Eina_Bool panic)
 {
    EINA_SAFETY_ON_NULL_RETURN(o);
 
@@ -466,6 +466,7 @@ ecore_drm2_fb_release(Ecore_Drm2_Output *o)
         o->next = NULL;
         return;
      }
+   if (!panic) return;
 
    WRN("Buffer release request when no next buffer");
    /* If we have to release these we're going to see tearing.
diff --git a/src/modules/evas/engines/drm/evas_outbuf.c 
b/src/modules/evas/engines/drm/evas_outbuf.c
index 2a9afa2..9d2454b 100644
--- a/src/modules/evas/engines/drm/evas_outbuf.c
+++ b/src/modules/evas/engines/drm/evas_outbuf.c
@@ -249,7 +249,7 @@ _outbuf_fb_assign(Outbuf *ob)
    ob->priv.draw = _outbuf_fb_wait(ob);
    while (!ob->priv.draw)
      {
-        ecore_drm2_fb_release(ob->priv.output);
+        ecore_drm2_fb_release(ob->priv.output, EINA_TRUE);
         ob->priv.draw = _outbuf_fb_wait(ob);
      }
 
diff --git a/src/modules/evas/engines/gl_drm/evas_outbuf.c 
b/src/modules/evas/engines/gl_drm/evas_outbuf.c
index fb813bf..e225b42 100644
--- a/src/modules/evas/engines/gl_drm/evas_outbuf.c
+++ b/src/modules/evas/engines/gl_drm/evas_outbuf.c
@@ -96,7 +96,7 @@ _evas_outbuf_buffer_swap(Outbuf *ob)
    bo = gbm_surface_lock_front_buffer(ob->surface);
    if (!bo)
      {
-        ecore_drm2_fb_release(ob->priv.output);
+        ecore_drm2_fb_release(ob->priv.output, EINA_TRUE);
         bo = gbm_surface_lock_front_buffer(ob->surface);
      }
    if (bo) fb = _evas_outbuf_fb_get(ob, bo);

-- 


Reply via email to