jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=5cd200194e9d695675208834b4c5abc57283f868
commit 5cd200194e9d695675208834b4c5abc57283f868 Author: Jean-Philippe Andre <jp.an...@samsung.com> Date: Thu Jan 22 17:25:59 2015 +0900 Evas masking: Fix potential GPU memory leak This should free the mask surface properly, like we do in software. --- src/modules/evas/engines/gl_generic/evas_engine.c | 22 +++++++++++++++++++--- 1 file 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 fe8125a..66d98c4 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) } static void -eng_context_clip_image_unset(void *data EINA_UNUSED, void *context) +eng_context_clip_image_unset(void *data, void *context) { RGBA_Draw_Context *ctx = context; Evas_GL_Image *im = ctx->clip.mask; - if (im && im->im) + if (EINA_UNLIKELY(im && im->im)) { #ifdef EVAS_CSERVE2 if (evas_cserve2_use_get()) @@ -1712,6 +1712,13 @@ eng_context_clip_image_unset(void *data EINA_UNUSED, void *context) // Is the above code safe? Hmmm... //evas_unref_queue_image_put(EVAS???, &ctx->clip.ie->cache_entry); } + else if (im) + { + im->references--; + if (!im->references) + eng_image_free(data, im); + } + ctx->clip.mask = NULL; } @@ -1728,14 +1735,23 @@ eng_context_clip_image_set(void *data EINA_UNUSED, void *context, void *surface, ctx->clip.mask_x = x; ctx->clip.mask_y = y; - if (im && im->im) + if (EINA_UNLIKELY(im && im->im)) { + // Unlikely to happen because masks are render surfaces. #ifdef EVAS_CSERVE2 if (evas_cserve2_use_get()) evas_cache2_image_ref(&im->im->cache_entry); else #endif evas_cache_image_ref(&im->im->cache_entry); + RECTS_CLIP_TO_RECT(ctx->clip.x, ctx->clip.y, ctx->clip.w, ctx->clip.h, + x, y, im->im->cache_entry.w, im->im->cache_entry.h); + } + else if (im) + { + im->references++; + RECTS_CLIP_TO_RECT(ctx->clip.x, ctx->clip.y, ctx->clip.w, ctx->clip.h, + x, y, im->w, im->h); } } --