ecore-drm: Create udev watch for each output, and delete the watch

when we free the output.

Summary: This commit fixes an issue where a hotplug watch was Only
being added for One input, and also deletes any created watch during
output_free.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2014-10-21 08:26:25 -04:00
parent 6cf9246ad6
commit 8549ee799a
1 changed files with 14 additions and 14 deletions

View File

@ -680,6 +680,8 @@ ecore_drm_outputs_create(Ecore_Drm_Device *dev)
for (i = 0; i < res->count_connectors; i++)
{
int events = 0;
/* get the connector */
if (!(conn = drmModeGetConnector(dev->drm.fd, res->connectors[i])))
continue;
@ -720,6 +722,15 @@ ecore_drm_outputs_create(Ecore_Drm_Device *dev)
drmModeFreeCrtc(crtc);
drmModeFreeEncoder(enc);
events = (EEZE_UDEV_EVENT_ADD | EEZE_UDEV_EVENT_REMOVE);
output->watch =
eeze_udev_watch_add(EEZE_UDEV_TYPE_DRM, events,
_ecore_drm_output_event, output);
if (!output->watch)
ERR("Could not create Eeze_Udev_Watch for drm output");
dev->outputs = eina_list_append(dev->outputs, output);
}
@ -737,20 +748,6 @@ ecore_drm_outputs_create(Ecore_Drm_Device *dev)
/* free resources */
drmModeFreeResources(res);
if ((output) && (!output->watch))
{
int events = 0;
events = (EEZE_UDEV_EVENT_ADD | EEZE_UDEV_EVENT_REMOVE);
if (!(output->watch =
eeze_udev_watch_add(EEZE_UDEV_TYPE_DRM, events,
_ecore_drm_output_event, output)))
{
ERR("Could not create Eeze_Udev_Watch for drm output");
return EINA_FALSE;
}
}
return ret;
}
@ -762,6 +759,9 @@ ecore_drm_output_free(Ecore_Drm_Output *output)
/* check for valid output */
if (!output) return;
/* delete any added udev watch */
if (output->watch) eeze_udev_watch_del(output->watch);
/* free modes */
EINA_LIST_FREE(output->modes, mode)
free(mode);