summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm/ecore_drm_device.c
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2015-04-07 11:08:19 -0400
committerStefan Schmidt <s.schmidt@samsung.com>2015-04-09 17:41:03 +0200
commitc7ced198e623dff7690b857e9702267b71633605 (patch)
treec80b802a221849e7ea1a85072ebd6b7468a22bda /src/lib/ecore_drm/ecore_drm_device.c
parentd815d9bd108a11628ac4e8679957b05cf49b3c3f (diff)
ecore-drm: Move Eeze Udev Watch to Drm Device
Summary: Move the Eeze udev watch to inside the ecore_drm_device. This allows us to only create One watch to catch all output changes. No need for more than one watch (one per output) as was done previously @fix Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/ecore_drm/ecore_drm_device.c')
-rw-r--r--src/lib/ecore_drm/ecore_drm_device.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/lib/ecore_drm/ecore_drm_device.c b/src/lib/ecore_drm/ecore_drm_device.c
index 917a02b117..69a8e1c05f 100644
--- a/src/lib/ecore_drm/ecore_drm_device.c
+++ b/src/lib/ecore_drm/ecore_drm_device.c
@@ -87,6 +87,15 @@ _ecore_drm_device_cb_idle(void *data)
87 return ECORE_CALLBACK_RENEW; 87 return ECORE_CALLBACK_RENEW;
88} 88}
89 89
90static void
91_ecore_drm_device_cb_output_event(const char *device EINA_UNUSED, Eeze_Udev_Event event EINA_UNUSED, void *data, Eeze_Udev_Watch *watch EINA_UNUSED)
92{
93 Ecore_Drm_Device *dev;
94
95 if (!(dev = data)) return;
96 _ecore_drm_outputs_update(dev);
97}
98
90/** 99/**
91 * @defgroup Ecore_Drm_Device_Group Device manipulation functions 100 * @defgroup Ecore_Drm_Device_Group Device manipulation functions
92 * 101 *
@@ -261,6 +270,7 @@ EAPI Eina_Bool
261ecore_drm_device_open(Ecore_Drm_Device *dev) 270ecore_drm_device_open(Ecore_Drm_Device *dev)
262{ 271{
263 uint64_t caps; 272 uint64_t caps;
273 int events = 0;
264 274
265 /* check for valid device */ 275 /* check for valid device */
266 if ((!dev) || (!dev->drm.name)) return EINA_FALSE; 276 if ((!dev) || (!dev->drm.name)) return EINA_FALSE;
@@ -299,6 +309,13 @@ ecore_drm_device_open(Ecore_Drm_Device *dev)
299 return EINA_FALSE; 309 return EINA_FALSE;
300 } 310 }
301 311
312 events = (EEZE_UDEV_EVENT_ADD | EEZE_UDEV_EVENT_REMOVE |
313 EEZE_UDEV_EVENT_CHANGE);
314
315 dev->watch =
316 eeze_udev_watch_add(EEZE_UDEV_TYPE_DRM, events,
317 _ecore_drm_device_cb_output_event, NULL);
318
302 dev->drm.hdlr = 319 dev->drm.hdlr =
303 ecore_main_fd_handler_add(dev->drm.fd, ECORE_FD_READ, 320 ecore_main_fd_handler_add(dev->drm.fd, ECORE_FD_READ,
304 _ecore_drm_device_cb_event, dev, NULL, NULL); 321 _ecore_drm_device_cb_event, dev, NULL, NULL);
@@ -326,6 +343,9 @@ ecore_drm_device_close(Ecore_Drm_Device *dev)
326 /* check for valid device */ 343 /* check for valid device */
327 if (!dev) return EINA_FALSE; 344 if (!dev) return EINA_FALSE;
328 345
346 /* delete udev watch */
347 if (dev->watch) eeze_udev_watch_del(dev->watch);
348
329 /* close xkb context */ 349 /* close xkb context */
330 if (dev->xkb_ctx) xkb_context_unref(dev->xkb_ctx); 350 if (dev->xkb_ctx) xkb_context_unref(dev->xkb_ctx);
331 351