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.
This commit is contained in:
Derek Foreman 2017-05-04 16:28:10 -05:00
parent 1071c9f3a8
commit c722466a60
3 changed files with 5 additions and 4 deletions

View File

@ -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;

View File

@ -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);
}

View File

@ -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