summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongyeon Kim <dy5.kim@samsung.com>2015-05-19 11:30:05 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-06-03 11:30:22 +0900
commita4c05cc68c9f5d0cd8d758881cf06e1b7aa88f89 (patch)
treef5e208f4ea8b750919a0ec7d8e551547e894dfe2
parent517109858e93d11bdc06556446de377085d69832 (diff)
downloadefl-a4c05cc68c9f5d0cd8d758881cf06e1b7aa88f89.tar.gz
Evas GL: Skip surface buffers create/allocate for pbuffer with NO_FBO
Summary: When pbuffer surface is created with EVAS_GL_NO_FBO config, FBO should not be created/allocated.
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_core.c116
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_core_private.h1
2 files changed, 65 insertions, 52 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.c b/src/modules/evas/engines/gl_common/evas_gl_core.c
index 38b3cb0abc..e9f9bb194f 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.c
@@ -1911,7 +1911,10 @@ evgl_pbuffer_surface_create(void *eng_data, Evas_GL_Config *cfg,
sfc->pbuffer.is_pbuffer = EINA_TRUE;
// If the surface is defined as RGB or RGBA, then create an FBO
- if (sfc->pbuffer.color_fmt != EVAS_GL_NO_FBO)
+ if (sfc->pbuffer.color_fmt == EVAS_GL_NO_FBO)
+ sfc->buffers_skip_allocate = 1;
+
+ if (!sfc->buffers_skip_allocate)
{
// Set the internal config value
if (!_internal_config_set(eng_data, sfc, cfg))
@@ -2009,20 +2012,26 @@ evgl_surface_destroy(void *eng_data, EVGL_Surface *sfc)
}
}
- // Destroy PBuffer surfaces
+ // Destroy PBuffer surface
if (sfc->pbuffer.native_surface)
{
int ret;
if (dbg) DBG("Surface sfc %p is a pbuffer: %p", sfc, sfc->pbuffer.native_surface);
+ if (!evgl_engine->funcs->pbuffer_surface_destroy)
+ {
+ ERR("Error destroying PBuffer surface");
+ return 0;
+ }
+
+ DBG("Destroying PBuffer surface");
ret = evgl_engine->funcs->pbuffer_surface_destroy(eng_data, sfc->pbuffer.native_surface);
- LKL(evgl_engine->resource_lock);
- evgl_engine->surfaces = eina_list_remove(evgl_engine->surfaces, sfc);
- LKU(evgl_engine->resource_lock);
- free(sfc);
- if (!ret) ERR("Engine failed to destroy a PBuffer.");
- return ret;
+ if (!ret)
+ {
+ ERR("Engine failed to destroy the PBuffer.");
+ return ret;
+ }
}
if ((rsc->current_ctx) && (rsc->current_ctx->current_sfc == sfc) )
@@ -2309,67 +2318,70 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx)
}
}
- if (!sfc->color_buf && !_surface_buffers_create(sfc))
- {
- ERR("Unable to create specified surfaces.");
- evas_gl_common_error_set(eng_data, EVAS_GL_BAD_ALLOC);
- return 0;
- };
-
- // Allocate or free resources depending on what mode (direct of fbo) it's
- // running only if the env var EVAS_GL_DIRECT_MEM_OPT is set.
- if (sfc->direct_mem_opt)
+ if (!sfc->buffers_skip_allocate)
{
- if (_evgl_direct_renderable(rsc, sfc))
+ if (!sfc->color_buf && !_surface_buffers_create(sfc))
{
- if (dbg) DBG("sfc %p is direct renderable (has buffers: %d).", sfc, (int) sfc->buffers_allocated);
+ ERR("Unable to create specified surfaces.");
+ evas_gl_common_error_set(eng_data, EVAS_GL_BAD_ALLOC);
+ return 0;
+ }
- // Destroy created resources
- if (sfc->buffers_allocated)
+ // Allocate or free resources depending on what mode (direct of fbo) it's
+ // running only if the env var EVAS_GL_DIRECT_MEM_OPT is set.
+ if (sfc->direct_mem_opt)
+ {
+ if (_evgl_direct_renderable(rsc, sfc))
{
- if (!_surface_buffers_allocate(eng_data, sfc, 0, 0, 0))
+ if (dbg) DBG("sfc %p is direct renderable (has buffers: %d).", sfc, (int) sfc->buffers_allocated);
+
+ // Destroy created resources
+ if (sfc->buffers_allocated)
{
- ERR("Unable to destroy surface buffers!");
- evas_gl_common_error_set(eng_data, EVAS_GL_BAD_ALLOC);
- return 0;
+ if (!_surface_buffers_allocate(eng_data, sfc, 0, 0, 0))
+ {
+ ERR("Unable to destroy surface buffers!");
+ evas_gl_common_error_set(eng_data, EVAS_GL_BAD_ALLOC);
+ return 0;
+ }
+ sfc->buffers_allocated = 0;
}
- sfc->buffers_allocated = 0;
- }
- }
- else
- {
- if (sfc->direct_override)
- {
- DBG("Not creating fallback surfaces even though it should. Use at OWN discretion!");
}
else
{
- // Create internal buffers if not yet created
- if (!sfc->buffers_allocated)
+ if (sfc->direct_override)
+ {
+ DBG("Not creating fallback surfaces even though it should. Use at OWN discretion!");
+ }
+ else
{
- if (dbg) DBG("Allocating buffers for sfc %p", sfc);
- if (!_surface_buffers_allocate(eng_data, sfc, sfc->w, sfc->h, 0))
+ // Create internal buffers if not yet created
+ if (!sfc->buffers_allocated)
{
- ERR("Unable Create Specificed Surfaces. Unsupported format!");
- evas_gl_common_error_set(eng_data, EVAS_GL_BAD_ALLOC);
- return 0;
+ if (dbg) DBG("Allocating buffers for sfc %p", sfc);
+ if (!_surface_buffers_allocate(eng_data, sfc, sfc->w, sfc->h, 0))
+ {
+ ERR("Unable Create Specificed Surfaces. Unsupported format!");
+ evas_gl_common_error_set(eng_data, EVAS_GL_BAD_ALLOC);
+ return 0;
+ }
+ sfc->buffers_allocated = 1;
}
- sfc->buffers_allocated = 1;
}
}
}
- }
- else
- {
- if (!sfc->buffers_allocated)
+ else
{
- if (!_surface_buffers_allocate(eng_data, sfc, sfc->w, sfc->h, 0))
+ if (!sfc->buffers_allocated)
{
- ERR("Unable Create Allocate Memory for Surface.");
- evas_gl_common_error_set(eng_data, EVAS_GL_BAD_ALLOC);
- return 0;
+ if (!_surface_buffers_allocate(eng_data, sfc, sfc->w, sfc->h, 0))
+ {
+ ERR("Unable Create Allocate Memory for Surface.");
+ evas_gl_common_error_set(eng_data, EVAS_GL_BAD_ALLOC);
+ return 0;
+ }
+ sfc->buffers_allocated = 1;
}
- sfc->buffers_allocated = 1;
}
}
@@ -2474,7 +2486,7 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx)
// Call end tiling
if (rsc->direct.partial.enabled)
- evgl_direct_partial_render_end();
+ evgl_direct_partial_render_end();
if (sfc->color_buf)
{
diff --git a/src/modules/evas/engines/gl_common/evas_gl_core_private.h b/src/modules/evas/engines/gl_common/evas_gl_core_private.h
index c90fea0808..8b1adc23af 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core_private.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_core_private.h
@@ -123,6 +123,7 @@ struct _EVGL_Surface
unsigned direct_mem_opt : 1;
// Init Flag
+ unsigned buffers_skip_allocate : 1;
unsigned buffers_allocated : 1;
void *cfg;