Evas GL: remove direct surfaces hash

Summary:
Evas GL surface buffers are allocated at make current time now
rather than surface creation time, and since we pass evas gl surface handle
to the backend, we do not need direct surfaces hash anymore.

Test Plan: elementary test and evas gl test cases

Reviewers: cedric, jpeg

Reviewed By: jpeg

Subscribers: cedric, mythri, mer.kim, wonsik

Differential Revision: https://phab.enlightenment.org/D2320
This commit is contained in:
Dongyeon Kim 2015-04-10 16:13:22 +09:00 committed by Jean-Philippe Andre
parent bbc4222eaf
commit 3228c376ec
3 changed files with 7 additions and 82 deletions

View File

@ -1667,9 +1667,6 @@ evgl_engine_init(void *eng_data, const EVGL_Interface *efunc)
// Clear Function Pointers
if (!gl_funcs) gl_funcs = calloc(1, EVAS_GL_API_STRUCT_SIZE);
// Direct surfaces map texid->Evas_GL_Surface
evgl_engine->direct_surfaces = eina_hash_int32_new(NULL);
return evgl_engine;
error:
@ -1706,12 +1703,6 @@ evgl_engine_shutdown(void *eng_data)
// Destroy internal resources
_evgl_tls_resource_destroy(eng_data);
if (evgl_engine->direct_surfaces)
{
eina_hash_free(evgl_engine->direct_surfaces);
evgl_engine->direct_surfaces = NULL;
}
LKD(evgl_engine->resource_lock);
// Free engine
@ -1791,20 +1782,6 @@ evgl_surface_create(void *eng_data, Evas_GL_Config *cfg, int w, int h)
// Keep track of all the created surfaces
LKL(evgl_engine->resource_lock);
evgl_engine->surfaces = eina_list_prepend(evgl_engine->surfaces, sfc);
if (sfc->direct_fb_opt)
{
if (!sfc->indirect)
{
eina_hash_add(evgl_engine->direct_surfaces, &sfc->color_buf, sfc);
DBG("Added tex %d as direct surface: %p", sfc->color_buf, sfc);
}
else
{
eina_hash_add(evgl_engine->direct_surfaces, &sfc->indirect_sfc_native, sfc);
DBG("Added native %p as direct surface: %p", sfc->indirect_sfc_native, sfc);
}
}
LKU(evgl_engine->resource_lock);
if (dbg) DBG("Created surface sfc %p (eng %p)", sfc, eng_data);
@ -2045,20 +2022,6 @@ evgl_surface_destroy(void *eng_data, EVGL_Surface *sfc)
// Remove it from the list
LKL(evgl_engine->resource_lock);
evgl_engine->surfaces = eina_list_remove(evgl_engine->surfaces, sfc);
if (sfc->direct_fb_opt)
{
if (!sfc->indirect)
{
eina_hash_del(evgl_engine->direct_surfaces, &sfc->color_buf, sfc);
DBG("Removed tex %d as direct surface: %p", sfc->color_buf, sfc);
}
else
{
eina_hash_del(evgl_engine->direct_surfaces, &sfc->indirect_sfc_native, sfc);
DBG("Removed native %p as direct surface: %p", sfc->indirect_sfc_native, sfc);
}
}
LKU(evgl_engine->resource_lock);
free(sfc);
@ -2623,19 +2586,10 @@ evgl_native_surface_get(EVGL_Surface *sfc, Evas_Native_Surface *ns)
return 0;
}
if (!sfc->indirect)
{
ns->type = EVAS_NATIVE_SURFACE_EVASGL;
ns->version = EVAS_NATIVE_SURFACE_VERSION;
ns->data.evasgl.surface = sfc;
}
else
{
ns->type = EVAS_NATIVE_SURFACE_X11;
ns->version = EVAS_NATIVE_SURFACE_VERSION;
ns->data.x11.pixmap = (unsigned long)(intptr_t)sfc->indirect_sfc_native;
ns->data.x11.visual = sfc->indirect_sfc_visual;
}
ns->type = EVAS_NATIVE_SURFACE_EVASGL;
ns->version = EVAS_NATIVE_SURFACE_VERSION;
ns->data.evasgl.surface = sfc;
return 1;
}
@ -2669,38 +2623,14 @@ evgl_native_surface_direct_opts_get(Evas_Native_Surface *ns,
if (!evgl_engine) return EINA_FALSE;
if (!ns) return EINA_FALSE;
if (ns->type == EVAS_NATIVE_SURFACE_OPENGL &&
ns->data.opengl.texture_id)
{
sfc = eina_hash_find(evgl_engine->direct_surfaces, &ns->data.opengl.texture_id);
if (!sfc)
{
if (evgl_engine->api_debug_mode)
DBG("Native surface %p (color_buf %d) was not found.",
ns, ns->data.opengl.texture_id);
return EINA_FALSE;
}
}
else if (ns->type == EVAS_NATIVE_SURFACE_X11 &&
ns->data.x11.pixmap)
{
sfc = eina_hash_find(evgl_engine->direct_surfaces, &ns->data.x11.pixmap);
if (!sfc)
{
if (evgl_engine->api_debug_mode)
DBG("Native surface %p (pixmap %lx) was not found.",
ns, ns->data.x11.pixmap);
return EINA_FALSE;
}
}
else if (ns->type == EVAS_NATIVE_SURFACE_EVASGL &&
if (ns->type == EVAS_NATIVE_SURFACE_EVASGL &&
ns->data.evasgl.surface)
{
sfc = ns->data.evasgl.surface;
}
else
{
ERR("Only EVAS_NATIVE_SURFACE_OPENGL or EVAS_NATIVE_SURFACE_X11 can be used for direct rendering");
ERR("Only EVAS_NATIVE_SURFACE_EVASGL can be used for direct rendering");
return EINA_FALSE;
}

View File

@ -326,7 +326,6 @@ struct _EVGL_Engine
// Keep track of all the current surfaces/contexts
Eina_List *surfaces;
Eina_List *contexts;
Eina_Hash *direct_surfaces; // unsigned (texid) --> EVGL_Surface*
//void *engine_data;
Eina_Hash *safe_extensions;

View File

@ -837,11 +837,7 @@ eng_image_draw(void *data, void *context, void *surface, void *image, int src_x,
evgl_direct_partial_info_set(gl_context->preserve_bit);
}
if (n->type == EVAS_NATIVE_SURFACE_OPENGL)
direct_surface = eina_hash_find(evgl_engine->direct_surfaces, &n->data.opengl.texture_id);
else if (n->type == EVAS_NATIVE_SURFACE_X11)
direct_surface = eina_hash_find(evgl_engine->direct_surfaces, &n->data.x11.pixmap);
else if (n->type == EVAS_NATIVE_SURFACE_EVASGL)
if (n->type == EVAS_NATIVE_SURFACE_EVASGL)
direct_surface = n->data.evasgl.surface;
else
{