forked from enlightenment/efl
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
This commit is contained in:
parent
e6a6218697
commit
410fb16d6c
|
@ -142,9 +142,8 @@ _drm_device_change(void *d EINA_UNUSED, int t EINA_UNUSED, void *event)
|
||||||
static int
|
static int
|
||||||
_ecore_evas_drm_init(Ecore_Evas *ee, Ecore_Evas_Engine_Drm_Data *edata, const char *device)
|
_ecore_evas_drm_init(Ecore_Evas *ee, Ecore_Evas_Engine_Drm_Data *edata, const char *device)
|
||||||
{
|
{
|
||||||
// XXX: this is broken. we init once but in a per ecore evas struct so
|
_drm_init_count++;
|
||||||
// we assume there will be only 1 of these drm ecore evas's ever...
|
if (_drm_init_count > 1) return _drm_init_count;
|
||||||
if (++_drm_init_count != 1) return _drm_init_count;
|
|
||||||
|
|
||||||
if (!ecore_drm2_init())
|
if (!ecore_drm2_init())
|
||||||
{
|
{
|
||||||
|
@ -201,24 +200,31 @@ static int
|
||||||
_ecore_evas_drm_shutdown(Ecore_Evas_Engine_Drm_Data *edata)
|
_ecore_evas_drm_shutdown(Ecore_Evas_Engine_Drm_Data *edata)
|
||||||
{
|
{
|
||||||
Ecore_Event_Handler *h;
|
Ecore_Event_Handler *h;
|
||||||
if (--_drm_init_count != 0) return _drm_init_count;
|
|
||||||
|
|
||||||
|
_drm_init_count--;
|
||||||
|
if (_drm_init_count == 0)
|
||||||
|
{
|
||||||
if (edata->focus_job)
|
if (edata->focus_job)
|
||||||
{
|
{
|
||||||
ecore_job_del(edata->focus_job);
|
ecore_job_del(edata->focus_job);
|
||||||
edata->focus_job = NULL;
|
edata->focus_job = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (edata->dev)
|
if (edata->dev)
|
||||||
{
|
{
|
||||||
ecore_drm2_outputs_destroy(edata->dev);
|
ecore_drm2_outputs_destroy(edata->dev);
|
||||||
ecore_drm2_device_close(edata->dev);
|
ecore_drm2_device_close(edata->dev);
|
||||||
edata->dev = NULL;
|
edata->dev = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ecore_drm2_shutdown();
|
ecore_drm2_shutdown();
|
||||||
ecore_event_evas_shutdown();
|
ecore_event_evas_shutdown();
|
||||||
|
|
||||||
EINA_LIST_FREE(handlers, h)
|
EINA_LIST_FREE(handlers, h)
|
||||||
ecore_event_handler_del(h);
|
ecore_event_handler_del(h);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_drm_init_count < 0) _drm_init_count = 0;
|
||||||
return _drm_init_count;
|
return _drm_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue