From ecc000d84c540804a19184c897627aa19efd220f Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Thu, 22 Sep 2016 11:42:57 -0400 Subject: [PATCH] ecore-drm2: Add code to free Atomic state on shutdown Signed-off-by: Chris Michael --- src/lib/ecore_drm2/ecore_drm2_device.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/lib/ecore_drm2/ecore_drm2_device.c b/src/lib/ecore_drm2/ecore_drm2_device.c index 262de80dba..6cd415b481 100644 --- a/src/lib/ecore_drm2/ecore_drm2_device.c +++ b/src/lib/ecore_drm2/ecore_drm2_device.c @@ -373,12 +373,14 @@ _drm2_atomic_state_plane_fill(Ecore_Drm2_Plane_State *pstate, int fd) { pstate->cid.id = prop->prop_id; pstate->cid.value = oprops->prop_values[i]; + DBG("\t\t\tValue: %d", pstate->cid.value); } else if (!strcmp(prop->name, "FB_ID")) { pstate->fid.id = prop->prop_id; pstate->fid.value = oprops->prop_values[i]; - } + DBG("\t\t\tValue: %d", pstate->fid.value); + } else if (!strcmp(prop->name, "CRTC_X")) { pstate->cx.id = prop->prop_id; @@ -426,13 +428,13 @@ _drm2_atomic_state_plane_fill(Ecore_Drm2_Plane_State *pstate, int fd) switch (pstate->type.value) { case DRM_PLANE_TYPE_OVERLAY: - DBG("\t\t\tOverlay Type"); + DBG("\t\t\tOverlay Plane"); break; case DRM_PLANE_TYPE_PRIMARY: - DBG("\t\t\tPrimary Type"); + DBG("\t\t\tPrimary Plane"); break; case DRM_PLANE_TYPE_CURSOR: - DBG("\t\t\tCursor Type"); + DBG("\t\t\tCursor Plane"); break; default: DBG("\t\t\tValue: %d", pstate->type.value); @@ -548,6 +550,15 @@ _drm2_atomic_state_fill(Ecore_Drm2_Atomic_State *state, int fd) err: drmModeFreeResources(res); } + +static void +_drm2_atomic_state_free(Ecore_Drm2_Atomic_State *state) +{ + free(state->plane_states); + free(state->conn_states); + free(state->crtc_states); + free(state); +} #endif EAPI Ecore_Drm2_Device * @@ -655,6 +666,11 @@ ecore_drm2_device_free(Ecore_Drm2_Device *device) { EINA_SAFETY_ON_NULL_RETURN(device); +#ifdef HAVE_ATOMIC_DRM + if (_ecore_drm2_use_atomic) + _drm2_atomic_state_free(device->state); +#endif + ecore_event_handler_del(device->active_hdlr); ecore_event_handler_del(device->device_change_hdlr); eina_stringshare_del(device->path);