forked from enlightenment/efl
Evas GL: Kill runtime warnings caused by auto fallback
The previous commit modifies the concept of direct rendering vs. indirect rendering, so some runtime checks (in debug mode only) will fail. This commit introduces two new engine functions: - gl_get_pixels_pre - gl_get_pixels_post The latter will be used in a later patch for optimization.
This commit is contained in:
parent
a14492ef73
commit
bea9567d0e
|
@ -2900,7 +2900,13 @@ evas_process_dirty_pixels(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj,
|
|||
h = obj->cur->geometry.h;
|
||||
|
||||
if (!o->direct_render)
|
||||
o->pixels->func.get_pixels(o->pixels->func.get_pixels_data, eo_obj);
|
||||
{
|
||||
if (ENFN->gl_get_pixels_pre)
|
||||
ENFN->gl_get_pixels_pre(output);
|
||||
o->pixels->func.get_pixels(o->pixels->func.get_pixels_data, eo_obj);
|
||||
if (ENFN->gl_get_pixels_post)
|
||||
ENFN->gl_get_pixels_post(output);
|
||||
}
|
||||
|
||||
if (!(obj->cur->geometry.x == x &&
|
||||
obj->cur->geometry.y == y &&
|
||||
|
@ -2936,9 +2942,11 @@ evas_process_dirty_pixels(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj,
|
|||
else
|
||||
{
|
||||
// Auto-fallback to FBO rendering (for perf & power consumption)
|
||||
if (ENFN->gl_get_pixels_pre)
|
||||
ENFN->gl_get_pixels_pre(output);
|
||||
o->pixels->func.get_pixels(o->pixels->func.get_pixels_data, obj->object);
|
||||
//if (ENFN->get_pixels_render_post)
|
||||
//ENFN->get_pixels_render_post(output);
|
||||
if (ENFN->gl_get_pixels_post)
|
||||
ENFN->gl_get_pixels_post(output);
|
||||
o->direct_render = EINA_FALSE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1311,6 +1311,8 @@ struct _Evas_Func
|
|||
Eina_Bool (*gl_surface_direct_renderable_get) (void *data, Evas_Native_Surface *ns, Eina_Bool *override);
|
||||
void (*gl_image_direct_set) (void *data, void *image, Eina_Bool direct);
|
||||
int (*gl_image_direct_get) (void *data, void *image);
|
||||
void (*gl_get_pixels_pre) (void *data);
|
||||
void (*gl_get_pixels_post) (void *data);
|
||||
|
||||
int (*image_load_error_get) (void *data, void *image);
|
||||
int (*font_run_end_get) (void *data, Evas_Font_Set *font, Evas_Font_Instance **script_fi, Evas_Font_Instance **cur_fi, Evas_Script_Type script, const Eina_Unicode *text, int run_len);
|
||||
|
|
|
@ -1284,42 +1284,19 @@ int
|
|||
_evgl_not_in_pixel_get(void)
|
||||
{
|
||||
EVGL_Resource *rsc;
|
||||
EVGL_Context *ctx;
|
||||
|
||||
if (!(rsc=_evgl_tls_resource_get())) return 1;
|
||||
|
||||
EVGL_Context *ctx = rsc->current_ctx;
|
||||
|
||||
if (evgl_engine->direct_force_off)
|
||||
return 0;
|
||||
if (!(rsc=_evgl_tls_resource_get()))
|
||||
return 1;
|
||||
|
||||
if (rsc->id != evgl_engine->main_tid)
|
||||
return 0;
|
||||
|
||||
ctx = rsc->current_ctx;
|
||||
if (!ctx || !ctx->current_sfc)
|
||||
return 0;
|
||||
|
||||
if (!ctx->current_sfc->direct_fb_opt)
|
||||
return 0;
|
||||
|
||||
if (rsc->direct.rot == 0)
|
||||
return !rsc->direct.enabled;
|
||||
|
||||
if (!ctx->current_sfc->client_side_rotation)
|
||||
return 0;
|
||||
|
||||
return !rsc->direct.enabled;
|
||||
|
||||
/* was:
|
||||
if ((!evgl_engine->direct_force_off) &&
|
||||
(rsc->id == evgl_engine->main_tid) &&
|
||||
(ctx) &&
|
||||
(ctx->current_sfc) &&
|
||||
(ctx->current_sfc->direct_fb_opt) &&
|
||||
(!rsc->direct.enabled))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
*/
|
||||
return !rsc->direct.in_get_pixels;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -1698,7 +1675,7 @@ evgl_surface_create(void *eng_data, Evas_GL_Config *cfg, int w, int h)
|
|||
else
|
||||
{
|
||||
eina_hash_add(evgl_engine->direct_surfaces, &sfc->gles1_sfc_native, sfc);
|
||||
DBG("Added tex %d as direct surface: %p", sfc->gles1_sfc_native, sfc);
|
||||
DBG("Added native %p as direct surface: %p", sfc->gles1_sfc_native, sfc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2500,7 +2477,7 @@ evgl_native_surface_get(EVGL_Surface *sfc, Evas_Native_Surface *ns)
|
|||
}
|
||||
|
||||
int
|
||||
evgl_direct_rendered()
|
||||
evgl_direct_rendered(void)
|
||||
{
|
||||
EVGL_Resource *rsc;
|
||||
|
||||
|
@ -2546,7 +2523,7 @@ evgl_native_surface_direct_opts_get(Evas_Native_Surface *ns,
|
|||
sfc = eina_hash_find(evgl_engine->direct_surfaces, &ns->data.x11.pixmap);
|
||||
if (!sfc)
|
||||
{
|
||||
DBG("Native surface %p (pixmap %x) was not found.",
|
||||
DBG("Native surface %p (pixmap %lx) was not found.",
|
||||
ns, ns->data.x11.pixmap);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
@ -2626,7 +2603,7 @@ evgl_direct_info_set(int win_w, int win_h, int rot,
|
|||
}
|
||||
|
||||
void
|
||||
evgl_direct_info_clear()
|
||||
evgl_direct_info_clear(void)
|
||||
{
|
||||
EVGL_Resource *rsc;
|
||||
|
||||
|
@ -2635,6 +2612,26 @@ evgl_direct_info_clear()
|
|||
rsc->direct.enabled = EINA_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
evgl_get_pixels_pre(void)
|
||||
{
|
||||
EVGL_Resource *rsc;
|
||||
|
||||
if (!(rsc=_evgl_tls_resource_get())) return;
|
||||
|
||||
rsc->direct.in_get_pixels = EINA_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
evgl_get_pixels_post(void)
|
||||
{
|
||||
EVGL_Resource *rsc;
|
||||
|
||||
if (!(rsc=_evgl_tls_resource_get())) return;
|
||||
|
||||
rsc->direct.in_get_pixels = EINA_FALSE;
|
||||
}
|
||||
|
||||
Evas_GL_API *
|
||||
evgl_api_get(Evas_GL_Context_Version version)
|
||||
{
|
||||
|
|
|
@ -36,13 +36,15 @@ Evas_GL_API *evgl_api_get(Evas_GL_Context_Version version);
|
|||
void evgl_safe_extension_add(const char *name, void *funcptr);
|
||||
Eina_Bool evgl_safe_extension_get(const char *name, void **pfuncptr);
|
||||
|
||||
int evgl_direct_rendered();
|
||||
int evgl_direct_rendered(void);
|
||||
void evgl_direct_override_get(Eina_Bool *override, Eina_Bool *force_off);
|
||||
void evgl_direct_info_set(int win_w, int win_h, int rot,
|
||||
int img_x, int img_y, int img_w, int img_h,
|
||||
int clip_x, int clip_y, int clip_w, int clip_h,
|
||||
unsigned int texid);
|
||||
void evgl_direct_info_clear();
|
||||
void evgl_direct_info_clear(void);
|
||||
void evgl_get_pixels_pre(void);
|
||||
void evgl_get_pixels_post(void);
|
||||
|
||||
Eina_Bool evgl_native_surface_direct_opts_get(Evas_Native_Surface *ns,
|
||||
Eina_Bool *direct_render,
|
||||
|
|
|
@ -279,6 +279,7 @@ struct _EVGL_Resource
|
|||
} partial;
|
||||
|
||||
Eina_Bool enabled : 1;
|
||||
Eina_Bool in_get_pixels : 1;
|
||||
} direct;
|
||||
struct {
|
||||
GLclampf r, g, b, a;
|
||||
|
|
|
@ -854,7 +854,9 @@ eng_image_draw(void *data, void *context, void *surface, void *image, int src_x,
|
|||
texid);
|
||||
|
||||
// Call pixel get function
|
||||
evgl_get_pixels_pre();
|
||||
re->func.get_pixels(re->func.get_pixels_data, re->func.obj);
|
||||
evgl_get_pixels_post();
|
||||
|
||||
// Call end tile if it's being used
|
||||
if ((gl_context->master_clip.enabled) &&
|
||||
|
@ -1349,6 +1351,18 @@ eng_gl_get_pixels_set(void *data, void *get_pixels, void *get_pixels_data, void
|
|||
re->func.obj = (Evas_Object*)obj;
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gl_get_pixels_pre(void *data EINA_UNUSED)
|
||||
{
|
||||
evgl_get_pixels_pre();
|
||||
}
|
||||
|
||||
static void
|
||||
eng_gl_get_pixels_post(void *data EINA_UNUSED)
|
||||
{
|
||||
evgl_get_pixels_post();
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
eng_gl_surface_lock(void *data, void *surface)
|
||||
{
|
||||
|
@ -2139,6 +2153,8 @@ module_open(Evas_Module *em)
|
|||
ORD(gl_direct_override_get);
|
||||
ORD(gl_surface_direct_renderable_get);
|
||||
ORD(gl_get_pixels_set);
|
||||
ORD(gl_get_pixels_pre);
|
||||
ORD(gl_get_pixels_post);
|
||||
ORD(gl_surface_lock);
|
||||
ORD(gl_surface_read_pixels);
|
||||
ORD(gl_surface_unlock);
|
||||
|
|
|
@ -3574,6 +3574,8 @@ static Evas_Func func =
|
|||
NULL, // need software mesa for gl rendering <- gl_surface_direct_renderable_get
|
||||
NULL, // need software mesa for gl rendering <- gl_image_direct_set
|
||||
NULL, // need software mesa for gl rendering <- gl_image_direct_get
|
||||
NULL, // need software mesa for gl rendering <- gl_get_pixels_pre
|
||||
NULL, // need software mesa for gl rendering <- gl_get_pixels_post
|
||||
eng_image_load_error_get,
|
||||
eng_font_run_font_end_get,
|
||||
eng_image_animated_get,
|
||||
|
|
Loading…
Reference in New Issue