evas: fix evas flushing its command queue to wrong gl context in gl-backends

For native surface rendering (glX, egl) in gl-backend,  if pixel get callback
function is called for native rendering, there is a case where evas will
try to call evas_gl_common_context_flush() to flush its remaining commands
in its command queue while the context is set current to the native surface/
context that is called within the pixel get callback.  So, I've added an
engine function that forces a flush before it enters the pixel get callback
function.
This commit is contained in:
Sung W. Park 2013-05-13 14:12:36 +09:00
parent b77016ad02
commit 97806103eb
5 changed files with 30 additions and 0 deletions

View File

@ -3812,6 +3812,9 @@ evas_object_image_render(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, v
{
if (o->pixels->func.get_pixels)
{
if (obj->layer->evas->engine.func->context_flush)
obj->layer->evas->engine.func->context_flush(output);
// Set img object for direct rendering optimization
// Check for image w/h against image geometry w/h
// Check for image color r,g,b,a = {255,255,255,255}

View File

@ -896,6 +896,8 @@ struct _Evas_Func
Eina_Bool (*multi_font_draw) (void *data, void *context, void *surface, Evas_Font_Set *font, int x, int y, int w, int h, int ow, int oh, Evas_Font_Array *texts, Eina_Bool do_async);
Eina_Bool (*pixel_alpha_get) (void *image, int x, int y, DATA8 *alpha, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h);
void (*context_flush) (void *data);
};
struct _Evas_Image_Save_Func

View File

@ -3270,6 +3270,16 @@ eng_pixel_alpha_get(void *image, int x, int y, DATA8 *alpha, int src_region_x, i
return EINA_TRUE;
}
static void
eng_context_flush(void *data)
{
Render_Engine *re;
re = (Render_Engine *)data;
eng_window_use(re->win);
evas_gl_common_context_flush(re->win->gl_context);
}
static int
module_open(Evas_Module *em)
{
@ -3388,6 +3398,8 @@ module_open(Evas_Module *em)
ORD(pixel_alpha_get);
ORD(context_flush);
/* now advertise out own api */
em->functions = (void *)(&func);
return 1;

View File

@ -2674,6 +2674,7 @@ static Evas_Func func =
NULL,
eng_multi_font_draw,
eng_pixel_alpha_get,
NULL, // eng_context_flush - software doesn't use it
/* FUTURE software generic calls go here */
};

View File

@ -3691,6 +3691,16 @@ eng_image_max_size_get(void *data, int *maxw, int *maxh)
if (maxh) *maxh = re->win->gl_context->shared->info.max_texture_size;
}
static void
eng_context_flush(void *data)
{
Render_Engine *re;
re = (Render_Engine *)data;
eng_window_use(re->win);
evas_gl_common_context_flush(re->win->gl_context);
}
static int
module_open(Evas_Module *em)
{
@ -3807,6 +3817,8 @@ module_open(Evas_Module *em)
ORD(image_max_size_get);
ORD(context_flush);
/* now advertise out own api */
em->functions = (void *)(&func);
return 1;