derekf pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=c722466a602794002b374ef0f84de0a92d9cd531

commit c722466a602794002b374ef0f84de0a92d9cd531
Author: Derek Foreman <der...@osg.samsung.com>
Date:   Thu May 4 16:28:10 2017 -0500

    ecore_drm2: Replace plane state release flag with plane dead flag
    
    The release flag is actually less useful than the existing in_use flag
    for determining if a plane is unused.  If a new plane is assigned before
    the next flip cleans up released planes, then it can point to a released
    plane state, and both it and the previous user will be freed on the next
    commit, leaking a plane.
    
    Putting the flag in the plane structure fixes this while still allowing us
    to keep released planes around to ensure a recently released plane is
    cleared from atomic state.
---
 src/lib/ecore_drm2/ecore_drm2_fb.c      | 4 ++--
 src/lib/ecore_drm2/ecore_drm2_plane.c   | 2 +-
 src/lib/ecore_drm2/ecore_drm2_private.h | 3 ++-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/lib/ecore_drm2/ecore_drm2_fb.c 
b/src/lib/ecore_drm2/ecore_drm2_fb.c
index 04af3b1..ea20bb2 100644
--- a/src/lib/ecore_drm2/ecore_drm2_fb.c
+++ b/src/lib/ecore_drm2/ecore_drm2_fb.c
@@ -240,7 +240,7 @@ ecore_drm2_fb_flip_complete(Ecore_Drm2_Output *output)
 
    EINA_LIST_FOREACH_SAFE(output->planes, l, ll, plane)
      {
-        if (!plane->state->release) continue;
+        if (!plane->dead) continue;
         output->planes = eina_list_remove_list(output->planes, l);
         free(plane);
      }
@@ -283,7 +283,7 @@ _fb_atomic_flip_test(Ecore_Drm2_Output *output)
      {
         pstate = plane->state;
 
-        if (pstate->release)
+        if (!pstate->in_use)
           {
              pstate->cid.value = 0;
              pstate->fid.value = 0;
diff --git a/src/lib/ecore_drm2/ecore_drm2_plane.c 
b/src/lib/ecore_drm2/ecore_drm2_plane.c
index aa07594..52f6bfd 100644
--- a/src/lib/ecore_drm2/ecore_drm2_plane.c
+++ b/src/lib/ecore_drm2/ecore_drm2_plane.c
@@ -130,8 +130,8 @@ ecore_drm2_plane_release(Ecore_Drm2_Plane *plane)
 {
    EINA_SAFETY_ON_NULL_RETURN(plane);
 
+   plane->dead = EINA_TRUE;
    plane->state->in_use = EINA_FALSE;
-   plane->state->release = EINA_TRUE;
    _fb_atomic_flip_test(plane->output);
 }
 
diff --git a/src/lib/ecore_drm2/ecore_drm2_private.h 
b/src/lib/ecore_drm2/ecore_drm2_private.h
index f73f8bc..860bb70 100644
--- a/src/lib/ecore_drm2/ecore_drm2_private.h
+++ b/src/lib/ecore_drm2/ecore_drm2_private.h
@@ -652,7 +652,7 @@ typedef struct _Ecore_Drm2_Plane_State
    uint32_t num_formats;
    uint32_t *formats;
 
-   Eina_Bool in_use, release;
+   Eina_Bool in_use;
 } Ecore_Drm2_Plane_State;
 
 struct _Ecore_Drm2_Atomic_State
@@ -712,6 +712,7 @@ struct _Ecore_Drm2_Plane
    int type;
    Ecore_Drm2_Plane_State *state;
    Ecore_Drm2_Output *output;
+   Eina_Bool dead;
 };
 
 struct _Ecore_Drm2_Output_Mode

-- 


Reply via email to