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.
This commit is contained in:
Dongyeon Kim 2015-05-19 11:30:05 +09:00 committed by Jean-Philippe Andre
parent 517109858e
commit a4c05cc68c
2 changed files with 70 additions and 57 deletions

View File

@ -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,21 +2012,27 @@ 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);
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 (!evgl_engine->funcs->pbuffer_surface_destroy)
{
ERR("Error destroying PBuffer surface");
return 0;
}
if (!ret) ERR("Engine failed to destroy a PBuffer.");
DBG("Destroying PBuffer surface");
ret = evgl_engine->funcs->pbuffer_surface_destroy(eng_data, sfc->pbuffer.native_surface);
if (!ret)
{
ERR("Engine failed to destroy the PBuffer.");
return ret;
}
}
if ((rsc->current_ctx) && (rsc->current_ctx->current_sfc == sfc) )
{
@ -2309,12 +2318,14 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx)
}
}
if (!sfc->buffers_skip_allocate)
{
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.
@ -2372,6 +2383,7 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx)
sfc->buffers_allocated = 1;
}
}
}
if (ctx->pixmap_image_supported)
{

View File

@ -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;