devilhorns pushed a commit to branch master.

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

commit 8549ee799ad9175ff011ae680def3f6787140206
Author: Chris Michael <cp.mich...@samsung.com>
Date:   Tue Oct 21 08:26:25 2014 -0400

    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.mich...@samsung.com>
---
 src/lib/ecore_drm/ecore_drm_output.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/lib/ecore_drm/ecore_drm_output.c 
b/src/lib/ecore_drm/ecore_drm_output.c
index 396e888..67f8f0c 100644
--- a/src/lib/ecore_drm/ecore_drm_output.c
+++ b/src/lib/ecore_drm/ecore_drm_output.c
@@ -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);

-- 


Reply via email to