jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=517109858e93d11bdc06556446de377085d69832

commit 517109858e93d11bdc06556446de377085d69832
Author: Dongyeon Kim <dy5....@samsung.com>
Date:   Tue May 12 12:03:29 2015 +0900

    Evas GL: Match FBO config with window surface config
    
    Summary:
    When direct rendering is enabled, FBO configuration should match
    window surface configuration as FBO will be used in fallback cases.
    So create FBO with configuration from window surface.
    @fix
---
 src/modules/evas/engines/gl_common/evas_gl_core.c  | 33 +++++++++++++++++++---
 .../evas/engines/gl_common/evas_gl_core_private.h  |  2 +-
 src/modules/evas/engines/gl_drm/evas_engine.c      |  2 +-
 src/modules/evas/engines/gl_sdl/evas_engine.c      |  2 +-
 src/modules/evas/engines/gl_x11/evas_engine.c      | 27 +++++++++---------
 src/modules/evas/engines/wayland_egl/evas_engine.c |  2 +-
 6 files changed, 46 insertions(+), 22 deletions(-)

diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.c 
b/src/modules/evas/engines/gl_common/evas_gl_core.c
index a173c4e..38b3cb0 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.c
@@ -1262,6 +1262,7 @@ _internal_config_set(void *eng_data, EVGL_Surface *sfc, 
Evas_GL_Config *cfg)
    int i = 0, cfg_index = -1;
    int color_bit = 0, depth_bit = 0, stencil_bit = 0, msaa_samples = 0;
    int depth_size = 0;
+   int native_win_depth = 0, native_win_stencil = 0, native_win_msaa = 0;
    Eina_Bool support_win_cfg = 1;
 
    // Check if engine is valid
@@ -1316,11 +1317,20 @@ try_again:
              sfc->msaa_samples      = evgl_engine->caps.fbo_fmts[i].samples;
 
              // Direct Rendering Option
-             if (((depth_bit > 0) || (stencil_bit > 0) || (msaa_samples > 0))
-                  && (evgl_engine->funcs->native_win_surface_config_check))
+             if (evgl_engine->funcs->native_win_surface_config_get)
+               evgl_engine->funcs->native_win_surface_config_get(eng_data, 
&native_win_depth, &native_win_stencil, &native_win_msaa);
+             if ((native_win_depth >= depth_size)
+                 && (native_win_stencil >= stencil_bit)
+                 && (native_win_msaa >= msaa_samples))
                {
-                  DBG("request to check win cfg with depth %d, stencil %d, 
msaa %d", depth_size, stencil_bit, msaa_samples);
-                  support_win_cfg = 
evgl_engine->funcs->native_win_surface_config_check(eng_data, depth_size, 
stencil_bit, msaa_samples);
+                  DBG("Win cfg can support the Req Evas GL's config 
successfully");
+                  support_win_cfg = EINA_TRUE;
+               }
+             else
+               {
+                  ERR("Win cfg can't support Evas GL DR win (depth %d, stencil 
%d, msaa %d)",
+                      native_win_depth, native_win_stencil, native_win_msaa);
+                  support_win_cfg = EINA_FALSE;
                }
 
              if ((sfc->direct_override) || support_win_cfg)
@@ -1337,6 +1347,21 @@ try_again:
                       s1[cfg->depth_bits], s2[cfg->stencil_bits], 
s3[cfg->multisample_bits]);
                }
 
+             // When direct rendering is enabled, FBO configuration should 
match
+             // window surface configuration as FBO will be used in fallback 
cases.
+             // So we search again for the formats that match window surface's.
+             if (sfc->direct_fb_opt &&
+                 ((native_win_depth != depth_size) ||
+                  (native_win_stencil != stencil_bit) ||
+                  (native_win_msaa != msaa_samples)))
+               {
+                  depth_bit = (1 << ((native_win_depth / 8) - 1));
+                  depth_size = native_win_depth;
+                  stencil_bit = native_win_stencil;
+                  msaa_samples = native_win_msaa;
+                  goto try_again;
+               }
+
              // Extra flags for direct rendering
              sfc->client_side_rotation = !!(cfg->options_bits & 
EVAS_GL_OPTIONS_CLIENT_SIDE_ROTATION);
              sfc->alpha = (cfg->color_format == EVAS_GL_RGBA_8888);
diff --git a/src/modules/evas/engines/gl_common/evas_gl_core_private.h 
b/src/modules/evas/engines/gl_common/evas_gl_core_private.h
index 4ad6426..c90fea0 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core_private.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_core_private.h
@@ -79,7 +79,7 @@ struct _EVGL_Interface
    void       *(*gles_context_create)(void *data, EVGL_Context *share_ctx, 
EVGL_Surface *evgl_sfc);
 
    // Check native window surface config for Evas GL Direct Rendering
