evas/engine/drm: Hold a reference to the Ecore_Drm_Device

We will need this in more places of the evas drm engine so keep a reference
in Evas_Engine_Info_Drm for later access.
This commit is contained in:
Stefan Schmidt 2014-08-29 12:48:49 +02:00
parent a6178c13e9
commit 2761b71c68
2 changed files with 11 additions and 10 deletions

View File

@ -1,6 +1,8 @@
#ifndef _EVAS_ENGINE_DRM_H
# define _EVAS_ENGINE_DRM_H
#include <Ecore_Drm.h>
typedef struct _Evas_Engine_Info_Drm Evas_Engine_Info_Drm;
struct _Evas_Engine_Info_Drm
@ -27,6 +29,7 @@ struct _Evas_Engine_Info_Drm
int plane;
Eina_Bool use_hw_accel : 1;
Ecore_Drm_Device *dev;
} info;
/* non-blocking or blocking mode */

View File

@ -1,9 +1,7 @@
#include "evas_engine.h"
#include <Ecore_Drm.h>
/* local structures */
typedef struct _Render_Engine Render_Engine;
static Ecore_Drm_Device *drm_dev = NULL;
struct _Render_Engine
{
@ -35,21 +33,21 @@ _output_setup(Evas_Engine_Info_Drm *info, int w, int h)
return NULL;
/* try getting the default drm device */
if (!(drm_dev = ecore_drm_device_find(NULL, NULL)))
if (!(info->info.dev = ecore_drm_device_find(NULL, NULL)))
goto on_error;
/* check if we already opened the drm device with ecore_evas */
/* try to open the drm ourselfs (most likely because we get called from expedite) */
if (!ecore_drm_device_open(drm_dev))
if (!ecore_drm_device_open(info->info.dev))
goto on_error;
info->info.own_fd = EINA_TRUE;
info->info.fd = ecore_drm_device_fd_get(drm_dev);
info->info.fd = ecore_drm_device_fd_get(info->info.dev);
if (info->info.tty < 0)
{
info->info.own_tty = EINA_TRUE;
info->info.tty = ecore_drm_tty_get(drm_dev);
info->info.tty = ecore_drm_tty_get(info->info.dev);
}
}
@ -82,9 +80,9 @@ _output_setup(Evas_Engine_Info_Drm *info, int w, int h)
/* check if we already opened the card. if so, close it */
if ((info->info.fd >= 0) && (info->info.own_fd))
{
ecore_drm_device_close(drm_dev);
ecore_drm_device_close(info->info.dev);
info->info.fd = -1;
ecore_drm_device_free(drm_dev);
ecore_drm_device_free(info->info.dev);
}
free(re);
@ -197,9 +195,9 @@ eng_output_free(void *data)
/* check if we already opened the card. if so, close it */
if ((re->info->info.fd >= 0) && (re->info->info.own_fd))
{
ecore_drm_device_close(drm_dev);
ecore_drm_device_close(re->info->info.dev);
re->info->info.fd = -1;
ecore_drm_device_free(drm_dev);
ecore_drm_device_free(re->info->info.dev);
}
evas_render_engine_software_generic_clean(&re->generic);