aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/modules/engines/wayland_egl/evas_engine.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/evas/src/modules/engines/wayland_egl/evas_engine.c')
-rw-r--r--libraries/evas/src/modules/engines/wayland_egl/evas_engine.c184
1 files changed, 21 insertions, 163 deletions
diff --git a/libraries/evas/src/modules/engines/wayland_egl/evas_engine.c b/libraries/evas/src/modules/engines/wayland_egl/evas_engine.c
index d2a6a0d..4f5102e 100644
--- a/libraries/evas/src/modules/engines/wayland_egl/evas_engine.c
+++ b/libraries/evas/src/modules/engines/wayland_egl/evas_engine.c
@@ -25,7 +25,6 @@ struct _Render_Engine
25 int end; 25 int end;
26 int w, h; 26 int w, h;
27 int vsync; 27 int vsync;
28
29}; 28};
30 29
31struct _Render_Engine_GL_Surface 30struct _Render_Engine_GL_Surface
@@ -1320,76 +1319,6 @@ struct _Native
1320// 1319//
1321//#define GLX_TEX_PIXMAP_RECREATE 1 1320//#define GLX_TEX_PIXMAP_RECREATE 1
1322 1321
1323static void
1324_native_bind_cb(void *data, void *image)
1325{
1326 Evas_GL_Image *im = image;
1327 Native *n = im->native.data;
1328
1329 if (n->egl_surface)
1330 {
1331 if (glsym_glEGLImageTargetTexture2DOES)
1332 {
1333 glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, n->egl_surface);
1334 if (eglGetError() != EGL_SUCCESS)
1335 ERR("glEGLImageTargetTexture2DOES() failed.");
1336 }
1337 else
1338 ERR("Try glEGLImageTargetTexture2DOES on EGL with no support");
1339 }
1340 return;
1341 data = NULL;
1342}
1343
1344static void
1345_native_unbind_cb(void *data, void *image)
1346{
1347 Evas_GL_Image *im = image;
1348 /* Native *n = im->native.data; */
1349
1350 /* if (n->ns.type == EVAS_NATIVE_SURFACE_X11) */
1351 /* { */
1352 /* // nothing */
1353 /* } */
1354 /* else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL) */
1355 /* { */
1356 /* glBindTexture(GL_TEXTURE_2D, 0); */
1357 /* GLERR(__FUNCTION__, __FILE__, __LINE__, ""); */
1358 /* } */
1359 return;
1360 data = NULL;
1361}
1362
1363static void
1364_native_free_cb(void *data, void *image)
1365{
1366 Render_Engine *re = data;
1367 Evas_GL_Image *im = image;
1368 Native *n = im->native.data;
1369 uint32_t texid;
1370// uint32_t pmid, texid;
1371
1372 /* eina_hash_del(re->win->gl_context->shared->native_pm_hash, &pmid, im); */
1373 if (n->egl_surface)
1374 {
1375 if (glsym_eglDestroyImage)
1376 {
1377 glsym_eglDestroyImage(re->win->egl_disp, n->egl_surface);
1378 if (eglGetError() != EGL_SUCCESS)
1379 ERR("eglDestroyImage() failed.");
1380 }
1381 else
1382 ERR("Try eglDestroyImage on EGL with no support");
1383 }
1384
1385 im->native.data = NULL;
1386 im->native.func.data = NULL;
1387 im->native.func.bind = NULL;
1388 im->native.func.unbind = NULL;
1389 im->native.func.free = NULL;
1390 free(n);
1391}
1392
1393static void * 1322static void *
1394eng_image_native_set(void *data, void *image, void *native) 1323eng_image_native_set(void *data, void *image, void *native)
1395{ 1324{
@@ -1397,10 +1326,6 @@ eng_image_native_set(void *data, void *image, void *native)
1397 Evas_Native_Surface *ns = native; 1326 Evas_Native_Surface *ns = native;
1398 Evas_GL_Image *im = image, *im2 = NULL; 1327 Evas_GL_Image *im = image, *im2 = NULL;
1399 Native *n = NULL; 1328 Native *n = NULL;
1400// uint32_t pmid;
1401// uint32_t texid;
1402 unsigned int tex = 0;
1403 unsigned int fbo = 0;
1404 1329
1405 if (!im) 1330 if (!im)
1406 { 1331 {
@@ -1418,15 +1343,7 @@ eng_image_native_set(void *data, void *image, void *native)
1418 1343
1419 if (ns) 1344 if (ns)
1420 { 1345 {
1421 /* vis = ns->data.x11.visual; */ 1346 if (im->native.data) return im;
1422 /* pm = ns->data.x11.pixmap; */
1423 if (im->native.data)
1424 {
1425 Evas_Native_Surface *ens = im->native.data;
1426 /* if ((ens->data.x11.visual == vis) && */
1427 /* (ens->data.x11.pixmap == pm)) */
1428 return im;
1429 }
1430 } 1347 }
1431 if ((!ns) && (!im->native.data)) return im; 1348 if ((!ns) && (!im->native.data)) return im;
1432 1349
@@ -1441,94 +1358,35 @@ eng_image_native_set(void *data, void *image, void *native)
1441 1358
1442 if (!ns) return im; 1359 if (!ns) return im;
1443 1360
1444 /* if (ns->type == EVAS_NATIVE_SURFACE_X11) */ 1361 if (im2 == im) return im;
1445 /* { */ 1362 if (im2)
1446 /* pmid = pm; */ 1363 {
1447 /* im2 = eina_hash_find(re->win->gl_context->shared->native_pm_hash, &pmid); */ 1364 n = im2->native.data;
1448 if (im2 == im) return im; 1365 if (n)
1449 if (im2) 1366 {
1450 { 1367 evas_gl_common_image_ref(im2);
1451 n = im2->native.data; 1368 evas_gl_common_image_free(im);
1452 if (n) 1369 return im2;
1453 { 1370 }
1454 evas_gl_common_image_ref(im2); 1371 }
1455 evas_gl_common_image_free(im);
1456 return im2;
1457 }
1458 }
1459 1372
1460 im2 = evas_gl_common_image_new_from_data(re->win->gl_context, 1373 im2 = evas_gl_common_image_new_from_data(re->win->gl_context,
1461 im->w, im->h, NULL, im->alpha, 1374 im->w, im->h, NULL, im->alpha,
1462 EVAS_COLORSPACE_ARGB8888); 1375 EVAS_COLORSPACE_ARGB8888);
1463 evas_gl_common_image_free(im); 1376 evas_gl_common_image_free(im);
1464 im = im2; 1377 im = im2;
1465 /* if (native) */ 1378
1466 /* { */
1467 /* n = calloc(1, sizeof(Native)); */
1468 /* if (n) */
1469 /* { */
1470 /* EGLConfig egl_config; */
1471 /* int config_attrs[20]; */
1472 /* int num_config, i = 0; */
1473
1474 /* eina_hash_add(re->win->gl_context->shared->native_pm_hash, &pmid, im); */
1475
1476 /* config_attrs[i++] = EGL_RED_SIZE; */
1477 /* config_attrs[i++] = 8; */
1478 /* config_attrs[i++] = EGL_GREEN_SIZE; */
1479 /* config_attrs[i++] = 8; */
1480 /* config_attrs[i++] = EGL_BLUE_SIZE; */
1481 /* config_attrs[i++] = 8; */
1482 /* config_attrs[i++] = EGL_ALPHA_SIZE; */
1483 /* config_attrs[i++] = 8; */
1484 /* config_attrs[i++] = EGL_DEPTH_SIZE; */
1485 /* config_attrs[i++] = 0; */
1486 /* config_attrs[i++] = EGL_STENCIL_SIZE; */
1487 /* config_attrs[i++] = 0; */
1488 /* config_attrs[i++] = EGL_RENDERABLE_TYPE; */
1489 /* config_attrs[i++] = EGL_OPENGL_ES2_BIT; */
1490 /* config_attrs[i++] = EGL_SURFACE_TYPE; */
1491 /* config_attrs[i++] = EGL_PIXMAP_BIT; */
1492 /* config_attrs[i++] = EGL_NONE; */
1493
1494 /* if (!eglChooseConfig(re->win->egl_disp, config_attrs, */
1495 /* &egl_config, 1, &num_config)) */
1496 /* ERR("eglChooseConfig() failed for, num_config = %i", num_config); */
1497 /* memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface)); */
1498 /* n->pixmap = pm; */
1499 /* if (glsym_eglCreateImage) */
1500 /* n->egl_surface = glsym_eglCreateImage(re->win->egl_disp, */
1501 /* EGL_NO_CONTEXT, */
1502 /* EGL_NATIVE_PIXMAP_KHR, */
1503 /* (void *)pm, */
1504 /* NULL); */
1505 /* else */
1506 /* ERR("Try eglCreateImage on EGL with no support"); */
1507 /* if (!n->egl_surface) */
1508 /* ERR("eglCreatePixmapSurface() for 0x%x failed", (unsigned int)pm); */
1509 /* im->native.yinvert = 1; */
1510 /* im->native.loose = 0; */
1511 /* im->native.data = n; */
1512 /* im->native.func.data = re; */
1513 /* im->native.func.bind = _native_bind_cb; */
1514 /* im->native.func.unbind = _native_unbind_cb; */
1515 /* im->native.func.free = _native_free_cb; */
1516 /* im->native.target = GL_TEXTURE_2D; */
1517 /* im->native.mipmap = 0; */
1518 /* evas_gl_common_image_native_enable(im); */
1519 /* } */
1520 /* } */
1521 return im; 1379 return im;
1522} 1380}
1523 1381
1524static void * 1382static void *
1525eng_image_native_get(void *data __UNUSED__, void *image) 1383eng_image_native_get(void *data __UNUSED__, void *image)
1526{ 1384{
1527 Evas_GL_Image *im = image; 1385 Evas_GL_Image *im;
1528 Native *n; 1386 Native *n;
1529 if (!im) return NULL; 1387
1530 n = im->native.data; 1388 if (!(im = image)) return NULL;
1531 if (!n) return NULL; 1389 if (!(n = im->native.data)) return NULL;
1532 return &(n->ns); 1390 return &(n->ns);
1533} 1391}
1534 1392