summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-10-16 17:20:14 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-10-16 22:56:38 +0900
commit7d7f548afcfcb0a69fe1694b7c68f36cecc74d89 (patch)
tree478b7990e8b732dbafc4681c8cfd228719b25650 /src/modules
parented0e8b8df1b751e0c9f46e5f2a3fdfa1364a8659 (diff)
evas - gl - dont allocate image and/or texture until needed on native unset
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/evas/engines/gl_cocoa/evas_engine.c7
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_common.h1
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_image.c15
-rw-r--r--src/modules/evas/engines/gl_sdl/evas_engine.c5
-rw-r--r--src/modules/evas/engines/gl_x11/evas_engine.c6
-rw-r--r--src/modules/evas/engines/wayland_egl/evas_engine.c6
6 files changed, 38 insertions, 2 deletions
diff --git a/src/modules/evas/engines/gl_cocoa/evas_engine.c b/src/modules/evas/engines/gl_cocoa/evas_engine.c
index 83c2968cc3..702e751fc2 100644
--- a/src/modules/evas/engines/gl_cocoa/evas_engine.c
+++ b/src/modules/evas/engines/gl_cocoa/evas_engine.c
@@ -453,6 +453,7 @@ eng_image_alpha_set(void *data, void *image, int has_alpha)
453 453
454 if (!im->im->image.data) 454 if (!im->im->image.data)
455 evas_cache_image_load_data(&im->im->cache_entry); 455 evas_cache_image_load_data(&im->im->cache_entry);
456 evas_gl_common_image_alloc_ensure(im);
456 im_new = evas_gl_common_image_new_from_copied_data 457 im_new = evas_gl_common_image_new_from_copied_data
457 (im->gc, im->im->cache_entry.w, im->im->cache_entry.h, 458 (im->gc, im->im->cache_entry.w, im->im->cache_entry.h,
458 im->im->image.data, 459 im->im->image.data,
@@ -523,6 +524,7 @@ eng_image_colorspace_set(void *data, void *image, int cspace)
523 /* FIXME: can move to gl_common */ 524 /* FIXME: can move to gl_common */
524 if (im->cs.space == cspace) return; 525 if (im->cs.space == cspace) return;
525 eng_window_use(re->win); 526 eng_window_use(re->win);
527 evas_gl_common_image_alloc_ensure(im);
526 evas_cache_image_colorspace(&im->im->cache_entry, cspace); 528 evas_cache_image_colorspace(&im->im->cache_entry, cspace);
527 switch (cspace) 529 switch (cspace)
528 { 530 {
@@ -676,7 +678,8 @@ eng_image_size_set(void *data, void *image, int w, int h)
676 w &= ~0x1; 678 w &= ~0x1;
677 break; 679 break;
678 } 680 }
679 681
682 evas_gl_common_image_alloc_ensure(im_old);
680 if ((im_old->im) && 683 if ((im_old->im) &&
681 ((int)im_old->im->cache_entry.w == w) && 684 ((int)im_old->im->cache_entry.w == w) &&
682 ((int)im_old->im->cache_entry.h == h)) 685 ((int)im_old->im->cache_entry.h == h))
@@ -744,6 +747,7 @@ eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, i
744 } 747 }
745 eng_window_use(re->win); 748 eng_window_use(re->win);
746 error = evas_cache_image_load_data(&im->im->cache_entry); 749 error = evas_cache_image_load_data(&im->im->cache_entry);
750 evas_gl_common_image_alloc_ensure(im);
747 switch (im->cs.space) 751 switch (im->cs.space)
748 { 752 {
749 case EVAS_COLORSPACE_ARGB8888: 753 case EVAS_COLORSPACE_ARGB8888:
@@ -795,6 +799,7 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data)
795 im = image; 799 im = image;
796 if (im->native.data) return image; 800 if (im->native.data) return image;
797 eng_window_use(re->win); 801 eng_window_use(re->win);
802 evas_gl_common_image_alloc_ensure(im);
798 if ((im->tex) && (im->tex->pt) && (im->tex->pt->dyn.data)) 803 if ((im->tex) && (im->tex->pt) && (im->tex->pt->dyn.data))
799 { 804 {
800 if (im->tex->pt->dyn.data == image_data) 805 if (im->tex->pt->dyn.data == image_data)
diff --git a/src/modules/evas/engines/gl_common/evas_gl_common.h b/src/modules/evas/engines/gl_common/evas_gl_common.h
index def64253fb..df0166452e 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -715,6 +715,7 @@ void evas_gl_common_texture_nv12_update(Evas_GL_Texture *tex, DATA8
715Evas_GL_Texture *evas_gl_common_texture_nv12tiled_new(Evas_Engine_GL_Context *gc, DATA8 **rows, unsigned int w, unsigned int h); 715Evas_GL_Texture *evas_gl_common_texture_nv12tiled_new(Evas_Engine_GL_Context *gc, DATA8 **rows, unsigned int w, unsigned int h);
716void evas_gl_common_texture_nv12tiled_update(Evas_GL_Texture *tex, DATA8 **row, unsigned int w, unsigned int h); 716void evas_gl_common_texture_nv12tiled_update(Evas_GL_Texture *tex, DATA8 **row, unsigned int w, unsigned int h);
717 717
718void evas_gl_common_image_alloc_ensure(Evas_GL_Image *im);
718void evas_gl_common_image_all_unload(Evas_Engine_GL_Context *gc); 719void evas_gl_common_image_all_unload(Evas_Engine_GL_Context *gc);
719 720
720void evas_gl_common_image_ref(Evas_GL_Image *im); 721void evas_gl_common_image_ref(Evas_GL_Image *im);
diff --git a/src/modules/evas/engines/gl_common/evas_gl_image.c b/src/modules/evas/engines/gl_common/evas_gl_image.c
index 769b65acaa..23177904fb 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_image.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_image.c
@@ -1,6 +1,14 @@
1#include "evas_gl_private.h" 1#include "evas_gl_private.h"
2 2
3void 3void
4evas_gl_common_image_alloc_ensure(Evas_GL_Image *im)
5{
6 if (!im->im) return;
7 im->im = (RGBA_Image *)evas_cache_image_size_set(&im->im->cache_entry,
8 im->w, im->h);
9}
10
11void
4evas_gl_common_image_all_unload(Evas_Engine_GL_Context *gc) 12evas_gl_common_image_all_unload(Evas_Engine_GL_Context *gc)
5{ 13{
6 Eina_List *l; 14 Eina_List *l;
@@ -332,6 +340,7 @@ evas_gl_common_image_alpha_set(Evas_GL_Image *im, int alpha)
332 if (im->alpha == alpha) return im; 340 if (im->alpha == alpha) return im;
333 im->alpha = alpha; 341 im->alpha = alpha;
334 if (!im->im) return im; 342 if (!im->im) return im;
343 evas_gl_common_image_alloc_ensure(im);
335 evas_cache_image_load_data(&im->im->cache_entry); 344 evas_cache_image_load_data(&im->im->cache_entry);
336 im->im->cache_entry.flags.alpha = alpha ? 1 : 0; 345 im->im->cache_entry.flags.alpha = alpha ? 1 : 0;
337 346
@@ -395,14 +404,15 @@ evas_gl_common_image_native_disable(Evas_GL_Image *im)
395 im->tex = NULL; 404 im->tex = NULL;
396 } 405 }
397 im->tex_only = 0; 406 im->tex_only = 0;
398
399 im->im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get()); 407 im->im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
400 im->im->cache_entry.flags.alpha = im->alpha; 408 im->im->cache_entry.flags.alpha = im->alpha;
401 im->cs.space = EVAS_COLORSPACE_ARGB8888; 409 im->cs.space = EVAS_COLORSPACE_ARGB8888;
402 evas_cache_image_colorspace(&im->im->cache_entry, im->cs.space); 410 evas_cache_image_colorspace(&im->im->cache_entry, im->cs.space);
411/*
403 im->im = (RGBA_Image *)evas_cache_image_size_set(&im->im->cache_entry, im->w, im->h); 412 im->im = (RGBA_Image *)evas_cache_image_size_set(&im->im->cache_entry, im->w, im->h);
404 if (!im->tex) 413 if (!im->tex)
405 im->tex = evas_gl_common_texture_new(im->gc, im->im); 414 im->tex = evas_gl_common_texture_new(im->gc, im->im);
415 */
406} 416}
407 417
408void 418void
@@ -538,6 +548,7 @@ evas_gl_common_image_dirty(Evas_GL_Image *im, unsigned int x, unsigned int y, un
538 } 548 }
539 if (im->im) 549 if (im->im)
540 { 550 {
551 evas_gl_common_image_alloc_ensure(im);
541 im->im = (RGBA_Image *)evas_cache_image_dirty(&im->im->cache_entry, x, y, w, h); 552 im->im = (RGBA_Image *)evas_cache_image_dirty(&im->im->cache_entry, x, y, w, h);
542 } 553 }
543 im->dirty = 1; 554 im->dirty = 1;
@@ -549,6 +560,7 @@ evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im)
549 Image_Entry *ie; 560 Image_Entry *ie;
550 if (!im->im) return; 561 if (!im->im) return;
551 ie = (Image_Entry *)(im->im); 562 ie = (Image_Entry *)(im->im);
563 evas_gl_common_image_alloc_ensure(im);
552/* 564/*
553 if ((im->cs.space == EVAS_COLORSPACE_YCBCR422P601_PL) || 565 if ((im->cs.space == EVAS_COLORSPACE_YCBCR422P601_PL) ||
554 (im->cs.space == EVAS_COLORSPACE_YCBCR422P709_PL)) 566 (im->cs.space == EVAS_COLORSPACE_YCBCR422P709_PL))
@@ -716,6 +728,7 @@ evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
716 RECTS_CLIP_TO_RECT(nx, ny, nw, nh, 728 RECTS_CLIP_TO_RECT(nx, ny, nw, nh,
717 cx, cy, cw, ch); 729 cx, cy, cw, ch);
718 if ((nw < 1) || (nh < 1)) return; 730 if ((nw < 1) || (nh < 1)) return;
731 if (!im->tex) return;
719 if ((nx == dx) && (ny == dy) && (nw == dw) && (nh == dh)) 732 if ((nx == dx) && (ny == dy) && (nw == dw) && (nh == dh))
720 { 733 {
721 if (yuv) 734 if (yuv)
diff --git a/src/modules/evas/engines/gl_sdl/evas_engine.c b/src/modules/evas/engines/gl_sdl/evas_engine.c
index 5c5df60eea..6e89f21ca2 100644
--- a/src/modules/evas/engines/gl_sdl/evas_engine.c
+++ b/src/modules/evas/engines/gl_sdl/evas_engine.c
@@ -365,6 +365,7 @@ eng_image_alpha_set(void *data EINA_UNUSED, void *image, int has_alpha)
365 365
366 if (!im->im->image.data) 366 if (!im->im->image.data)
367 evas_cache_image_load_data(&im->im->cache_entry); 367 evas_cache_image_load_data(&im->im->cache_entry);
368 evas_gl_common_image_alloc_ensure(im);
368 im_new = evas_gl_common_image_new_from_copied_data(im->gc, im->im->cache_entry.w, im->im->cache_entry.h, im->im->image.data, 369 im_new = evas_gl_common_image_new_from_copied_data(im->gc, im->im->cache_entry.w, im->im->cache_entry.h, im->im->image.data,
369 eng_image_alpha_get(data, image), 370 eng_image_alpha_get(data, image),
370 eng_image_colorspace_get(data, image)); 371 eng_image_colorspace_get(data, image));
@@ -414,6 +415,7 @@ eng_image_colorspace_set(void *data EINA_UNUSED, void *image, int cspace)
414 if (im->native.data) return; 415 if (im->native.data) return;
415 /* FIXME: can move to gl_common */ 416 /* FIXME: can move to gl_common */
416 if (im->cs.space == cspace) return; 417 if (im->cs.space == cspace) return;
418 evas_gl_common_image_alloc_ensure(im);
417 evas_cache_image_colorspace(&im->im->cache_entry, cspace); 419 evas_cache_image_colorspace(&im->im->cache_entry, cspace);
418 switch (cspace) 420 switch (cspace)
419 { 421 {
@@ -566,6 +568,7 @@ eng_image_size_set(void *data, void *image, int w, int h)
566 break; 568 break;
567 } 569 }
568 570
571 evas_gl_common_image_alloc_ensure(im_old);
569 if ((im_old->im) && 572 if ((im_old->im) &&
570 ((int)im_old->im->cache_entry.w == w) && 573 ((int)im_old->im->cache_entry.w == w) &&
571 ((int)im_old->im->cache_entry.h == h)) 574 ((int)im_old->im->cache_entry.h == h))
@@ -621,6 +624,7 @@ eng_image_data_get(void *data EINA_UNUSED, void *image, int to_write, DATA32 **i
621 return im; 624 return im;
622 } 625 }
623 error = evas_cache_image_load_data(&im->im->cache_entry); 626 error = evas_cache_image_load_data(&im->im->cache_entry);
627 evas_gl_common_image_alloc_ensure(im);
624 switch (im->cs.space) 628 switch (im->cs.space)
625 { 629 {
626 case EVAS_COLORSPACE_ARGB8888: 630 case EVAS_COLORSPACE_ARGB8888:
@@ -670,6 +674,7 @@ eng_image_data_put(void *data EINA_UNUSED, void *image, DATA32 *image_data)
670 if (!image) return NULL; 674 if (!image) return NULL;
671 im = image; 675 im = image;
672 if (im->native.data) return image; 676 if (im->native.data) return image;
677 evas_gl_common_image_alloc_ensure(im);
673 switch (im->cs.space) 678 switch (im->cs.space)
674 { 679 {
675 case EVAS_COLORSPACE_ARGB8888: 680 case EVAS_COLORSPACE_ARGB8888:
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c
index cda7fe7e6f..f1a41e5a3a 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -1817,6 +1817,7 @@ eng_image_alpha_set(void *data, void *image, int has_alpha)
1817 1817
1818 if (!im->im->image.data) 1818 if (!im->im->image.data)
1819 evas_cache_image_load_data(&im->im->cache_entry); 1819 evas_cache_image_load_data(&im->im->cache_entry);
1820 evas_gl_common_image_alloc_ensure(im);
1820 im_new = evas_gl_common_image_new_from_copied_data 1821 im_new = evas_gl_common_image_new_from_copied_data
1821 (im->gc, im->im->cache_entry.w, im->im->cache_entry.h, 1822 (im->gc, im->im->cache_entry.w, im->im->cache_entry.h,
1822 im->im->image.data, 1823 im->im->image.data,
@@ -1888,6 +1889,7 @@ eng_image_colorspace_set(void *data, void *image, int cspace)
1888 /* FIXME: can move to gl_common */ 1889 /* FIXME: can move to gl_common */
1889 if (im->cs.space == cspace) return; 1890 if (im->cs.space == cspace) return;
1890 eng_window_use(re->win); 1891 eng_window_use(re->win);
1892 evas_gl_common_image_alloc_ensure(im);
1891 evas_cache_image_colorspace(&im->im->cache_entry, cspace); 1893 evas_cache_image_colorspace(&im->im->cache_entry, cspace);
1892 switch (cspace) 1894 switch (cspace)
1893 { 1895 {
@@ -2633,6 +2635,7 @@ eng_image_size_set(void *data, void *image, int w, int h)
2633 break; 2635 break;
2634 } 2636 }
2635 2637
2638 evas_gl_common_image_alloc_ensure(im_old);
2636 if ((im_old->im) && 2639 if ((im_old->im) &&
2637 ((int)im_old->im->cache_entry.w == w) && 2640 ((int)im_old->im->cache_entry.w == w) &&
2638 ((int)im_old->im->cache_entry.h == h)) 2641 ((int)im_old->im->cache_entry.h == h))
@@ -2743,6 +2746,7 @@ eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, i
2743 } 2746 }
2744 2747
2745 error = evas_cache_image_load_data(&im->im->cache_entry); 2748 error = evas_cache_image_load_data(&im->im->cache_entry);
2749 evas_gl_common_image_alloc_ensure(im);
2746 switch (im->cs.space) 2750 switch (im->cs.space)
2747 { 2751 {
2748 case EVAS_COLORSPACE_ARGB8888: 2752 case EVAS_COLORSPACE_ARGB8888:
@@ -2797,6 +2801,7 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data)
2797 im = image; 2801 im = image;
2798 if (im->native.data) return image; 2802 if (im->native.data) return image;
2799 eng_window_use(re->win); 2803 eng_window_use(re->win);
2804 evas_gl_common_image_alloc_ensure(im);
2800 if ((im->tex) && (im->tex->pt) 2805 if ((im->tex) && (im->tex->pt)
2801 && (im->tex->pt->dyn.data) 2806 && (im->tex->pt->dyn.data)
2802 && (im->cs.space == EVAS_COLORSPACE_ARGB8888)) 2807 && (im->cs.space == EVAS_COLORSPACE_ARGB8888))
@@ -3357,6 +3362,7 @@ eng_pixel_alpha_get(void *image, int x, int y, DATA8 *alpha, int src_region_x, i
3357 return EINA_FALSE; 3362 return EINA_FALSE;
3358 } 3363 }
3359 3364
3365 evas_gl_common_image_alloc_ensure(im);
3360 src_w = im->im->cache_entry.w; 3366 src_w = im->im->cache_entry.w;
3361 src_h = im->im->cache_entry.h; 3367 src_h = im->im->cache_entry.h;
3362 if ((src_w == 0) || (src_h == 0)) 3368 if ((src_w == 0) || (src_h == 0))
diff --git a/src/modules/evas/engines/wayland_egl/evas_engine.c b/src/modules/evas/engines/wayland_egl/evas_engine.c
index 28f72b08de..a370825b2f 100644
--- a/src/modules/evas/engines/wayland_egl/evas_engine.c
+++ b/src/modules/evas/engines/wayland_egl/evas_engine.c
@@ -1681,6 +1681,7 @@ eng_image_size_set(void *data, void *image, int w, int h)
1681 break; 1681 break;
1682 } 1682 }
1683 1683
1684 evas_gl_common_image_alloc_ensure(im);
1684 if ((im_old->im) && 1685 if ((im_old->im) &&
1685 ((int)im_old->im->cache_entry.w == w) && 1686 ((int)im_old->im->cache_entry.w == w) &&
1686 ((int)im_old->im->cache_entry.h == h)) 1687 ((int)im_old->im->cache_entry.h == h))
@@ -1778,6 +1779,7 @@ eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, i
1778 } 1779 }
1779 1780
1780 error = evas_cache_image_load_data(&im->im->cache_entry); 1781 error = evas_cache_image_load_data(&im->im->cache_entry);
1782 evas_gl_common_image_alloc_ensure(im);
1781 switch (im->cs.space) 1783 switch (im->cs.space)
1782 { 1784 {
1783 case EVAS_COLORSPACE_ARGB8888: 1785 case EVAS_COLORSPACE_ARGB8888:
@@ -1832,6 +1834,7 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data)
1832 if (!(im = image)) return NULL; 1834 if (!(im = image)) return NULL;
1833 if (im->native.data) return image; 1835 if (im->native.data) return image;
1834 eng_window_use(re->win); 1836 eng_window_use(re->win);
1837 evas_gl_common_image_alloc_ensure(im);
1835 if ((im->tex) && (im->tex->pt) 1838 if ((im->tex) && (im->tex->pt)
1836 && (im->tex->pt->dyn.data) 1839 && (im->tex->pt->dyn.data)
1837 && (im->cs.space == EVAS_COLORSPACE_ARGB8888)) 1840 && (im->cs.space == EVAS_COLORSPACE_ARGB8888))
@@ -1959,6 +1962,7 @@ eng_image_alpha_set(void *data, void *image, int has_alpha)
1959 1962
1960 if (!im->im->image.data) 1963 if (!im->im->image.data)
1961 evas_cache_image_load_data(&im->im->cache_entry); 1964 evas_cache_image_load_data(&im->im->cache_entry);
1965 evas_gl_common_image_alloc_ensure(im);
1962 im_new = evas_gl_common_image_new_from_copied_data 1966 im_new = evas_gl_common_image_new_from_copied_data
1963 (im->gc, im->im->cache_entry.w, im->im->cache_entry.h, 1967 (im->gc, im->im->cache_entry.w, im->im->cache_entry.h,
1964 im->im->image.data, 1968 im->im->image.data,
@@ -2071,6 +2075,7 @@ eng_image_colorspace_set(void *data, void *image, int cspace)
2071 /* FIXME: can move to gl_common */ 2075 /* FIXME: can move to gl_common */
2072 if (im->cs.space == cspace) return; 2076 if (im->cs.space == cspace) return;
2073 eng_window_use(re->win); 2077 eng_window_use(re->win);
2078 evas_gl_common_image_alloc_ensure(im);
2074 evas_cache_image_colorspace(&im->im->cache_entry, cspace); 2079 evas_cache_image_colorspace(&im->im->cache_entry, cspace);
2075 switch (cspace) 2080 switch (cspace)
2076 { 2081 {
@@ -2516,6 +2521,7 @@ eng_pixel_alpha_get(void *image, int x, int y, DATA8 *alpha, int src_region_x, i
2516 return EINA_FALSE; 2521 return EINA_FALSE;
2517 } 2522 }
2518 2523
2524 evas_gl_common_image_alloc_ensure(im);
2519 src_w = im->im->cache_entry.w; 2525 src_w = im->im->cache_entry.w;
2520 src_h = im->im->cache_entry.h; 2526 src_h = im->im->cache_entry.h;
2521 if ((src_w == 0) || (src_h == 0)) 2527 if ((src_w == 0) || (src_h == 0))