Revert "evas/drm: Make use of ecore_drm for opening DRM device"
This reverts commit 31ad73efa9
.
Conflicts:
src/modules/evas/engines/drm/evas_engine.c
Revert this commit as these functions are needed to run evas engine
standalone (expedite) on drm
This commit is contained in:
parent
e2ad7a18f9
commit
ea8ffdf433
|
@ -1207,11 +1207,9 @@ modules_evas_engines_drm_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
||||||
-I$(top_srcdir)/src/lib/evas/include \
|
-I$(top_srcdir)/src/lib/evas/include \
|
||||||
-I$(top_srcdir)/src/lib/evas/cserve2 \
|
-I$(top_srcdir)/src/lib/evas/cserve2 \
|
||||||
@EVAS_CFLAGS@ \
|
@EVAS_CFLAGS@ \
|
||||||
@ECORE_DRM_CFLAGS@ \
|
|
||||||
@evas_engine_drm_cflags@
|
@evas_engine_drm_cflags@
|
||||||
modules_evas_engines_drm_module_la_LIBADD = \
|
modules_evas_engines_drm_module_la_LIBADD = \
|
||||||
@USE_EVAS_LIBS@ \
|
@USE_EVAS_LIBS@ \
|
||||||
@ECORE_DRM_LIBS@ \
|
|
||||||
@evas_engine_drm_libs@
|
@evas_engine_drm_libs@
|
||||||
modules_evas_engines_drm_module_la_DEPENDENCIES = @USE_EVAS_INTERNAL_LIBS@
|
modules_evas_engines_drm_module_la_DEPENDENCIES = @USE_EVAS_INTERNAL_LIBS@
|
||||||
modules_evas_engines_drm_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
|
modules_evas_engines_drm_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
|
||||||
|
|
|
@ -2,12 +2,90 @@
|
||||||
#include <linux/vt.h>
|
#include <linux/vt.h>
|
||||||
#include <linux/kd.h>
|
#include <linux/kd.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <Ecore_Drm.h>
|
|
||||||
|
|
||||||
/* NB: REALLY hate to store this here, but sigaction signal handlers cannot
|
/* NB: REALLY hate to store this here, but sigaction signal handlers cannot
|
||||||
* pass any 'user data' to the signal handlers :( */
|
* pass any 'user data' to the signal handlers :( */
|
||||||
static Evas_Engine_Info_Drm *siginfo;
|
static Evas_Engine_Info_Drm *siginfo;
|
||||||
|
|
||||||
|
static char *
|
||||||
|
_evas_drm_card_driver_get(const char *dev)
|
||||||
|
{
|
||||||
|
struct stat st;
|
||||||
|
int maj, min;
|
||||||
|
char *path, path_link[PATH_MAX + 1] = "";
|
||||||
|
char *drv;
|
||||||
|
|
||||||
|
if (stat(dev, &st) < 0) return NULL;
|
||||||
|
|
||||||
|
if (!S_ISCHR(st.st_mode)) return NULL;
|
||||||
|
|
||||||
|
maj = major(st.st_rdev);
|
||||||
|
min = minor(st.st_rdev);
|
||||||
|
|
||||||
|
asprintf(&path, "/sys/dev/char/%d:%d/device/driver", maj, min);
|
||||||
|
if (readlink(path, path_link, sizeof(path_link) - 1) < 0)
|
||||||
|
{
|
||||||
|
free(path);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(path);
|
||||||
|
|
||||||
|
if (!(drv = strrchr(path_link, '/'))) return NULL;
|
||||||
|
return strdup(drv + strlen("/"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_evas_drm_card_open(int card)
|
||||||
|
{
|
||||||
|
char dev[32], *driver;
|
||||||
|
int fd = -1;
|
||||||
|
uint64_t dumb;
|
||||||
|
|
||||||
|
sprintf(dev, DRM_DEV_NAME, DRM_DIR_NAME, card);
|
||||||
|
|
||||||
|
driver = _evas_drm_card_driver_get(dev);
|
||||||
|
DBG("Drm Device Driver: %s", driver);
|
||||||
|
|
||||||
|
if ((fd = drmOpen(driver, NULL)) < 0)
|
||||||
|
{
|
||||||
|
CRI("Could not open drm device %s: %m", dev);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if ((fd = open(dev, (O_RDWR | O_CLOEXEC))) < 0) */
|
||||||
|
/* { */
|
||||||
|
/* CRI("Could not open drm device %s: %m", dev); */
|
||||||
|
/* return -1; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* drmVersionPtr ver; */
|
||||||
|
/* if ((ver = drmGetVersion(fd))) */
|
||||||
|
/* { */
|
||||||
|
/* DBG("Drm Driver Name: %s", ver->name); */
|
||||||
|
/* drmFreeVersion(ver); */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* check for dumb buffer support
|
||||||
|
*
|
||||||
|
* NB: This checks that we can at least support software rendering */
|
||||||
|
if ((drmGetCap(fd, DRM_CAP_DUMB_BUFFER, &dumb) < 0) || (!dumb))
|
||||||
|
{
|
||||||
|
CRI("Drm Device %s does not support software rendering", dev);
|
||||||
|
|
||||||
|
/* close the card */
|
||||||
|
close(fd);
|
||||||
|
|
||||||
|
/* return failure */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
DBG("Opened Drm Card %s: %d", dev, fd);
|
||||||
|
|
||||||
|
/* return opened card */
|
||||||
|
return fd;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_evas_drm_tty_open(Evas_Engine_Info_Drm *info)
|
_evas_drm_tty_open(Evas_Engine_Info_Drm *info)
|
||||||
{
|
{
|
||||||
|
@ -309,14 +387,25 @@ _evas_drm_outbuf_planes_setup(Outbuf *ob, drmModePlaneResPtr pres)
|
||||||
}
|
}
|
||||||
|
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
evas_drm_init(Evas_Engine_Info_Drm *info)
|
evas_drm_init(Evas_Engine_Info_Drm *info, int card)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* check for valid engine info */
|
/* check for valid engine info */
|
||||||
if (!info) return EINA_FALSE;
|
if (!info) return EINA_FALSE;
|
||||||
|
|
||||||
setvbuf(stdout, NULL, _IONBF, 0);
|
setvbuf(stdout, NULL, _IONBF, 0);
|
||||||
|
|
||||||
|
/* check if we already opened the card */
|
||||||
|
if (info->info.fd < 0)
|
||||||
|
{
|
||||||
|
/* try to open the drm card */
|
||||||
|
if ((info->info.fd = _evas_drm_card_open(card)) < 0)
|
||||||
|
return EINA_FALSE;
|
||||||
|
|
||||||
|
/* set flag to indicate that evas opened the card and we should
|
||||||
|
* be the one to close it */
|
||||||
|
info->info.own_fd = EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* check if we already opened the tty */
|
/* check if we already opened the tty */
|
||||||
if (info->info.tty < 0)
|
if (info->info.tty < 0)
|
||||||
{
|
{
|
||||||
|
@ -341,6 +430,8 @@ evas_drm_init(Evas_Engine_Info_Drm *info)
|
||||||
if ((info->info.tty >= 0) && (info->info.own_tty))
|
if ((info->info.tty >= 0) && (info->info.own_tty))
|
||||||
close(info->info.tty);
|
close(info->info.tty);
|
||||||
|
|
||||||
|
/* FIXME: Close card also ?? */
|
||||||
|
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,6 +451,13 @@ evas_drm_shutdown(Evas_Engine_Info_Drm *info)
|
||||||
info->info.tty = -1;
|
info->info.tty = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check if we already opened the card. if so, close it */
|
||||||
|
if ((info->info.fd >= 0) && (info->info.own_fd))
|
||||||
|
{
|
||||||
|
close(info->info.fd);
|
||||||
|
info->info.fd = -1;
|
||||||
|
}
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ void evas_outbuf_update_region_push(Outbuf *ob, RGBA_Image *update, int x, int y
|
||||||
void evas_outbuf_update_region_free(Outbuf *ob, RGBA_Image *update);
|
void evas_outbuf_update_region_free(Outbuf *ob, RGBA_Image *update);
|
||||||
void evas_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects, Evas_Render_Mode render_mode);
|
void evas_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects, Evas_Render_Mode render_mode);
|
||||||
|
|
||||||
Eina_Bool evas_drm_init(Evas_Engine_Info_Drm *info);
|
Eina_Bool evas_drm_init(Evas_Engine_Info_Drm *info, int card);
|
||||||
Eina_Bool evas_drm_shutdown(Evas_Engine_Info_Drm *info);
|
Eina_Bool evas_drm_shutdown(Evas_Engine_Info_Drm *info);
|
||||||
|
|
||||||
Eina_Bool evas_drm_outbuf_setup(Outbuf *ob);
|
Eina_Bool evas_drm_outbuf_setup(Outbuf *ob);
|
||||||
|
|
Loading…
Reference in New Issue