ecore_drm2: Make ecore_drm2_fb_release return status
authorDerek Foreman <derekf@osg.samsung.com>
Wed, 7 Dec 2016 17:28:33 +0000 (11:28 -0600)
committerDerek Foreman <derekf@osg.samsung.com>
Wed, 7 Dec 2016 17:30:03 +0000 (11:30 -0600)
We need to use this to free up gbm buffers on a surface release, so it
has to report when it successfully frees a buffer.

src/lib/ecore_drm2/Ecore_Drm2.h
src/lib/ecore_drm2/ecore_drm2_fb.c

index 863a9c6df9b697a385fd655058e1dd4cd31ac74f..2b87981da5a30ba2941ca17dbbdc2cf32d6fd44c 100644 (file)
@@ -866,10 +866,13 @@ EAPI void ecore_drm2_fb_busy_set(Ecore_Drm2_Fb *fb, Eina_Bool busy);
  *
  * @param output The output to force release
  * @param panic Try to release even buffers committed to scanout
+ *
+ * @return EINA_TRUE if a buffer was released
+ *
  * @ingroup Ecore_Drm2_Fb_Group
  * @since 1.19
  */
-EAPI void ecore_drm2_fb_release(Ecore_Drm2_Output *o, Eina_Bool panic);
+EAPI Eina_Bool ecore_drm2_fb_release(Ecore_Drm2_Output *o, Eina_Bool panic);
 
 /**
  * Set the user data for the output's page flip handler
index 3737bdfcc021f52fa9dfbcf82cc3f17ecadff8f9..6648d67aab24ae465c1c14fe2f7cb04e9fec14cc 100644 (file)
@@ -455,20 +455,24 @@ ecore_drm2_fb_busy_set(Ecore_Drm2_Fb *fb, Eina_Bool busy)
    fb->busy = busy;
 }
 
-EAPI void
+EAPI Eina_Bool
 ecore_drm2_fb_release(Ecore_Drm2_Output *o, Eina_Bool panic)
 {
-   EINA_SAFETY_ON_NULL_RETURN(o);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(o, EINA_FALSE);
 
    if (o->next)
      {
         _release_buffer(o, o->next);
         o->next = NULL;
-        return;
+        return EINA_TRUE;
      }
-   if (!panic) return;
+   if (!panic) return EINA_FALSE;
 
-   WRN("Buffer release request when no next buffer");
+   /* This has been demoted to DBG from WRN because we
+    * call this function to reclaim all buffers on a
+    * surface resize.
+    */
+   DBG("Buffer release request when no next buffer");
    /* If we have to release these we're going to see tearing.
     * Try to reclaim in decreasing order of visual awfulness
     */
@@ -476,15 +480,17 @@ ecore_drm2_fb_release(Ecore_Drm2_Output *o, Eina_Bool panic)
      {
         _release_buffer(o, o->current);
         o->current = NULL;
-        return;
+        return EINA_TRUE;
      }
 
    if (o->pending)
      {
         _release_buffer(o, o->pending);
         o->pending = NULL;
-        return;
+        return EINA_TRUE;
      }
+
+   return EINA_FALSE;
 }
 
 EAPI void *