summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongyeon Kim <dy5.kim@samsung.com>2015-04-30 16:04:47 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-06-03 11:30:22 +0900
commite4e67732c26d581ff0cf3ae3ef4d5f460b574e60 (patch)
tree901c165e95f603e8a78e434afd1a97da3d04b7c4
parent660bfcf3c2bafb58bf0957c28f92572195ffa3ec (diff)
Evas GL: return correct context for context_get with indirect context
Summary: When evas gl falls back to using indirect context, evas_gl_current_context_get() should return the indirect context. @fix
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_core.c18
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_core.h2
-rw-r--r--src/modules/evas/engines/gl_x11/evas_engine.c15
3 files changed, 28 insertions, 7 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 3b75ca356c..a173c4e228 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.c
@@ -1500,6 +1500,22 @@ evas_gl_common_current_context_get(void)
1500 return rsc->current_ctx; 1500 return rsc->current_ctx;
1501} 1501}
1502 1502
1503EAPI void *
1504evgl_current_native_context_get(EVGL_Context *ctx)
1505{
1506 EVGLNative_Context context;
1507
1508 if (!ctx)
1509 return NULL;
1510
1511 context = ctx->context;
1512
1513 if ((ctx->pixmap_image_supported) && evgl_direct_rendered())
1514 context = ctx->indirect_context;
1515
1516 return context;
1517}
1518
1503int 1519int
1504_evgl_not_in_pixel_get(void) 1520_evgl_not_in_pixel_get(void)
1505{ 1521{
@@ -1577,7 +1593,7 @@ _evgl_native_context_get(Evas_GL_Context *ctx)
1577 1593
1578 evglctx = glsym_evas_gl_native_context_get(ctx); 1594 evglctx = glsym_evas_gl_native_context_get(ctx);
1579 if (!evglctx) return NULL; 1595 if (!evglctx) return NULL;
1580 return evglctx->context; 1596 return evgl_current_native_context_get(evglctx);;
1581} 1597}
1582 1598
1583//---------------------------------------------------------------// 1599//---------------------------------------------------------------//
diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.h b/src/modules/evas/engines/gl_common/evas_gl_core.h
index 352e6470a2..43d32a6b9f 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.h
@@ -46,10 +46,12 @@ typedef struct _EVGL_Surface_Format EVGL_Surface_Format;
46EAPI void evgl_engine_shutdown(void *eng_data); 46EAPI void evgl_engine_shutdown(void *eng_data);
47EAPI void *evgl_native_surface_buffer_get(EVGL_Surface *sfc, Eina_Bool *is_egl_image); 47EAPI void *evgl_native_surface_buffer_get(EVGL_Surface *sfc, Eina_Bool *is_egl_image);
48EAPI int evgl_native_surface_yinvert_get(EVGL_Surface *sfc); 48EAPI int evgl_native_surface_yinvert_get(EVGL_Surface *sfc);
49EAPI void *evgl_current_native_context_get(EVGL_Context *ctx);
49 50
50typedef void (*EVGL_Engine_Call)(void *eng_data); 51typedef void (*EVGL_Engine_Call)(void *eng_data);
51typedef void *(*EVGL_Native_Surface_Call)(void *sfc, Eina_Bool *is_egl_image); 52typedef void *(*EVGL_Native_Surface_Call)(void *sfc, Eina_Bool *is_egl_image);
52typedef int (*EVGL_Native_Surface_Yinvert_Call)(void *sfc); 53typedef int (*EVGL_Native_Surface_Yinvert_Call)(void *sfc);
54typedef void *(*EVGL_Current_Native_Context_Get_Call)(void *ctx);
53 55
54EVGL_Engine *evgl_engine_init(void *eng_data, const EVGL_Interface *efunc); 56EVGL_Engine *evgl_engine_init(void *eng_data, const EVGL_Interface *efunc);
55 57
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c
index 949f910633..604f22ed33 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -61,6 +61,7 @@ Evas_GL_Preload glsym_evas_gl_preload_shutdown = NULL;
61EVGL_Engine_Call glsym_evgl_engine_shutdown = NULL; 61EVGL_Engine_Call glsym_evgl_engine_shutdown = NULL;
62EVGL_Native_Surface_Call glsym_evgl_native_surface_buffer_get = NULL; 62EVGL_Native_Surface_Call glsym_evgl_native_surface_buffer_get = NULL;
63EVGL_Native_Surface_Yinvert_Call glsym_evgl_native_surface_yinvert_get = NULL; 63EVGL_Native_Surface_Yinvert_Call glsym_evgl_native_surface_yinvert_get = NULL;
64EVGL_Current_Native_Context_Get_Call glsym_evgl_current_native_context_get = NULL;
64Evas_Gl_Symbols glsym_evas_gl_symbols = NULL; 65Evas_Gl_Symbols glsym_evas_gl_symbols = NULL;
65 66
66Evas_GL_Common_Context_New glsym_evas_gl_common_context_new = NULL; 67Evas_GL_Common_Context_New glsym_evas_gl_common_context_new = NULL;
@@ -1280,6 +1281,7 @@ gl_symbols(void)
1280 LINK2GENERIC(evgl_engine_shutdown); 1281 LINK2GENERIC(evgl_engine_shutdown);
1281 LINK2GENERIC(evgl_native_surface_buffer_get); 1282 LINK2GENERIC(evgl_native_surface_buffer_get);
1282 LINK2GENERIC(evgl_native_surface_yinvert_get); 1283 LINK2GENERIC(evgl_native_surface_yinvert_get);
1284 LINK2GENERIC(evgl_current_native_context_get);
1283 LINK2GENERIC(evas_gl_symbols); 1285 LINK2GENERIC(evas_gl_symbols);
1284 LINK2GENERIC(evas_gl_common_error_get); 1286 LINK2GENERIC(evas_gl_common_error_get);
1285 LINK2GENERIC(evas_gl_common_error_set); 1287 LINK2GENERIC(evas_gl_common_error_set);
@@ -1918,22 +1920,23 @@ static void *
1918eng_gl_current_context_get(void *data EINA_UNUSED) 1920eng_gl_current_context_get(void *data EINA_UNUSED)
1919{ 1921{
1920 EVGL_Context *ctx; 1922 EVGL_Context *ctx;
1923 EVGLNative_Context context;
1921 1924
1922 ctx = glsym_evas_gl_common_current_context_get(); 1925 ctx = glsym_evas_gl_common_current_context_get();
1923 if (!ctx) 1926 if (!ctx)
1924 return NULL; 1927 return NULL;
1925 1928
1929 context = glsym_evgl_current_native_context_get(ctx);
1930
1926#ifdef GL_GLES 1931#ifdef GL_GLES
1927 if (eglGetCurrentContext() == (ctx->context)) 1932 if (eglGetCurrentContext() == context)
1928 return ctx; 1933 return ctx;
1929 else
1930 return NULL;
1931#else 1934#else
1932 if (glXGetCurrentContext() == (ctx->context)) 1935 if (glXGetCurrentContext() == context)
1933 return ctx; 1936 return ctx;
1934 else
1935 return NULL;
1936#endif 1937#endif
1938
1939 return NULL;
1937} 1940}
1938 1941
1939static int 1942static int