ecore_drm2: Make ecore_drm2_fb_release return status

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.
This commit is contained in:
Derek Foreman 2016-12-07 11:28:33 -06:00
parent 9c38423ecd
commit 515362efe2
2 changed files with 17 additions and 8 deletions

View 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 output The output to force release
* @param panic Try to release even buffers committed to scanout * @param panic Try to release even buffers committed to scanout
*
* @return EINA_TRUE if a buffer was released
*
* @ingroup Ecore_Drm2_Fb_Group * @ingroup Ecore_Drm2_Fb_Group
* @since 1.19 * @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 * Set the user data for the output's page flip handler

View File

@ -455,20 +455,24 @@ ecore_drm2_fb_busy_set(Ecore_Drm2_Fb *fb, Eina_Bool busy)
fb->busy = busy; fb->busy = busy;
} }
EAPI void EAPI Eina_Bool
ecore_drm2_fb_release(Ecore_Drm2_Output *o, Eina_Bool panic) 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) if (o->next)
{ {
_release_buffer(o, o->next); _release_buffer(o, o->next);
o->next = NULL; 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. /* If we have to release these we're going to see tearing.
* Try to reclaim in decreasing order of visual awfulness * 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); _release_buffer(o, o->current);
o->current = NULL; o->current = NULL;
return; return EINA_TRUE;
} }
if (o->pending) if (o->pending)
{ {
_release_buffer(o, o->pending); _release_buffer(o, o->pending);
o->pending = NULL; o->pending = NULL;
return; return EINA_TRUE;
} }
return EINA_FALSE;
} }
EAPI void * EAPI void *