ecore_drm2: Make _release_buffer take a state struct instead of fb
authorDerek Foreman <derekf@osg.samsung.com>
Fri, 28 Apr 2017 17:22:04 +0000 (12:22 -0500)
committerDerek Foreman <derekf@osg.samsung.com>
Fri, 5 May 2017 17:53:23 +0000 (12:53 -0500)
Lets us push the NULL set into _release_buffer for some clean up

src/lib/ecore_drm2/ecore_drm2_fb.c

index fefd8be..462f41b 100644 (file)
@@ -209,10 +209,11 @@ ecore_drm2_fb_dirty(Ecore_Drm2_Fb *fb, Eina_Rectangle *rects, unsigned int count
 }
 
 static void
-_release_buffer(Ecore_Drm2_Output *output, Ecore_Drm2_Fb *b)
+_release_buffer(Ecore_Drm2_Output *output, Ecore_Drm2_Output_State *s)
 {
-   b->busy = EINA_FALSE;
-   if (output->release_cb) output->release_cb(output->release_data, b);
+   s->fb->busy = EINA_FALSE;
+   if (output->release_cb) output->release_cb(output->release_data, s->fb);
+   s->fb = NULL;
 }
 
 EAPI Eina_Bool
@@ -221,7 +222,7 @@ ecore_drm2_fb_flip_complete(Ecore_Drm2_Output *output)
    EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE);
 
    if (output->current.fb && (output->current.fb != output->pending.fb))
-     _release_buffer(output, output->current.fb);
+     _release_buffer(output, &output->current);
    output->current.fb = output->pending.fb;
    output->pending.fb = NULL;
 
@@ -393,7 +394,7 @@ _fb_flip(Ecore_Drm2_Output *output)
              return ret;
           }
 
-        if (output->current.fb) _release_buffer(output, output->current.fb);
+        if (output->current.fb) _release_buffer(output, &output->current);
         output->current.fb = fb;
         output->current.fb->busy = EINA_TRUE;
         output->next.fb = NULL;
@@ -471,7 +472,7 @@ ecore_drm2_fb_flip(Ecore_Drm2_Fb *fb, Ecore_Drm2_Output *output)
 
    if (output->pending.fb)
      {
-        if (output->next.fb) _release_buffer(output, output->next.fb);
+        if (output->next.fb) _release_buffer(output, &output->next);
         output->next.fb = fb;
         if (output->next.fb) output->next.fb->busy = EINA_TRUE;
         return 0;
@@ -525,8 +526,7 @@ ecore_drm2_fb_release(Ecore_Drm2_Output *o, Eina_Bool panic)
 
    if (o->next.fb)
      {
-        _release_buffer(o, o->next.fb);
-        o->next.fb = NULL;
+        _release_buffer(o, &o->next);
         return EINA_TRUE;
      }
    if (!panic) return EINA_FALSE;
@@ -541,15 +541,13 @@ ecore_drm2_fb_release(Ecore_Drm2_Output *o, Eina_Bool panic)
     */
    if (o->current.fb)
      {
-        _release_buffer(o, o->current.fb);
-        o->current.fb = NULL;
+        _release_buffer(o, &o->current);
         return EINA_TRUE;
      }
 
    if (o->pending.fb)
      {
-        _release_buffer(o, o->pending.fb);
-        o->pending.fb = NULL;
+        _release_buffer(o, &o->pending);
         return EINA_TRUE;
      }