summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-01-22 17:25:59 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-01-22 17:25:59 +0900
commit5cd200194e9d695675208834b4c5abc57283f868 (patch)
tree4a2847d22a0676d8e40d49bdceab2f23d750abb7 /src/modules
parent84c0ea04232c56feb94ae17a54b79fab85a22a40 (diff)
Evas masking: Fix potential GPU memory leak
This should free the mask surface properly, like we do in software.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index fe8125ad7b..66d98c48c6 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -1696,12 +1696,12 @@ eng_context_flush(void *data)
1696} 1696}
1697 1697
1698static void 1698static void
1699eng_context_clip_image_unset(void *data EINA_UNUSED, void *context) 1699eng_context_clip_image_unset(void *data, void *context)
1700{ 1700{
1701 RGBA_Draw_Context *ctx = context; 1701 RGBA_Draw_Context *ctx = context;
1702 Evas_GL_Image *im = ctx->clip.mask; 1702 Evas_GL_Image *im = ctx->clip.mask;
1703 1703
1704 if (im && im->im) 1704 if (EINA_UNLIKELY(im && im->im))
1705 { 1705 {
1706#ifdef EVAS_CSERVE2 1706#ifdef EVAS_CSERVE2
1707 if (evas_cserve2_use_get()) 1707 if (evas_cserve2_use_get())
@@ -1712,6 +1712,13 @@ eng_context_clip_image_unset(void *data EINA_UNUSED, void *context)
1712 // Is the above code safe? Hmmm... 1712 // Is the above code safe? Hmmm...
1713 //evas_unref_queue_image_put(EVAS???, &ctx->clip.ie->cache_entry); 1713 //evas_unref_queue_image_put(EVAS???, &ctx->clip.ie->cache_entry);
1714 } 1714 }
1715 else if (im)
1716 {
1717 im->references--;
1718 if (!im->references)
1719 eng_image_free(data, im);
1720 }
1721
1715 ctx->clip.mask = NULL; 1722 ctx->clip.mask = NULL;
1716} 1723}
1717 1724
@@ -1728,14 +1735,23 @@ eng_context_clip_image_set(void *data EINA_UNUSED, void *context, void *surface,
1728 ctx->clip.mask_x = x; 1735 ctx->clip.mask_x = x;
1729 ctx->clip.mask_y = y; 1736 ctx->clip.mask_y = y;
1730 1737
1731 if (im && im->im) 1738 if (EINA_UNLIKELY(im && im->im))
1732 { 1739 {
1740 // Unlikely to happen because masks are render surfaces.
1733#ifdef EVAS_CSERVE2 1741#ifdef EVAS_CSERVE2
1734 if (evas_cserve2_use_get()) 1742 if (evas_cserve2_use_get())
1735 evas_cache2_image_ref(&im->im->cache_entry); 1743 evas_cache2_image_ref(&im->im->cache_entry);
1736 else 1744 else
1737#endif 1745#endif
1738 evas_cache_image_ref(&im->im->cache_entry); 1746 evas_cache_image_ref(&im->im->cache_entry);
1747 RECTS_CLIP_TO_RECT(ctx->clip.x, ctx->clip.y, ctx->clip.w, ctx->clip.h,
1748 x, y, im->im->cache_entry.w, im->im->cache_entry.h);
1749 }
1750 else if (im)
1751 {
1752 im->references++;
1753 RECTS_CLIP_TO_RECT(ctx->clip.x, ctx->clip.y, ctx->clip.w, ctx->clip.h,
1754 x, y, im->w, im->h);
1739 } 1755 }
1740} 1756}
1741 1757