evas-gl-drm: Fix issue with swap mode returning wrong value
authorChris Michael <cp.michael@samsung.com>
Fri, 5 Jun 2015 13:59:57 +0000 (09:59 -0400)
committerChris Michael <cp.michael@samsung.com>
Fri, 5 Jun 2015 14:00:45 +0000 (10:00 -0400)
Summary: This fixes a crashing issue in evas image cache due to the
engine returning an improper swap mode.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/modules/evas/engines/gl_drm/evas_outbuf.c

index 09f2981..6a9d7b8 100644 (file)
@@ -450,6 +450,9 @@ evas_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot, Outbuf_Depth depth)
 Render_Engine_Swap_Mode
 evas_outbuf_buffer_state_get(Outbuf *ob)
 {
+   /* check for valid output buffer */
+   if (!ob) return MODE_FULL;
+
    if (ob->swap_mode == MODE_AUTO && _extn_have_buffer_age)
      {
         Render_Engine_Swap_Mode swap_mode;
@@ -469,6 +472,29 @@ evas_outbuf_buffer_state_get(Outbuf *ob)
 
         return swap_mode;
      }
+   else
+     {
+        int delta;
+
+        delta = (ob->priv.last - ob->priv.curr +
+                 (ob->priv.last > ob->priv.last ?
+                     0 : ob->priv.num)) % ob->priv.num;
+
+        /* This is the number of frame since last frame */
+        switch (delta)
+          {
+           case 0:
+             return MODE_COPY;
+           case 1:
+             return MODE_DOUBLE;
+           case 2:
+             return MODE_TRIPLE;
+           case 3:
+             return MODE_QUADRUPLE;
+           default:
+             return MODE_FULL;
+          }
+     }
 
    return ob->swap_mode;
 }