summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2015-02-19 14:47:34 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2015-02-19 14:48:25 -0500
commit0d69422cca743a1c57b63995caee23ea16516ab7 (patch)
tree32bf8ea8ef53c082ecc14acf4af18387ee5ce591 /src/lib/ecore_drm
parent5184ffec63390172d40ac525abb1d7b22c27457e (diff)
ecore-drm Add hooks for updating wl_output when outputs are hotplugged
Summary: This provides callbacks to any bound wl_output listeners when a display is hotplugged. NOTE: Currently we don't receive hotplug events ANOTHER NOTE: We don't yet handle display removal Reviewers: devilhorns, zmike Reviewed By: devilhorns, zmike Subscribers: cedric Maniphest Tasks: T2131 Differential Revision: https://phab.enlightenment.org/D2006
Diffstat (limited to 'src/lib/ecore_drm')
-rw-r--r--src/lib/ecore_drm/Ecore_Drm.h19
-rw-r--r--src/lib/ecore_drm/ecore_drm.c1
-rw-r--r--src/lib/ecore_drm/ecore_drm_output.c39
-rw-r--r--src/lib/ecore_drm/ecore_drm_private.h1
4 files changed, 60 insertions, 0 deletions
diff --git a/src/lib/ecore_drm/Ecore_Drm.h b/src/lib/ecore_drm/Ecore_Drm.h
index 17def6ea81..9ce2722a10 100644
--- a/src/lib/ecore_drm/Ecore_Drm.h
+++ b/src/lib/ecore_drm/Ecore_Drm.h
@@ -116,6 +116,19 @@ struct _Ecore_Drm_Event_Activate
116 Eina_Bool active; 116 Eina_Bool active;
117}; 117};
118 118
119struct _Ecore_Drm_Event_Output
120{
121 int x, y;
122 int w, h;
123 int phys_width, phys_height;
124 unsigned int refresh;
125 int subpixel_order;
126 int transform;
127 const char *make;
128 const char *model;
129 Eina_Bool plug : 1;
130};
131
119/* opaque structure to represent a drm device */ 132/* opaque structure to represent a drm device */
120typedef struct _Ecore_Drm_Device Ecore_Drm_Device; 133typedef struct _Ecore_Drm_Device Ecore_Drm_Device;
121 134
@@ -140,8 +153,14 @@ typedef struct _Ecore_Drm_Sprite Ecore_Drm_Sprite;
140/* structure to inform drm activation state */ 153/* structure to inform drm activation state */
141typedef struct _Ecore_Drm_Event_Activate Ecore_Drm_Event_Activate; 154typedef struct _Ecore_Drm_Event_Activate Ecore_Drm_Event_Activate;
142 155
156/* structure to inform drm output plug events */
157/** @since 1.14 */
158typedef struct _Ecore_Drm_Event_Output Ecore_Drm_Event_Output;
159
143EAPI extern int ECORE_DRM_EVENT_ACTIVATE; 160EAPI extern int ECORE_DRM_EVENT_ACTIVATE;
144 161
162EAPI extern int ECORE_DRM_EVENT_OUTPUT; /**< @since 1.14 */
163
145/** 164/**
146 * @file 165 * @file
147 * @brief Ecore functions for dealing with drm, virtual terminals 166 * @brief Ecore functions for dealing with drm, virtual terminals
diff --git a/src/lib/ecore_drm/ecore_drm.c b/src/lib/ecore_drm/ecore_drm.c
index 81a6fa9500..2ae0766a40 100644
--- a/src/lib/ecore_drm/ecore_drm.c
+++ b/src/lib/ecore_drm/ecore_drm.c
@@ -89,6 +89,7 @@ ecore_drm_init(void)
89 if (!eeze_init()) goto eeze_err; 89 if (!eeze_init()) goto eeze_err;
90 90
91 ECORE_DRM_EVENT_ACTIVATE = ecore_event_type_new(); 91 ECORE_DRM_EVENT_ACTIVATE = ecore_event_type_new();
92 ECORE_DRM_EVENT_OUTPUT = ecore_event_type_new();
92 93
93 /* return init count */ 94 /* return init count */
94 return _ecore_drm_init_count; 95 return _ecore_drm_init_count;
diff --git a/src/lib/ecore_drm/ecore_drm_output.c b/src/lib/ecore_drm/ecore_drm_output.c
index 827a4fcf75..c264877fe0 100644
--- a/src/lib/ecore_drm/ecore_drm_output.c
+++ b/src/lib/ecore_drm/ecore_drm_output.c
@@ -13,6 +13,8 @@ static const char *conn_types[] =
13 "DP", "HDMI", "HDMI", "TV", "eDP", 13 "DP", "HDMI", "HDMI", "TV", "eDP",
14}; 14};
15 15
16EAPI int ECORE_DRM_EVENT_OUTPUT = 0;
17
16/* local functions */ 18/* local functions */
17 19
18static Eina_Bool 20static Eina_Bool
@@ -359,6 +361,8 @@ _ecore_drm_output_create(Ecore_Drm_Device *dev, drmModeRes *res, drmModeConnecto
359 output->backlight = 361 output->backlight =
360 _ecore_drm_output_backlight_init(output, conn->connector_type); 362 _ecore_drm_output_backlight_init(output, conn->connector_type);
361 363
364 _ecore_drm_event_output_send(output, EINA_TRUE);
365
362 return output; 366 return output;
363 367
364mode_err: 368mode_err:
@@ -580,6 +584,41 @@ _ecore_drm_output_event(const char *device EINA_UNUSED, Eeze_Udev_Event event EI
580 _ecore_drm_update_outputs(output); 584 _ecore_drm_update_outputs(output);
581} 585}
582 586
587static void
588_ecore_drm_event_output_free(void *data EINA_UNUSED, void *event)
589{
590 Ecore_Drm_Event_Output *e = event;
591
592 eina_stringshare_del(e->make);
593 eina_stringshare_del(e->model);
594 free(event);
595}
596
597void
598_ecore_drm_event_output_send(const Ecore_Drm_Output *output, Eina_Bool plug)
599{
600 Ecore_Drm_Event_Output *e;
601
602 if (!(e = calloc(1, sizeof(Ecore_Drm_Event_Output)))) return;
603 e->plug = plug;
604 if (plug)
605 {
606 e->w = output->current_mode->width;
607 e->h = output->current_mode->height;
608 e->x = output->x;
609 e->y = output->y;
610 e->phys_width = 0;
611 e->phys_height = 0;
612 e->refresh = output->current_mode->refresh;
613 e->subpixel_order = output->subpixel;
614 e->make = eina_stringshare_ref(output->make);
615 e->model = eina_stringshare_ref(output->model);
616 e->transform = 0;
617 }
618 ecore_event_add(ECORE_DRM_EVENT_OUTPUT, e,
619 _ecore_drm_event_output_free, NULL);
620}
621
583/* public functions */ 622/* public functions */
584 623
585/** 624/**
diff --git a/src/lib/ecore_drm/ecore_drm_private.h b/src/lib/ecore_drm/ecore_drm_private.h
index 444b1c06e8..03a7c27543 100644
--- a/src/lib/ecore_drm/ecore_drm_private.h
+++ b/src/lib/ecore_drm/ecore_drm_private.h
@@ -234,6 +234,7 @@ struct _Ecore_Drm_Sprite
234typedef void (*Ecore_Drm_Open_Cb)(void *data, int fd, Eina_Bool b); 234typedef void (*Ecore_Drm_Open_Cb)(void *data, int fd, Eina_Bool b);
235 235
236void _ecore_drm_event_activate_send(Eina_Bool active); 236void _ecore_drm_event_activate_send(Eina_Bool active);
237void _ecore_drm_event_output_send(const Ecore_Drm_Output *output, Eina_Bool plug);
237 238
238Eina_Bool _ecore_drm_launcher_device_open(const char *device, Ecore_Drm_Open_Cb callback, void *data, int flags); 239Eina_Bool _ecore_drm_launcher_device_open(const char *device, Ecore_Drm_Open_Cb callback, void *data, int flags);
239int _ecore_drm_launcher_device_open_no_pending(const char *device, int flags); 240int _ecore_drm_launcher_device_open_no_pending(const char *device, int flags);