summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung Park <sungwoo@gmail.com>2012-11-21 04:59:52 +0000
committerSung Park <sungwoo@gmail.com>2012-11-21 04:59:52 +0000
commit995e0a6613c2c1a8ecf5464aea603f8b601a0863 (patch)
tree716118fc67c382e2f28f754c204398e536cd9b69
parent2f2ef8042b9f7e5eea910a5e0ca211803b79944e (diff)
Fixed Evas GL direct rendering bug from refactoring. The conditions
weren't set properly where if a program uses evas_gl to do GL rendering in direct rendering mode and then use a pixmap to do native GL rendering in the same program, native pixmap rendering would also fall into the direct rendering path and not render anything for image object. It's been fixed. SVN revision: 79493
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_api.c12
-rwxr-xr-xsrc/modules/evas/engines/gl_common/evas_gl_core.c70
-rwxr-xr-xsrc/modules/evas/engines/gl_common/evas_gl_core.h2
-rwxr-xr-xsrc/modules/evas/engines/gl_common/evas_gl_core_private.h3
-rw-r--r--src/modules/evas/engines/gl_x11/evas_engine.c4
5 files changed, 50 insertions, 41 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_api.c b/src/modules/evas/engines/gl_common/evas_gl_api.c
index d5b952af72..02e8297fb1 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_api.c
@@ -68,7 +68,7 @@ _evgl_glBindFramebuffer(GLenum target, GLuint framebuffer)
68 // Take care of BindFramebuffer 0 issue 68 // Take care of BindFramebuffer 0 issue
69 if (framebuffer==0) 69 if (framebuffer==0)
70 { 70 {
71 if (evgl_direct_enabled(evgl_engine)) 71 if (_evgl_direct_enabled(evgl_engine))
72 glBindFramebuffer(target, 0); 72 glBindFramebuffer(target, 0);
73 else 73 else
74 glBindFramebuffer(target, ctx->surface_fbo); 74 glBindFramebuffer(target, ctx->surface_fbo);
@@ -270,7 +270,7 @@ _evgl_glClear(GLbitfield mask)
270 return; 270 return;
271 } 271 }
272 272
273 if (evgl_direct_enabled(evgl_engine)) 273 if (_evgl_direct_enabled(evgl_engine))
274 { 274 {
275 if (!(rsc->current_ctx->current_fbo)) 275 if (!(rsc->current_ctx->current_fbo))
276 { 276 {
@@ -351,7 +351,7 @@ _evgl_glGetIntegerv(GLenum pname, GLint* params)
351 EVGL_Context *ctx; 351 EVGL_Context *ctx;
352 Evas_Object_Protected_Data *img; 352 Evas_Object_Protected_Data *img;
353 353
354 if (evgl_direct_enabled(evgl_engine)) 354 if (_evgl_direct_enabled(evgl_engine))
355 { 355 {
356 if (!params) 356 if (!params)
357 { 357 {
@@ -423,7 +423,7 @@ _evgl_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum forma
423 return; 423 return;
424 } 424 }
425 425
426 if (evgl_direct_enabled(evgl_engine)) 426 if (_evgl_direct_enabled(evgl_engine))
427 { 427 {
428 428
429 if (!(rsc->current_ctx->current_fbo)) 429 if (!(rsc->current_ctx->current_fbo))
@@ -468,7 +468,7 @@ _evgl_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
468 return; 468 return;
469 } 469 }
470 470
471 if (evgl_direct_enabled(evgl_engine)) 471 if (_evgl_direct_enabled(evgl_engine))
472 { 472 {
473 if (!(rsc->current_ctx->current_fbo)) 473 if (!(rsc->current_ctx->current_fbo))
474 { 474 {
@@ -548,7 +548,7 @@ _evgl_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
548 return; 548 return;
549 } 549 }
550 550
551 if (evgl_direct_enabled(evgl_engine)) 551 if (_evgl_direct_enabled(evgl_engine))
552 { 552 {
553 if (!(rsc->current_ctx->current_fbo)) 553 if (!(rsc->current_ctx->current_fbo))
554 { 554 {
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 212e54ad39..53289e6d06 100755
--- a/src/modules/evas/engines/gl_common/evas_gl_core.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.c
@@ -950,12 +950,8 @@ _internal_config_set(EVGL_Engine *ee, EVGL_Surface *sfc, Evas_GL_Config *cfg)
950} 950}
951 951
952static int 952static int
953_evgl_direct_renderable(EVGL_Engine *ee, EVGL_Context *ctx, EVGL_Surface *sfc) 953_evgl_direct_renderable(EVGL_Engine *ee, EVGL_Resource *rsc, EVGL_Context *ctx, EVGL_Surface *sfc)
954{ 954{
955 EVGL_Resource *rsc;
956
957 if (!(rsc=_evgl_tls_resource_get(ee))) return 0;
958
959 if (ee->force_direct_off) return 0; 955 if (ee->force_direct_off) return 0;
960 if (rsc->id != ee->main_tid) return 0; 956 if (rsc->id != ee->main_tid) return 0;
961 if (!ctx) return 0; 957 if (!ctx) return 0;
@@ -966,7 +962,7 @@ _evgl_direct_renderable(EVGL_Engine *ee, EVGL_Context *ctx, EVGL_Surface *sfc)
966} 962}
967 963
968//---------------------------------------------------------------// 964//---------------------------------------------------------------//
969// Retrieve the internal resource object from TLS 965// Functions used by Evas GL module
970//---------------------------------------------------------------// 966//---------------------------------------------------------------//
971EVGL_Resource * 967EVGL_Resource *
972_evgl_tls_resource_get(EVGL_Engine *ee) 968_evgl_tls_resource_get(EVGL_Engine *ee)
@@ -1009,6 +1005,37 @@ _evgl_current_context_get()
1009 return rsc->current_ctx; 1005 return rsc->current_ctx;
1010} 1006}
1011 1007
1008int
1009_evgl_not_in_pixel_get(EVGL_Engine *ee)
1010{
1011 EVGL_Resource *rsc;
1012
1013 if (!(rsc=_evgl_tls_resource_get(ee))) return 1;
1014
1015 EVGL_Context *ctx = rsc->current_ctx;
1016
1017 if ((!ee->force_direct_off) && (rsc->id == ee->main_tid) &&
1018 (ctx) && (ctx->current_sfc) && (ctx->current_sfc->direct_fb_opt) &&
1019 (!rsc->direct_img_obj))
1020 return 1;
1021 else
1022 return 0;
1023}
1024
1025int
1026_evgl_direct_enabled(EVGL_Engine *ee)
1027{
1028 EVGL_Resource *rsc;
1029 EVGL_Context *ctx;
1030 EVGL_Surface *sfc;
1031
1032 if (!(rsc=_evgl_tls_resource_get(ee))) return 0;
1033 if (!(ctx=rsc->current_ctx)) return 0;
1034 if (!(sfc=rsc->current_ctx->current_sfc)) return 0;
1035
1036 return _evgl_direct_renderable(ee, rsc, ctx, sfc);
1037}
1038
1012//---------------------------------------------------------------// 1039//---------------------------------------------------------------//
1013// Exported functions for evas_engine to use 1040// Exported functions for evas_engine to use
1014 1041
@@ -1153,9 +1180,6 @@ int evgl_engine_destroy(EVGL_Engine *ee)
1153 return 1; 1180 return 1;
1154} 1181}
1155 1182
1156//-----------------------------------------------------//
1157// Exported functions for evas_engine to use
1158// - We just need to implement these functions and have evas_engine load them :)
1159void * 1183void *
1160evgl_surface_create(EVGL_Engine *ee, Evas_GL_Config *cfg, int w, int h) 1184evgl_surface_create(EVGL_Engine *ee, Evas_GL_Config *cfg, int w, int h)
1161{ 1185{
@@ -1426,7 +1450,7 @@ evgl_make_current(EVGL_Engine *ee, EVGL_Surface *sfc, EVGL_Context *ctx)
1426 glGenFramebuffers(1, &ctx->surface_fbo); 1450 glGenFramebuffers(1, &ctx->surface_fbo);
1427 1451
1428 // Direct Rendering 1452 // Direct Rendering
1429 if (_evgl_direct_renderable(ee, ctx, sfc)) 1453 if (_evgl_direct_renderable(ee, rsc, ctx, sfc))
1430 { 1454 {
1431 // This is to transition from FBO rendering to direct rendering 1455 // This is to transition from FBO rendering to direct rendering
1432 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &curr_fbo); 1456 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &curr_fbo);
@@ -1435,7 +1459,7 @@ evgl_make_current(EVGL_Engine *ee, EVGL_Surface *sfc, EVGL_Context *ctx)
1435 glBindFramebuffer(GL_FRAMEBUFFER, 0); 1459 glBindFramebuffer(GL_FRAMEBUFFER, 0);
1436 ctx->current_fbo = 0; 1460 ctx->current_fbo = 0;
1437 } 1461 }
1438 rsc->direct_enabled = 1; 1462 rsc->direct_rendered = 1;
1439 } 1463 }
1440 else 1464 else
1441 { 1465 {
@@ -1452,8 +1476,7 @@ evgl_make_current(EVGL_Engine *ee, EVGL_Surface *sfc, EVGL_Context *ctx)
1452 if (ctx->current_fbo) 1476 if (ctx->current_fbo)
1453 glBindFramebuffer(GL_FRAMEBUFFER, ctx->current_fbo); 1477 glBindFramebuffer(GL_FRAMEBUFFER, ctx->current_fbo);
1454 } 1478 }
1455 1479 rsc->direct_rendered = 0;
1456 rsc->direct_enabled = 0;
1457 } 1480 }
1458 1481
1459 ctx->current_sfc = sfc; 1482 ctx->current_sfc = sfc;
@@ -1507,30 +1530,13 @@ evgl_native_surface_get(EVGL_Engine *ee, EVGL_Surface *sfc, Evas_Native_Surface
1507} 1530}
1508 1531
1509int 1532int
1510_evgl_not_in_pixel_get(EVGL_Engine *ee) 1533evgl_direct_rendered(EVGL_Engine *ee)
1511{
1512 EVGL_Resource *rsc;
1513
1514 if (!(rsc=_evgl_tls_resource_get(ee))) return 1;
1515
1516 EVGL_Context *ctx = rsc->current_ctx;
1517
1518 if ((!ee->force_direct_off) && (rsc->id == ee->main_tid) &&
1519 (ctx) && (ctx->current_sfc) && (ctx->current_sfc->direct_fb_opt) &&
1520 (!rsc->direct_img_obj))
1521 return 1;
1522 else
1523 return 0;
1524}
1525
1526int
1527evgl_direct_enabled(EVGL_Engine *ee)
1528{ 1534{
1529 EVGL_Resource *rsc; 1535 EVGL_Resource *rsc;
1530 1536
1531 if (!(rsc=_evgl_tls_resource_get(ee))) return 0; 1537 if (!(rsc=_evgl_tls_resource_get(ee))) return 0;
1532 1538
1533 return rsc->direct_enabled; 1539 return rsc->direct_rendered;
1534} 1540}
1535 1541
1536void 1542void
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 c18f6fc9dc..369b3c3237 100755
--- a/src/modules/evas/engines/gl_common/evas_gl_core.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.h
@@ -31,7 +31,7 @@ extern void *evgl_proc_address_get(const char *name);
31extern int evgl_native_surface_get(EVGL_Engine *ee, EVGL_Surface *sfc, Evas_Native_Surface *ns); 31extern int evgl_native_surface_get(EVGL_Engine *ee, EVGL_Surface *sfc, Evas_Native_Surface *ns);
32extern Evas_GL_API *evgl_api_get(EVGL_Engine *ee); 32extern Evas_GL_API *evgl_api_get(EVGL_Engine *ee);
33 33
34extern int evgl_direct_enabled(EVGL_Engine *ee); 34extern int evgl_direct_rendered(EVGL_Engine *ee);
35extern void evgl_direct_img_obj_set(EVGL_Engine *ee, Evas_Object *img); 35extern void evgl_direct_img_obj_set(EVGL_Engine *ee, Evas_Object *img);
36extern Evas_Object *evgl_direct_img_obj_get(EVGL_Engine *ee); 36extern Evas_Object *evgl_direct_img_obj_get(EVGL_Engine *ee);
37 37
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 be114b497d..491bd75349 100755
--- a/src/modules/evas/engines/gl_common/evas_gl_core_private.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_core_private.h
@@ -200,7 +200,7 @@ struct _EVGL_Resource
200 200
201 EVGL_Context *current_ctx; 201 EVGL_Context *current_ctx;
202 202
203 int direct_enabled; 203 int direct_rendered;
204 Evas_Object *direct_img_obj; 204 Evas_Object *direct_img_obj;
205}; 205};
206 206
@@ -249,5 +249,6 @@ extern void _evgl_api_get(Evas_GL_API *api, int debug);
249extern EVGL_Resource *_evgl_tls_resource_get(EVGL_Engine *ee); 249extern EVGL_Resource *_evgl_tls_resource_get(EVGL_Engine *ee);
250extern EVGL_Context *_evgl_current_context_get(); 250extern EVGL_Context *_evgl_current_context_get();
251extern int _evgl_not_in_pixel_get(); 251extern int _evgl_not_in_pixel_get();
252extern int _evgl_direct_enabled(EVGL_Engine *ee);
252 253
253#endif //_EVAS_GL_CORE_PRIVATE_H 254#endif //_EVAS_GL_CORE_PRIVATE_H
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c
index 3aca2d78af..aa8dcc8542 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -2491,10 +2491,12 @@ eng_image_draw(void *data, void *context, void *surface, void *image, int src_x,
2491 Render_Engine *re; 2491 Render_Engine *re;
2492 re = (Render_Engine *)data; 2492 re = (Render_Engine *)data;
2493 Evas_GL_Image *im = image; 2493 Evas_GL_Image *im = image;
2494 Native *n;
2494 2495
2495 if (!im) return; 2496 if (!im) return;
2497 n = im->native.data;
2496 2498
2497 if ((im->native.data) && evgl_direct_enabled(re->evgl_engine)) 2499 if ((n) && (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL) && (evgl_direct_rendered(re->evgl_engine)))
2498 { 2500 {
2499 DBG("Rendering Directly to the window"); 2501 DBG("Rendering Directly to the window");
2500 evas_object_image_pixels_dirty_set(evgl_direct_img_obj_get(re->evgl_engine), EINA_TRUE); 2502 evas_object_image_pixels_dirty_set(evgl_direct_img_obj_get(re->evgl_engine), EINA_TRUE);