e->engine.module = em;
evas_module_ref(em);
/* get the engine info struct */
- if (e->engine.func->output_info)
+ if (e->engine.func->info_size)
{
Efl_Canvas_Output *output;
Eina_List *l;
EINA_LIST_FOREACH(e->outputs, l, output)
- if (!output->info) output->info = e->engine.func->output_info();
+ if (!output->info)
+ {
+ output->info = calloc(1, e->engine.func->info_size);
+ if (!output->info) continue ;
+ output->info->magic = rand();
+ output->info_magic = output->info->magic;
+
+ if (e->engine.func->output_info_setup)
+ e->engine.func->output_info_setup(output->info);
+ }
+ }
+ else
+ {
+ CRI("Engine not up to date no info size provided.");
}
// Wayland/drm already handles seats.
// The engine is already initialized, use it
// right away to setup the info structure
- if (e->engine.func->output_info)
+ if (e->engine.func->info_size)
{
- r->info = e->engine.func->output_info();
+ r->info = calloc(1, e->engine.func->info_size);
+ if (!r->info) goto on_error;
+ r->info->magic = rand();
+ r->info_magic = r->info->magic;
+
+ if (e->engine.func->output_info_setup)
+ e->engine.func->output_info_setup(r->info);
+ }
+ else
+ {
+ CRI("Engine not up to date no info size provided.");
}
+ on_error:
return r;
}
output->ector);
e->engine.func->output_free(_evas_engine_context(e),
output->output);
- e->engine.func->output_info_free(output->info);
+ free(output->info);
+ output->info = NULL;
}
e->outputs = eina_list_remove(e->outputs, output);
Ector_Surface *ector;
- void *info, *output;
+ Evas_Engine_Info *info;
+ void *output;
Evas_Coord x, y, w, h;
int info_magic;
struct _Evas_Func
{
- void *(*output_info) (void);
- void (*output_info_free) (void *info);
- void *(*output_setup) (void *engine, void *info, unsigned int w, unsigned int h);
- int (*output_update) (void *engine, void *data, void *info, unsigned int w, unsigned int h);
+ void (*output_info_setup) (void *info);
+ void *(*output_setup) (void *engine, void *info, unsigned int w, unsigned int h);
+ int (*output_update) (void *engine, void *data, void *info, unsigned int w, unsigned int h);
void (*output_free) (void *engine, void *data);
void (*output_resize) (void *engine, void *data, int w, int h);
Evas_Filter_Support (*gfx_filter_supports) (void *engine, Evas_Filter_Command *cmd);
Eina_Bool (*gfx_filter_process) (void *engine, Evas_Filter_Command *cmd);
+
+ unsigned int info_size;
};
struct _Evas_Image_Save_Func
/* prototypes we will use here */
static void *_output_setup(int w, int h, void *dest_buffer, int dest_buffer_row_bytes, int depth_type, int use_color_key, int alpha_threshold, int color_key_r, int color_key_g, int color_key_b, void *(*new_update_region) (int x, int y, int w, int h, int *row_bytes), void (*free_update_region) (int x, int y, int w, int h, void *data), void *(*switch_buffer) (void *data, void *dest_buffer), void *switch_data);
-static void *eng_output_info(void);
-static void eng_output_info_free(void *info);
static void eng_output_free(void *engine EINA_UNUSED, void *data);
/* internal engine routines */
}
/* engine api this module provides */
-static void *
-eng_output_info(void)
-{
- Evas_Engine_Info_Buffer *info;
- info = calloc(1, sizeof(Evas_Engine_Info_Buffer));
- if (!info) return NULL;
- info->magic.magic = rand();
- info->render_mode = EVAS_RENDER_MODE_BLOCKING;
- return info;
-}
-
static void
-eng_output_info_free(void *info)
+eng_output_info_setup(void *info)
{
- Evas_Engine_Info_Buffer *in;
- in = (Evas_Engine_Info_Buffer *)info;
- free(in);
+ Evas_Engine_Info_Buffer *einfo = info;
+
+ einfo->render_mode = EVAS_RENDER_MODE_BLOCKING;
}
static void *
func = pfunc;
/* now to override methods */
#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
- ORD(output_info);
- ORD(output_info_free);
+ ORD(output_info_setup);
ORD(output_setup);
ORD(canvas_alpha_get);
ORD(output_free);
+
+ func.info_size = sizeof (Evas_Engine_Info_Buffer);
+
/* now advertise out own api */
em->functions = (void *)(&func);
return 1;
return NULL;
}
-static void *
-eng_output_info(void)
-{
- Evas_Engine_Info_Drm *info;
-
- /* try to allocate space for our engine info structure */
- info = calloc(1, sizeof(Evas_Engine_Info_Drm));
- if (!info) return NULL;
-
- /* set some engine default properties */
- info->magic.magic = rand();
- info->render_mode = EVAS_RENDER_MODE_BLOCKING;
-
- return info;
-}
-
static void
-eng_output_info_free(void *einfo)
+eng_output_info_setup(void *info)
{
- Evas_Engine_Info_Drm *info;
+ Evas_Engine_Info_Drm *einfo = info;
- /* free the engine info */
- info = (Evas_Engine_Info_Drm *)einfo;
- free(info);
+ einfo->render_mode = EVAS_RENDER_MODE_BLOCKING;
}
static void *
func = pfunc;
/* override the methods we provide */
- EVAS_API_OVERRIDE(output_info, &func, eng_);
- EVAS_API_OVERRIDE(output_info_free, &func, eng_);
+ EVAS_API_OVERRIDE(output_info_setup, &func, eng_);
EVAS_API_OVERRIDE(output_setup, &func, eng_);
EVAS_API_OVERRIDE(output_update, &func, eng_);
EVAS_API_OVERRIDE(output_free, &func, eng_);
EVAS_API_OVERRIDE(image_plane_assign, &func, eng_);
EVAS_API_OVERRIDE(image_plane_release, &func, eng_);
+ func.info_size = sizeof (Evas_Engine_Info_Drm);
+
/* advertise our engine functions */
em->functions = (void *)(&func);
}
/* engine specific override functions */
-static void *
-eng_output_info(void)
-{
- Evas_Engine_Info_Eglfs *info;
-
- /* try to allocate space for our engine info */
- if (!(info = calloc(1, sizeof(Evas_Engine_Info_Eglfs))))
- return NULL;
-
- info->magic.magic = rand();
- info->render_mode = EVAS_RENDER_MODE_BLOCKING;
-
- return info;
-}
-
static void
-eng_output_info_free(void *in)
+eng_output_info_setup(void *info)
{
- Evas_Engine_Info_Eglfs *info;
+ Evas_Engine_Info_Eglfs *einfo = info;
- if ((info = (Evas_Engine_Info_Eglfs *)in))
- free(info);
+ einfo->render_mode = EVAS_RENDER_MODE_BLOCKING;
}
static void *
/* now to override methods */
EVAS_API_OVERRIDE(output_info, &func, eng_);
- EVAS_API_OVERRIDE(output_info_free, &func, eng_);
EVAS_API_OVERRIDE(output_setup, &func, eng_);
EVAS_API_OVERRIDE(output_update, &func, eng_);
EVAS_API_OVERRIDE(canvas_alpha_get, &func, eng_);
EVAS_API_OVERRIDE(output_dump, &func, eng_);
EVAS_API_OVERRIDE(image_native_set, &func, eng_);
+ func.info_size = sizeof (Evas_Engine_Info_Eglfs);
+
setenv("EGL_PLATFORM", "fbdev", 1);
gl_symbols();
}
/* engine api this module provides */
-static void *
-eng_output_info(void)
-{
- Evas_Engine_Info_FB *info;
- info = calloc(1, sizeof(Evas_Engine_Info_FB));
- if (!info) return NULL;
- info->magic.magic = rand();
- info->render_mode = EVAS_RENDER_MODE_BLOCKING;
- return info;
-}
-
static void
-eng_output_info_free(void *info)
+eng_output_info_setup(void *info)
{
- Evas_Engine_Info_FB *in;
- in = (Evas_Engine_Info_FB *)info;
- free(in);
+ Evas_Engine_Info_FB *einfo = info;
+
+ einfo->render_mode = EVAS_RENDER_MODE_BLOCKING;
}
static void *
func = pfunc;
/* now to override methods */
#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
- ORD(output_info);
- ORD(output_info_free);
+ ORD(output_info_setup);
ORD(output_setup);
ORD(canvas_alpha_get);
ORD(output_free);
+
+ func.info_size = sizeof (Evas_Engine_Info_FB);
+
/* now advertise out own api */
em->functions = (void *)(&func);
return 1;
NULL, // native_win_surface_config_get
};
-
-static void *
-eng_output_info(void)
-{
- Evas_Engine_Info_GL_Cocoa *info;
-
- info = calloc(1, sizeof(*info));
- if (EINA_UNLIKELY(!info))
- {
- CRI("Failed to allocate memory");
- return NULL;
- }
- info->magic.magic = rand();
- return info;
-}
-
-static void
-eng_output_info_free(void *info)
-{
- Evas_Engine_Info_GL_Cocoa *const in = info;
- free(in);
-}
-
static void *
eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned int h)
{
/* now to override methods */
#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
- ORD(output_info);
- ORD(output_info_free);
ORD(output_setup);
ORD(output_update);
ORD(canvas_alpha_get);
ORD(output_free);
+ func.info_size = sizeof (Evas_Engine_Info_GL_Cocoa);
+
_gl_symbols();
/* now advertise out own api */
}
/* engine specific override functions */
-static void *
-eng_output_info(void)
-{
- Evas_Engine_Info_GL_Drm *info;
-
- /* try to allocate space for our engine info */
- if (!(info = calloc(1, sizeof(Evas_Engine_Info_GL_Drm))))
- return NULL;
-
- info->magic.magic = rand();
- info->render_mode = EVAS_RENDER_MODE_BLOCKING;
-
- return info;
-}
-
static void
-eng_output_info_free(void *in)
+eng_output_info_setup(void *info)
{
- Evas_Engine_Info_GL_Drm *info;
+ Evas_Engine_Info_GL_Drm *einfo = info;
- if ((info = (Evas_Engine_Info_GL_Drm *)in))
- free(info);
+ einfo->render_mode = EVAS_RENDER_MODE_BLOCKING;
}
static Render_Engine_Merge_Mode
func = pfunc;
/* now to override methods */
- EVAS_API_OVERRIDE(output_info, &func, eng_);
- EVAS_API_OVERRIDE(output_info_free, &func, eng_);
+ EVAS_API_OVERRIDE(output_info_setup, &func, eng_);
EVAS_API_OVERRIDE(output_setup, &func, eng_);
EVAS_API_OVERRIDE(output_update, &func, eng_);
EVAS_API_OVERRIDE(canvas_alpha_get, &func, eng_);
EVAS_API_OVERRIDE(image_plane_assign, &func, eng_);
EVAS_API_OVERRIDE(image_plane_release, &func, eng_);
+ func.info_size = sizeof (Evas_Engine_Info_GL_Drm);
+
/* Mesa's EGL driver loads wayland egl by default. (called by eglGetProcaddr() )
* implicit env set (EGL_PLATFORM=drm) prevent that. */
setenv("EGL_PLATFORM", "drm", 1);
NULL, // native_win_surface_config_get
};
-
-static void *
-eng_output_info(void)
-{
- Evas_Engine_Info_GL_SDL *info;
-
- info = calloc(1, sizeof(Evas_Engine_Info_GL_SDL));
- if (!info) return NULL;
- info->magic.magic = rand();
- return info;
-}
-
-static void
-eng_output_info_free(void *info)
-{
- Evas_Engine_Info_GL_SDL *in;
- in = (Evas_Engine_Info_GL_SDL *)info;
- free(in);
-}
-
static void *
eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned int h)
{
func = pfunc;
/* now to override methods */
#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
- ORD(output_info);
- ORD(output_info_free);
ORD(output_setup);
ORD(canvas_alpha_get);
ORD(output_free);
ORD(output_dump);
+ func.info_size = sizeof (Evas_Engine_Info_GL_SDL);
+
gl_symbols();
/* now advertise out own api */
/* function tables - filled in later (func and parent func) */
static Evas_Func func, pfunc;
-static void *
-eng_output_info(void)
-{
- Evas_Engine_Info_GL_X11 *info;
-
- info = calloc(1, sizeof(Evas_Engine_Info_GL_X11));
- info->magic.magic = rand();
- info->func.best_visual_get = eng_best_visual_get;
- info->func.best_colormap_get = eng_best_colormap_get;
- info->func.best_depth_get = eng_best_depth_get;
- info->render_mode = EVAS_RENDER_MODE_BLOCKING;
- return info;
-}
-
static void
-eng_output_info_free(void *info)
+eng_output_info_setup(void *info)
{
- Evas_Engine_Info_GL_X11 *in;
-// dont free! why bother? its not worth it
-// eina_log_domain_unregister(_evas_engine_GL_X11_log_dom);
- in = (Evas_Engine_Info_GL_X11 *)info;
- free(in);
+ Evas_Engine_Info_GL_X11 *einfo = info;
+
+ einfo->func.best_visual_get = eng_best_visual_get;
+ einfo->func.best_colormap_get = eng_best_colormap_get;
+ einfo->func.best_depth_get = eng_best_depth_get;
+ einfo->render_mode = EVAS_RENDER_MODE_BLOCKING;
}
static void
func = pfunc;
/* now to override methods */
#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
- ORD(output_info);
- ORD(output_info_free);
+ ORD(output_info_setup);
ORD(output_setup);
ORD(output_update);
ORD(canvas_alpha_get);
// gl_current_surface_get is in gl generic
ORD(gl_current_context_get);
+ func.info_size = sizeof (Evas_Engine_Info_GL_X11);
+
if (!(platform_env = getenv("EGL_PLATFORM")))
setenv("EGL_PLATFORM", "x11", 0);
}
/* engine api this module provides */
-static void *
-eng_output_info(void)
-{
- Evas_Engine_Info_PSL1GHT *info;
-
- printf ("eng_info called\n");
- info = calloc(1, sizeof(Evas_Engine_Info_PSL1GHT));
- if (!info)
- return NULL;
-
- info->magic.magic = rand();
- info->render_mode = EVAS_RENDER_MODE_BLOCKING;
-
- return info;
-}
-
static void
-eng_output_info_free(void *info)
+eng_output_info_setup(void *info)
{
- Evas_Engine_Info_PSL1GHT *in;
+ Evas_Engine_Info_PSL1GHT *einfo = info;
- printf ("eng_info_free called\n");
- in = (Evas_Engine_Info_PSL1GHT *)info;
- free(in);
+ einfo->render_mode = EVAS_RENDER_MODE_BLOCKING;
}
static void *
func = pfunc;
/* now to override methods */
#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
- ORD(output_info);
- ORD(output_info_free);
+ ORD(output_info_setup);
ORD(output_setup);
ORD(canvas_alpha_get);
ORD(output_free);
ORD(output_flush);
ORD(output_idle_flush);
+ func.info_size = sizeof (Evas_Engine_Info_PSL1GHT);
+
/* now advertise out own api */
em->functions = (void *)(&func);
return 1;
/* engine api this module provides */
-
-static void *
-eng_output_info(void)
-{
- Evas_Engine_Info_Software_DDraw *info;
-
- info = calloc(1, sizeof(Evas_Engine_Info_Software_DDraw));
- if (!info) return NULL;
- info->magic.magic = rand();
- info->render_mode = EVAS_RENDER_MODE_BLOCKING;
- return info;
-}
-
static void
-eng_output_info_free(void *info)
+eng_output_info_setup(void *info)
{
- Evas_Engine_Info_Software_DDraw *in;
+ Evas_Engine_Info_Software_DDraw *einfo = info;
- in = (Evas_Engine_Info_Software_DDraw *)info;
- free(in);
+ einfo->render_mode = EVAS_RENDER_MODE_BLOCKING;
}
static void *
func = pfunc;
/* now to override methods */
#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
- ORD(output_info);
- ORD(output_info_free);
+ ORD(output_info_setup);
ORD(output_setup);
ORD(canvas_alpha_get);
ORD(output_free);
+
+ func.info_size = sizeof (Evas_Engine_Info_Software_DDraw);
+
/* now advertise out own api */
em->functions = (void *)(&func);
return 1;
/* engine api this module provides */
-
-static void *
-eng_output_info(void)
-{
- Evas_Engine_Info_Software_Gdi *info;
- info = calloc(1, sizeof(Evas_Engine_Info_Software_Gdi));
- if (!info) return NULL;
- info->magic.magic = rand();
- return info;
-}
-
-static void
-eng_output_info_free(void *info)
-{
- Evas_Engine_Info_Software_Gdi *in;
- in = (Evas_Engine_Info_Software_Gdi *)info;
- free(in);
-}
-
static void *
eng_output_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned int h)
{
func = pfunc;
/* now to override methods */
#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
- ORD(output_info);
- ORD(output_info_free);
ORD(output_setup);
ORD(output_update);
ORD(canvas_alpha_get);
ORD(output_free);
+
+ func.info_size = sizeof (Evas_Engine_Info_Software_Gdi);
/* now advertise out own api */
em->functions = (void *)(&func);
return 1;
static Evas_Func func =
{
- NULL, // eng_info
- NULL, // eng_info_free
+ NULL, // eng_info_setup
NULL, // eng_setup
NULL, // eng_update
NULL, // eng_output_free
eng_ector_new,
eng_ector_free,
eng_gfx_filter_supports,
- eng_gfx_filter_process
+ eng_gfx_filter_process,
/* FUTURE software generic calls go here */
+ 0 // sizeof (Info)
};
}
/* engine api this module provides */
-static void *
-eng_output_info(void)
-{
- Evas_Engine_Info_Software_X11 *info;
-
- if (!(info = calloc(1, sizeof(Evas_Engine_Info_Software_X11))))
- return NULL;
-
- info->magic.magic = rand();
- info->info.debug = 0;
- info->info.alloc_grayscale = 0;
- info->info.alloc_colors_max = 216;
- info->func.best_visual_get = _best_visual_get;
- info->func.best_colormap_get = _best_colormap_get;
- info->func.best_depth_get = _best_depth_get;
- info->render_mode = EVAS_RENDER_MODE_BLOCKING;
- return info;
-}
-
static void
-eng_output_info_free(void *info)
+eng_output_info_setup(void *info)
{
- Evas_Engine_Info_Software_X11 *in;
-
- in = (Evas_Engine_Info_Software_X11 *)info;
- free(in);
+ Evas_Engine_Info_Software_X11 *einfo = info;
+
+ einfo->info.debug = 0;
+ einfo->info.alloc_grayscale = 0;
+ einfo->info.alloc_colors_max = 216;
+ einfo->func.best_visual_get = _best_visual_get;
+ einfo->func.best_colormap_get = _best_colormap_get;
+ einfo->func.best_depth_get = _best_depth_get;
+ einfo->render_mode = EVAS_RENDER_MODE_BLOCKING;
}
static void *
/* now to override methods */
#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
- ORD(output_info);
- ORD(output_info_free);
+ ORD(output_info_setup);
ORD(output_setup);
ORD(output_update);
ORD(canvas_alpha_get);
ORD(image_native_set);
ORD(image_native_get);
+ func.info_size = sizeof (Evas_Engine_Info_Software_X11);
+
_symbols();
/* now advertise out own api */
em->functions = (void *)(&func);
};
/* engine functions */
-static void *
-eng_output_info(void)
-{
- Evas_Engine_Info_Wayland *info;
-
- /* try to allocate space for our engine info */
- if (!(info = calloc(1, sizeof(Evas_Engine_Info_Wayland))))
- return NULL;
-
- info->magic.magic = rand();
- info->render_mode = EVAS_RENDER_MODE_BLOCKING;
-
- return info;
-}
-
static void
-eng_output_info_free(Evas *evas EINA_UNUSED, void *info)
+eng_output_info_setup(void *info)
{
- Evas_Engine_Info_Wayland *inf;
+ Evas_Engine_Info_Wayland *info = info;
- if ((inf = (Evas_Engine_Info_Wayland *)info))
- free(inf);
+ info->render_mode = EVAS_RENDER_MODE_BLOCKING;
}
static Render_Engine_Swap_Mode
#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
- ORD(output_info);
- ORD(output_info_free);
+ ORD(output_info_setup);
ORD(output_setup);
ORD(output_update);
ORD(canvas_alpha_get);
ORD(image_native_init);
ORD(image_native_shutdown);
+ func.info_size = sizeof (Evas_Engine_Info_Wayland);
+
symbols();
/* advertise out which functions we support */
}
/* ENGINE API FUNCTIONS WE PROVIDE */
-static void *
-eng_output_info(void)
-{
- Evas_Engine_Info_Wayland *einfo;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- /* try to allocate space for new engine info */
- if (!(einfo = calloc(1, sizeof(Evas_Engine_Info_Wayland))))
- return NULL;
-
- /* fill in engine info */
- einfo->magic.magic = rand();
- einfo->render_mode = EVAS_RENDER_MODE_BLOCKING;
-
- /* return allocated engine info */
- return einfo;
-}
-
static void
-eng_output_info_free(void *info)
+eng_output_info_setup(void *info)
{
- Evas_Engine_Info_Wayland *einfo;
+ Evas_Engine_Info_Wayland *einfo = info;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- /* try to free previously allocated engine info */
- if ((einfo = (Evas_Engine_Info_Wayland *)info))
- free(einfo);
+ einfo->render_mode = EVAS_RENDER_MODE_BLOCKING;
}
static void *
/* override engine specific functions */
#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
- ORD(output_info);
- ORD(output_info_free);
+ ORD(output_info_setup);
ORD(output_setup);
ORD(output_update);
ORD(output_free);
ORD(image_native_init);
ORD(image_native_shutdown);
+ func.info_size = sizeof (Evas_Engine_Info_Wayland);
+
_symbols();
/* advertise our own engine functions */
em->functions = (void *)(&func);