forked from enlightenment/efl
evas: refactor setup stage and reduce complexity for engine.
This commit is contained in:
parent
da5f41723a
commit
73b308fb66
|
@ -420,22 +420,44 @@ _evas_canvas_engine_info_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
|
|||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_evas_canvas_engine_info_set(Eo *eo_e, Evas_Public_Data *e, Evas_Engine_Info *info)
|
||||
_evas_canvas_engine_info_set(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, Evas_Engine_Info *info)
|
||||
{
|
||||
Eina_Bool res;
|
||||
|
||||
if (!info) return EINA_FALSE;
|
||||
if (info != e->engine.info) return EINA_FALSE;
|
||||
if (info->magic != e->engine.info_magic) return EINA_FALSE;
|
||||
|
||||
evas_canvas_async_block(e);
|
||||
if (!e->common_init)
|
||||
|
||||
if (e->engine.data.output)
|
||||
{
|
||||
e->common_init = 1;
|
||||
evas_common_init();
|
||||
if (e->engine.func->update)
|
||||
{
|
||||
e->engine.func->update(e->engine.data.output, info, e->output.w, e->output.h);
|
||||
}
|
||||
else
|
||||
{
|
||||
// For engine who do not provide an update function
|
||||
e->engine.func->output_free(e->engine.data.output);
|
||||
|
||||
goto setup;
|
||||
}
|
||||
}
|
||||
res = e->engine.func->setup(eo_e, info);
|
||||
return res;
|
||||
else
|
||||
{
|
||||
if (!e->common_init)
|
||||
{
|
||||
e->common_init = 1;
|
||||
evas_common_init();
|
||||
}
|
||||
|
||||
setup:
|
||||
e->engine.data.output = e->engine.func->setup(info, e->output.w, e->output.h);
|
||||
}
|
||||
|
||||
if (!e->engine.data.context)
|
||||
e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
|
||||
|
||||
return !!e->engine.data.output;
|
||||
}
|
||||
|
||||
EOLIAN static Evas_Coord
|
||||
|
|
|
@ -1339,7 +1339,8 @@ struct _Evas_Func
|
|||
{
|
||||
void *(*info) (Evas *e);
|
||||
void (*info_free) (Evas *e, void *info);
|
||||
int (*setup) (Evas *e, void *info);
|
||||
void *(*setup) (void *info, unsigned int w, unsigned int h);
|
||||
int (*update) (void *data, void *info, unsigned int w, unsigned int h);
|
||||
|
||||
void (*output_free) (void *data);
|
||||
void (*output_resize) (void *data, int w, int h);
|
||||
|
|
|
@ -29,7 +29,6 @@ static void *_output_setup(int w, int h, void *dest_buffer, int dest_buffer_row_
|
|||
|
||||
static void *eng_info(Evas *eo_e EINA_UNUSED);
|
||||
static void eng_info_free(Evas *eo_e EINA_UNUSED, void *info);
|
||||
static int eng_setup(Evas *eo_e, void *info);
|
||||
static void eng_output_free(void *data);
|
||||
|
||||
/* internal engine routines */
|
||||
|
@ -132,35 +131,25 @@ eng_info_free(Evas *eo_e EINA_UNUSED, void *info)
|
|||
free(in);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_setup(Evas *eo_e, void *in)
|
||||
static void *
|
||||
eng_setup(void *in, unsigned int w, unsigned int h)
|
||||
{
|
||||
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
||||
Render_Engine *re;
|
||||
Evas_Engine_Info_Buffer *info;
|
||||
Evas_Engine_Info_Buffer *info = in;
|
||||
|
||||
info = (Evas_Engine_Info_Buffer *)in;
|
||||
re = _output_setup(e->output.w,
|
||||
e->output.h,
|
||||
info->info.dest_buffer,
|
||||
info->info.dest_buffer_row_bytes,
|
||||
info->info.depth_type,
|
||||
info->info.use_color_key,
|
||||
info->info.alpha_threshold,
|
||||
info->info.color_key_r,
|
||||
info->info.color_key_g,
|
||||
info->info.color_key_b,
|
||||
info->info.func.new_update_region,
|
||||
info->info.func.free_update_region,
|
||||
info->info.func.switch_buffer,
|
||||
info->info.switch_data);
|
||||
if (e->engine.data.output)
|
||||
eng_output_free(e->engine.data.output);
|
||||
e->engine.data.output = re;
|
||||
if (!e->engine.data.output) return 0;
|
||||
if (!e->engine.data.context)
|
||||
e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
|
||||
return 1;
|
||||
return _output_setup(w,
|
||||
h,
|
||||
info->info.dest_buffer,
|
||||
info->info.dest_buffer_row_bytes,
|
||||
info->info.depth_type,
|
||||
info->info.use_color_key,
|
||||
info->info.alpha_threshold,
|
||||
info->info.color_key_r,
|
||||
info->info.color_key_g,
|
||||
info->info.color_key_b,
|
||||
info->info.func.new_update_region,
|
||||
info->info.func.free_update_region,
|
||||
info->info.func.switch_buffer,
|
||||
info->info.switch_data);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -72,45 +72,28 @@ eng_info_free(Evas *evas EINA_UNUSED, void *einfo)
|
|||
free(info);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_setup(Evas *evas, void *einfo)
|
||||
static void *
|
||||
eng_setup(void *einfo, unsigned int w, unsigned int h)
|
||||
{
|
||||
Render_Engine *re;
|
||||
Evas_Public_Data *epd;
|
||||
Evas_Engine_Info_Drm *info;
|
||||
Evas_Engine_Info_Drm *info = einfo;
|
||||
|
||||
info = (Evas_Engine_Info_Drm *)einfo;
|
||||
if (!info) return 0;
|
||||
return _render_engine_setup(info, w, h);
|
||||
}
|
||||
|
||||
epd = efl_data_scope_get(evas, EVAS_CANVAS_CLASS);
|
||||
if (!epd) return 0;
|
||||
static int
|
||||
eng_update(void *data, void *einfo, unsigned int w, unsigned int h)
|
||||
{
|
||||
Evas_Engine_Info_Drm *info = einfo;
|
||||
Render_Engine *re = data;
|
||||
Outbuf *ob;
|
||||
|
||||
re = epd->engine.data.output;
|
||||
if (!re)
|
||||
{
|
||||
_outbuf_reconfigure(re->generic.ob, w, h,
|
||||
info->info.rotation, info->info.depth);
|
||||
if (!ob) return 0;
|
||||
|
||||
re = _render_engine_setup(info, epd->output.w, epd->output.h);
|
||||
if (!re) return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_outbuf_reconfigure(re->generic.ob, epd->output.w, epd->output.h,
|
||||
info->info.rotation, info->info.depth);
|
||||
|
||||
evas_render_engine_software_generic_update(&re->generic,
|
||||
re->generic.ob,
|
||||
epd->output.w,
|
||||
epd->output.h);
|
||||
}
|
||||
|
||||
epd->engine.data.output = re;
|
||||
if (!epd->engine.data.output) return 0;
|
||||
|
||||
if (!epd->engine.data.context)
|
||||
{
|
||||
epd->engine.data.context =
|
||||
epd->engine.func->context_new(epd->engine.data.output);
|
||||
}
|
||||
evas_render_engine_software_generic_update(&re->generic, ob,
|
||||
ob->w, ob->h);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -157,6 +140,7 @@ module_open(Evas_Module *em)
|
|||
EVAS_API_OVERRIDE(info, &func, eng_);
|
||||
EVAS_API_OVERRIDE(info_free, &func, eng_);
|
||||
EVAS_API_OVERRIDE(setup, &func, eng_);
|
||||
EVAS_API_OVERRIDE(update, &func, eng_);
|
||||
EVAS_API_OVERRIDE(output_free, &func, eng_);
|
||||
|
||||
/* advertise our engine functions */
|
||||
|
|
|
@ -690,21 +690,12 @@ eng_info_free(Evas *eo_e EINA_UNUSED, void *in)
|
|||
free(info);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_setup(Evas *evas, void *in)
|
||||
static Render_Engine_Swap_Mode
|
||||
_eng_swapmode_get(void)
|
||||
{
|
||||
Evas_Engine_Info_Eglfs *info;
|
||||
Evas_Public_Data *epd;
|
||||
Render_Engine *re;
|
||||
Render_Engine_Swap_Mode swap_mode = MODE_FULL;
|
||||
const char *s = NULL;
|
||||
|
||||
/* try to cast to our engine info structure */
|
||||
if (!(info = (Evas_Engine_Info_Eglfs *)in)) return 0;
|
||||
|
||||
/* try to get the evas public data */
|
||||
if (!(epd = efl_data_scope_get(evas, EVAS_CANVAS_CLASS))) return 0;
|
||||
|
||||
s = getenv("EVAS_GL_SWAP_MODE");
|
||||
if (s)
|
||||
{
|
||||
|
@ -759,139 +750,71 @@ eng_setup(Evas *evas, void *in)
|
|||
}
|
||||
}
|
||||
|
||||
if (!(re = epd->engine.data.output))
|
||||
return swap_mode;
|
||||
}
|
||||
|
||||
static void *
|
||||
eng_setup(void *in, unsigned int w, unsigned int h)
|
||||
{
|
||||
Evas_Engine_Info_Eglfs *info = in;
|
||||
Render_Engine *re = NULL;
|
||||
Outbuf *ob = NULL;
|
||||
Render_Engine_Merge_Mode merge_mode = MERGE_BOUNDING;
|
||||
Render_Engine_Swap_Mode swap_mode;
|
||||
|
||||
swap_mode = _eng_swapmode_get();
|
||||
|
||||
if (!initted)
|
||||
{
|
||||
Outbuf *ob;
|
||||
Render_Engine_Merge_Mode merge_mode = MERGE_BOUNDING;
|
||||
|
||||
if (!initted)
|
||||
{
|
||||
glsym_evas_gl_preload_init();
|
||||
}
|
||||
|
||||
if (!(re = calloc(1, sizeof(Render_Engine)))) return 0;
|
||||
|
||||
/* try to create new outbuf */
|
||||
ob = evas_outbuf_new(info, epd->output.w, epd->output.h, swap_mode);
|
||||
if (!ob)
|
||||
{
|
||||
free(re);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ob->evas = evas;
|
||||
|
||||
if (!evas_render_engine_gl_generic_init(&re->generic, ob,
|
||||
evas_outbuf_buffer_state_get,
|
||||
evas_outbuf_rot_get,
|
||||
evas_outbuf_reconfigure,
|
||||
evas_outbuf_update_region_first_rect,
|
||||
NULL,
|
||||
evas_outbuf_update_region_new,
|
||||
evas_outbuf_update_region_push,
|
||||
evas_outbuf_update_region_free,
|
||||
NULL,
|
||||
evas_outbuf_flush,
|
||||
NULL,
|
||||
evas_outbuf_free,
|
||||
evas_outbuf_use,
|
||||
evas_outbuf_gl_context_get,
|
||||
evas_outbuf_egl_display_get,
|
||||
evas_outbuf_gl_context_new,
|
||||
evas_outbuf_gl_context_use,
|
||||
&evgl_funcs, ob->w, ob->h))
|
||||
{
|
||||
/* free outbuf */
|
||||
|
||||
evas_outbuf_free(ob);
|
||||
free(re);
|
||||
return 0;
|
||||
}
|
||||
|
||||
epd->engine.data.output = re;
|
||||
gl_wins++;
|
||||
|
||||
s = getenv("EVAS_GL_PARTIAL_MERGE");
|
||||
if (s)
|
||||
{
|
||||
if ((!strcmp(s, "bounding")) || (!strcmp(s, "b")))
|
||||
merge_mode = MERGE_BOUNDING;
|
||||
else if ((!strcmp(s, "full")) || (!strcmp(s, "f")))
|
||||
merge_mode = MERGE_FULL;
|
||||
}
|
||||
|
||||
evas_render_engine_software_generic_merge_mode_set(&re->generic.software, merge_mode);
|
||||
|
||||
if (!initted)
|
||||
{
|
||||
gl_extn_veto(re);
|
||||
initted = EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (eng_get_ob(re) && _re_wincheck(eng_get_ob(re)))
|
||||
{
|
||||
if ((info->info.depth != eng_get_ob(re)->depth) ||
|
||||
(info->info.destination_alpha != eng_get_ob(re)->destination_alpha))
|
||||
{
|
||||
Outbuf *ob, *ob_old;
|
||||
|
||||
ob_old = re->generic.software.ob;
|
||||
re->generic.software.ob = NULL;
|
||||
gl_wins--;
|
||||
|
||||
ob = evas_outbuf_new(info, epd->output.w, epd->output.h, swap_mode);
|
||||
if (!ob)
|
||||
{
|
||||
if (ob_old) evas_outbuf_free(ob_old);
|
||||
free(re);
|
||||
return 0;
|
||||
}
|
||||
|
||||
evas_outbuf_use(ob);
|
||||
if (ob_old) evas_outbuf_free(ob_old);
|
||||
|
||||
ob->evas = evas;
|
||||
|
||||
evas_render_engine_software_generic_update(&re->generic.software, ob,
|
||||
epd->output.w, epd->output.h);
|
||||
|
||||
gl_wins++;
|
||||
}
|
||||
else if ((eng_get_ob(re)->w != epd->output.w) ||
|
||||
(eng_get_ob(re)->h != epd->output.h) ||
|
||||
(info->info.rotation != eng_get_ob(re)->rotation))
|
||||
{
|
||||
evas_outbuf_reconfigure(eng_get_ob(re),
|
||||
epd->output.w, epd->output.h,
|
||||
info->info.rotation,
|
||||
info->info.depth);
|
||||
}
|
||||
}
|
||||
glsym_evas_gl_preload_init();
|
||||
}
|
||||
|
||||
if (!eng_get_ob(re))
|
||||
if (!(re = calloc(1, sizeof(Render_Engine)))) return NULL;
|
||||
|
||||
/* try to create new outbuf */
|
||||
ob = evas_outbuf_new(info, w, h, swap_mode);
|
||||
if (!ob) goto on_error;
|
||||
|
||||
ob->evas = evas;
|
||||
|
||||
if (!evas_render_engine_gl_generic_init(&re->generic, ob,
|
||||
evas_outbuf_buffer_state_get,
|
||||
evas_outbuf_rot_get,
|
||||
evas_outbuf_reconfigure,
|
||||
evas_outbuf_update_region_first_rect,
|
||||
NULL,
|
||||
evas_outbuf_update_region_new,
|
||||
evas_outbuf_update_region_push,
|
||||
evas_outbuf_update_region_free,
|
||||
NULL,
|
||||
evas_outbuf_flush,
|
||||
NULL,
|
||||
evas_outbuf_free,
|
||||
evas_outbuf_use,
|
||||
evas_outbuf_gl_context_get,
|
||||
evas_outbuf_egl_display_get,
|
||||
evas_outbuf_gl_context_new,
|
||||
evas_outbuf_gl_context_use,
|
||||
&evgl_funcs, ob->w, ob->h))
|
||||
goto on_error;
|
||||
|
||||
gl_wins++;
|
||||
|
||||
s = getenv("EVAS_GL_PARTIAL_MERGE");
|
||||
if (s)
|
||||
{
|
||||
free(re);
|
||||
return 0;
|
||||
if ((!strcmp(s, "bounding")) || (!strcmp(s, "b")))
|
||||
merge_mode = MERGE_BOUNDING;
|
||||
else if ((!strcmp(s, "full")) || (!strcmp(s, "f")))
|
||||
merge_mode = MERGE_FULL;
|
||||
}
|
||||
|
||||
if (!epd->engine.data.output)
|
||||
{
|
||||
if (eng_get_ob(re))
|
||||
{
|
||||
evas_outbuf_free(eng_get_ob(re));
|
||||
gl_wins--;
|
||||
}
|
||||
free(re);
|
||||
return 0;
|
||||
}
|
||||
evas_render_engine_software_generic_merge_mode_set(&re->generic.software, merge_mode);
|
||||
|
||||
if (re->generic.software.tb)
|
||||
evas_common_tilebuf_free(re->generic.software.tb);
|
||||
re->generic.software.tb =
|
||||
evas_common_tilebuf_new(epd->output.w, epd->output.h);
|
||||
evas_common_tilebuf_new(w, h);
|
||||
if (re->generic.software.tb)
|
||||
evas_common_tilebuf_set_tile_size(re->generic.software.tb,
|
||||
TILESIZE, TILESIZE);
|
||||
|
@ -899,12 +822,78 @@ eng_setup(Evas *evas, void *in)
|
|||
if (re->generic.software.tb)
|
||||
evas_render_engine_software_generic_tile_strict_set(&re->generic.software, EINA_TRUE);
|
||||
|
||||
if (!epd->engine.data.context)
|
||||
evas_outbuf_use(eng_get_ob(re));
|
||||
|
||||
if (!initted)
|
||||
{
|
||||
epd->engine.data.context =
|
||||
epd->engine.func->context_new(epd->engine.data.output);
|
||||
gl_extn_veto(re);
|
||||
initted = EINA_TRUE;
|
||||
}
|
||||
|
||||
return re;
|
||||
|
||||
on_error:
|
||||
/* free outbuf */
|
||||
evas_outbuf_free(ob);
|
||||
free(re);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
eng_update(void *data, void *info, unsigned int w, unsigned int h)
|
||||
{
|
||||
Render_Engine *re = data;
|
||||
|
||||
if (eng_get_ob(re) && _re_wincheck(eng_get_ob(re)))
|
||||
{
|
||||
if ((info->info.depth != eng_get_ob(re)->depth) ||
|
||||
(info->info.destination_alpha != eng_get_ob(re)->destination_alpha))
|
||||
{
|
||||
Outbuf *ob, *ob_old;
|
||||
|
||||
ob_old = re->generic.software.ob;
|
||||
re->generic.software.ob = NULL;
|
||||
gl_wins--;
|
||||
|
||||
ob = evas_outbuf_new(info, w, h, swap_mode);
|
||||
if (!ob)
|
||||
{
|
||||
if (ob_old) evas_outbuf_free(ob_old);
|
||||
return 0;
|
||||
}
|
||||
|
||||
evas_outbuf_use(ob);
|
||||
if (ob_old) evas_outbuf_free(ob_old);
|
||||
|
||||
ob->evas = evas;
|
||||
|
||||
evas_render_engine_software_generic_update(&re->generic.software, ob,
|
||||
w, h);
|
||||
|
||||
gl_wins++;
|
||||
}
|
||||
else if ((eng_get_ob(re)->w != w) ||
|
||||
(eng_get_ob(re)->h != h) ||
|
||||
(info->info.rotation != eng_get_ob(re)->rotation))
|
||||
{
|
||||
evas_outbuf_reconfigure(eng_get_ob(re),
|
||||
w, h,
|
||||
info->info.rotation,
|
||||
info->info.depth);
|
||||
}
|
||||
}
|
||||
|
||||
if (re->generic.software.tb)
|
||||
evas_common_tilebuf_free(re->generic.software.tb);
|
||||
re->generic.software.tb =
|
||||
evas_common_tilebuf_new(w, h);
|
||||
if (re->generic.software.tb)
|
||||
evas_common_tilebuf_set_tile_size(re->generic.software.tb,
|
||||
TILESIZE, TILESIZE);
|
||||
|
||||
if (re->generic.software.tb)
|
||||
evas_render_engine_software_generic_tile_strict_set(&re->generic.software, EINA_TRUE);
|
||||
|
||||
evas_outbuf_use(eng_get_ob(re));
|
||||
|
||||
return 1;
|
||||
|
@ -1219,6 +1208,7 @@ module_open(Evas_Module *em)
|
|||
EVAS_API_OVERRIDE(info, &func, eng_);
|
||||
EVAS_API_OVERRIDE(info_free, &func, eng_);
|
||||
EVAS_API_OVERRIDE(setup, &func, eng_);
|
||||
EVAS_API_OVERRIDE(update, &func, eng_);
|
||||
EVAS_API_OVERRIDE(canvas_alpha_get, &func, eng_);
|
||||
EVAS_API_OVERRIDE(output_free, &func, eng_);
|
||||
EVAS_API_OVERRIDE(output_dump, &func, eng_);
|
||||
|
|
|
@ -37,7 +37,6 @@ static void *_output_setup(Evas *eo_e, int w, int h, int rot, int vt, int dev, i
|
|||
|
||||
static void *eng_info(Evas *eo_e);
|
||||
static void eng_info_free(Evas *eo_e, void *info);
|
||||
static int eng_setup(Evas *eo_e, void *info);
|
||||
static void eng_output_free(void *data);
|
||||
|
||||
static void
|
||||
|
@ -154,25 +153,18 @@ eng_info_free(Evas *eo_e EINA_UNUSED, void *info)
|
|||
free(in);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_setup(Evas *eo_e, void *in)
|
||||
static void *
|
||||
eng_setup(void *in, unsigned int w, unsigned int h)
|
||||
{
|
||||
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
||||
Render_Engine *re;
|
||||
Evas_Engine_Info_FB *info;
|
||||
Evas_Engine_Info_FB *info = in;
|
||||
|
||||
info = (Evas_Engine_Info_FB *)in;
|
||||
re = _output_setup(eo_e, e->output.w,
|
||||
e->output.h,
|
||||
info->info.rotation,
|
||||
info->info.virtual_terminal,
|
||||
info->info.device_number,
|
||||
info->info.refresh, info->func.region_push_hook);
|
||||
e->engine.data.output = re;
|
||||
if (!e->engine.data.output) return 0;
|
||||
e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
|
||||
|
||||
return 1;
|
||||
return _output_setup(w,
|
||||
h,
|
||||
info->info.rotation,
|
||||
info->info.virtual_terminal,
|
||||
info->info.device_number,
|
||||
info->info.refresh,
|
||||
info->func.region_push_hook);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -148,101 +148,79 @@ eng_info_free(Evas *e EINA_UNUSED, void *info)
|
|||
free(in);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_setup(Evas *evas, void *in)
|
||||
static void *
|
||||
eng_setup(void *in, unsigned int w, unsinged int h)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(in, 0);
|
||||
|
||||
Evas_Engine_Info_GL_Cocoa *const info = in;
|
||||
Evas_Public_Data *e;
|
||||
Render_Engine *re = NULL;
|
||||
Render_Engine *re;
|
||||
Outbuf *ob;
|
||||
Eina_Bool chk;
|
||||
|
||||
e = efl_data_scope_get(evas, EVAS_CANVAS_CLASS);
|
||||
if (EINA_UNLIKELY(!e))
|
||||
// TODO SWAP MODE
|
||||
|
||||
if (!_initted)
|
||||
{
|
||||
CRI("Failed to get evas public data");
|
||||
glsym_evas_gl_preload_init();
|
||||
_initted = EINA_TRUE;
|
||||
}
|
||||
|
||||
re = calloc(1, sizeof(*re));
|
||||
if (EINA_UNLIKELY(!re))
|
||||
{
|
||||
CRI("Failed to allocate memory");
|
||||
goto err;
|
||||
}
|
||||
|
||||
// TODO SWAP MODE
|
||||
|
||||
if (!e->engine.data.output)
|
||||
ob = evas_outbuf_new(info, w, h);
|
||||
if (EINA_UNLIKELY(!ob))
|
||||
{
|
||||
if (!_initted)
|
||||
{
|
||||
glsym_evas_gl_preload_init();
|
||||
_initted = EINA_TRUE;
|
||||
}
|
||||
|
||||
re = calloc(1, sizeof(*re));
|
||||
if (EINA_UNLIKELY(!re))
|
||||
{
|
||||
CRI("Failed to allocate memory");
|
||||
goto err;
|
||||
}
|
||||
|
||||
ob = evas_outbuf_new(info,
|
||||
e->output.w,
|
||||
e->output.h);
|
||||
if (EINA_UNLIKELY(!ob))
|
||||
{
|
||||
CRI("Failed to create outbuf");
|
||||
goto err;
|
||||
}
|
||||
|
||||
ob->evas = evas;
|
||||
info->view = ob->ns_gl_view;
|
||||
|
||||
chk = evas_render_engine_gl_generic_init(&re->generic, ob,
|
||||
evas_outbuf_buffer_state_get,
|
||||
evas_outbuf_rot_get,
|
||||
evas_outbuf_reconfigure,
|
||||
evas_outbuf_update_region_first_rect,
|
||||
NULL,
|
||||
evas_outbuf_update_region_new,
|
||||
evas_outbuf_update_region_push,
|
||||
evas_outbuf_update_region_free,
|
||||
NULL,
|
||||
evas_outbuf_flush,
|
||||
NULL,
|
||||
evas_outbuf_free,
|
||||
evas_outbuf_use,
|
||||
evas_outbuf_gl_context_get,
|
||||
evas_outbuf_egl_display_get,
|
||||
evas_outbuf_gl_context_new,
|
||||
evas_outbuf_gl_context_use,
|
||||
&evgl_funcs, ob->w, ob->h);
|
||||
if (EINA_UNLIKELY(!ob))
|
||||
{
|
||||
CRI("Failed to initialize gl_generic");
|
||||
evas_outbuf_free(re->win);
|
||||
goto err;
|
||||
}
|
||||
re->win = ob;
|
||||
e->engine.data.output = re;
|
||||
_gl_wins++;
|
||||
}
|
||||
else
|
||||
{
|
||||
CRI("ALREADY A DATA OUTPUT. THIS PART IS NOT IMPLEMENTED YET. PLEASE REPORT.");
|
||||
return 0;
|
||||
}
|
||||
if (EINA_UNLIKELY(!e->engine.data.output))
|
||||
{
|
||||
CRI("Failed to create a data output");
|
||||
return 0;
|
||||
CRI("Failed to create outbuf");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!e->engine.data.context)
|
||||
e->engine.data.context =
|
||||
e->engine.func->context_new(e->engine.data.output);
|
||||
ob->evas = evas;
|
||||
info->view = ob->ns_gl_view;
|
||||
|
||||
chk = evas_render_engine_gl_generic_init(&re->generic, ob,
|
||||
evas_outbuf_buffer_state_get,
|
||||
evas_outbuf_rot_get,
|
||||
evas_outbuf_reconfigure,
|
||||
evas_outbuf_update_region_first_rect,
|
||||
NULL,
|
||||
evas_outbuf_update_region_new,
|
||||
evas_outbuf_update_region_push,
|
||||
evas_outbuf_update_region_free,
|
||||
NULL,
|
||||
evas_outbuf_flush,
|
||||
NULL,
|
||||
evas_outbuf_free,
|
||||
evas_outbuf_use,
|
||||
evas_outbuf_gl_context_get,
|
||||
evas_outbuf_egl_display_get,
|
||||
evas_outbuf_gl_context_new,
|
||||
evas_outbuf_gl_context_use,
|
||||
&evgl_funcs, ob->w, ob->h);
|
||||
if (EINA_UNLIKELY(!ob))
|
||||
{
|
||||
CRI("Failed to initialize gl_generic");
|
||||
evas_outbuf_free(re->win);
|
||||
goto err;
|
||||
}
|
||||
re->win = ob;
|
||||
_gl_wins++;
|
||||
|
||||
evas_outbuf_use(re->win);
|
||||
|
||||
return 1;
|
||||
err:
|
||||
free(re);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
eng_update(void *data, void *info, unsigned int w, unsigned int h)
|
||||
{
|
||||
Evas_Engine_Info_GL_Cocoa *const info = in;
|
||||
Render_Engine *re = data;
|
||||
|
||||
CRI("ALREADY A DATA OUTPUT. THIS PART IS NOT IMPLEMENTED YET. PLEASE REPORT.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -325,6 +303,7 @@ module_open(Evas_Module *em)
|
|||
ORD(info);
|
||||
ORD(info_free);
|
||||
ORD(setup);
|
||||
ORD(update);
|
||||
ORD(canvas_alpha_get);
|
||||
ORD(output_free);
|
||||
|
||||
|
|
|
@ -827,20 +827,11 @@ eng_info_free(Evas *eo_e EINA_UNUSED, void *in)
|
|||
free(info);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_setup(Evas *evas, void *in)
|
||||
static Render_Engine_Swap_Mode
|
||||
_eng_swap_mode_get(Evas_Engine_Info_GL_Drm_Swap_Mode info_swap_mode)
|
||||
{
|
||||
Evas_Engine_Info_GL_Drm *info;
|
||||
Evas_Public_Data *epd;
|
||||
Render_Engine *re;
|
||||
Render_Engine_Swap_Mode swap_mode = MODE_FULL;
|
||||
const char *s = NULL;
|
||||
|
||||
/* try to cast to our engine info structure */
|
||||
if (!(info = (Evas_Engine_Info_GL_Drm *)in)) return 0;
|
||||
|
||||
/* try to get the evas public data */
|
||||
if (!(epd = efl_data_scope_get(evas, EVAS_CANVAS_CLASS))) return 0;
|
||||
const char *s;
|
||||
|
||||
s = getenv("EVAS_GL_SWAP_MODE");
|
||||
if (s)
|
||||
|
@ -873,7 +864,7 @@ eng_setup(Evas *evas, void *in)
|
|||
// re->mode = MODE_TRIPLE;
|
||||
// XXX: note - the above seems to break on some older intel chipsets and
|
||||
// drivers. it seems we CANT depend on backbuffer staying around. bugger!
|
||||
switch (info->info.swap_mode)
|
||||
switch (info_swap_mode)
|
||||
{
|
||||
case EVAS_ENGINE_GL_DRM_SWAP_MODE_FULL:
|
||||
swap_mode = MODE_FULL;
|
||||
|
@ -896,155 +887,108 @@ eng_setup(Evas *evas, void *in)
|
|||
}
|
||||
}
|
||||
|
||||
if (!(re = epd->engine.data.output))
|
||||
return swap_mode;
|
||||
}
|
||||
|
||||
static Render_Engine_Merge_Mode
|
||||
_eng_merge_mode_get(void)
|
||||
{
|
||||
Render_Engine_Merge_Mode merge_mode = MERGE_SMART;
|
||||
const char *s;
|
||||
|
||||
s = getenv("EVAS_GL_PARTIAL_MERGE");
|
||||
if (s)
|
||||
{
|
||||
Outbuf *ob;
|
||||
Render_Engine_Merge_Mode merge_mode = MERGE_SMART;
|
||||
|
||||
if (!initted)
|
||||
{
|
||||
glsym_evas_gl_preload_init();
|
||||
}
|
||||
|
||||
if (!(re = calloc(1, sizeof(Render_Engine)))) return 0;
|
||||
|
||||
if (!eng_gbm_init(info))
|
||||
{
|
||||
free(re);
|
||||
return 0;
|
||||
}
|
||||
|
||||
re->fd = info->info.fd;
|
||||
|
||||
/* try to create new outbuf */
|
||||
ob = evas_outbuf_new(info, epd->output.w, epd->output.h, swap_mode);
|
||||
if (!ob)
|
||||
{
|
||||
eng_gbm_shutdown(info);
|
||||
free(re);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ob->evas = evas;
|
||||
|
||||
if (!evas_render_engine_gl_generic_init(&re->generic, ob,
|
||||
evas_outbuf_buffer_state_get,
|
||||
evas_outbuf_rot_get,
|
||||
evas_outbuf_reconfigure,
|
||||
evas_outbuf_update_region_first_rect,
|
||||
NULL,
|
||||
evas_outbuf_update_region_new,
|
||||
evas_outbuf_update_region_push,
|
||||
evas_outbuf_update_region_free,
|
||||
NULL,
|
||||
evas_outbuf_flush,
|
||||
NULL,
|
||||
evas_outbuf_free,
|
||||
evas_outbuf_use,
|
||||
evas_outbuf_gl_context_get,
|
||||
evas_outbuf_egl_display_get,
|
||||
evas_outbuf_gl_context_new,
|
||||
evas_outbuf_gl_context_use,
|
||||
&evgl_funcs, ob->w, ob->h))
|
||||
{
|
||||
/* free outbuf */
|
||||
evas_outbuf_free(ob);
|
||||
eng_gbm_shutdown(info);
|
||||
free(re);
|
||||
return 0;
|
||||
}
|
||||
|
||||
epd->engine.data.output = re;
|
||||
gl_wins++;
|
||||
|
||||
s = getenv("EVAS_GL_PARTIAL_MERGE");
|
||||
if (s)
|
||||
{
|
||||
if ((!strcmp(s, "bounding")) || (!strcmp(s, "b")))
|
||||
merge_mode = MERGE_BOUNDING;
|
||||
else if ((!strcmp(s, "full")) || (!strcmp(s, "f")))
|
||||
merge_mode = MERGE_FULL;
|
||||
else if ((!strcmp(s, "smart")) || (!strcmp(s, "s")))
|
||||
merge_mode = MERGE_SMART;
|
||||
}
|
||||
|
||||
evas_render_engine_software_generic_merge_mode_set(&re->generic.software, merge_mode);
|
||||
|
||||
if (!initted)
|
||||
{
|
||||
gl_extn_veto(re);
|
||||
initted = EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (eng_get_ob(re) && _re_wincheck(eng_get_ob(re)))
|
||||
{
|
||||
if ((info->info.depth != eng_get_ob(re)->depth) ||
|
||||
(info->info.destination_alpha != eng_get_ob(re)->destination_alpha))
|
||||
{
|
||||
Outbuf *ob, *ob_old;
|
||||
|
||||
ob_old = re->generic.software.ob;
|
||||
re->generic.software.ob = NULL;
|
||||
gl_wins--;
|
||||
|
||||
if (ob_old) evas_outbuf_free(ob_old);
|
||||
|
||||
ob = evas_outbuf_new(info, epd->output.w, epd->output.h, swap_mode);
|
||||
if (!ob)
|
||||
{
|
||||
free(re);
|
||||
return 0;
|
||||
}
|
||||
|
||||
evas_outbuf_use(ob);
|
||||
|
||||
ob->evas = evas;
|
||||
|
||||
evas_render_engine_software_generic_update(&re->generic.software, ob,
|
||||
epd->output.w, epd->output.h);
|
||||
|
||||
gl_wins++;
|
||||
}
|
||||
else if ((eng_get_ob(re)->w != epd->output.w) ||
|
||||
(eng_get_ob(re)->h != epd->output.h) ||
|
||||
(info->info.rotation != eng_get_ob(re)->rotation))
|
||||
{
|
||||
evas_outbuf_reconfigure(eng_get_ob(re),
|
||||
epd->output.w, epd->output.h,
|
||||
info->info.rotation,
|
||||
info->info.depth);
|
||||
evas_render_engine_software_generic_update(&re->generic.software,
|
||||
re->generic.software.ob,
|
||||
epd->output.w,
|
||||
epd->output.h);
|
||||
}
|
||||
}
|
||||
if ((!strcmp(s, "bounding")) || (!strcmp(s, "b")))
|
||||
merge_mode = MERGE_BOUNDING;
|
||||
else if ((!strcmp(s, "full")) || (!strcmp(s, "f")))
|
||||
merge_mode = MERGE_FULL;
|
||||
else if ((!strcmp(s, "smart")) || (!strcmp(s, "s")))
|
||||
merge_mode = MERGE_SMART;
|
||||
}
|
||||
|
||||
if (!eng_get_ob(re))
|
||||
return merge_mode;
|
||||
}
|
||||
|
||||
static void *
|
||||
eng_setup(void *in, unsigned int w, unsigned int h)
|
||||
{
|
||||
Evas_Engine_Info_GL_Drm *info = in;
|
||||
Render_Engine *re = NULL;
|
||||
Outbuf *ob;
|
||||
Render_Engine_Swap_Mode swap_mode;
|
||||
Render_Engine_Merge_Mode merge_mode;
|
||||
|
||||
swap_mode = _eng_swap_mode_get(info->info.swap_mode);
|
||||
merge_mode = _eng_merge_mode_get(void);
|
||||
|
||||
|
||||
if (!initted)
|
||||
{
|
||||
glsym_evas_gl_preload_init();
|
||||
}
|
||||
|
||||
if (!(re = calloc(1, sizeof(Render_Engine)))) return 0;
|
||||
|
||||
if (!eng_gbm_init(info))
|
||||
{
|
||||
free(re);
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!epd->engine.data.output)
|
||||
re->fd = info->info.fd;
|
||||
|
||||
/* try to create new outbuf */
|
||||
ob = evas_outbuf_new(info, w, h, swap_mode);
|
||||
if (!ob)
|
||||
{
|
||||
if (eng_get_ob(re))
|
||||
{
|
||||
evas_outbuf_free(eng_get_ob(re));
|
||||
gl_wins--;
|
||||
eng_gbm_shutdown(info);
|
||||
}
|
||||
eng_gbm_shutdown(info);
|
||||
free(re);
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ob->evas = evas;
|
||||
|
||||
if (!evas_render_engine_gl_generic_init(&re->generic, ob,
|
||||
evas_outbuf_buffer_state_get,
|
||||
evas_outbuf_rot_get,
|
||||
evas_outbuf_reconfigure,
|
||||
evas_outbuf_update_region_first_rect,
|
||||
NULL,
|
||||
evas_outbuf_update_region_new,
|
||||
evas_outbuf_update_region_push,
|
||||
evas_outbuf_update_region_free,
|
||||
NULL,
|
||||
evas_outbuf_flush,
|
||||
NULL,
|
||||
evas_outbuf_free,
|
||||
evas_outbuf_use,
|
||||
evas_outbuf_gl_context_get,
|
||||
evas_outbuf_egl_display_get,
|
||||
evas_outbuf_gl_context_new,
|
||||
evas_outbuf_gl_context_use,
|
||||
&evgl_funcs, ob->w, ob->h))
|
||||
{
|
||||
/* free outbuf */
|
||||
evas_outbuf_free(ob);
|
||||
eng_gbm_shutdown(info);
|
||||
free(re);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gl_wins++;
|
||||
|
||||
evas_render_engine_software_generic_merge_mode_set(&re->generic.software, merge_mode);
|
||||
|
||||
if (!initted)
|
||||
{
|
||||
gl_extn_veto(re);
|
||||
initted = EINA_TRUE;
|
||||
}
|
||||
|
||||
if (re->generic.software.tb)
|
||||
evas_common_tilebuf_free(re->generic.software.tb);
|
||||
re->generic.software.tb =
|
||||
evas_common_tilebuf_new(epd->output.w, epd->output.h);
|
||||
re->generic.software.tb = evas_common_tilebuf_new(w, h);
|
||||
if (re->generic.software.tb)
|
||||
evas_common_tilebuf_set_tile_size(re->generic.software.tb,
|
||||
TILESIZE, TILESIZE);
|
||||
|
@ -1052,12 +996,71 @@ eng_setup(Evas *evas, void *in)
|
|||
if (re->generic.software.tb)
|
||||
evas_render_engine_software_generic_tile_strict_set(&re->generic.software, EINA_TRUE);
|
||||
|
||||
if (!epd->engine.data.context)
|
||||
evas_outbuf_use(eng_get_ob(re));
|
||||
|
||||
return re;
|
||||
}
|
||||
|
||||
static int
|
||||
eng_update(void *data, void *info, unsigned int w, unsigned int h)
|
||||
{
|
||||
Evas_Engine_Info_GL_Drm *info = in;
|
||||
Render_Engine *re = data;
|
||||
|
||||
if (eng_get_ob(re) && _re_wincheck(eng_get_ob(re)))
|
||||
{
|
||||
epd->engine.data.context =
|
||||
epd->engine.func->context_new(epd->engine.data.output);
|
||||
if ((info->info.depth != eng_get_ob(re)->depth) ||
|
||||
(info->info.destination_alpha != eng_get_ob(re)->destination_alpha))
|
||||
{
|
||||
Outbuf *ob, *ob_old;
|
||||
|
||||
ob_old = re->generic.software.ob;
|
||||
re->generic.software.ob = NULL;
|
||||
gl_wins--;
|
||||
|
||||
if (ob_old) evas_outbuf_free(ob_old);
|
||||
|
||||
ob = evas_outbuf_new(info, w, h, swap_mode);
|
||||
if (!ob)
|
||||
{
|
||||
free(re);
|
||||
return 0;
|
||||
}
|
||||
|
||||
evas_outbuf_use(ob);
|
||||
|
||||
ob->evas = evas;
|
||||
|
||||
evas_render_engine_software_generic_update(&re->generic.software, ob,
|
||||
w, h);
|
||||
|
||||
gl_wins++;
|
||||
}
|
||||
else if ((eng_get_ob(re)->w != w) ||
|
||||
(eng_get_ob(re)->h != h) ||
|
||||
(info->info.rotation != eng_get_ob(re)->rotation))
|
||||
{
|
||||
evas_outbuf_reconfigure(eng_get_ob(re),
|
||||
w, h,
|
||||
info->info.rotation,
|
||||
info->info.depth);
|
||||
evas_render_engine_software_generic_update(&re->generic.software,
|
||||
re->generic.software.ob,
|
||||
w,
|
||||
h);
|
||||
}
|
||||
}
|
||||
|
||||
if (re->generic.software.tb)
|
||||
evas_common_tilebuf_free(re->generic.software.tb);
|
||||
re->generic.software.tb = evas_common_tilebuf_new(w, h);
|
||||
if (re->generic.software.tb)
|
||||
evas_common_tilebuf_set_tile_size(re->generic.software.tb,
|
||||
TILESIZE, TILESIZE);
|
||||
|
||||
if (re->generic.software.tb)
|
||||
evas_render_engine_software_generic_tile_strict_set(&re->generic.software, EINA_TRUE);
|
||||
|
||||
evas_outbuf_use(eng_get_ob(re));
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -85,8 +85,6 @@ struct _Outbuf
|
|||
Evas_Engine_Info_GL_Drm *info;
|
||||
Evas_Engine_GL_Context *gl_context;
|
||||
|
||||
Evas *evas; // used for pre_swap, post_swap
|
||||
|
||||
int fd, w, h, bpp;
|
||||
unsigned int rotation, depth, format;
|
||||
int prev_age;
|
||||
|
|
|
@ -286,17 +286,14 @@ eng_info_free(Evas *e EINA_UNUSED, void *info)
|
|||
free(in);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_setup(Evas *eo_e, void *in)
|
||||
static void *
|
||||
eng_setup(void *in, unsigned int w, unsigned int h)
|
||||
{
|
||||
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
||||
Render_Engine *re = NULL;
|
||||
Outbuf *ob = NULL;
|
||||
Evas_Engine_Info_GL_SDL *info;
|
||||
Evas_Engine_Info_GL_SDL *info = in;
|
||||
|
||||
info = (Evas_Engine_Info_GL_SDL *)in;
|
||||
|
||||
ob = _sdl_output_setup(e->output.w, e->output.h,
|
||||
ob = _sdl_output_setup(w, h,
|
||||
info->flags.fullscreen,
|
||||
info->flags.noframe,
|
||||
info);
|
||||
|
@ -323,24 +320,16 @@ eng_setup(Evas *eo_e, void *in)
|
|||
_window_gl_context_new,
|
||||
_window_gl_context_use,
|
||||
&evgl_funcs,
|
||||
e->output.w, e->output.h))
|
||||
w, h))
|
||||
goto on_error;
|
||||
|
||||
e->engine.data.output = re;
|
||||
if (!e->engine.data.output)
|
||||
return 0;
|
||||
e->engine.func = &func;
|
||||
e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
|
||||
|
||||
/* if we haven't initialized - init (automatic abort if already done) */
|
||||
|
||||
return 1;
|
||||
return re;
|
||||
|
||||
on_error:
|
||||
if (ob) _outbuf_free(ob);
|
||||
free(ob);
|
||||
free(re);
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -1614,17 +1614,12 @@ _re_winfree(Render_Engine *re)
|
|||
eng_window_unsurf(eng_get_ob(re));
|
||||
}
|
||||
|
||||
static int
|
||||
eng_setup(Evas *eo_e, void *in)
|
||||
static Render_Engine_Swap_Mode
|
||||
_eng_swap_mode_get(Evas_Engine_Info_GL_X11_Swap_Mode info_swap_mode)
|
||||
{
|
||||
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
||||
Render_Engine *re;
|
||||
Evas_Engine_Info_GL_X11 *info;
|
||||
Render_Engine_Swap_Mode swap_mode = MODE_FULL;
|
||||
const char *s;
|
||||
|
||||
info = (Evas_Engine_Info_GL_X11 *)in;
|
||||
|
||||
if ((s = getenv("EVAS_GL_SWAP_MODE")))
|
||||
{
|
||||
if ((!strcasecmp(s, "full")) ||
|
||||
|
@ -1660,7 +1655,7 @@ eng_setup(Evas *eo_e, void *in)
|
|||
// re->mode = MODE_TRIPLE;
|
||||
// XXX: note - the above seems to break on some older intel chipsets and
|
||||
// drivers. it seems we CANT depend on backbuffer staying around. bugger!
|
||||
switch (info->swap_mode)
|
||||
switch (info_swap_mode)
|
||||
{
|
||||
case EVAS_ENGINE_GL_X11_SWAP_MODE_FULL:
|
||||
swap_mode = MODE_FULL;
|
||||
|
@ -1683,6 +1678,21 @@ eng_setup(Evas *eo_e, void *in)
|
|||
}
|
||||
}
|
||||
|
||||
return swap_mode;
|
||||
}
|
||||
|
||||
static void *
|
||||
eng_setup(void *in, unsigned int w, unsigned int h)
|
||||
{
|
||||
Evas_Engine_Info_GL_X11 *info = in;
|
||||
Render_Engine *re = NULL;
|
||||
Outbuf *ob = NULL;
|
||||
Render_Engine_Merge_Mode merge_mode = MERGE_SMART;
|
||||
Render_Engine_Swap_Mode swap_mode;
|
||||
const char *s;
|
||||
|
||||
swap_mode = _eng_swap_mode_get(info->swap_mode);
|
||||
|
||||
// Set this env var to dump files every frame
|
||||
// Or set the global var in gdb to 1|0 to turn it on and off
|
||||
if (getenv("EVAS_GL_SWAP_BUFFER_DEBUG_ALWAYS"))
|
||||
|
@ -1706,189 +1716,170 @@ eng_setup(Evas *eo_e, void *in)
|
|||
}
|
||||
|
||||
|
||||
if (!e->engine.data.output)
|
||||
if (!initted)
|
||||
{
|
||||
Outbuf *ob;
|
||||
Render_Engine_Merge_Mode merge_mode = MERGE_SMART;
|
||||
|
||||
if (!initted)
|
||||
{
|
||||
glsym_evas_gl_preload_init();
|
||||
}
|
||||
glsym_evas_gl_preload_init();
|
||||
}
|
||||
|
||||
#ifdef GL_GLES
|
||||
#else
|
||||
int eb, evb;
|
||||
int eb, evb;
|
||||
|
||||
if (!glXQueryExtension(info->info.display, &eb, &evb)) return 0;
|
||||
if (!glXQueryExtension(info->info.display, &eb, &evb)) return 0;
|
||||
#endif
|
||||
re = calloc(1, sizeof(Render_Engine));
|
||||
if (!re) return 0;
|
||||
ob = eng_window_new(info, eo_e,
|
||||
info->info.display,
|
||||
info->info.drawable,
|
||||
info->info.screen,
|
||||
info->info.visual,
|
||||
info->info.colormap,
|
||||
info->info.depth,
|
||||
e->output.w, e->output.h,
|
||||
info->indirect,
|
||||
info->info.destination_alpha,
|
||||
info->info.rotation,
|
||||
swap_mode,
|
||||
info->depth_bits,
|
||||
info->stencil_bits,
|
||||
info->msaa_bits);
|
||||
if (!ob)
|
||||
{
|
||||
free(re);
|
||||
return 0;
|
||||
}
|
||||
re = calloc(1, sizeof(Render_Engine));
|
||||
if (!re) return NULL;
|
||||
|
||||
if (!evas_render_engine_gl_generic_init(&re->generic, ob,
|
||||
eng_outbuf_swap_mode,
|
||||
eng_outbuf_get_rot,
|
||||
eng_outbuf_reconfigure,
|
||||
eng_outbuf_region_first_rect,
|
||||
ob = eng_window_new(info,
|
||||
info->info.display,
|
||||
info->info.drawable,
|
||||
info->info.screen,
|
||||
info->info.visual,
|
||||
info->info.colormap,
|
||||
info->info.depth,
|
||||
w, h,
|
||||
info->indirect,
|
||||
info->info.destination_alpha,
|
||||
info->info.rotation,
|
||||
swap_mode,
|
||||
info->depth_bits,
|
||||
info->stencil_bits,
|
||||
info->msaa_bits);
|
||||
if (!ob) goto on_error;
|
||||
|
||||
if (!evas_render_engine_gl_generic_init(&re->generic, ob,
|
||||
eng_outbuf_swap_mode,
|
||||
eng_outbuf_get_rot,
|
||||
eng_outbuf_reconfigure,
|
||||
eng_outbuf_region_first_rect,
|
||||
#ifdef GL_GLES
|
||||
eng_outbuf_damage_region_set,
|
||||
eng_outbuf_damage_region_set,
|
||||
#else
|
||||
NULL,
|
||||
NULL,
|
||||
#endif
|
||||
eng_outbuf_new_region_for_update,
|
||||
eng_outbuf_push_updated_region,
|
||||
eng_outbuf_push_free_region_for_update,
|
||||
eng_outbuf_idle_flush,
|
||||
eng_outbuf_flush,
|
||||
NULL,
|
||||
eng_window_free,
|
||||
eng_window_use,
|
||||
eng_outbuf_gl_context_get,
|
||||
eng_outbuf_egl_display_get,
|
||||
eng_gl_context_new,
|
||||
eng_gl_context_use,
|
||||
&evgl_funcs,
|
||||
e->output.w, e->output.h))
|
||||
{
|
||||
eng_window_free(ob);
|
||||
free(re);
|
||||
return 0;
|
||||
}
|
||||
eng_outbuf_new_region_for_update,
|
||||
eng_outbuf_push_updated_region,
|
||||
eng_outbuf_push_free_region_for_update,
|
||||
eng_outbuf_idle_flush,
|
||||
eng_outbuf_flush,
|
||||
NULL,
|
||||
eng_window_free,
|
||||
eng_window_use,
|
||||
eng_outbuf_gl_context_get,
|
||||
eng_outbuf_egl_display_get,
|
||||
eng_gl_context_new,
|
||||
eng_gl_context_use,
|
||||
&evgl_funcs,
|
||||
w, h))
|
||||
goto on_error;
|
||||
|
||||
e->engine.data.output = re;
|
||||
gl_wins++;
|
||||
gl_wins++;
|
||||
|
||||
if ((s = getenv("EVAS_GL_PARTIAL_MERGE")))
|
||||
{
|
||||
if ((!strcmp(s, "bounding")) ||
|
||||
(!strcmp(s, "b")))
|
||||
merge_mode = MERGE_BOUNDING;
|
||||
else if ((!strcmp(s, "full")) ||
|
||||
(!strcmp(s, "f")))
|
||||
merge_mode = MERGE_FULL;
|
||||
else if ((!strcmp(s, "smart")) ||
|
||||
(!strcmp(s, "s")))
|
||||
merge_mode = MERGE_SMART;
|
||||
}
|
||||
|
||||
evas_render_engine_software_generic_merge_mode_set(&re->generic.software, merge_mode);
|
||||
|
||||
if (!initted)
|
||||
{
|
||||
gl_extn_veto(re);
|
||||
// evgl_engine_init(re, &evgl_funcs);
|
||||
initted = 1;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
if ((s = getenv("EVAS_GL_PARTIAL_MERGE")))
|
||||
{
|
||||
re = e->engine.data.output;
|
||||
if (eng_get_ob(re) && _re_wincheck(eng_get_ob(re)))
|
||||
{
|
||||
if ((info->info.display != eng_get_ob(re)->disp) ||
|
||||
(info->info.drawable != eng_get_ob(re)->win) ||
|
||||
(info->info.screen != eng_get_ob(re)->screen) ||
|
||||
(info->info.visual != eng_get_ob(re)->visual) ||
|
||||
(info->info.colormap != eng_get_ob(re)->colormap) ||
|
||||
(info->info.depth != eng_get_ob(re)->depth) ||
|
||||
(info->depth_bits != eng_get_ob(re)->depth_bits) ||
|
||||
(info->stencil_bits != eng_get_ob(re)->stencil_bits) ||
|
||||
(info->msaa_bits != eng_get_ob(re)->msaa_bits) ||
|
||||
(info->info.destination_alpha != eng_get_ob(re)->alpha))
|
||||
{
|
||||
Outbuf *ob, *ob_old;
|
||||
|
||||
ob_old = re->generic.software.ob;
|
||||
re->generic.software.ob = NULL;
|
||||
gl_wins--;
|
||||
|
||||
ob = eng_window_new(info, eo_e,
|
||||
info->info.display,
|
||||
info->info.drawable,
|
||||
info->info.screen,
|
||||
info->info.visual,
|
||||
info->info.colormap,
|
||||
info->info.depth,
|
||||
e->output.w, e->output.h,
|
||||
info->indirect,
|
||||
info->info.destination_alpha,
|
||||
info->info.rotation,
|
||||
swap_mode,
|
||||
info->depth_bits,
|
||||
info->stencil_bits,
|
||||
info->msaa_bits);
|
||||
if (!ob)
|
||||
{
|
||||
if (ob_old) eng_window_free(ob_old);
|
||||
free(re);
|
||||
return 0;
|
||||
}
|
||||
eng_window_use(ob);
|
||||
if (ob_old) eng_window_free(ob_old);
|
||||
evas_render_engine_software_generic_update(&re->generic.software, ob,
|
||||
e->output.w, e->output.h);
|
||||
|
||||
gl_wins++;
|
||||
}
|
||||
else if ((eng_get_ob(re)->w != e->output.w) ||
|
||||
(eng_get_ob(re)->h != e->output.h) ||
|
||||
(eng_get_ob(re)->info->info.rotation != eng_get_ob(re)->rot))
|
||||
{
|
||||
eng_outbuf_reconfigure(eng_get_ob(re), e->output.w, e->output.h, eng_get_ob(re)->info->info.rotation, 0);
|
||||
if (re->generic.software.tb)
|
||||
evas_common_tilebuf_free(re->generic.software.tb);
|
||||
re->generic.software.tb = evas_common_tilebuf_new(e->output.w, e->output.h);
|
||||
if (re->generic.software.tb)
|
||||
evas_common_tilebuf_set_tile_size(re->generic.software.tb,
|
||||
TILESIZE, TILESIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!eng_get_ob(re))
|
||||
{
|
||||
free(re);
|
||||
return 0;
|
||||
if ((!strcmp(s, "bounding")) ||
|
||||
(!strcmp(s, "b")))
|
||||
merge_mode = MERGE_BOUNDING;
|
||||
else if ((!strcmp(s, "full")) ||
|
||||
(!strcmp(s, "f")))
|
||||
merge_mode = MERGE_FULL;
|
||||
else if ((!strcmp(s, "smart")) ||
|
||||
(!strcmp(s, "s")))
|
||||
merge_mode = MERGE_SMART;
|
||||
}
|
||||
|
||||
if (!e->engine.data.output)
|
||||
evas_render_engine_software_generic_merge_mode_set(&re->generic.software, merge_mode);
|
||||
|
||||
if (!initted)
|
||||
{
|
||||
if (eng_get_ob(re))
|
||||
{
|
||||
eng_window_free(eng_get_ob(re));
|
||||
gl_wins--;
|
||||
}
|
||||
free(re);
|
||||
return 0;
|
||||
gl_extn_veto(re);
|
||||
// evgl_engine_init(re, &evgl_funcs);
|
||||
initted = 1;
|
||||
}
|
||||
|
||||
if (re->generic.software.tb)
|
||||
evas_render_engine_software_generic_tile_strict_set
|
||||
(&re->generic.software, EINA_TRUE);
|
||||
|
||||
if (!e->engine.data.context)
|
||||
e->engine.data.context =
|
||||
e->engine.func->context_new(e->engine.data.output);
|
||||
eng_window_use(eng_get_ob(re));
|
||||
|
||||
return re;
|
||||
|
||||
on_error:
|
||||
if (ob) eng_window_free(ob);
|
||||
free(re);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
eng_update(void *data, void *in, unsigned int w, unsigned int h)
|
||||
{
|
||||
Evas_Engine_Info_GL_X11 *info = in;
|
||||
Render_Engine *re = data;
|
||||
Render_Engine_Swap_Mode swap_mode;
|
||||
|
||||
swap_mode = _eng_swap_mode_get(info->swap_mode);
|
||||
|
||||
if (eng_get_ob(re) && _re_wincheck(eng_get_ob(re)))
|
||||
{
|
||||
if ((info->info.display != eng_get_ob(re)->disp) ||
|
||||
(info->info.drawable != eng_get_ob(re)->win) ||
|
||||
(info->info.screen != eng_get_ob(re)->screen) ||
|
||||
(info->info.visual != eng_get_ob(re)->visual) ||
|
||||
(info->info.colormap != eng_get_ob(re)->colormap) ||
|
||||
(info->info.depth != eng_get_ob(re)->depth) ||
|
||||
(info->depth_bits != eng_get_ob(re)->depth_bits) ||
|
||||
(info->stencil_bits != eng_get_ob(re)->stencil_bits) ||
|
||||
(info->msaa_bits != eng_get_ob(re)->msaa_bits) ||
|
||||
(info->info.destination_alpha != eng_get_ob(re)->alpha))
|
||||
{
|
||||
Outbuf *ob, *ob_old;
|
||||
|
||||
ob_old = re->generic.software.ob;
|
||||
re->generic.software.ob = NULL;
|
||||
gl_wins--;
|
||||
|
||||
ob = eng_window_new(info,
|
||||
info->info.display,
|
||||
info->info.drawable,
|
||||
info->info.screen,
|
||||
info->info.visual,
|
||||
info->info.colormap,
|
||||
info->info.depth,
|
||||
w, h,
|
||||
info->indirect,
|
||||
info->info.destination_alpha,
|
||||
info->info.rotation,
|
||||
swap_mode,
|
||||
info->depth_bits,
|
||||
info->stencil_bits,
|
||||
info->msaa_bits);
|
||||
if (!ob)
|
||||
{
|
||||
if (ob_old) eng_window_free(ob_old);
|
||||
return 0;
|
||||
}
|
||||
|
||||
eng_window_use(ob);
|
||||
if (ob_old) eng_window_free(ob_old);
|
||||
evas_render_engine_software_generic_update(&re->generic.software, ob,
|
||||
w, h);
|
||||
gl_wins++;
|
||||
}
|
||||
else if ((eng_get_ob(re)->w != w) ||
|
||||
(eng_get_ob(re)->h != h) ||
|
||||
(eng_get_ob(re)->info->info.rotation != eng_get_ob(re)->rot))
|
||||
{
|
||||
eng_outbuf_reconfigure(eng_get_ob(re), w, h, eng_get_ob(re)->info->info.rotation, 0);
|
||||
if (re->generic.software.tb)
|
||||
evas_common_tilebuf_free(re->generic.software.tb);
|
||||
re->generic.software.tb = evas_common_tilebuf_new(w, h);
|
||||
if (re->generic.software.tb)
|
||||
evas_common_tilebuf_set_tile_size(re->generic.software.tb,
|
||||
TILESIZE, TILESIZE);
|
||||
}
|
||||
}
|
||||
|
||||
eng_window_use(eng_get_ob(re));
|
||||
|
||||
return 1;
|
||||
|
@ -3160,6 +3151,7 @@ module_open(Evas_Module *em)
|
|||
ORD(info);
|
||||
ORD(info_free);
|
||||
ORD(setup);
|
||||
ORD(update);
|
||||
ORD(canvas_alpha_get);
|
||||
ORD(output_free);
|
||||
ORD(output_dump);
|
||||
|
|
|
@ -93,7 +93,7 @@ struct _Outbuf
|
|||
Render_Engine_Swap_Mode swap_mode;
|
||||
Colormap colormap;
|
||||
Window win;
|
||||
int w, h;
|
||||
unsigned int w, h;
|
||||
int screen;
|
||||
int depth;
|
||||
int alpha;
|
||||
|
@ -164,10 +164,10 @@ extern int (*glsym_glXWaitVideoSync) (int a, int b, unsigned int *c);
|
|||
|
||||
#endif
|
||||
|
||||
Outbuf *eng_window_new(Evas_Engine_Info_GL_X11 *info, Evas *e,
|
||||
Outbuf *eng_window_new(Evas_Engine_Info_GL_X11 *info,
|
||||
Display *disp, Window win, int screen,
|
||||
Visual *vis, Colormap cmap,
|
||||
int depth, int w, int h, int indirect,
|
||||
int depth, unsigned int w, unsigned int h, int indirect,
|
||||
int alpha, int rot,
|
||||
Render_Engine_Swap_Mode swap_mode,
|
||||
int depth_bits, int stencil_bits, int msaa_bits);
|
||||
|
|
|
@ -181,15 +181,14 @@ _x11_eglGetDisplay(Display *x11_display)
|
|||
|
||||
Outbuf *
|
||||
eng_window_new(Evas_Engine_Info_GL_X11 *info,
|
||||
Evas *e,
|
||||
Display *disp,
|
||||
Window win,
|
||||
int screen,
|
||||
Visual *vis,
|
||||
Colormap cmap,
|
||||
int depth,
|
||||
int w,
|
||||
int h,
|
||||
unsigned int w,
|
||||
unsigned int h,
|
||||
int indirect EINA_UNUSED,
|
||||
int alpha,
|
||||
int rot,
|
||||
|
@ -241,7 +240,6 @@ eng_window_new(Evas_Engine_Info_GL_X11 *info,
|
|||
gw->rot = rot;
|
||||
gw->swap_mode = swap_mode;
|
||||
gw->info = info;
|
||||
gw->evas = e;
|
||||
gw->depth_bits = depth_bits;
|
||||
gw->stencil_bits = stencil_bits;
|
||||
gw->msaa_bits = msaa_bits;
|
||||
|
@ -1549,7 +1547,7 @@ eng_outbuf_new_region_for_update(Outbuf *ob,
|
|||
int *cx EINA_UNUSED, int *cy EINA_UNUSED,
|
||||
int *cw EINA_UNUSED, int *ch EINA_UNUSED)
|
||||
{
|
||||
if (w == ob->w && h == ob->h)
|
||||
if (w == (int) ob->w && h == (int) ob->h)
|
||||
{
|
||||
ob->gl_context->master_clip.enabled = EINA_FALSE;
|
||||
}
|
||||
|
@ -1621,10 +1619,6 @@ eng_outbuf_flush(Outbuf *ob, Tilebuf_Rect *surface_damage EINA_UNUSED, Tilebuf_R
|
|||
else eglSwapInterval(ob->egl_disp, 0);
|
||||
ob->vsync = 1;
|
||||
}
|
||||
if (ob->info->callback.pre_swap)
|
||||
{
|
||||
ob->info->callback.pre_swap(ob->info->callback.data, ob->evas);
|
||||
}
|
||||
if ((glsym_eglSwapBuffersWithDamage) && (rects) &&
|
||||
(ob->swap_mode != MODE_FULL))
|
||||
{
|
||||
|
@ -1650,10 +1644,6 @@ eng_outbuf_flush(Outbuf *ob, Tilebuf_Rect *surface_damage EINA_UNUSED, Tilebuf_R
|
|||
eglSwapBuffers(ob->egl_disp, ob->egl_surface[0]);
|
||||
|
||||
//xx if (!safe_native) eglWaitGL();
|
||||
if (ob->info->callback.post_swap)
|
||||
{
|
||||
ob->info->callback.post_swap(ob->info->callback.data, ob->evas);
|
||||
}
|
||||
// if (eglGetError() != EGL_SUCCESS)
|
||||
// {
|
||||
// printf("Error: eglSwapBuffers() fail.\n");
|
||||
|
@ -1693,18 +1683,10 @@ eng_outbuf_flush(Outbuf *ob, Tilebuf_Rect *surface_damage EINA_UNUSED, Tilebuf_R
|
|||
}
|
||||
}
|
||||
#endif
|
||||
if (ob->info->callback.pre_swap)
|
||||
{
|
||||
ob->info->callback.pre_swap(ob->info->callback.data, ob->evas);
|
||||
}
|
||||
// XXX: if partial swaps can be done use re->rects
|
||||
// measure(0, "swap");
|
||||
glXSwapBuffers(ob->disp, ob->glxwin);
|
||||
// measure(1, "swap");
|
||||
if (ob->info->callback.post_swap)
|
||||
{
|
||||
ob->info->callback.post_swap(ob->info->callback.data, ob->evas);
|
||||
}
|
||||
#endif
|
||||
// clear out rects after swap as we may use them during swap
|
||||
|
||||
|
|
|
@ -43,8 +43,6 @@ static void *_output_setup(int w, int h);
|
|||
static void *eng_info(Evas *e);
|
||||
static void
|
||||
eng_info_free(Evas *e, void *info);
|
||||
static int
|
||||
eng_setup(Evas *e, void *info);
|
||||
static void
|
||||
eng_output_free(void *data);
|
||||
static void
|
||||
|
@ -149,23 +147,14 @@ eng_info_free(Evas *e EINA_UNUSED, void *info)
|
|||
free(in);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_setup(Evas *eo_e, void *in)
|
||||
static void *
|
||||
eng_setup(void *in, unsigned int w, unsigned int h)
|
||||
{
|
||||
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
||||
Evas_Engine_Info_PSL1GHT *info;
|
||||
Evas_Engine_Info_PSL1GHT *info = in;
|
||||
|
||||
printf ("eng_setup called\n");
|
||||
info = (Evas_Engine_Info_PSL1GHT *)in;
|
||||
|
||||
e->engine.data.output = _output_setup(e->output.w, e->output.h);
|
||||
if (!e->engine.data.output)
|
||||
return 0;
|
||||
|
||||
e->engine.func = &func;
|
||||
e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
|
||||
|
||||
return 1;
|
||||
return _output_setup(w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -87,48 +87,16 @@ eng_info_free(Evas *e EINA_UNUSED, void *info)
|
|||
free(in);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_setup(Evas *eo_e, void *in)
|
||||
static void *
|
||||
eng_setup(void *in, unsigned int w, unsigned int h)
|
||||
{
|
||||
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
||||
Render_Engine *re;
|
||||
Evas_Engine_Info_Software_DDraw *info;
|
||||
Evas_Engine_Info_Software_DDraw *info = in;
|
||||
|
||||
info = (Evas_Engine_Info_Software_DDraw *)in;
|
||||
if (!e->engine.data.output)
|
||||
e->engine.data.output = _output_setup(e->output.w,
|
||||
e->output.h,
|
||||
info->info.rotation,
|
||||
info->info.window,
|
||||
info->info.depth,
|
||||
info->info.fullscreen);
|
||||
else
|
||||
{
|
||||
Outbuf *ob;
|
||||
int ponebuf = 0;
|
||||
|
||||
re = e->engine.data.output;
|
||||
ponebuf = re->generic.ob->onebuf;
|
||||
|
||||
ob = evas_software_ddraw_outbuf_setup(e->output.w,
|
||||
e->output.h,
|
||||
info->info.rotation,
|
||||
OUTBUF_DEPTH_INHERIT,
|
||||
info->info.window,
|
||||
info->info.depth,
|
||||
info->info.fullscreen);
|
||||
if (!ob) return 0;
|
||||
evas_render_engine_software_generic_update(&re->generic, ob, e->output.w, e->output.h);
|
||||
|
||||
re->generic.ob->onebuf = ponebuf;
|
||||
}
|
||||
if (!e->engine.data.output) return 0;
|
||||
if (!e->engine.data.context)
|
||||
e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
|
||||
|
||||
re = e->engine.data.output;
|
||||
|
||||
return 1;
|
||||
return _output_setup(w, h,
|
||||
info->info.rotation,
|
||||
info->info.window,
|
||||
info->info.depth,
|
||||
info->info.fullscreen);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -90,51 +90,46 @@ eng_info_free(Evas *e EINA_UNUSED, void *info)
|
|||
free(in);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_setup(Evas *eo_e, void *in)
|
||||
static void *
|
||||
eng_setup(void *in, unsigned int w, unsigned int h)
|
||||
{
|
||||
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
||||
Render_Engine *re;
|
||||
Evas_Engine_Info_Software_Gdi *info;
|
||||
Render_Engine *re;
|
||||
|
||||
info = (Evas_Engine_Info_Software_Gdi *)in;
|
||||
if (!e->engine.data.output)
|
||||
e->engine.data.output = _output_setup(e->output.w,
|
||||
e->output.h,
|
||||
info->info.rotation,
|
||||
info->info.window,
|
||||
info->info.depth,
|
||||
info->info.borderless,
|
||||
info->info.fullscreen,
|
||||
info->info.region);
|
||||
else
|
||||
{
|
||||
Outbuf *ob;
|
||||
int ponebuf = 0;
|
||||
return _output_setup(w,
|
||||
h,
|
||||
info->info.rotation,
|
||||
info->info.window,
|
||||
info->info.depth,
|
||||
info->info.borderless,
|
||||
info->info.fullscreen,
|
||||
info->info.region);
|
||||
}
|
||||
|
||||
re = e->engine.data.output;
|
||||
ponebuf = re->generic.ob->onebuf;
|
||||
static int
|
||||
eng_update(void *data, void *in, unsigned int w, unsigned int h)
|
||||
{
|
||||
Render_Engine *re = data;
|
||||
Outbuf *ob;
|
||||
int ponebuf = 0;
|
||||
|
||||
ob = evas_software_gdi_outbuf_setup(e->output.w,
|
||||
e->output.h,
|
||||
info->info.rotation,
|
||||
OUTBUF_DEPTH_INHERIT,
|
||||
info->info.window,
|
||||
info->info.depth,
|
||||
info->info.borderless,
|
||||
info->info.fullscreen,
|
||||
info->info.region,
|
||||
0, 0);
|
||||
if (!ob) return 0;
|
||||
ponebuf = re->generic.ob->onebuf;
|
||||
|
||||
evas_render_engine_software_generic_update(&re->generic, ob, e->output.w, e->output.h);
|
||||
re->generic.ob->onebuf = ponebuf;
|
||||
}
|
||||
if (!e->engine.data.output) return 0;
|
||||
if (!e->engine.data.context)
|
||||
e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
|
||||
ob = evas_software_gdi_outbuf_setup(w,
|
||||
h,
|
||||
info->info.rotation,
|
||||
OUTBUF_DEPTH_INHERIT,
|
||||
info->info.window,
|
||||
info->info.depth,
|
||||
info->info.borderless,
|
||||
info->info.fullscreen,
|
||||
info->info.region,
|
||||
0, 0);
|
||||
if (!ob) return 0;
|
||||
|
||||
re = e->engine.data.output;
|
||||
evas_render_engine_software_generic_update(&re->generic, ob, w, h);
|
||||
re->generic.ob->onebuf = ponebuf;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -180,6 +175,7 @@ module_open(Evas_Module *em)
|
|||
ORD(info);
|
||||
ORD(info_free);
|
||||
ORD(setup);
|
||||
ORD(update);
|
||||
ORD(canvas_alpha_get);
|
||||
ORD(output_free);
|
||||
/* now advertise out own api */
|
||||
|
|
|
@ -4613,9 +4613,10 @@ eng_ector_end(void *data EINA_UNUSED, void *context EINA_UNUSED, Ector_Surface *
|
|||
|
||||
static Evas_Func func =
|
||||
{
|
||||
NULL, // eng_info
|
||||
NULL, // eng_info
|
||||
NULL, // eng_info_free
|
||||
NULL, // eng_setup
|
||||
NULL, // eng_update
|
||||
NULL, // eng_output_free
|
||||
eng_output_resize,
|
||||
eng_output_tile_size_set,
|
||||
|
|
|
@ -65,7 +65,6 @@ static int _best_depth_get(int backend, void *connection, int screen);
|
|||
|
||||
static void *eng_info(Evas *eo_e);
|
||||
static void eng_info_free(Evas *eo_e, void *info);
|
||||
static int eng_setup(Evas *eo_e, void *info);
|
||||
static void eng_output_free(void *data);
|
||||
|
||||
static Eina_List *_outbufs = NULL;
|
||||
|
@ -317,127 +316,115 @@ eng_info_free(Evas *eo_e EINA_UNUSED, void *info)
|
|||
free(in);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_setup(Evas *eo_e, void *in)
|
||||
static void *
|
||||
eng_setup(void *in, unsigned int w, unsigned int h)
|
||||
{
|
||||
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
||||
Evas_Engine_Info_Software_X11 *info;
|
||||
Evas_Engine_Info_Software_X11 *info = in;
|
||||
Render_Engine *re = NULL;
|
||||
static int try_swapbuf = -1;
|
||||
char* s;
|
||||
|
||||
info = (Evas_Engine_Info_Software_X11 *)in;
|
||||
if (!e->engine.data.output)
|
||||
if (info->info.backend != EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB)
|
||||
return NULL;
|
||||
|
||||
if (try_swapbuf == -1)
|
||||
{
|
||||
/* if we haven't initialized - init (automatic abort if already done) */
|
||||
|
||||
if (info->info.backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB)
|
||||
if ((s = getenv("EVAS_NO_DRI_SWAPBUF")) != NULL)
|
||||
{
|
||||
static int try_swapbuf = -1;
|
||||
char* s;
|
||||
|
||||
if (try_swapbuf == -1)
|
||||
{
|
||||
if ((s = getenv("EVAS_NO_DRI_SWAPBUF")) != NULL)
|
||||
{
|
||||
if (atoi(s) == 1) try_swapbuf = 0;
|
||||
else try_swapbuf = 1;
|
||||
}
|
||||
else try_swapbuf = 1;
|
||||
}
|
||||
if (try_swapbuf)
|
||||
re = _output_swapbuf_setup(e->output.w, e->output.h,
|
||||
info->info.rotation, info->info.connection,
|
||||
info->info.drawable, info->info.visual,
|
||||
info->info.colormap,
|
||||
info->info.depth, info->info.debug,
|
||||
info->info.alloc_grayscale,
|
||||
info->info.alloc_colors_max,
|
||||
info->info.mask, info->info.shape_dither,
|
||||
info->info.destination_alpha);
|
||||
if (re) re->outbuf_alpha_get = evas_software_xlib_swapbuf_alpha_get;
|
||||
else
|
||||
{
|
||||
re = _output_xlib_setup(e->output.w, e->output.h,
|
||||
info->info.rotation, info->info.connection,
|
||||
info->info.drawable, info->info.visual,
|
||||
info->info.colormap,
|
||||
info->info.depth, info->info.debug,
|
||||
info->info.alloc_grayscale,
|
||||
info->info.alloc_colors_max,
|
||||
info->info.mask, info->info.shape_dither,
|
||||
info->info.destination_alpha);
|
||||
re->outbuf_alpha_get = evas_software_xlib_outbuf_alpha_get;
|
||||
}
|
||||
re->generic.ob->region_push_hook.cb = info->func.region_push_hook;
|
||||
re->generic.ob->region_push_hook.evas = eo_e;
|
||||
if (atoi(s) == 1) try_swapbuf = 0;
|
||||
else try_swapbuf = 1;
|
||||
}
|
||||
e->engine.data.output = re;
|
||||
else try_swapbuf = 1;
|
||||
}
|
||||
|
||||
if (try_swapbuf)
|
||||
re = _output_swapbuf_setup(w, h,
|
||||
info->info.rotation, info->info.connection,
|
||||
info->info.drawable, info->info.visual,
|
||||
info->info.colormap,
|
||||
info->info.depth, info->info.debug,
|
||||
info->info.alloc_grayscale,
|
||||
info->info.alloc_colors_max,
|
||||
info->info.mask, info->info.shape_dither,
|
||||
info->info.destination_alpha);
|
||||
if (re) re->outbuf_alpha_get = evas_software_xlib_swapbuf_alpha_get;
|
||||
else
|
||||
{
|
||||
re = _output_xlib_setup(w, h,
|
||||
info->info.rotation, info->info.connection,
|
||||
info->info.drawable, info->info.visual,
|
||||
info->info.colormap,
|
||||
info->info.depth, info->info.debug,
|
||||
info->info.alloc_grayscale,
|
||||
info->info.alloc_colors_max,
|
||||
info->info.mask, info->info.shape_dither,
|
||||
info->info.destination_alpha);
|
||||
re->outbuf_alpha_get = evas_software_xlib_outbuf_alpha_get;
|
||||
}
|
||||
re->generic.ob->region_push_hook.cb = info->func.region_push_hook;
|
||||
re->generic.ob->region_push_hook.evas = eo_e;
|
||||
|
||||
_outbufs = eina_list_append(_outbufs, re->generic.ob);
|
||||
|
||||
return re;
|
||||
}
|
||||
|
||||
static int
|
||||
eng_update(void *data, void *in, unsigned int w, unsigned int h)
|
||||
{
|
||||
Evas_Engine_Info_Software_X11 *info = in;
|
||||
Render_Engine *re = data;
|
||||
Outbuf *ob = NULL;
|
||||
|
||||
if (info->info.backend != EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB)
|
||||
return 0;
|
||||
|
||||
_outbufs = eina_list_remove(_outbufs, re->generic.ob);
|
||||
|
||||
if (re->generic.outbuf_free == evas_software_xlib_swapbuf_free)
|
||||
{
|
||||
ob =
|
||||
evas_software_xlib_swapbuf_setup_x(w, h,
|
||||
info->info.rotation,
|
||||
OUTBUF_DEPTH_INHERIT,
|
||||
info->info.connection,
|
||||
info->info.drawable,
|
||||
info->info.visual,
|
||||
info->info.colormap,
|
||||
info->info.depth,
|
||||
info->info.alloc_grayscale,
|
||||
info->info.alloc_colors_max,
|
||||
info->info.mask,
|
||||
info->info.shape_dither,
|
||||
info->info.destination_alpha);
|
||||
}
|
||||
else
|
||||
{
|
||||
Outbuf *ob = NULL;
|
||||
/* int ponebuf = 0; */
|
||||
|
||||
re = e->engine.data.output;
|
||||
/* if ((re) && (re->ob)) ponebuf = re->ob->onebuf; */
|
||||
|
||||
_outbufs = eina_list_remove(_outbufs, re->generic.ob);
|
||||
|
||||
if (info->info.backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB)
|
||||
{
|
||||
if (re->generic.outbuf_free == evas_software_xlib_swapbuf_free)
|
||||
{
|
||||
ob =
|
||||
evas_software_xlib_swapbuf_setup_x(e->output.w, e->output.h,
|
||||
info->info.rotation,
|
||||
OUTBUF_DEPTH_INHERIT,
|
||||
info->info.connection,
|
||||
info->info.drawable,
|
||||
info->info.visual,
|
||||
info->info.colormap,
|
||||
info->info.depth,
|
||||
info->info.alloc_grayscale,
|
||||
info->info.alloc_colors_max,
|
||||
info->info.mask,
|
||||
info->info.shape_dither,
|
||||
info->info.destination_alpha);
|
||||
}
|
||||
else
|
||||
{
|
||||
ob =
|
||||
evas_software_xlib_outbuf_setup_x(e->output.w, e->output.h,
|
||||
info->info.rotation,
|
||||
OUTBUF_DEPTH_INHERIT,
|
||||
info->info.connection,
|
||||
info->info.drawable,
|
||||
info->info.visual,
|
||||
info->info.colormap,
|
||||
info->info.depth,
|
||||
info->info.alloc_grayscale,
|
||||
info->info.alloc_colors_max,
|
||||
info->info.mask,
|
||||
info->info.shape_dither,
|
||||
info->info.destination_alpha);
|
||||
if (ob)
|
||||
evas_software_xlib_outbuf_debug_set(ob, info->info.debug);
|
||||
}
|
||||
}
|
||||
ob =
|
||||
evas_software_xlib_outbuf_setup_x(w, h,
|
||||
info->info.rotation,
|
||||
OUTBUF_DEPTH_INHERIT,
|
||||
info->info.connection,
|
||||
info->info.drawable,
|
||||
info->info.visual,
|
||||
info->info.colormap,
|
||||
info->info.depth,
|
||||
info->info.alloc_grayscale,
|
||||
info->info.alloc_colors_max,
|
||||
info->info.mask,
|
||||
info->info.shape_dither,
|
||||
info->info.destination_alpha);
|
||||
if (ob)
|
||||
{
|
||||
evas_render_engine_software_generic_update(&re->generic, ob, e->output.w, e->output.h);
|
||||
ob->region_push_hook.cb = info->func.region_push_hook;
|
||||
ob->region_push_hook.evas = eo_e;
|
||||
}
|
||||
|
||||
/* if ((re) && (re->ob)) re->ob->onebuf = ponebuf; */
|
||||
evas_software_xlib_outbuf_debug_set(ob, info->info.debug);
|
||||
}
|
||||
if (!e->engine.data.output) return 0;
|
||||
if (!e->engine.data.context)
|
||||
|
||||
if (ob)
|
||||
{
|
||||
e->engine.data.context =
|
||||
e->engine.func->context_new(e->engine.data.output);
|
||||
evas_render_engine_software_generic_update(&re->generic, ob, w, h);
|
||||
ob->region_push_hook.cb = info->func.region_push_hook;
|
||||
ob->region_push_hook.evas = eo_e;
|
||||
}
|
||||
|
||||
re = e->engine.data.output;
|
||||
_outbufs = eina_list_append(_outbufs, re->generic.ob);
|
||||
|
||||
return 1;
|
||||
|
@ -664,6 +651,7 @@ module_open(Evas_Module *em)
|
|||
ORD(info);
|
||||
ORD(info_free);
|
||||
ORD(setup);
|
||||
ORD(update);
|
||||
ORD(canvas_alpha_get);
|
||||
ORD(output_free);
|
||||
ORD(image_native_init);
|
||||
|
|
|
@ -524,19 +524,12 @@ eng_info_free(Evas *evas EINA_UNUSED, void *info)
|
|||
free(inf);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_setup(Evas *evas, void *info)
|
||||
static Render_Engine_Swap_Mode
|
||||
_eng_swap_mode_get(void)
|
||||
{
|
||||
Render_Engine_Swap_Mode swap_mode = MODE_FULL;
|
||||
Evas_Engine_Info_Wayland *inf;
|
||||
Evas_Public_Data *epd;
|
||||
Render_Engine *re;
|
||||
Outbuf *ob;
|
||||
const char *s;
|
||||
|
||||
inf = (Evas_Engine_Info_Wayland *)info;
|
||||
epd = efl_data_scope_get(evas, EVAS_CANVAS_CLASS);
|
||||
|
||||
if ((s = getenv("EVAS_GL_SWAP_MODE")))
|
||||
{
|
||||
if ((!strcasecmp(s, "full")) ||
|
||||
|
@ -558,149 +551,105 @@ eng_setup(Evas *evas, void *info)
|
|||
(!strcasecmp(s, "4")))
|
||||
swap_mode = MODE_QUADRUPLE;
|
||||
}
|
||||
else swap_mode = MODE_AUTO;
|
||||
|
||||
if (!(re = epd->engine.data.output))
|
||||
{
|
||||
Render_Engine_Merge_Mode merge = MERGE_SMART;
|
||||
|
||||
/* FIXME: Remove this line as soon as eglGetDisplay() autodetection
|
||||
* gets fixed. Currently it is incorrectly detecting wl_display and
|
||||
* returning _EGL_PLATFORM_X11 instead of _EGL_PLATFORM_WAYLAND.
|
||||
*
|
||||
* See ticket #1972 for more info.
|
||||
*/
|
||||
setenv("EGL_PLATFORM", "wayland", 1);
|
||||
|
||||
/* try to allocate space for a new render engine */
|
||||
if (!(re = calloc(1, sizeof(Render_Engine))))
|
||||
return 0;
|
||||
|
||||
/* if we have not initialize gl & evas, do it */
|
||||
if (!initted)
|
||||
{
|
||||
glsym_evas_gl_preload_init();
|
||||
}
|
||||
|
||||
ob = eng_window_new(evas, inf, epd->output.w, epd->output.h, swap_mode);
|
||||
if (!ob) goto ob_err;
|
||||
|
||||
if (!evas_render_engine_gl_generic_init(&re->generic, ob,
|
||||
eng_outbuf_swap_mode_get,
|
||||
eng_outbuf_rotation_get,
|
||||
eng_outbuf_reconfigure,
|
||||
eng_outbuf_region_first_rect,
|
||||
eng_outbuf_damage_region_set,
|
||||
eng_outbuf_update_region_new,
|
||||
eng_outbuf_update_region_push,
|
||||
eng_outbuf_update_region_free,
|
||||
NULL,
|
||||
eng_outbuf_flush,
|
||||
NULL,
|
||||
eng_window_free,
|
||||
eng_window_use,
|
||||
eng_outbuf_gl_context_get,
|
||||
eng_outbuf_egl_display_get,
|
||||
eng_gl_context_new,
|
||||
eng_gl_context_use,
|
||||
&evgl_funcs,
|
||||
epd->output.w, epd->output.h))
|
||||
{
|
||||
eng_window_free(ob);
|
||||
goto ob_err;
|
||||
}
|
||||
|
||||
epd->engine.data.output = re;
|
||||
gl_wins++;
|
||||
|
||||
if ((s = getenv("EVAS_GL_PARTIAL_MERGE")))
|
||||
{
|
||||
if ((!strcmp(s, "bounding")) || (!strcmp(s, "b")))
|
||||
merge = MERGE_BOUNDING;
|
||||
else if ((!strcmp(s, "full")) || (!strcmp(s, "f")))
|
||||
merge = MERGE_FULL;
|
||||
else if ((!strcmp(s, "smart")) || (!strcmp(s, "s")))
|
||||
merge = MERGE_SMART;
|
||||
}
|
||||
|
||||
evas_render_engine_software_generic_merge_mode_set(&re->generic.software, merge);
|
||||
|
||||
if (!initted)
|
||||
{
|
||||
gl_extn_veto(re);
|
||||
initted = EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
re = epd->engine.data.output;
|
||||
ob = eng_get_ob(re);
|
||||
|
||||
if (!inf->info.wl_surface && (ob->egl_surface[0] != EGL_NO_SURFACE))
|
||||
{
|
||||
eglDestroySurface(ob->egl_disp, ob->egl_surface[0]);
|
||||
eglMakeCurrent(ob->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||
EGL_NO_CONTEXT);
|
||||
ob->egl_surface[0] = EGL_NO_SURFACE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((ob) && (_re_wincheck(ob)))
|
||||
{
|
||||
ob->info = inf;
|
||||
if ((ob->info->info.wl_display != ob->disp) ||
|
||||
(ob->info->info.wl_surface != ob->surface) ||
|
||||
/* FIXME: comment out below line.
|
||||
* since there is no place set the info->info.win for now,
|
||||
* it causes renew the window unnecessarily.
|
||||
*/
|
||||
/* (ob->info->info.win != ob->win) || */
|
||||
(ob->info->info.depth != ob->depth) ||
|
||||
(ob->info->info.destination_alpha != ob->alpha))
|
||||
{
|
||||
gl_wins--;
|
||||
if (!ob->info->info.wl_display)
|
||||
{
|
||||
eng_window_free(re->generic.software.ob);
|
||||
re->generic.software.ob = NULL;
|
||||
epd->engine.data.output = NULL;
|
||||
goto ob_err;
|
||||
}
|
||||
|
||||
ob = eng_window_new(evas, inf, epd->output.w, epd->output.h, swap_mode);
|
||||
if (!ob) goto ob_err;
|
||||
|
||||
eng_window_use(ob);
|
||||
|
||||
evas_render_engine_software_generic_update(&re->generic.software, ob,
|
||||
epd->output.w, epd->output.h);
|
||||
gl_wins++;
|
||||
}
|
||||
else if ((ob->w != epd->output.w) || (ob->h != epd->output.h) ||
|
||||
(ob->info->info.rotation != ob->rot))
|
||||
{
|
||||
eng_outbuf_reconfigure(ob, epd->output.w, epd->output.h,
|
||||
ob->info->info.rotation, 0);
|
||||
}
|
||||
}
|
||||
swap_mode = MODE_AUTO;
|
||||
}
|
||||
|
||||
if (!eng_get_ob(re)) goto ob_err;
|
||||
return swap_mode;
|
||||
}
|
||||
|
||||
if (!epd->engine.data.output)
|
||||
static Render_Engine_Merge_Mode
|
||||
_eng_merge_mode_get(void)
|
||||
{
|
||||
Render_Engine_Merge_Mode merge = MERGE_SMART;
|
||||
const char *s;
|
||||
|
||||
if ((s = getenv("EVAS_GL_PARTIAL_MERGE")))
|
||||
{
|
||||
if (eng_get_ob(re))
|
||||
{
|
||||
eng_window_free(eng_get_ob(re));
|
||||
gl_wins--;
|
||||
}
|
||||
goto ob_err;
|
||||
if ((!strcmp(s, "bounding")) || (!strcmp(s, "b")))
|
||||
merge = MERGE_BOUNDING;
|
||||
else if ((!strcmp(s, "full")) || (!strcmp(s, "f")))
|
||||
merge = MERGE_FULL;
|
||||
else if ((!strcmp(s, "smart")) || (!strcmp(s, "s")))
|
||||
merge = MERGE_SMART;
|
||||
}
|
||||
|
||||
return merge;
|
||||
}
|
||||
|
||||
static void *
|
||||
eng_setup(void *info, unsigned int w, unsigned int h)
|
||||
{
|
||||
Evas_Engine_Info_Wayland *inf = info;
|
||||
Render_Engine *re;
|
||||
Outbuf *ob;
|
||||
Render_Engine_Swap_Mode swap_mode;
|
||||
Render_Engine_Merge_Mode merge;
|
||||
|
||||
swap_mode = _eng_swap_mode_get();
|
||||
merge = _eng_merge_mode_get();
|
||||
|
||||
/* FIXME: Remove this line as soon as eglGetDisplay() autodetection
|
||||
* gets fixed. Currently it is incorrectly detecting wl_display and
|
||||
* returning _EGL_PLATFORM_X11 instead of _EGL_PLATFORM_WAYLAND.
|
||||
*
|
||||
* See ticket #1972 for more info.
|
||||
*/
|
||||
setenv("EGL_PLATFORM", "wayland", 1);
|
||||
|
||||
/* try to allocate space for a new render engine */
|
||||
if (!(re = calloc(1, sizeof(Render_Engine))))
|
||||
return NULL;
|
||||
|
||||
/* if we have not initialize gl & evas, do it */
|
||||
if (!initted)
|
||||
{
|
||||
glsym_evas_gl_preload_init();
|
||||
}
|
||||
|
||||
ob = eng_window_new(evas, inf, w, h, swap_mode);
|
||||
if (!ob) goto ob_err;
|
||||
|
||||
if (!evas_render_engine_gl_generic_init(&re->generic, ob,
|
||||
eng_outbuf_swap_mode_get,
|
||||
eng_outbuf_rotation_get,
|
||||
eng_outbuf_reconfigure,
|
||||
eng_outbuf_region_first_rect,
|
||||
eng_outbuf_damage_region_set,
|
||||
eng_outbuf_update_region_new,
|
||||
eng_outbuf_update_region_push,
|
||||
eng_outbuf_update_region_free,
|
||||
NULL,
|
||||
eng_outbuf_flush,
|
||||
NULL,
|
||||
eng_window_free,
|
||||
eng_window_use,
|
||||
eng_outbuf_gl_context_get,
|
||||
eng_outbuf_egl_display_get,
|
||||
eng_gl_context_new,
|
||||
eng_gl_context_use,
|
||||
&evgl_funcs,
|
||||
w, h))
|
||||
{
|
||||
eng_window_free(ob);
|
||||
free(re);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gl_wins++;
|
||||
|
||||
evas_render_engine_software_generic_merge_mode_set(&re->generic.software, merge);
|
||||
|
||||
if (!initted)
|
||||
{
|
||||
gl_extn_veto(re);
|
||||
initted = EINA_TRUE;
|
||||
}
|
||||
|
||||
if (re->generic.software.tb)
|
||||
evas_common_tilebuf_free(re->generic.software.tb);
|
||||
re->generic.software.tb =
|
||||
evas_common_tilebuf_new(epd->output.w, epd->output.h);
|
||||
re->generic.software.tb = evas_common_tilebuf_new(w, h);
|
||||
|
||||
if (re->generic.software.tb)
|
||||
{
|
||||
|
@ -710,10 +659,79 @@ eng_setup(Evas *evas, void *info)
|
|||
(&re->generic.software, EINA_TRUE);
|
||||
}
|
||||
|
||||
if (!epd->engine.data.context)
|
||||
eng_window_use(eng_get_ob(re));
|
||||
|
||||
return re;
|
||||
}
|
||||
|
||||
static int
|
||||
eng_update(void *data, void *info, unsigned int w, unsigned int h)
|
||||
{
|
||||
Evas_Engine_Info_Wayland *inf = info;
|
||||
Render_Engine *re = data;
|
||||
Outbuf *ob;
|
||||
|
||||
ob = eng_get_ob(re);
|
||||
|
||||
if (!inf->info.wl_surface && (ob->egl_surface[0] != EGL_NO_SURFACE))
|
||||
{
|
||||
epd->engine.data.context =
|
||||
epd->engine.func->context_new(epd->engine.data.output);
|
||||
eglDestroySurface(ob->egl_disp, ob->egl_surface[0]);
|
||||
eglMakeCurrent(ob->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||
EGL_NO_CONTEXT);
|
||||
ob->egl_surface[0] = EGL_NO_SURFACE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((ob) && (_re_wincheck(ob)))
|
||||
{
|
||||
ob->info = inf;
|
||||
if ((ob->info->info.wl_display != ob->disp) ||
|
||||
(ob->info->info.wl_surface != ob->surface) ||
|
||||
/* FIXME: comment out below line.
|
||||
* since there is no place set the info->info.win for now,
|
||||
* it causes renew the window unnecessarily.
|
||||
*/
|
||||
/* (ob->info->info.win != ob->win) || */
|
||||
(ob->info->info.depth != ob->depth) ||
|
||||
(ob->info->info.destination_alpha != ob->alpha))
|
||||
{
|
||||
gl_wins--;
|
||||
if (!ob->info->info.wl_display)
|
||||
{
|
||||
eng_window_free(ob);
|
||||
re->generic.software.ob = NULL;
|
||||
goto ob_err;
|
||||
}
|
||||
|
||||
ob = eng_window_new(evas, inf, w, h, swap_mode);
|
||||
if (!ob) goto ob_err;
|
||||
|
||||
eng_window_use(ob);
|
||||
|
||||
evas_render_engine_software_generic_update(&re->generic.software, ob,
|
||||
w, h);
|
||||
gl_wins++;
|
||||
}
|
||||
else if ((ob->w != w) || (ob->h != h) ||
|
||||
(ob->info->info.rotation != ob->rot))
|
||||
{
|
||||
eng_outbuf_reconfigure(ob, w, h,
|
||||
ob->info->info.rotation, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (!eng_get_ob(re)) goto ob_err;
|
||||
|
||||
if (re->generic.software.tb)
|
||||
evas_common_tilebuf_free(re->generic.software.tb);
|
||||
re->generic.software.tb = evas_common_tilebuf_new(w, h);
|
||||
|
||||
if (re->generic.software.tb)
|
||||
{
|
||||
evas_common_tilebuf_set_tile_size(re->generic.software.tb,
|
||||
TILESIZE, TILESIZE);
|
||||
evas_render_engine_software_generic_tile_strict_set
|
||||
(&re->generic.software, EINA_TRUE);
|
||||
}
|
||||
|
||||
eng_window_use(eng_get_ob(re));
|
||||
|
@ -721,7 +739,6 @@ eng_setup(Evas *evas, void *info)
|
|||
return 1;
|
||||
|
||||
ob_err:
|
||||
free(re);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1407,6 +1424,7 @@ module_open(Evas_Module *em)
|
|||
ORD(info);
|
||||
ORD(info_free);
|
||||
ORD(setup);
|
||||
ORD(update);
|
||||
ORD(canvas_alpha_get);
|
||||
|
||||
ORD(output_free);
|
||||
|
|
|
@ -75,6 +75,8 @@ _render_engine_swapbuf_setup(int w, int h, Evas_Engine_Info_Wayland *einfo)
|
|||
|
||||
evas_render_engine_software_generic_merge_mode_set(&re->generic, merge_mode);
|
||||
|
||||
re->generic.ob->info = einfo;
|
||||
|
||||
/* return allocated render engine */
|
||||
return re;
|
||||
|
||||
|
@ -134,61 +136,34 @@ eng_info_free(Evas *eo_evas EINA_UNUSED, void *info)
|
|||
free(einfo);
|
||||
}
|
||||
|
||||
static int
|
||||
eng_setup(Evas *eo_evas, void *info)
|
||||
static void *
|
||||
eng_setup(void *info, unsigned int w, unsigned int h)
|
||||
{
|
||||
Evas_Engine_Info_Wayland *einfo;
|
||||
Evas_Public_Data *epd;
|
||||
Evas_Engine_Info_Wayland *einfo = info;
|
||||
Render_Engine *re = NULL;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
/* try to cast to our engine info */
|
||||
if (!(einfo = (Evas_Engine_Info_Wayland *)info))
|
||||
return 0;
|
||||
return _render_engine_swapbuf_setup(w, h, einfo);
|
||||
}
|
||||
|
||||
/* try to get evas public data */
|
||||
if (!(epd = efl_data_scope_get(eo_evas, EVAS_CANVAS_CLASS)))
|
||||
return 0;
|
||||
static int
|
||||
eng_update(void *data, void *info, unsigned int w, unsigned int h)
|
||||
{
|
||||
Evas_Engine_Info_Wayland *einfo = info;
|
||||
Render_Engine *re = data;
|
||||
Outbuf *ob;
|
||||
|
||||
/* test for valid engine output */
|
||||
if (!(re = epd->engine.data.output))
|
||||
{
|
||||
/* if we have no engine data, assume we have not initialized yet */
|
||||
if (!einfo->info.wl_surface) return 0;
|
||||
if (!einfo->info.hidden) return 1;
|
||||
|
||||
re = _render_engine_swapbuf_setup(epd->output.w, epd->output.h, einfo);
|
||||
eng_output_resize(re, w, h);
|
||||
if (!ob) return 0;
|
||||
|
||||
if (re)
|
||||
re->generic.ob->info = einfo;
|
||||
else
|
||||
goto err;
|
||||
}
|
||||
else if ((einfo->info.wl_surface) && (!einfo->info.hidden))
|
||||
{
|
||||
eng_output_resize(re, epd->output.w, epd->output.h);
|
||||
evas_render_engine_software_generic_update(&re->generic,
|
||||
re->generic.ob,
|
||||
epd->output.w,
|
||||
epd->output.h);
|
||||
}
|
||||
|
||||
epd->engine.data.output = re;
|
||||
if (!epd->engine.data.output)
|
||||
{
|
||||
ERR("Failed to create Render Engine");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!epd->engine.data.context)
|
||||
{
|
||||
epd->engine.data.context =
|
||||
epd->engine.func->context_new(epd->engine.data.output);
|
||||
}
|
||||
evas_render_engine_software_generic_update(&re->generic, ob,
|
||||
w, h);
|
||||
|
||||
return 1;
|
||||
|
||||
err:
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -393,6 +368,7 @@ module_open(Evas_Module *em)
|
|||
ORD(info);
|
||||
ORD(info_free);
|
||||
ORD(setup);
|
||||
ORD(update);
|
||||
ORD(output_free);
|
||||
ORD(output_resize);
|
||||
ORD(image_native_set);
|
||||
|
|
Loading…
Reference in New Issue