sung pushed a commit to branch master.

commit 97806103ebc76059ab144a4842723bebabadb510
Author: Sung W. Park <[email protected]>
Date:   Mon May 13 14:12:36 2013 +0900

    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.
---
 src/lib/evas/canvas/evas_object_image.c                 |  3 +++
 src/lib/evas/include/evas_private.h                     |  2 ++
 src/modules/evas/engines/gl_x11/evas_engine.c           | 12 ++++++++++++
 src/modules/evas/engines/software_generic/evas_engine.c |  1 +
 src/modules/evas/engines/wayland_egl/evas_engine.c      | 12 ++++++++++++
 5 files changed, 30 insertions(+)

diff --git a/src/lib/evas/canvas/evas_object_image.c 
b/src/lib/evas/canvas/evas_object_image.c
index 8f86d67..09269e0 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -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}
diff --git a/src/lib/evas/include/evas_private.h 
b/src/lib/evas/include/evas_private.h
index d0df9df..831f900 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -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
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c 
b/src/modules/evas/engines/gl_x11/evas_engine.c
index a48cbae..76cf8c5 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -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;
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c 
b/src/modules/evas/engines/software_generic/evas_engine.c
index 636e11b..bb2d4b8 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -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 */
 };
 
diff --git a/src/modules/evas/engines/wayland_egl/evas_engine.c 
b/src/modules/evas/engines/wayland_egl/evas_engine.c
index b447387..58ea516 100644
--- a/src/modules/evas/engines/wayland_egl/evas_engine.c
+++ b/src/modules/evas/engines/wayland_egl/evas_engine.c
@@ -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;

-- 

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may

Reply via email to