Add a compatibility layer to protect against ecore_drm2 api change
In case we roll an E release before the next EFL one, we need these API changes to be hidden. Later we can remove this...
This commit is contained in:
parent
50169af1db
commit
0fd23928f0
|
@ -539,7 +539,7 @@ endif
|
||||||
src_bin_enlightenment_alert_SOURCES = \
|
src_bin_enlightenment_alert_SOURCES = \
|
||||||
src/bin/e_alert_main.c
|
src/bin/e_alert_main.c
|
||||||
|
|
||||||
src_bin_enlightenment_alert_LDADD = @E_ALERT_LIBS@
|
src_bin_enlightenment_alert_LDADD = @E_ALERT_LIBS@ @dlopen_libs@
|
||||||
src_bin_enlightenment_alert_CPPFLAGS = @E_ALERT_CFLAGS@
|
src_bin_enlightenment_alert_CPPFLAGS = @E_ALERT_CFLAGS@
|
||||||
|
|
||||||
src_bin_enlightenment_filemanager_SOURCES = \
|
src_bin_enlightenment_filemanager_SOURCES = \
|
||||||
|
|
|
@ -32,8 +32,11 @@
|
||||||
# include <Evas_Engine_Buffer.h>
|
# include <Evas_Engine_Buffer.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "e_drm2.x"
|
||||||
|
|
||||||
#ifdef HAVE_WL_DRM
|
#ifdef HAVE_WL_DRM
|
||||||
# ifdef HAVE_DRM2
|
# ifdef HAVE_DRM2
|
||||||
|
|
||||||
/* DRM_FORMAT_XRGB8888 and fourcc_code borrowed from <drm_fourcc.h>
|
/* DRM_FORMAT_XRGB8888 and fourcc_code borrowed from <drm_fourcc.h>
|
||||||
*
|
*
|
||||||
* Copyright 2011 Intel Corporation
|
* Copyright 2011 Intel Corporation
|
||||||
|
@ -389,13 +392,13 @@ _e_alert_drm_connect(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ecore_drm2_init())
|
if (!e_drm2_compat_init() || !ecore_drm2_init())
|
||||||
{
|
{
|
||||||
printf("\tCannot init ecore_drm\n");
|
printf("\tCannot init ecore_drm\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev = ecore_drm2_device_open("seat0", 0);
|
dev = e_drm2_device_open("seat0", 0);
|
||||||
if (!dev)
|
if (!dev)
|
||||||
{
|
{
|
||||||
printf("\tCannot find drm device\n");
|
printf("\tCannot find drm device\n");
|
||||||
|
@ -410,7 +413,7 @@ _e_alert_drm_connect(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
output = ecore_drm2_output_find(dev, 0, 0);
|
output = ecore_drm2_output_find(dev, 0, 0);
|
||||||
if (output) ecore_drm2_output_info_get(output, NULL, NULL, &sw, &sh, NULL);
|
if (output) e_drm2_output_info_get(output, NULL, NULL, &sw, &sh, NULL);
|
||||||
fprintf(stderr, "\tOutput Size: %d %d\n", sw, sh);
|
fprintf(stderr, "\tOutput Size: %d %d\n", sw, sh);
|
||||||
|
|
||||||
ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
|
ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
|
||||||
|
@ -429,7 +432,7 @@ _e_alert_drm_create(void)
|
||||||
|
|
||||||
fh = 13;
|
fh = 13;
|
||||||
|
|
||||||
buffer = ecore_drm2_fb_create(dev, sw, sh, 24, 32, DRM_FORMAT_XRGB8888);
|
buffer = e_drm2_fb_create(dev, sw, sh, 24, 32, DRM_FORMAT_XRGB8888);
|
||||||
|
|
||||||
method = evas_render_method_lookup("buffer");
|
method = evas_render_method_lookup("buffer");
|
||||||
if (method <= 0)
|
if (method <= 0)
|
||||||
|
@ -496,11 +499,12 @@ _e_alert_drm_shutdown(void)
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
ecore_drm2_outputs_destroy(dev);
|
ecore_drm2_outputs_destroy(dev);
|
||||||
ecore_drm2_device_close(dev);
|
e_drm2_device_close(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
ecore_drm2_shutdown();
|
ecore_drm2_shutdown();
|
||||||
evas_shutdown();
|
evas_shutdown();
|
||||||
|
e_drm2_compat_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
# else
|
# else
|
||||||
|
|
|
@ -0,0 +1,117 @@
|
||||||
|
# ifdef HAVE_DRM2
|
||||||
|
# include <dlfcn.h>
|
||||||
|
|
||||||
|
static int crude_hack_fd;
|
||||||
|
static void *e_drm2_lib;
|
||||||
|
|
||||||
|
void (*sym_ecore_drm2_output_crtc_size_get_120)(Ecore_Drm2_Output *output, int *w, int *h);
|
||||||
|
void (*sym_ecore_drm2_output_geometry_get_120)(Ecore_Drm2_Output *output, int *x, int *y, int *w, int *h);
|
||||||
|
void (*sym_ecore_drm2_output_resolution_get_120)(Ecore_Drm2_Output *output, int *w, int *h, unsigned int *refresh);
|
||||||
|
Ecore_Drm2_Device *(*sym_ecore_drm2_device_find_120)(const char *seat, unsigned int tty);
|
||||||
|
int (*sym_ecore_drm2_device_open_120)(Ecore_Drm2_Device *device);
|
||||||
|
Ecore_Drm2_Device *(*sym_ecore_drm2_device_open_121)(const char *seat, unsigned int tty);
|
||||||
|
void (*sym_ecore_drm2_device_free_120)(Ecore_Drm2_Device *device);
|
||||||
|
void (*sym_ecore_drm2_output_info_get_121)(Ecore_Drm2_Output *output, int *x, int *y, int *w, int *h, unsigned int *refresh);
|
||||||
|
Ecore_Drm2_Fb *(*sym_ecore_drm2_fb_create_120)(int fd, int width, int height, int depth, int bpp, unsigned int format);
|
||||||
|
Ecore_Drm2_Fb *(*sym_ecore_drm2_fb_create_121)(Ecore_Drm2_Device *dev, int width, int height, int depth, int bpp, unsigned int format);
|
||||||
|
|
||||||
|
#define E_DRM2_EFL_VERSION_MINIMUM(MAJ, MIN, MIC) \
|
||||||
|
((eina_version->major > MAJ) || (eina_version->minor > MIN) ||\
|
||||||
|
((eina_version->minor == MIN) && (eina_version->micro >= MIC)))
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
e_drm2_compat_init(void)
|
||||||
|
{
|
||||||
|
#define EDRM2SYM(sym, ver) \
|
||||||
|
sym_##sym##_##ver = dlsym(e_drm2_lib, #sym); \
|
||||||
|
if (!sym_##sym##_##ver) \
|
||||||
|
{ \
|
||||||
|
dlclose(e_drm2_lib); \
|
||||||
|
return EINA_FALSE; \
|
||||||
|
}
|
||||||
|
|
||||||
|
e_drm2_lib = dlopen("libecore_drm2.so", RTLD_NOW | RTLD_LOCAL);
|
||||||
|
if (E_DRM2_EFL_VERSION_MINIMUM(1, 20, 99))
|
||||||
|
{
|
||||||
|
EDRM2SYM(ecore_drm2_device_open, 121);
|
||||||
|
EDRM2SYM(ecore_drm2_output_info_get, 121);
|
||||||
|
EDRM2SYM(ecore_drm2_fb_create, 121);
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
EDRM2SYM(ecore_drm2_output_crtc_size_get, 120);
|
||||||
|
EDRM2SYM(ecore_drm2_output_geometry_get, 120);
|
||||||
|
EDRM2SYM(ecore_drm2_output_resolution_get, 120);
|
||||||
|
EDRM2SYM(ecore_drm2_device_find, 120);
|
||||||
|
EDRM2SYM(ecore_drm2_device_open, 120);
|
||||||
|
EDRM2SYM(ecore_drm2_device_free, 120);
|
||||||
|
EDRM2SYM(ecore_drm2_fb_create, 120);
|
||||||
|
return EINA_TRUE;
|
||||||
|
|
||||||
|
#undef EDRM2SYM
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
e_drm2_compat_shutdown(void)
|
||||||
|
{
|
||||||
|
dlclose(e_drm2_lib);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline Ecore_Drm2_Device *
|
||||||
|
e_drm2_device_open(const char *seat, int vt)
|
||||||
|
{
|
||||||
|
Ecore_Drm2_Device *out;
|
||||||
|
|
||||||
|
if (E_DRM2_EFL_VERSION_MINIMUM(1, 20, 99))
|
||||||
|
{
|
||||||
|
return sym_ecore_drm2_device_open_121(seat, vt);
|
||||||
|
}
|
||||||
|
|
||||||
|
out = sym_ecore_drm2_device_find_120(seat, vt);
|
||||||
|
if (!out) return NULL;
|
||||||
|
|
||||||
|
crude_hack_fd = sym_ecore_drm2_device_open_120(out);
|
||||||
|
if (crude_hack_fd < 0)
|
||||||
|
{
|
||||||
|
ecore_drm2_device_close(out);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
e_drm2_device_close(Ecore_Drm2_Device *device)
|
||||||
|
{
|
||||||
|
if (E_DRM2_EFL_VERSION_MINIMUM(1, 20, 99))
|
||||||
|
{
|
||||||
|
ecore_drm2_device_close(device);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ecore_drm2_device_close(device);
|
||||||
|
sym_ecore_drm2_device_free_120(device);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
e_drm2_output_info_get(Ecore_Drm2_Output *op, int *x, int *y, int *w, int *h, unsigned int *refresh)
|
||||||
|
{
|
||||||
|
if (E_DRM2_EFL_VERSION_MINIMUM(1, 20, 99))
|
||||||
|
{
|
||||||
|
sym_ecore_drm2_output_info_get_121(op, x, y, w, h, refresh);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sym_ecore_drm2_output_geometry_get_120(op, x, y, w, h);
|
||||||
|
sym_ecore_drm2_output_resolution_get_120(op, NULL, NULL, refresh);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline Ecore_Drm2_Fb *
|
||||||
|
e_drm2_fb_create(Ecore_Drm2_Device *device, int width, int height, int depth, int bpp, unsigned int format)
|
||||||
|
{
|
||||||
|
if (E_DRM2_EFL_VERSION_MINIMUM(1, 20, 99))
|
||||||
|
{
|
||||||
|
return sym_ecore_drm2_fb_create_121(device, width, height, depth, bpp, format);
|
||||||
|
}
|
||||||
|
return sym_ecore_drm2_fb_create_120(crude_hack_fd, width, height, depth, bpp, format);
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef E_DRM2_EFL_VERSION_MINIMUM
|
||||||
|
#endif
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#include <Ecore_Drm2.h>
|
#include <Ecore_Drm2.h>
|
||||||
#include <Elput.h>
|
#include <Elput.h>
|
||||||
|
#include "e_drm2.x"
|
||||||
|
|
||||||
static Ecore_Event_Handler *seat_handler;
|
static Ecore_Event_Handler *seat_handler;
|
||||||
|
|
||||||
E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Drm" };
|
E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Drm" };
|
||||||
|
@ -391,7 +393,7 @@ _drm2_randr_create(void)
|
||||||
{
|
{
|
||||||
unsigned int refresh;
|
unsigned int refresh;
|
||||||
|
|
||||||
ecore_drm2_output_info_get(output,
|
e_drm2_output_info_get(output,
|
||||||
&s->config.geom.x,
|
&s->config.geom.x,
|
||||||
&s->config.geom.y,
|
&s->config.geom.y,
|
||||||
&s->config.mode.w,
|
&s->config.mode.w,
|
||||||
|
@ -547,7 +549,7 @@ _drm2_randr_apply(void)
|
||||||
if (!ecore_drm2_output_enabled_get(output)) continue;
|
if (!ecore_drm2_output_enabled_get(output)) continue;
|
||||||
if (ecore_drm2_output_cloned_get(output)) continue;
|
if (ecore_drm2_output_cloned_get(output)) continue;
|
||||||
|
|
||||||
ecore_drm2_output_info_get(output, NULL, NULL, &ow, &oh, NULL);
|
e_drm2_output_info_get(output, NULL, NULL, &ow, &oh, NULL);
|
||||||
pw += MAX(pw, ow);
|
pw += MAX(pw, ow);
|
||||||
ph = MAX(ph, oh);
|
ph = MAX(ph, oh);
|
||||||
}
|
}
|
||||||
|
@ -785,6 +787,8 @@ e_modapi_init(E_Module *m)
|
||||||
/* return NULL; */
|
/* return NULL; */
|
||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
|
if (!e_drm2_compat_init()) return NULL;
|
||||||
|
|
||||||
if (e_comp_config_get()->engine == E_COMP_ENGINE_GL)
|
if (e_comp_config_get()->engine == E_COMP_ENGINE_GL)
|
||||||
{
|
{
|
||||||
e_comp->ee = ecore_evas_new("gl_drm", 0, 0, 1, 1, NULL);
|
e_comp->ee = ecore_evas_new("gl_drm", 0, 0, 1, 1, NULL);
|
||||||
|
@ -858,6 +862,6 @@ e_modapi_shutdown(E_Module *m EINA_UNUSED)
|
||||||
activate_handler = NULL;
|
activate_handler = NULL;
|
||||||
|
|
||||||
E_FREE_FUNC(input_handler, ecore_event_handler_del);
|
E_FREE_FUNC(input_handler, ecore_event_handler_del);
|
||||||
|
e_drm2_compat_shutdown();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue