diff options
author | Christopher Michael <cpmichael1@comcast.net> | 2012-01-12 09:01:37 +0000 |
---|---|---|
committer | Christopher Michael <cpmichael1@comcast.net> | 2012-01-12 09:01:37 +0000 |
commit | c0dd6f79754b937ed550ae89a1020c40aeeb6913 (patch) | |
tree | 22f8d1eb71195b03dba197dbb45c969eec4dc084 | |
parent | dd7d556916124fe6dfa86267c3ecfc88482b996a (diff) |
Evas (wayland_egl): Fix egl detection in check_engine. (In theory, the
old version of this w/ the 3 includes Should be working, but I've
tested it on 2 machines now, and it fails on both with those lines in
there, so I am removing them).
Make wayland_egl engine Actually work and draw stuff now (too many
code changes to list them all separately). See http://i.imgur.com/i2eBE.png.
SVN revision: 67128
Diffstat (limited to '')
4 files changed, 179 insertions, 313 deletions
diff --git a/legacy/evas/m4/evas_check_engine.m4 b/legacy/evas/m4/evas_check_engine.m4 index e88022b1c1..4fc13a9f85 100644 --- a/legacy/evas/m4/evas_check_engine.m4 +++ b/legacy/evas/m4/evas_check_engine.m4 | |||
@@ -923,9 +923,6 @@ if test "x${have_dep}" = "xyes" ; then | |||
923 | [have_egl="yes"], | 923 | [have_egl="yes"], |
924 | [have_egl="no"], | 924 | [have_egl="no"], |
925 | [ | 925 | [ |
926 | #include <GLES2/gl2.h> | ||
927 | #include <EGL/egl.h> | ||
928 | #include <GL/gl.h> | ||
929 | ]) | 926 | ]) |
930 | if test "x${have_egl}" = "xyes" ; then | 927 | if test "x${have_egl}" = "xyes" ; then |
931 | evas_engine_[]$1[]_cflags="${WAYLAND_EGL_CFLAGS}" | 928 | evas_engine_[]$1[]_cflags="${WAYLAND_EGL_CFLAGS}" |
diff --git a/legacy/evas/src/modules/engines/wayland_egl/evas_engine.c b/legacy/evas/src/modules/engines/wayland_egl/evas_engine.c index 1f9e0d0f40..0fd3a835b9 100644 --- a/legacy/evas/src/modules/engines/wayland_egl/evas_engine.c +++ b/legacy/evas/src/modules/engines/wayland_egl/evas_engine.c | |||
@@ -612,7 +612,9 @@ eng_setup(Evas *e, void *in) | |||
612 | re->w = e->output.w; | 612 | re->w = e->output.w; |
613 | re->h = e->output.h; | 613 | re->h = e->output.h; |
614 | 614 | ||
615 | re->win = eng_window_new(re->info->info.display, re->info->info.surface, re->info->info.screen, | 615 | re->win = eng_window_new(re->info->info.display, |
616 | re->info->info.surface, | ||
617 | re->info->info.screen, | ||
616 | re->info->info.depth, re->w, re->h, | 618 | re->info->info.depth, re->w, re->h, |
617 | re->info->indirect, | 619 | re->info->indirect, |
618 | re->info->info.destination_alpha, | 620 | re->info->info.destination_alpha, |
@@ -654,6 +656,7 @@ eng_setup(Evas *e, void *in) | |||
654 | if (_re_wincheck(re)) | 656 | if (_re_wincheck(re)) |
655 | { | 657 | { |
656 | if ((re->info->info.display != re->win->disp) || | 658 | if ((re->info->info.display != re->win->disp) || |
659 | (re->info->info.surface != re->win->surface) || | ||
657 | (re->info->info.screen != re->win->screen) || | 660 | (re->info->info.screen != re->win->screen) || |
658 | (re->info->info.depth != re->win->depth) || | 661 | (re->info->info.depth != re->win->depth) || |
659 | (re->info->info.destination_alpha != re->win->alpha) || | 662 | (re->info->info.destination_alpha != re->win->alpha) || |
@@ -789,6 +792,17 @@ eng_output_resize(void *data, int w, int h) | |||
789 | re->win->w = w; | 792 | re->win->w = w; |
790 | re->win->h = h; | 793 | re->win->h = h; |
791 | eng_window_use(re->win); | 794 | eng_window_use(re->win); |
795 | |||
796 | if (re->win->win) | ||
797 | { | ||
798 | int nw, nh; | ||
799 | wl_egl_window_get_attached_size(re->win->win, &nw, &nh); | ||
800 | printf("Attached Size: %d %d\n", nw, nh); | ||
801 | wl_egl_window_resize(re->win->win, w, h, 0, 0); | ||
802 | wl_egl_window_get_attached_size(re->win->win, &nw, &nh); | ||
803 | printf("Attached Size: %d %d\n\n", nw, nh); | ||
804 | } | ||
805 | |||
792 | evas_gl_common_context_resize(re->win->gl_context, w, h, re->win->rot); | 806 | evas_gl_common_context_resize(re->win->gl_context, w, h, re->win->rot); |
793 | evas_common_tilebuf_free(re->tb); | 807 | evas_common_tilebuf_free(re->tb); |
794 | re->tb = evas_common_tilebuf_new(w, h); | 808 | re->tb = evas_common_tilebuf_new(w, h); |
@@ -984,79 +998,23 @@ eng_output_flush(void *data) | |||
984 | else eglSwapInterval(re->win->egl_disp, 0); | 998 | else eglSwapInterval(re->win->egl_disp, 0); |
985 | re->vsync = 1; | 999 | re->vsync = 1; |
986 | } | 1000 | } |
1001 | |||
987 | if (re->info->callback.pre_swap) | 1002 | if (re->info->callback.pre_swap) |
988 | { | 1003 | re->info->callback.pre_swap(re->info->callback.data, re->evas); |
989 | re->info->callback.pre_swap(re->info->callback.data, re->evas); | 1004 | |
990 | } | ||
991 | eglSwapBuffers(re->win->egl_disp, re->win->egl_surface[0]); | 1005 | eglSwapBuffers(re->win->egl_disp, re->win->egl_surface[0]); |
992 | if (!safe_native) eglWaitGL(); | 1006 | if (!safe_native) eglWaitGL(); |
1007 | |||
993 | if (re->info->callback.post_swap) | 1008 | if (re->info->callback.post_swap) |
994 | { | 1009 | re->info->callback.post_swap(re->info->callback.data, re->evas); |
995 | re->info->callback.post_swap(re->info->callback.data, re->evas); | 1010 | |
996 | } | 1011 | if (eglGetError() != EGL_SUCCESS) |
1012 | printf("Error: eglSwapBuffers() fail.\n"); | ||
1013 | |||
997 | # ifdef FRAMECOUNT | 1014 | # ifdef FRAMECOUNT |
998 | double t1 = get_time(); | 1015 | double t1 = get_time(); |
999 | printf("%1.5f\n", t1 - t0); | 1016 | printf("%1.5f\n", t1 - t0); |
1000 | # endif | 1017 | # endif |
1001 | if (eglGetError() != EGL_SUCCESS) | ||
1002 | { | ||
1003 | printf("Error: eglSwapBuffers() fail.\n"); | ||
1004 | } | ||
1005 | |||
1006 | if (re->info->callback.pre_swap) | ||
1007 | { | ||
1008 | re->info->callback.pre_swap(re->info->callback.data, re->evas); | ||
1009 | } | ||
1010 | #if 1 | ||
1011 | if (1) | ||
1012 | #else | ||
1013 | if ((re->win->draw.x1 == 0) && (re->win->draw.y1 == 0) && (re->win->draw.x2 == (re->win->w - 1)) && (re->win->draw.y2 == (re->win->h - 1))) | ||
1014 | #endif | ||
1015 | { | ||
1016 | #ifdef FRAMECOUNT | ||
1017 | double t, t2 = 0.0; | ||
1018 | t = get_time(); | ||
1019 | #endif | ||
1020 | |||
1021 | eglSwapBuffers(re->win->egl_disp, re->win->egl_surface[0]); | ||
1022 | |||
1023 | #ifdef FRAMECOUNT | ||
1024 | t = get_time() - t; | ||
1025 | if (!safe_native) | ||
1026 | { | ||
1027 | t2 = get_time(); | ||
1028 | eglWaitGL(); | ||
1029 | t2 = get_time() - t2; | ||
1030 | } | ||
1031 | printf("swap: %3.5f (%3.5fms), x wait gl: %3.5f (%3.5fms)\n", | ||
1032 | t, t * 1000.0, t2, t2 * 1000.0); | ||
1033 | #endif | ||
1034 | } | ||
1035 | else | ||
1036 | { | ||
1037 | // FIXME: this doesn't work.. why oh why? | ||
1038 | // int sx, sy, sw, sh; | ||
1039 | |||
1040 | // sx = re->win->draw.x1; | ||
1041 | // sy = re->win->draw.y1; | ||
1042 | // sw = (re->win->draw.x2 - re->win->draw.x1) + 1; | ||
1043 | // sh = (re->win->draw.y2 - re->win->draw.y1) + 1; | ||
1044 | // sy = re->win->h - sy - sh; | ||
1045 | |||
1046 | // glBitmap(0, 0, 0, 0, sx, re->win->h - sy, NULL); | ||
1047 | // glEnable(GL_SCISSOR_TEST); | ||
1048 | // glScissor(sx, sy, sw, sh); | ||
1049 | // glDrawBuffer(GL_FRONT); | ||
1050 | // glCopyPixels(sx, sy, sw, sh, GL_COLOR); | ||
1051 | // glDrawBuffer(GL_BACK); | ||
1052 | // glDisable(GL_SCISSOR_TEST); | ||
1053 | // glBitmap(0, 0, 0, 0, 0, 0, NULL); | ||
1054 | // glFlush(); | ||
1055 | } | ||
1056 | if (re->info->callback.post_swap) | ||
1057 | { | ||
1058 | re->info->callback.post_swap(re->info->callback.data, re->evas); | ||
1059 | } | ||
1060 | } | 1018 | } |
1061 | 1019 | ||
1062 | static void | 1020 | static void |
@@ -1355,27 +1313,17 @@ _native_bind_cb(void *data, void *image) | |||
1355 | Evas_GL_Image *im = image; | 1313 | Evas_GL_Image *im = image; |
1356 | Native *n = im->native.data; | 1314 | Native *n = im->native.data; |
1357 | 1315 | ||
1358 | /* if (n->ns.type == EVAS_NATIVE_SURFACE_X11) */ | 1316 | if (n->egl_surface) |
1359 | /* { */ | 1317 | { |
1360 | /* #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) */ | 1318 | if (glsym_glEGLImageTargetTexture2DOES) |
1361 | /* if (n->egl_surface) */ | 1319 | { |
1362 | /* { */ | 1320 | glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, n->egl_surface); |
1363 | /* if (glsym_glEGLImageTargetTexture2DOES) */ | 1321 | if (eglGetError() != EGL_SUCCESS) |
1364 | /* { */ | 1322 | ERR("glEGLImageTargetTexture2DOES() failed."); |
1365 | /* glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, n->egl_surface); */ | 1323 | } |
1366 | /* if (eglGetError() != EGL_SUCCESS) */ | 1324 | else |
1367 | /* ERR("glEGLImageTargetTexture2DOES() failed."); */ | 1325 | ERR("Try glEGLImageTargetTexture2DOES on EGL with no support"); |
1368 | /* } */ | 1326 | } |
1369 | /* else */ | ||
1370 | /* ERR("Try glEGLImageTargetTexture2DOES on EGL with no support"); */ | ||
1371 | /* } */ | ||
1372 | /* #endif */ | ||
1373 | /* } */ | ||
1374 | /* else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL) */ | ||
1375 | { | ||
1376 | glBindTexture(GL_TEXTURE_2D, n->ns.data.opengl.texture_id); | ||
1377 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | ||
1378 | } | ||
1379 | return; | 1327 | return; |
1380 | data = NULL; | 1328 | data = NULL; |
1381 | } | 1329 | } |
@@ -1384,17 +1332,17 @@ static void | |||
1384 | _native_unbind_cb(void *data, void *image) | 1332 | _native_unbind_cb(void *data, void *image) |
1385 | { | 1333 | { |
1386 | Evas_GL_Image *im = image; | 1334 | Evas_GL_Image *im = image; |
1387 | Native *n = im->native.data; | 1335 | /* Native *n = im->native.data; */ |
1388 | 1336 | ||
1389 | /* if (n->ns.type == EVAS_NATIVE_SURFACE_X11) */ | 1337 | /* if (n->ns.type == EVAS_NATIVE_SURFACE_X11) */ |
1390 | /* { */ | 1338 | /* { */ |
1391 | /* // nothing */ | 1339 | /* // nothing */ |
1392 | /* } */ | 1340 | /* } */ |
1393 | /* else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL) */ | 1341 | /* else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL) */ |
1394 | { | 1342 | /* { */ |
1395 | glBindTexture(GL_TEXTURE_2D, 0); | 1343 | /* glBindTexture(GL_TEXTURE_2D, 0); */ |
1396 | GLERR(__FUNCTION__, __FILE__, __LINE__, ""); | 1344 | /* GLERR(__FUNCTION__, __FILE__, __LINE__, ""); */ |
1397 | } | 1345 | /* } */ |
1398 | return; | 1346 | return; |
1399 | data = NULL; | 1347 | data = NULL; |
1400 | } | 1348 | } |
@@ -1408,45 +1356,38 @@ _native_free_cb(void *data, void *image) | |||
1408 | uint32_t texid; | 1356 | uint32_t texid; |
1409 | // uint32_t pmid, texid; | 1357 | // uint32_t pmid, texid; |
1410 | 1358 | ||
1411 | /* if (n->ns.type == EVAS_NATIVE_SURFACE_X11) */ | 1359 | /* eina_hash_del(re->win->gl_context->shared->native_pm_hash, &pmid, im); */ |
1412 | /* { */ | 1360 | if (n->egl_surface) |
1413 | /* eina_hash_del(re->win->gl_context->shared->native_pm_hash, &pmid, im); */ | 1361 | { |
1414 | /* if (n->egl_surface) */ | 1362 | if (glsym_eglDestroyImage) |
1415 | /* { */ | 1363 | { |
1416 | /* if (glsym_eglDestroyImage) */ | 1364 | glsym_eglDestroyImage(re->win->egl_disp, n->egl_surface); |
1417 | /* { */ | 1365 | if (eglGetError() != EGL_SUCCESS) |
1418 | /* glsym_eglDestroyImage(re->win->egl_disp, n->egl_surface); */ | 1366 | ERR("eglDestroyImage() failed."); |
1419 | /* if (eglGetError() != EGL_SUCCESS) */ | 1367 | } |
1420 | /* ERR("eglDestroyImage() failed."); */ | 1368 | else |
1421 | /* } */ | 1369 | ERR("Try eglDestroyImage on EGL with no support"); |
1422 | /* else */ | 1370 | } |
1423 | /* ERR("Try eglDestroyImage on EGL with no support"); */ | 1371 | |
1424 | /* } */ | 1372 | im->native.data = NULL; |
1425 | /* } */ | 1373 | im->native.func.data = NULL; |
1426 | /* else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL) */ | 1374 | im->native.func.bind = NULL; |
1427 | { | 1375 | im->native.func.unbind = NULL; |
1428 | texid = n->ns.data.opengl.texture_id; | 1376 | im->native.func.free = NULL; |
1429 | eina_hash_del(re->win->gl_context->shared->native_tex_hash, &texid, im); | 1377 | free(n); |
1430 | } | ||
1431 | im->native.data = NULL; | ||
1432 | im->native.func.data = NULL; | ||
1433 | im->native.func.bind = NULL; | ||
1434 | im->native.func.unbind = NULL; | ||
1435 | im->native.func.free = NULL; | ||
1436 | free(n); | ||
1437 | } | 1378 | } |
1438 | 1379 | ||
1439 | static void * | 1380 | static void * |
1440 | eng_image_native_set(void *data, void *image, void *native) | 1381 | eng_image_native_set(void *data, void *image, void *native) |
1441 | { | 1382 | { |
1442 | Render_Engine *re = (Render_Engine *)data; | 1383 | Render_Engine *re = (Render_Engine *)data; |
1443 | Evas_Native_Surface *ns = native; | 1384 | Evas_Native_Surface *ns = native; |
1444 | Evas_GL_Image *im = image, *im2 = NULL; | 1385 | Evas_GL_Image *im = image, *im2 = NULL; |
1445 | struct wl_egl_pixmap *pm; | 1386 | Native *n = NULL; |
1446 | Native *n = NULL; | 1387 | // uint32_t pmid; |
1447 | uint32_t pmid, texid; | 1388 | // uint32_t texid; |
1448 | unsigned int tex = 0; | 1389 | unsigned int tex = 0; |
1449 | unsigned int fbo = 0; | 1390 | unsigned int fbo = 0; |
1450 | 1391 | ||
1451 | if (!im) | 1392 | if (!im) |
1452 | { | 1393 | { |
@@ -1464,30 +1405,15 @@ eng_image_native_set(void *data, void *image, void *native) | |||
1464 | 1405 | ||
1465 | if (ns) | 1406 | if (ns) |
1466 | { | 1407 | { |
1467 | /* if (ns->type == EVAS_NATIVE_SURFACE_X11) */ | ||
1468 | /* { */ | ||
1469 | /* vis = ns->data.x11.visual; */ | 1408 | /* vis = ns->data.x11.visual; */ |
1470 | /* pm = ns->data.x11.pixmap; */ | 1409 | /* pm = ns->data.x11.pixmap; */ |
1471 | /* if (im->native.data) */ | ||
1472 | /* { */ | ||
1473 | /* Evas_Native_Surface *ens = im->native.data; */ | ||
1474 | /* if ((ens->data.x11.visual == vis) && */ | ||
1475 | /* (ens->data.x11.pixmap == pm)) */ | ||
1476 | /* return im; */ | ||
1477 | /* } */ | ||
1478 | /* } */ | ||
1479 | /* else if (ns->type == EVAS_NATIVE_SURFACE_OPENGL) */ | ||
1480 | { | ||
1481 | tex = ns->data.opengl.texture_id; | ||
1482 | fbo = ns->data.opengl.framebuffer_id; | ||
1483 | if (im->native.data) | 1410 | if (im->native.data) |
1484 | { | 1411 | { |
1485 | Evas_Native_Surface *ens = im->native.data; | 1412 | Evas_Native_Surface *ens = im->native.data; |
1486 | if ((ens->data.opengl.texture_id == tex) && | 1413 | /* if ((ens->data.x11.visual == vis) && */ |
1487 | (ens->data.opengl.framebuffer_id == fbo)) | 1414 | /* (ens->data.x11.pixmap == pm)) */ |
1488 | return im; | 1415 | return im; |
1489 | } | 1416 | } |
1490 | } | ||
1491 | } | 1417 | } |
1492 | if ((!ns) && (!im->native.data)) return im; | 1418 | if ((!ns) && (!im->native.data)) return im; |
1493 | 1419 | ||
@@ -1506,131 +1432,79 @@ eng_image_native_set(void *data, void *image, void *native) | |||
1506 | /* { */ | 1432 | /* { */ |
1507 | /* pmid = pm; */ | 1433 | /* pmid = pm; */ |
1508 | /* im2 = eina_hash_find(re->win->gl_context->shared->native_pm_hash, &pmid); */ | 1434 | /* im2 = eina_hash_find(re->win->gl_context->shared->native_pm_hash, &pmid); */ |
1509 | /* if (im2 == im) return im; */ | 1435 | if (im2 == im) return im; |
1510 | /* if (im2) */ | 1436 | if (im2) |
1511 | /* { */ | 1437 | { |
1512 | /* n = im2->native.data; */ | 1438 | n = im2->native.data; |
1513 | /* if (n) */ | 1439 | if (n) |
1514 | /* { */ | 1440 | { |
1515 | /* evas_gl_common_image_ref(im2); */ | 1441 | evas_gl_common_image_ref(im2); |
1516 | /* evas_gl_common_image_free(im); */ | 1442 | evas_gl_common_image_free(im); |
1517 | /* return im2; */ | 1443 | return im2; |
1518 | /* } */ | 1444 | } |
1519 | /* } */ | 1445 | } |
1520 | /* } */ | ||
1521 | /* else if (ns->type == EVAS_NATIVE_SURFACE_OPENGL) */ | ||
1522 | { | ||
1523 | texid = tex; | ||
1524 | im2 = eina_hash_find(re->win->gl_context->shared->native_tex_hash, &texid); | ||
1525 | if (im2 == im) return im; | ||
1526 | if (im2) | ||
1527 | { | ||
1528 | n = im2->native.data; | ||
1529 | if (n) | ||
1530 | { | ||
1531 | evas_gl_common_image_ref(im2); | ||
1532 | evas_gl_common_image_free(im); | ||
1533 | return im2; | ||
1534 | } | ||
1535 | } | ||
1536 | 1446 | ||
1537 | } | 1447 | im2 = evas_gl_common_image_new_from_data(re->win->gl_context, |
1538 | im2 = evas_gl_common_image_new_from_data(re->win->gl_context, | ||
1539 | im->w, im->h, NULL, im->alpha, | 1448 | im->w, im->h, NULL, im->alpha, |
1540 | EVAS_COLORSPACE_ARGB8888); | 1449 | EVAS_COLORSPACE_ARGB8888); |
1541 | evas_gl_common_image_free(im); | 1450 | evas_gl_common_image_free(im); |
1542 | im = im2; | 1451 | im = im2; |
1543 | /* if (ns->type == EVAS_NATIVE_SURFACE_X11) */ | 1452 | /* if (native) */ |
1544 | /* { */ | 1453 | /* { */ |
1545 | /* if (native) */ | 1454 | /* n = calloc(1, sizeof(Native)); */ |
1546 | /* { */ | 1455 | /* if (n) */ |
1547 | /* n = calloc(1, sizeof(Native)); */ | 1456 | /* { */ |
1548 | /* if (n) */ | 1457 | /* EGLConfig egl_config; */ |
1549 | /* { */ | 1458 | /* int config_attrs[20]; */ |
1550 | /* EGLConfig egl_config; */ | 1459 | /* int num_config, i = 0; */ |
1551 | /* int config_attrs[20]; */ | ||
1552 | /* int num_config, i = 0; */ | ||
1553 | 1460 | ||
1554 | /* eina_hash_add(re->win->gl_context->shared->native_pm_hash, &pmid, im); */ | 1461 | /* eina_hash_add(re->win->gl_context->shared->native_pm_hash, &pmid, im); */ |
1555 | 1462 | ||
1556 | /* config_attrs[i++] = EGL_RED_SIZE; */ | 1463 | /* config_attrs[i++] = EGL_RED_SIZE; */ |
1557 | /* config_attrs[i++] = 8; */ | 1464 | /* config_attrs[i++] = 8; */ |
1558 | /* config_attrs[i++] = EGL_GREEN_SIZE; */ | 1465 | /* config_attrs[i++] = EGL_GREEN_SIZE; */ |
1559 | /* config_attrs[i++] = 8; */ | 1466 | /* config_attrs[i++] = 8; */ |
1560 | /* config_attrs[i++] = EGL_BLUE_SIZE; */ | 1467 | /* config_attrs[i++] = EGL_BLUE_SIZE; */ |
1561 | /* config_attrs[i++] = 8; */ | 1468 | /* config_attrs[i++] = 8; */ |
1562 | /* config_attrs[i++] = EGL_ALPHA_SIZE; */ | 1469 | /* config_attrs[i++] = EGL_ALPHA_SIZE; */ |
1563 | /* config_attrs[i++] = 8; */ | 1470 | /* config_attrs[i++] = 8; */ |
1564 | /* config_attrs[i++] = EGL_DEPTH_SIZE; */ | 1471 | /* config_attrs[i++] = EGL_DEPTH_SIZE; */ |
1565 | /* config_attrs[i++] = 0; */ | 1472 | /* config_attrs[i++] = 0; */ |
1566 | /* config_attrs[i++] = EGL_STENCIL_SIZE; */ | 1473 | /* config_attrs[i++] = EGL_STENCIL_SIZE; */ |
1567 | /* config_attrs[i++] = 0; */ | 1474 | /* config_attrs[i++] = 0; */ |
1568 | /* config_attrs[i++] = EGL_RENDERABLE_TYPE; */ | 1475 | /* config_attrs[i++] = EGL_RENDERABLE_TYPE; */ |
1569 | /* config_attrs[i++] = EGL_OPENGL_ES2_BIT; */ | 1476 | /* config_attrs[i++] = EGL_OPENGL_ES2_BIT; */ |
1570 | /* config_attrs[i++] = EGL_SURFACE_TYPE; */ | 1477 | /* config_attrs[i++] = EGL_SURFACE_TYPE; */ |
1571 | /* config_attrs[i++] = EGL_PIXMAP_BIT; */ | 1478 | /* config_attrs[i++] = EGL_PIXMAP_BIT; */ |
1572 | /* config_attrs[i++] = EGL_NONE; */ | 1479 | /* config_attrs[i++] = EGL_NONE; */ |
1573 | 1480 | ||
1574 | /* if (!eglChooseConfig(re->win->egl_disp, config_attrs, */ | 1481 | /* if (!eglChooseConfig(re->win->egl_disp, config_attrs, */ |
1575 | /* &egl_config, 1, &num_config)) */ | 1482 | /* &egl_config, 1, &num_config)) */ |
1576 | /* ERR("eglChooseConfig() failed for pixmap 0x%x, num_config = %i", (unsigned int)pm, num_config); */ | 1483 | /* ERR("eglChooseConfig() failed for, num_config = %i", num_config); */ |
1577 | /* memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface)); */ | 1484 | /* memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface)); */ |
1578 | /* n->pixmap = pm; */ | 1485 | /* n->pixmap = pm; */ |
1579 | /* if (glsym_eglCreateImage) */ | 1486 | /* if (glsym_eglCreateImage) */ |
1580 | /* n->egl_surface = glsym_eglCreateImage(re->win->egl_disp, */ | 1487 | /* n->egl_surface = glsym_eglCreateImage(re->win->egl_disp, */ |
1581 | /* EGL_NO_CONTEXT, */ | 1488 | /* EGL_NO_CONTEXT, */ |
1582 | /* EGL_NATIVE_PIXMAP_KHR, */ | 1489 | /* EGL_NATIVE_PIXMAP_KHR, */ |
1583 | /* (void *)pm, */ | 1490 | /* (void *)pm, */ |
1584 | /* NULL); */ | 1491 | /* NULL); */ |
1585 | /* else */ | 1492 | /* else */ |
1586 | /* ERR("Try eglCreateImage on EGL with no support"); */ | 1493 | /* ERR("Try eglCreateImage on EGL with no support"); */ |
1587 | /* if (!n->egl_surface) */ | 1494 | /* if (!n->egl_surface) */ |
1588 | /* ERR("eglCreatePixmapSurface() for 0x%x failed", (unsigned int)pm); */ | 1495 | /* ERR("eglCreatePixmapSurface() for 0x%x failed", (unsigned int)pm); */ |
1589 | /* im->native.yinvert = 1; */ | 1496 | /* im->native.yinvert = 1; */ |
1590 | /* im->native.loose = 0; */ | 1497 | /* im->native.loose = 0; */ |
1591 | /* im->native.data = n; */ | 1498 | /* im->native.data = n; */ |
1592 | /* im->native.func.data = re; */ | 1499 | /* im->native.func.data = re; */ |
1593 | /* im->native.func.bind = _native_bind_cb; */ | 1500 | /* im->native.func.bind = _native_bind_cb; */ |
1594 | /* im->native.func.unbind = _native_unbind_cb; */ | 1501 | /* im->native.func.unbind = _native_unbind_cb; */ |
1595 | /* im->native.func.free = _native_free_cb; */ | 1502 | /* im->native.func.free = _native_free_cb; */ |
1596 | /* im->native.target = GL_TEXTURE_2D; */ | 1503 | /* im->native.target = GL_TEXTURE_2D; */ |
1597 | /* im->native.mipmap = 0; */ | 1504 | /* im->native.mipmap = 0; */ |
1598 | /* evas_gl_common_image_native_enable(im); */ | 1505 | /* evas_gl_common_image_native_enable(im); */ |
1599 | /* } */ | 1506 | /* } */ |
1600 | /* } */ | 1507 | /* } */ |
1601 | /* } */ | ||
1602 | /* else if (ns->type == EVAS_NATIVE_SURFACE_OPENGL) */ | ||
1603 | { | ||
1604 | if (native) | ||
1605 | { | ||
1606 | n = calloc(1, sizeof(Native)); | ||
1607 | if (n) | ||
1608 | { | ||
1609 | memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface)); | ||
1610 | |||
1611 | eina_hash_add(re->win->gl_context->shared->native_tex_hash, &texid, im); | ||
1612 | |||
1613 | n->pixmap = NULL; | ||
1614 | n->egl_surface = 0; | ||
1615 | |||
1616 | im->native.yinvert = 0; | ||
1617 | im->native.loose = 0; | ||
1618 | im->native.data = n; | ||
1619 | im->native.func.data = re; | ||
1620 | im->native.func.bind = _native_bind_cb; | ||
1621 | im->native.func.unbind = _native_unbind_cb; | ||
1622 | im->native.func.free = _native_free_cb; | ||
1623 | im->native.target = GL_TEXTURE_2D; | ||
1624 | im->native.mipmap = 0; | ||
1625 | |||
1626 | // FIXME: need to implement mapping sub texture regions | ||
1627 | // x, y, w, h for possible texture atlasing | ||
1628 | |||
1629 | evas_gl_common_image_native_enable(im); | ||
1630 | } | ||
1631 | } | ||
1632 | |||
1633 | } | ||
1634 | return im; | 1508 | return im; |
1635 | } | 1509 | } |
1636 | 1510 | ||
@@ -1679,11 +1553,6 @@ eng_image_filtered_free(void *im, Filtered_Image *fim) | |||
1679 | } | 1553 | } |
1680 | #endif | 1554 | #endif |
1681 | 1555 | ||
1682 | |||
1683 | // | ||
1684 | // | ||
1685 | ///////////////////////////////////////////////////////////////////////// | ||
1686 | |||
1687 | static void * | 1556 | static void * |
1688 | eng_image_load(void *data, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo) | 1557 | eng_image_load(void *data, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo) |
1689 | { | 1558 | { |
@@ -1793,7 +1662,7 @@ eng_image_size_set(void *data, void *image, int w, int h) | |||
1793 | evas_common_blit_rectangle(im_old->im, im->im, 0, 0, w, h, 0, 0); | 1662 | evas_common_blit_rectangle(im_old->im, im->im, 0, 0, w, h, 0, 0); |
1794 | evas_common_cpu_end_opt(); | 1663 | evas_common_cpu_end_opt(); |
1795 | } | 1664 | } |
1796 | */ | 1665 | */ |
1797 | evas_gl_common_image_free(im_old); | 1666 | evas_gl_common_image_free(im_old); |
1798 | } | 1667 | } |
1799 | else | 1668 | else |
@@ -1862,7 +1731,7 @@ eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, i | |||
1862 | return im; | 1731 | return im; |
1863 | } | 1732 | } |
1864 | 1733 | ||
1865 | /* Engine can be fail to create texture after cache drop like eng_image_content_hint_set function, | 1734 | /* Engine can fail to create texture after cache drop like eng_image_content_hint_set function, |
1866 | so it is need to add code which check im->im's NULL value*/ | 1735 | so it is need to add code which check im->im's NULL value*/ |
1867 | 1736 | ||
1868 | if (!im->im) | 1737 | if (!im->im) |
diff --git a/legacy/evas/src/modules/engines/wayland_egl/evas_engine.h b/legacy/evas/src/modules/engines/wayland_egl/evas_engine.h index 4482e96afd..204d7932a0 100644 --- a/legacy/evas/src/modules/engines/wayland_egl/evas_engine.h +++ b/legacy/evas/src/modules/engines/wayland_egl/evas_engine.h | |||
@@ -47,6 +47,7 @@ struct _Evas_GL_Wl_Window | |||
47 | { | 47 | { |
48 | struct wl_display *disp; | 48 | struct wl_display *disp; |
49 | struct wl_egl_window *win; | 49 | struct wl_egl_window *win; |
50 | struct wl_surface *surface; | ||
50 | int w, h; | 51 | int w, h; |
51 | int screen; | 52 | int screen; |
52 | // XVisualInfo *visualinfo; | 53 | // XVisualInfo *visualinfo; |
diff --git a/legacy/evas/src/modules/engines/wayland_egl/evas_wl_main.c b/legacy/evas/src/modules/engines/wayland_egl/evas_wl_main.c index 949f8134c1..6416178097 100644 --- a/legacy/evas/src/modules/engines/wayland_egl/evas_wl_main.c +++ b/legacy/evas/src/modules/engines/wayland_egl/evas_wl_main.c | |||
@@ -1,6 +1,6 @@ | |||
1 | #include "evas_engine.h" | 1 | #include "evas_engine.h" |
2 | 2 | ||
3 | static Evas_GL_Wl_Window *_evas_gl_x11_window = NULL; | 3 | static Evas_GL_Wl_Window *_evas_gl_wl_window = NULL; |
4 | 4 | ||
5 | static EGLContext context = EGL_NO_CONTEXT; | 5 | static EGLContext context = EGL_NO_CONTEXT; |
6 | 6 | ||
@@ -25,10 +25,8 @@ eng_window_new(struct wl_display *disp, struct wl_surface *surface, int screen, | |||
25 | 25 | ||
26 | win_count++; | 26 | win_count++; |
27 | gw->disp = disp; | 27 | gw->disp = disp; |
28 | // gw->win = win; | 28 | gw->surface = surface; |
29 | gw->screen = screen; | 29 | gw->screen = screen; |
30 | // gw->visual = vis; | ||
31 | // gw->colormap = cmap; | ||
32 | gw->depth = depth; | 30 | gw->depth = depth; |
33 | gw->alpha = alpha; | 31 | gw->alpha = alpha; |
34 | gw->w = w; | 32 | gw->w = w; |
@@ -138,20 +136,20 @@ eng_window_new(struct wl_display *disp, struct wl_surface *surface, int screen, | |||
138 | eng_window_free(gw); | 136 | eng_window_free(gw); |
139 | return NULL; | 137 | return NULL; |
140 | } | 138 | } |
141 | /* FIXME: !!! */ | 139 | |
142 | gw->win = wl_egl_window_create(surface, gw->w, gw->h); | 140 | gw->win = wl_egl_window_create(gw->surface, gw->w, gw->h); |
143 | 141 | ||
144 | gw->egl_surface[0] = eglCreateWindowSurface(gw->egl_disp, gw->egl_config, | 142 | gw->egl_surface[0] = eglCreateWindowSurface(gw->egl_disp, gw->egl_config, |
145 | (EGLNativeWindowType)gw->win, | 143 | (EGLNativeWindowType)gw->win, |
146 | NULL); | 144 | NULL); |
147 | if (gw->egl_surface[0] == EGL_NO_SURFACE) | 145 | if (gw->egl_surface[0] == EGL_NO_SURFACE) |
148 | { | 146 | { |
149 | /* FIXME: !! */ | 147 | ERR("eglCreateWindowSurface() fail for %#x. code=%#x", |
150 | /* ERR("eglCreateWindowSurface() fail for %#x. code=%#x", */ | 148 | (unsigned int)gw->win, eglGetError()); |
151 | /* (unsigned int)gw->win, eglGetError()); */ | ||
152 | eng_window_free(gw); | 149 | eng_window_free(gw); |
153 | return NULL; | 150 | return NULL; |
154 | } | 151 | } |
152 | |||
155 | if (context == EGL_NO_CONTEXT) | 153 | if (context == EGL_NO_CONTEXT) |
156 | context = eglCreateContext(gw->egl_disp, gw->egl_config, NULL, | 154 | context = eglCreateContext(gw->egl_disp, gw->egl_config, NULL, |
157 | context_attrs); | 155 | context_attrs); |
@@ -162,6 +160,7 @@ eng_window_new(struct wl_display *disp, struct wl_surface *surface, int screen, | |||
162 | eng_window_free(gw); | 160 | eng_window_free(gw); |
163 | return NULL; | 161 | return NULL; |
164 | } | 162 | } |
163 | |||
165 | if (eglMakeCurrent(gw->egl_disp, gw->egl_surface[0], gw->egl_surface[0], | 164 | if (eglMakeCurrent(gw->egl_disp, gw->egl_surface[0], gw->egl_surface[0], |
166 | gw->egl_context[0]) == EGL_FALSE) | 165 | gw->egl_context[0]) == EGL_FALSE) |
167 | { | 166 | { |
@@ -204,8 +203,8 @@ eng_window_free(Evas_GL_Wl_Window *gw) | |||
204 | 203 | ||
205 | win_count--; | 204 | win_count--; |
206 | eng_window_use(gw); | 205 | eng_window_use(gw); |
207 | if (gw == _evas_gl_x11_window) _evas_gl_x11_window = NULL; | 206 | if (gw == _evas_gl_wl_window) _evas_gl_wl_window = NULL; |
208 | if (gw->win) wl_egl_window_destroy(gw->win); | 207 | // if (gw->win) wl_egl_window_destroy(gw->win); |
209 | if (gw->gl_context) | 208 | if (gw->gl_context) |
210 | { | 209 | { |
211 | ref = gw->gl_context->references - 1; | 210 | ref = gw->gl_context->references - 1; |
@@ -216,10 +215,11 @@ eng_window_free(Evas_GL_Wl_Window *gw) | |||
216 | if (ref == 0) | 215 | if (ref == 0) |
217 | { | 216 | { |
218 | if (context) eglDestroyContext(gw->egl_disp, context); | 217 | if (context) eglDestroyContext(gw->egl_disp, context); |
219 | eglTerminate(gw->egl_disp); | ||
220 | context = EGL_NO_CONTEXT; | 218 | context = EGL_NO_CONTEXT; |
221 | } | 219 | } |
222 | eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); | 220 | eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); |
221 | if (ref == 0) eglTerminate(gw->egl_disp); | ||
222 | eglReleaseThread(); | ||
223 | free(gw); | 223 | free(gw); |
224 | } | 224 | } |
225 | 225 | ||
@@ -228,36 +228,36 @@ eng_window_use(Evas_GL_Wl_Window *gw) | |||
228 | { | 228 | { |
229 | Eina_Bool force_use = EINA_FALSE; | 229 | Eina_Bool force_use = EINA_FALSE; |
230 | 230 | ||
231 | if (_evas_gl_x11_window) | 231 | if (_evas_gl_wl_window) |
232 | { | 232 | { |
233 | if ((eglGetCurrentContext() != | 233 | if ((eglGetCurrentContext() != |
234 | _evas_gl_x11_window->egl_context[0]) || | 234 | _evas_gl_wl_window->egl_context[0]) || |
235 | (eglGetCurrentSurface(EGL_READ) != | 235 | (eglGetCurrentSurface(EGL_READ) != |
236 | _evas_gl_x11_window->egl_surface[0]) || | 236 | _evas_gl_wl_window->egl_surface[0]) || |
237 | (eglGetCurrentSurface(EGL_DRAW) != | 237 | (eglGetCurrentSurface(EGL_DRAW) != |
238 | _evas_gl_x11_window->egl_surface[0])) | 238 | _evas_gl_wl_window->egl_surface[0])) |
239 | force_use = EINA_TRUE; | 239 | force_use = EINA_TRUE; |
240 | } | 240 | } |
241 | if ((_evas_gl_x11_window != gw) || (force_use)) | 241 | if ((_evas_gl_wl_window != gw) || (force_use)) |
242 | { | 242 | { |
243 | if (_evas_gl_x11_window) | 243 | if (_evas_gl_wl_window) |
244 | { | 244 | { |
245 | evas_gl_common_context_use(_evas_gl_x11_window->gl_context); | 245 | evas_gl_common_context_use(_evas_gl_wl_window->gl_context); |
246 | evas_gl_common_context_flush(_evas_gl_x11_window->gl_context); | 246 | evas_gl_common_context_flush(_evas_gl_wl_window->gl_context); |
247 | } | 247 | } |
248 | _evas_gl_x11_window = gw; | 248 | _evas_gl_wl_window = gw; |
249 | if (gw) | 249 | if (gw) |
250 | { | 250 | { |
251 | // EGL / GLES | 251 | // EGL / GLES |
252 | if (gw->egl_surface[0] != EGL_NO_SURFACE) | 252 | if (gw->egl_surface[0] != EGL_NO_SURFACE) |
253 | { | 253 | { |
254 | if (eglMakeCurrent(gw->egl_disp, gw->egl_surface[0], | 254 | if (eglMakeCurrent(gw->egl_disp, gw->egl_surface[0], |
255 | gw->egl_surface[0], | 255 | gw->egl_surface[0], |
256 | gw->egl_context[0]) == EGL_FALSE) | 256 | gw->egl_context[0]) == EGL_FALSE) |
257 | { | 257 | { |
258 | ERR("eglMakeCurrent() failed!"); | 258 | ERR("eglMakeCurrent() failed!"); |
259 | } | 259 | } |
260 | } | 260 | } |
261 | } | 261 | } |
262 | } | 262 | } |
263 | if (gw) evas_gl_common_context_use(gw->gl_context); | 263 | if (gw) evas_gl_common_context_use(gw->gl_context); |
@@ -270,15 +270,15 @@ eng_window_unsurf(Evas_GL_Wl_Window *gw) | |||
270 | if (!getenv("EVAS_GL_WIN_RESURF")) return; | 270 | if (!getenv("EVAS_GL_WIN_RESURF")) return; |
271 | if (getenv("EVAS_GL_INFO")) printf("unsurf %p\n", gw); | 271 | if (getenv("EVAS_GL_INFO")) printf("unsurf %p\n", gw); |
272 | 272 | ||
273 | if (_evas_gl_x11_window) | 273 | if (_evas_gl_wl_window) |
274 | evas_gl_common_context_flush(_evas_gl_x11_window->gl_context); | 274 | evas_gl_common_context_flush(_evas_gl_wl_window->gl_context); |
275 | if (_evas_gl_x11_window == gw) | 275 | if (_evas_gl_wl_window == gw) |
276 | { | 276 | { |
277 | eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); | 277 | eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); |
278 | if (gw->egl_surface[0] != EGL_NO_SURFACE) | 278 | if (gw->egl_surface[0] != EGL_NO_SURFACE) |
279 | eglDestroySurface(gw->egl_disp, gw->egl_surface[0]); | 279 | eglDestroySurface(gw->egl_disp, gw->egl_surface[0]); |
280 | gw->egl_surface[0] = EGL_NO_SURFACE; | 280 | gw->egl_surface[0] = EGL_NO_SURFACE; |
281 | _evas_gl_x11_window = NULL; | 281 | _evas_gl_wl_window = NULL; |
282 | } | 282 | } |
283 | gw->surf = 0; | 283 | gw->surf = 0; |
284 | } | 284 | } |
@@ -289,15 +289,14 @@ eng_window_resurf(Evas_GL_Wl_Window *gw) | |||
289 | if (gw->surf) return; | 289 | if (gw->surf) return; |
290 | if (getenv("EVAS_GL_INFO")) printf("resurf %p\n", gw); | 290 | if (getenv("EVAS_GL_INFO")) printf("resurf %p\n", gw); |
291 | 291 | ||
292 | /* FIXME !! */ | 292 | gw->egl_surface[0] = |
293 | /* gw->egl_surface[0] = eglCreateWindowSurface(gw->egl_disp, gw->egl_config, */ | 293 | eglCreateWindowSurface(gw->egl_disp, gw->egl_config, |
294 | /* (EGLNativeWindowType)gw->win, */ | 294 | (EGLNativeWindowType)gw->win, NULL); |
295 | /* NULL); */ | 295 | |
296 | if (gw->egl_surface[0] == EGL_NO_SURFACE) | 296 | if (gw->egl_surface[0] == EGL_NO_SURFACE) |
297 | { | 297 | { |
298 | /* FIXME: !! */ | 298 | ERR("eglCreateWindowSurface() fail for %#x. code=%#x", |
299 | /* ERR("eglCreateWindowSurface() fail for %#x. code=%#x", */ | 299 | (unsigned int)gw->win, eglGetError()); |
300 | /* (unsigned int)gw->win, eglGetError()); */ | ||
301 | return; | 300 | return; |
302 | } | 301 | } |
303 | if (eglMakeCurrent(gw->egl_disp, gw->egl_surface[0], gw->egl_surface[0], | 302 | if (eglMakeCurrent(gw->egl_disp, gw->egl_surface[0], gw->egl_surface[0], |