ecore_drm2: Replace output fbs with state structs
authorDerek Foreman <derekf@osg.samsung.com>
Thu, 27 Apr 2017 21:43:06 +0000 (16:43 -0500)
committerDerek Foreman <derekf@osg.samsung.com>
Fri, 5 May 2017 17:53:22 +0000 (12:53 -0500)
next, pending, and current are going to have to deal with atomic state
instead of just fbs soon

src/lib/ecore_drm2/ecore_drm2_fb.c
src/lib/ecore_drm2/ecore_drm2_outputs.c
src/lib/ecore_drm2/ecore_drm2_private.h

index 52cf55a..1a3b40c 100644 (file)
@@ -220,12 +220,12 @@ ecore_drm2_fb_flip_complete(Ecore_Drm2_Output *output)
 {
    EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE);
 
-   if (output->current && (output->current != output->pending))
-     _release_buffer(output, output->current);
-   output->current = output->pending;
-   output->pending = NULL;
+   if (output->current.fb && (output->current.fb != output->pending.fb))
+     _release_buffer(output, output->current.fb);
+   output->current.fb = output->pending.fb;
+   output->pending.fb = NULL;
 
-   return !!output->next;
+   return !!output->next.fb;
 }
 
 Eina_Bool
@@ -375,29 +375,29 @@ _fb_flip(Ecore_Drm2_Output *output, Ecore_Drm2_Fb *fb)
    int count = 0;
    int ret = 0;
 
-   if (output->pending)
+   if (output->pending.fb)
      {
-        if (output->next) _release_buffer(output, output->next);
-        output->next = fb;
-        if (output->next) output->next->busy = EINA_TRUE;
+        if (output->next.fb) _release_buffer(output, output->next.fb);
+        output->next.fb = fb;
+        if (output->next.fb) output->next.fb->busy = EINA_TRUE;
         return 0;
      }
-   if (!fb) fb = output->next;
+   if (!fb) fb = output->next.fb;
 
    /* So we can generate a tick by flipping to the current fb */
-   if (!fb) fb = output->current;
+   if (!fb) fb = output->current.fb;
 
-   if (output->next)
+   if (output->next.fb)
      {
-        output->next->busy = EINA_FALSE;
-        output->next = NULL;
+        output->next.fb->busy = EINA_FALSE;
+        output->next.fb = NULL;
      }
 
    /* If we don't have an fb to set by now, BAIL! */
    if (!fb) return -1;
 
-   if ((!output->current) ||
-       (output->current->strides[0] != fb->strides[0]))
+   if ((!output->current.fb) ||
+       (output->current.fb->strides[0] != fb->strides[0]))
      {
         ret =
           sym_drmModeSetCrtc(fb->fd, output->crtc_id, fb->id,
@@ -411,10 +411,10 @@ _fb_flip(Ecore_Drm2_Output *output, Ecore_Drm2_Fb *fb)
              return ret;
           }
 
-        if (output->current) _release_buffer(output, output->current);
-        output->current = fb;
-        output->current->busy = EINA_TRUE;
-        output->next = NULL;
+        if (output->current.fb) _release_buffer(output, output->current.fb);
+        output->current.fb = fb;
+        output->current.fb->busy = EINA_TRUE;
+        output->next.fb = NULL;
         /* We used to return here, but now that the ticker is fixed this
          * can leave us hanging waiting for a tick to happen forever.
          * Instead, we now fall through the the flip path to make sure
@@ -469,13 +469,13 @@ _fb_flip(Ecore_Drm2_Output *output, Ecore_Drm2_Fb *fb)
      }
    else if (ret < 0)
      {
-        output->next = fb;
-        output->next->busy = EINA_TRUE;
+        output->next.fb = fb;
+        output->next.fb->busy = EINA_TRUE;
         return 0;
      }
 
-   output->pending = fb;
-   output->pending->busy = EINA_TRUE;
+   output->pending.fb = fb;
+   output->pending.fb->busy = EINA_TRUE;
 
    return 0;
 }
@@ -517,10 +517,10 @@ ecore_drm2_fb_release(Ecore_Drm2_Output *o, Eina_Bool panic)
 {
    EINA_SAFETY_ON_NULL_RETURN_VAL(o, EINA_FALSE);
 
-   if (o->next)
+   if (o->next.fb)
      {
-        _release_buffer(o, o->next);
-        o->next = NULL;
+        _release_buffer(o, o->next.fb);
+        o->next.fb = NULL;
         return EINA_TRUE;
      }
    if (!panic) return EINA_FALSE;
@@ -533,17 +533,17 @@ ecore_drm2_fb_release(Ecore_Drm2_Output *o, Eina_Bool panic)
    /* If we have to release these we're going to see tearing.
     * Try to reclaim in decreasing order of visual awfulness
     */
-   if (o->current)
+   if (o->current.fb)
      {
-        _release_buffer(o, o->current);
-        o->current = NULL;
+        _release_buffer(o, o->current.fb);
+        o->current.fb = NULL;
         return EINA_TRUE;
      }
 
-   if (o->pending)
+   if (o->pending.fb)
      {
-        _release_buffer(o, o->pending);
-        o->pending = NULL;
+        _release_buffer(o, o->pending.fb);
+        o->pending.fb = NULL;
         return EINA_TRUE;
      }
 
index fa7d223..4432380 100644 (file)
@@ -1162,9 +1162,9 @@ EAPI Ecore_Drm2_Fb *
 ecore_drm2_output_latest_fb_get(Ecore_Drm2_Output *output)
 {
    EINA_SAFETY_ON_NULL_RETURN_VAL(output, NULL);
-   if (output->pending) return output->pending;
-   if (output->current) return output->current;
-   return output->next;
+   if (output->pending.fb) return output->pending.fb;
+   if (output->current.fb) return output->current.fb;
+   return output->next.fb;
 }
 
 EAPI void
@@ -1233,8 +1233,8 @@ ecore_drm2_output_enabled_set(Ecore_Drm2_Output *output, Eina_Bool enabled)
           }
 
         ecore_drm2_output_dpms_set(output, DRM_MODE_DPMS_OFF);
-        output->current = NULL;
-        /* output->next = NULL; */
+        output->current.fb = NULL;
+        /* output->next.fb = NULL; */
      }
 
    _output_event_send(output);
@@ -1370,10 +1370,10 @@ ecore_drm2_output_mode_set(Ecore_Drm2_Output *output, Ecore_Drm2_Output_Mode *mo
           {
              unsigned int buffer = 0;
 
-             if (output->current)
-               buffer = output->current->id;
-             else if (output->next)
-               buffer = output->next->id;
+             if (output->current.fb)
+               buffer = output->current.fb->id;
+             else if (output->next.fb)
+               buffer = output->next.fb->id;
              else
                buffer = output->ocrtc->buffer_id;
 
index d97b7cd..3bef9fe 100644 (file)
@@ -772,7 +772,7 @@ struct _Ecore_Drm2_Output
     * attempted to commit */
    Ecore_Drm2_Output_State prep;
 
-   Ecore_Drm2_Fb *current, *next, *pending;
+   Ecore_Drm2_Output_State current, next, pending;
 
    Eina_Matrix4 matrix, inverse;
    Ecore_Drm2_Transform transform;