summaryrefslogtreecommitdiff
path: root/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
diff options
context:
space:
mode:
authorChristopher Michael <devilhorns@comcast.net>2020-04-28 12:35:07 -0400
committerChristopher Michael <devilhorns@comcast.net>2020-04-28 12:38:14 -0400
commit410fb16d6cf2f65f4e1c6de12712359547e67862 (patch)
tree5ba378dd63882e850a239831beef2962907962f6 /src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
parente6a62186971d5ef445f6a79d593bc3c3b92628a7 (diff)
ecore-evas-drm: Fix broken init count
We should not assume that there is only ever 1 drm ecore_evas here so we need to handle init count properly @fix
Diffstat (limited to 'src/modules/ecore_evas/engines/drm/ecore_evas_drm.c')
-rw-r--r--src/modules/ecore_evas/engines/drm/ecore_evas_drm.c40
1 files changed, 23 insertions, 17 deletions
diff --git a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
index 35eadc002b..3953b3323d 100644
--- a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
+++ b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
@@ -142,9 +142,8 @@ _drm_device_change(void *d EINA_UNUSED, int t EINA_UNUSED, void *event)
142static int 142static int
143_ecore_evas_drm_init(Ecore_Evas *ee, Ecore_Evas_Engine_Drm_Data *edata, const char *device) 143_ecore_evas_drm_init(Ecore_Evas *ee, Ecore_Evas_Engine_Drm_Data *edata, const char *device)
144{ 144{
145 // XXX: this is broken. we init once but in a per ecore evas struct so 145 _drm_init_count++;
146 // we assume there will be only 1 of these drm ecore evas's ever... 146 if (_drm_init_count > 1) return _drm_init_count;
147 if (++_drm_init_count != 1) return _drm_init_count;
148 147
149 if (!ecore_drm2_init()) 148 if (!ecore_drm2_init())
150 { 149 {
@@ -201,24 +200,31 @@ static int
201_ecore_evas_drm_shutdown(Ecore_Evas_Engine_Drm_Data *edata) 200_ecore_evas_drm_shutdown(Ecore_Evas_Engine_Drm_Data *edata)
202{ 201{
203 Ecore_Event_Handler *h; 202 Ecore_Event_Handler *h;
204 if (--_drm_init_count != 0) return _drm_init_count;
205 203
206 if (edata->focus_job) 204 _drm_init_count--;
205 if (_drm_init_count == 0)
207 { 206 {
208 ecore_job_del(edata->focus_job); 207 if (edata->focus_job)
209 edata->focus_job = NULL; 208 {
210 } 209 ecore_job_del(edata->focus_job);
211 if (edata->dev) 210 edata->focus_job = NULL;
212 { 211 }
213 ecore_drm2_outputs_destroy(edata->dev); 212
214 ecore_drm2_device_close(edata->dev); 213 if (edata->dev)
215 edata->dev = NULL; 214 {
215 ecore_drm2_outputs_destroy(edata->dev);
216 ecore_drm2_device_close(edata->dev);
217 edata->dev = NULL;
218 }
219
220 ecore_drm2_shutdown();
221 ecore_event_evas_shutdown();
222
223 EINA_LIST_FREE(handlers, h)
224 ecore_event_handler_del(h);
216 } 225 }
217 ecore_drm2_shutdown();
218 ecore_event_evas_shutdown();
219 EINA_LIST_FREE(handlers, h)
220 ecore_event_handler_del(h);
221 226
227 if (_drm_init_count < 0) _drm_init_count = 0;
222 return _drm_init_count; 228 return _drm_init_count;
223} 229}
224 230