Eina_List *contexts;
Eina_List *surfaces;
+ Eina_Lock lck;
};
struct _Evas_GL_Context
evas_gl->magic = MAGIC_EVAS_GL;
evas_gl->evas = eo_data_ref(e, EVAS_CANVAS_CLASS);
+ LKI(evas_gl->lck);
if (!evas_gl->evas->engine.func->gl_context_create)
{
return;
MAGIC_CHECK_END();
-
// Delete undeleted surfaces
while (evas_gl->surfaces)
evas_gl_surface_destroy(evas_gl, evas_gl->surfaces->data);
eo_data_unref(evas_gl->evas->evas, evas_gl->evas);
evas_gl->magic = 0;
+ LKD(evas_gl->lck);
free(evas_gl);
}
return NULL;
}
- if ( (width <= 0) || (height <= 0))
+ if ((width <= 0) || (height <= 0))
{
ERR("Invalid surface dimensions: %d, %d", width, height);
return NULL;
}
// Keep track of the surface creations
+ LKL(evas_gl->lck);
evas_gl->surfaces = eina_list_prepend(evas_gl->surfaces, surf);
+ LKU(evas_gl->lck);
return surf;
}
evas_gl->evas->engine.func->gl_surface_destroy(evas_gl->evas->engine.data.output, surf->data);
// Remove it from the list
+ LKL(evas_gl->lck);
evas_gl->surfaces = eina_list_remove(evas_gl->surfaces, surf);
+ LKU(evas_gl->lck);
// Delete the object
free(surf);
}
// Keep track of the context creations
+ LKL(evas_gl->lck);
evas_gl->contexts = eina_list_prepend(evas_gl->contexts, ctx);
+ LKU(evas_gl->lck);
return ctx;
evas_gl->evas->engine.func->gl_context_destroy(evas_gl->evas->engine.data.output, ctx->data);
// Remove it from the list
+ LKL(evas_gl->lck);
evas_gl->contexts = eina_list_remove(evas_gl->contexts, ctx);
+ LKU(evas_gl->lck);
// Delete the object
free(ctx);
MAGIC_CHECK(evas_gl, Evas_GL, MAGIC_EVAS_GL);
return EINA_FALSE;
MAGIC_CHECK_END();
-
+
if ((surf) && (ctx))
ret = (Eina_Bool)evas_gl->evas->engine.func->gl_make_current(evas_gl->evas->engine.data.output, surf->data, ctx->data);
else if ((!surf) && (!ctx))
return EINA_FALSE;
MAGIC_CHECK_END();
- if ((!surf) || (!ns))
+ if (!surf)
+ {
+ ERR("Invalid surface!");
+ return EINA_FALSE;
+ }
+
+ if (!ns)
{
ERR("Invalid input parameters!");
return EINA_FALSE;
MAGIC_CHECK_END();
return (Evas_GL_API*)evas_gl->evas->engine.func->gl_api_get(evas_gl->evas->engine.data.output);
-
}
#define YELLOW "\e[1;33m"
#define RED "\e[1;31m"
+ LKL(evgl_engine->resource_lock);
+
DBG( YELLOW "-----------------------------------------------" RESET);
DBG("Total Number of active Evas GL Surfaces: %d", eina_list_count(evgl_engine->surfaces));
}
DBG( YELLOW "-----------------------------------------------" RESET);
+ LKU(evgl_engine->resource_lock);
+
#undef RESET
#undef GREEN
#undef YELLOW
goto error;
}
+ LKI(evgl_engine->resource_lock);
+
// Assign functions
evgl_engine->funcs = efunc;
{
if (evgl_engine->resource_key)
eina_tls_free(evgl_engine->resource_key);
+ LKD(evgl_engine->resource_lock);
free(evgl_engine);
}
evgl_engine = NULL;
// Destroy internal resources
_evgl_tls_resource_destroy(eng_data);
+ LKD(evgl_engine->resource_lock);
+
// Free engine
free(evgl_engine);
evgl_engine = NULL;
}
// Keep track of all the created surfaces
+ LKL(evgl_engine->resource_lock);
evgl_engine->surfaces = eina_list_prepend(evgl_engine->surfaces, sfc);
+ LKU(evgl_engine->resource_lock);
return sfc;
}
// Remove it from the list
+ LKL(evgl_engine->resource_lock);
evgl_engine->surfaces = eina_list_remove(evgl_engine->surfaces, sfc);
+ LKU(evgl_engine->resource_lock);
free(sfc);
sfc = NULL;
}
// Keep track of all the created context
+ LKL(evgl_engine->resource_lock);
evgl_engine->contexts = eina_list_prepend(evgl_engine->contexts, ctx);
+ LKU(evgl_engine->resource_lock);
return ctx;
}
}
// Remove it from the list
+ LKL(evgl_engine->resource_lock);
evgl_engine->contexts = eina_list_remove(evgl_engine->contexts, ctx);
+ LKU(evgl_engine->resource_lock);
// Free context
free(ctx);