diff options
author | Derek Foreman <derekf@osg.samsung.com> | 2017-05-04 16:28:10 -0500 |
---|---|---|
committer | Derek Foreman <derekf@osg.samsung.com> | 2017-05-04 16:51:18 -0500 |
commit | c87f37774addfaef1ad28586278d95737afd4961 (patch) | |
tree | 51c5a8b1a9d66356b7fb260fac8cc1186b2f4936 | |
parent | 062260056253275b58ee0edf236db4547ffad99c (diff) | |
download | efl-c87f37774addfaef1ad28586278d95737afd4961.tar.gz |
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.
-rw-r--r-- | src/lib/ecore_drm2/ecore_drm2_fb.c | 4 | ||||
-rw-r--r-- | src/lib/ecore_drm2/ecore_drm2_plane.c | 2 | ||||
-rw-r--r-- | 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 04af3b1325..ea20bb2fbd 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 aa07594873..52f6bfd1d8 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 f73f8bcb49..860bb70c66 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 |