-   Eina_Bool   (*native_win_surface_config_check)(void *data, int evgl_depth, 
int evgl_stencil, int evgl_msaa);
+   void        (*native_win_surface_config_get)(void *data, int *win_depth, 
int *win_stencil, int *win_msaa);
 };
 
 struct _EVGL_Surface
diff --git a/src/modules/evas/engines/gl_drm/evas_engine.c 
b/src/modules/evas/engines/gl_drm/evas_engine.c
index 75b54af..0049819 100644
--- a/src/modules/evas/engines/gl_drm/evas_engine.c
+++ b/src/modules/evas/engines/gl_drm/evas_engine.c
@@ -133,7 +133,7 @@ static const EVGL_Interface evgl_funcs =
    NULL, // OpenGL-ES 1
    NULL, // OpenGL-ES 1
    NULL, // OpenGL-ES 1
-   NULL, // native_win_surface_config_check
+   NULL, // native_win_surface_config_get
 };
 
 /* local functions */
diff --git a/src/modules/evas/engines/gl_sdl/evas_engine.c 
b/src/modules/evas/engines/gl_sdl/evas_engine.c
index 5691684..56a2c7d 100644
--- a/src/modules/evas/engines/gl_sdl/evas_engine.c
+++ b/src/modules/evas/engines/gl_sdl/evas_engine.c
@@ -260,7 +260,7 @@ static const EVGL_Interface evgl_funcs =
    NULL, // OpenGL-ES 1
    NULL, // OpenGL-ES 1
    NULL, // OpenGL-ES 1
-   NULL, // native_win_surface_config_check
+   NULL, // native_win_surface_config_get
 };
 
 
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c 
b/src/modules/evas/engines/gl_x11/evas_engine.c
index 604f22e..f3dce21 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -1201,25 +1201,24 @@ evgl_eng_gles_context_create(void *data,
 #endif
 }
 
-static Eina_Bool
-evgl_eng_native_win_surface_config_check(void *data, int evgl_depth,
-                                         int evgl_stencil, int evgl_msaa)
+static void
+evgl_eng_native_win_surface_config_get(void *data, int *win_depth,
+                                         int *win_stencil, int *win_msaa)
 {
    Render_Engine *re = data;
-   if (!re) return EINA_FALSE;
+   if (!re) return;
 
-   if ((eng_get_ob(re)->detected.depth_buffer_size >= evgl_depth)
-       && (eng_get_ob(re)->detected.stencil_buffer_size >= evgl_stencil)
-       && (eng_get_ob(re)->detected.msaa >= evgl_msaa))
-     {
-        DBG("Win cfg can support the Req Evas GL's config successfully");
-        return EINA_TRUE;
-     }
-   DBG("Win cfg can't support Evas GL DR win (depth %d, stencil %d, msaa %d)",
+   if (win_depth)
+     *win_depth = eng_get_ob(re)->detected.depth_buffer_size;
+   if (win_stencil)
+     *win_stencil = eng_get_ob(re)->detected.stencil_buffer_size;
+   if (win_msaa)
+     *win_msaa = eng_get_ob(re)->detected.msaa;
+
+   DBG("Window config(depth %d, stencil %d, msaa %d)",
        eng_get_ob(re)->detected.depth_buffer_size,
        eng_get_ob(re)->detected.stencil_buffer_size,
        eng_get_ob(re)->detected.msaa);
-   return EINA_FALSE;
 }
 
 static const EVGL_Interface evgl_funcs =
@@ -1241,7 +1240,7 @@ static const EVGL_Interface evgl_funcs =
    evgl_eng_indirect_surface_create,
    evgl_eng_indirect_surface_destroy,
    evgl_eng_gles_context_create,
-   evgl_eng_native_win_surface_config_check,
+   evgl_eng_native_win_surface_config_get,
 };
 
 //----------------------------------------------------------//
diff --git a/src/modules/evas/engines/wayland_egl/evas_engine.c 
b/src/modules/evas/engines/wayland_egl/evas_engine.c
index b088158..47ac0e2 100644
--- a/src/modules/evas/engines/wayland_egl/evas_engine.c
+++ b/src/modules/evas/engines/wayland_egl/evas_engine.c
@@ -484,7 +484,7 @@ static const EVGL_Interface evgl_funcs =
    NULL, // OpenGL-ES 1
    NULL, // OpenGL-ES 1
    NULL, // OpenGL-ES 1
-   NULL, // native_win_surface_config_check
+   NULL, // native_win_surface_config_get
 };
 
 /* engine functions */

-- 


Reply via email to