forked from enlightenment/efl
Evas GL: Add hidden config values for direct rendering options
Those 2 new values are here to avoid using environment variables that have side effects on the whole application. I'm actually wondering if we shouldn't just kill off the env vars altogether. Also, direct override is a terrible option that should never be used. Memory optimization can make sense (needs more testing tho).
This commit is contained in:
parent
c198746b2d
commit
93d167ac87
|
@ -2842,8 +2842,7 @@ static void *
|
|||
evas_process_dirty_pixels(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Image_Data *o,
|
||||
void *output, void *pixels)
|
||||
{
|
||||
int direct_override = 0;
|
||||
int direct_force_off = 0;
|
||||
Eina_Bool direct_override = EINA_FALSE, direct_force_off = EINA_FALSE;
|
||||
|
||||
if (o->dirty_pixels)
|
||||
{
|
||||
|
@ -2866,7 +2865,7 @@ evas_process_dirty_pixels(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj,
|
|||
if (ENFN->gl_direct_override_get)
|
||||
ENFN->gl_direct_override_get(output, &direct_override, &direct_force_off);
|
||||
if (ENFN->gl_surface_direct_renderable_get)
|
||||
direct_renderable = ENFN->gl_surface_direct_renderable_get(output, ns);
|
||||
direct_renderable = ENFN->gl_surface_direct_renderable_get(output, ns, &direct_override);
|
||||
|
||||
if ( ((direct_override) ||
|
||||
((direct_renderable) &&
|
||||
|
@ -2885,7 +2884,6 @@ evas_process_dirty_pixels(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj,
|
|||
}
|
||||
else
|
||||
o->direct_render = EINA_FALSE;
|
||||
|
||||
}
|
||||
|
||||
if ( (ns) &&
|
||||
|
|
|
@ -1297,7 +1297,7 @@ struct _Evas_Func
|
|||
void *(*gl_proc_address_get) (void *data, const char *name);
|
||||
int (*gl_native_surface_get) (void *data, void *surface, void *native_surface);
|
||||
void *(*gl_api_get) (void *data, int version);
|
||||
void (*gl_direct_override_get) (void *data, int *override, int *force_off);
|
||||
void (*gl_direct_override_get) (void *data, Eina_Bool *override, Eina_Bool *force_off);
|
||||
void (*gl_get_pixels_set) (void *data, void *get_pixels, void *get_pixels_data, void *obj);
|
||||
Eina_Bool (*gl_surface_lock) (void *data, void *surface);
|
||||
Eina_Bool (*gl_surface_read_pixels) (void *data, void *surface, int x, int y, int w, int h, Evas_Colorspace cspace, void *pixels);
|
||||
|
@ -1307,7 +1307,7 @@ struct _Evas_Func
|
|||
void *(*gl_current_surface_get) (void *data);
|
||||
int (*gl_rotation_angle_get) (void *data);
|
||||
Eina_Bool (*gl_surface_query) (void *data, void *surface, int attr, void *value);
|
||||
Eina_Bool (*gl_surface_direct_renderable_get) (void *data, Evas_Native_Surface *ns);
|
||||
Eina_Bool (*gl_surface_direct_renderable_get) (void *data, Evas_Native_Surface *ns, Eina_Bool *override);
|
||||
|
||||
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);
|
||||
|
|
|
@ -24,6 +24,12 @@ static void _surface_cap_print(int error);
|
|||
static void _surface_context_list_print();
|
||||
static void _internal_resources_destroy(void *eng_data, EVGL_Resource *rsc);
|
||||
|
||||
// NOTE: These constants are "hidden", kinda non public API. They should not
|
||||
// be used unless you know exactly what you are doing.
|
||||
// These vars replace environment variables.
|
||||
#define EVAS_GL_OPTIONS_DIRECT_MEMORY_OPTIMIZE 0x1000
|
||||
#define EVAS_GL_OPTIONS_DIRECT_OVERRIDE 0x2000
|
||||
|
||||
|
||||
//---------------------------------------------------------------//
|
||||
// Internal Resources:
|
||||
|
@ -1112,11 +1118,19 @@ _internal_config_set(EVGL_Surface *sfc, Evas_GL_Config *cfg)
|
|||
sfc->depth_stencil_fmt = evgl_engine->caps.fbo_fmts[i].depth_stencil_fmt;
|
||||
sfc->msaa_samples = evgl_engine->caps.fbo_fmts[i].samples;
|
||||
|
||||
// TODO: Implement surface reconfigure and add depth+stencil support
|
||||
/*
|
||||
// TODO:
|
||||
if (((depth_bit > 0) ||(stencil_bit > 0) ||(msaa_samples > 0))
|
||||
&& (evgl_engine->funcs->native_win_surface_config_check))
|
||||
{
|
||||
DBG("request to check wid cfg with depth %d, stencil %d, msaa %d",depth_bit,stencil_bit,msaa_samples);
|
||||
support_win_cfg = evgl_engine->funcs->native_win_surface_config_check(eng_data,depth_bit,stencil_bit,msaa_samples);
|
||||
}
|
||||
*/
|
||||
|
||||
// Direct Rendering Option
|
||||
if ((!depth_bit && !stencil_bit && !msaa_samples) || evgl_engine->direct_override)
|
||||
sfc->direct_fb_opt = cfg->options_bits & EVAS_GL_OPTIONS_DIRECT;
|
||||
if ((!depth_bit && !stencil_bit && !msaa_samples) || sfc->direct_override)
|
||||
sfc->direct_fb_opt = !!(cfg->options_bits & EVAS_GL_OPTIONS_DIRECT);
|
||||
|
||||
// Extra flags for direct rendering
|
||||
sfc->client_side_rotation = !!(cfg->options_bits & EVAS_GL_OPTIONS_CLIENT_SIDE_ROTATION);
|
||||
|
@ -1141,7 +1155,7 @@ _internal_config_set(EVGL_Surface *sfc, Evas_GL_Config *cfg)
|
|||
DBG(" Stencil Format : %s", _glenum_string_get(sfc->stencil_fmt));
|
||||
DBG(" D-Stencil Format : %s", _glenum_string_get(sfc->depth_stencil_fmt));
|
||||
DBG(" MSAA Samples : %d", sfc->msaa_samples);
|
||||
DBG(" Direct Option : %d", sfc->direct_fb_opt);
|
||||
DBG(" Direct Option : %d%s", sfc->direct_fb_opt, sfc->direct_override ? " (override)" : "");
|
||||
DBG(" Client-side Rot. : %d", sfc->client_side_rotation);
|
||||
sfc->cfg_index = cfg_index;
|
||||
return 1;
|
||||
|
@ -1379,8 +1393,7 @@ _evgl_native_context_get(Evas_GL_Context *ctx)
|
|||
EVGL_Engine *
|
||||
evgl_engine_init(void *eng_data, const EVGL_Interface *efunc)
|
||||
{
|
||||
int direct_mem_opt = 0, direct_off = 0, direct_soff = 0, debug_mode = 0;
|
||||
int direct_override = 0;
|
||||
int direct_off = 0, direct_soff = 0, debug_mode = 0;
|
||||
char *s = NULL;
|
||||
|
||||
if (evgl_engine) return evgl_engine;
|
||||
|
@ -1456,18 +1469,25 @@ evgl_engine_init(void *eng_data, const EVGL_Interface *efunc)
|
|||
goto error;
|
||||
}
|
||||
|
||||
// NOTE: Should we finally remove these variables?
|
||||
// Check for Direct rendering override env var.
|
||||
if ((s = getenv("EVAS_GL_DIRECT_OVERRIDE")))
|
||||
{
|
||||
WRN("EVAS_GL_DIRECT_OVERRIDE is set to '%s' for the whole application. "
|
||||
"This should never be done except for debugging purposes.", s);
|
||||
if (atoi(s) == 1)
|
||||
evgl_engine->direct_override = 1;
|
||||
}
|
||||
|
||||
// Check if Direct Rendering Memory Optimzation flag is on
|
||||
// Creates resources on demand when it fallsback to fbo rendering
|
||||
s = getenv("EVAS_GL_DIRECT_MEM_OPT");
|
||||
if (s) direct_mem_opt = atoi(s);
|
||||
if (direct_mem_opt == 1)
|
||||
evgl_engine->direct_mem_opt = 1;
|
||||
|
||||
// Check for Direct rendering override env var.
|
||||
s = getenv("EVAS_GL_DIRECT_OVERRIDE");
|
||||
if (s) direct_override = atoi(s);
|
||||
if (direct_override == 1)
|
||||
evgl_engine->direct_override = 1;
|
||||
if ((s = getenv("EVAS_GL_DIRECT_MEM_OPT")))
|
||||
{
|
||||
WRN("EVAS_GL_DIRECT_MEM_OPT is set to '%s' for the whole application. "
|
||||
"This should never be done except for debugging purposes.", s);
|
||||
if (atoi(s) == 1)
|
||||
evgl_engine->direct_mem_opt = 1;
|
||||
}
|
||||
|
||||
// Check if Direct Rendering Override Force Off flag is on
|
||||
s = getenv("EVAS_GL_DIRECT_OVERRIDE_FORCE_OFF");
|
||||
|
@ -1590,6 +1610,23 @@ evgl_surface_create(void *eng_data, Evas_GL_Config *cfg, int w, int h)
|
|||
sfc->w = w;
|
||||
sfc->h = h;
|
||||
|
||||
// Extra options for DR
|
||||
if (cfg->options_bits & EVAS_GL_OPTIONS_DIRECT_MEMORY_OPTIMIZE)
|
||||
{
|
||||
DBG("Setting DIRECT_MEMORY_OPTIMIZE bit");
|
||||
sfc->direct_mem_opt = EINA_TRUE;
|
||||
}
|
||||
else if (evgl_engine->direct_mem_opt == 1)
|
||||
sfc->direct_mem_opt = EINA_TRUE;
|
||||
|
||||
if (cfg->options_bits & EVAS_GL_OPTIONS_DIRECT_OVERRIDE)
|
||||
{
|
||||
DBG("Setting DIRECT_OVERRIDE bit");
|
||||
sfc->direct_override = EINA_TRUE;
|
||||
}
|
||||
else if (evgl_engine->direct_override == 1)
|
||||
sfc->direct_override = EINA_TRUE;
|
||||
|
||||
// Set the internal config value
|
||||
if (!_internal_config_set(sfc, cfg))
|
||||
{
|
||||
|
@ -1628,7 +1665,7 @@ evgl_surface_create(void *eng_data, Evas_GL_Config *cfg, int w, int h)
|
|||
};
|
||||
|
||||
// Allocate resources for fallback unless the flag is on
|
||||
if (!evgl_engine->direct_mem_opt)
|
||||
if (!sfc->direct_mem_opt)
|
||||
{
|
||||
if (!_surface_buffers_allocate(eng_data, sfc, sfc->w, sfc->h, 0))
|
||||
{
|
||||
|
@ -1752,6 +1789,7 @@ evgl_pbuffer_surface_create(void *eng_data, Evas_GL_Config *cfg,
|
|||
};
|
||||
|
||||
// Allocate resources for fallback unless the flag is on
|
||||
// Note: we don't care about sfc->direct_mem_opt, as DR makes no sense with PBuffer.
|
||||
if (!evgl_engine->direct_mem_opt)
|
||||
{
|
||||
if (!_surface_buffers_allocate(eng_data, sfc, sfc->w, sfc->h, 0))
|
||||
|
@ -2418,10 +2456,12 @@ evgl_direct_rendered()
|
|||
Eina_Bool
|
||||
evgl_native_surface_direct_opts_get(Evas_Native_Surface *ns,
|
||||
Eina_Bool *direct_render,
|
||||
Eina_Bool *client_side_rotation)
|
||||
Eina_Bool *client_side_rotation,
|
||||
Eina_Bool *override)
|
||||
{
|
||||
EVGL_Surface *sfc;
|
||||
|
||||
if (override) *override = EINA_FALSE;
|
||||
if (direct_render) *direct_render = EINA_FALSE;
|
||||
if (client_side_rotation) *client_side_rotation = EINA_FALSE;
|
||||
|
||||
|
@ -2446,6 +2486,7 @@ evgl_native_surface_direct_opts_get(Evas_Native_Surface *ns,
|
|||
}
|
||||
|
||||
if (direct_render) *direct_render = sfc->direct_fb_opt;
|
||||
if (override) *override |= sfc->direct_override;
|
||||
if (client_side_rotation) *client_side_rotation = sfc->client_side_rotation;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -2474,9 +2515,8 @@ evgl_direct_info_set(int win_w, int win_h, int rot,
|
|||
|
||||
sfc = eina_hash_find(evgl_engine->direct_surfaces, &texid);
|
||||
|
||||
if ((rot == 0) ||
|
||||
evgl_engine->direct_override ||
|
||||
(sfc && sfc->client_side_rotation))
|
||||
if (sfc &&
|
||||
((rot == 0) || sfc->client_side_rotation || sfc->direct_override))
|
||||
{
|
||||
if (evgl_engine->api_debug_mode)
|
||||
DBG("Direct rendering is enabled.");
|
||||
|
@ -2555,7 +2595,7 @@ evgl_direct_partial_info_clear()
|
|||
}
|
||||
|
||||
void
|
||||
evgl_direct_override_get(int *override, int *force_off)
|
||||
evgl_direct_override_get(Eina_Bool *override, Eina_Bool *force_off)
|
||||
{
|
||||
if (override) *override = evgl_engine->direct_override;
|
||||
if (force_off) *force_off = evgl_engine->direct_force_off;
|
||||
|
|
|
@ -37,7 +37,7 @@ 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();
|
||||
void evgl_direct_override_get(int *override, int *force_off);
|
||||
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,
|
||||
|
@ -46,7 +46,8 @@ void evgl_direct_info_clear();
|
|||
|
||||
Eina_Bool evgl_native_surface_direct_opts_get(Evas_Native_Surface *ns,
|
||||
Eina_Bool *direct_render,
|
||||
Eina_Bool *client_side_rotation);
|
||||
Eina_Bool *client_side_rotation,
|
||||
Eina_Bool *override);
|
||||
|
||||
void evgl_direct_partial_info_set(int pres);
|
||||
void evgl_direct_partial_info_clear();
|
||||
|
|
|
@ -112,6 +112,10 @@ struct _EVGL_Surface
|
|||
unsigned gles1_indirect : 1;
|
||||
unsigned xpixmap : 1;
|
||||
|
||||
// Moved from evgl_engine
|
||||
unsigned direct_override : 1;
|
||||
unsigned direct_mem_opt : 1;
|
||||
|
||||
// Init Flag
|
||||
unsigned buffers_allocated : 1;
|
||||
|
||||
|
@ -292,15 +296,16 @@ struct _EVGL_Engine
|
|||
int resource_count;
|
||||
int main_tid;
|
||||
|
||||
int direct_override;
|
||||
int direct_mem_opt;
|
||||
|
||||
// Add more debug logs (DBG levels 4 and 6)
|
||||
int api_debug_mode;
|
||||
|
||||
// Force Off for Debug purposes
|
||||
int direct_force_off;
|
||||
|
||||
// Other DR flags for debugging purposes
|
||||
int direct_override;
|
||||
int direct_mem_opt;
|
||||
|
||||
// Force Direct Scissoring off for Debug purposes
|
||||
int direct_scissor_off;
|
||||
|
||||
|
|
|
@ -1232,21 +1232,21 @@ eng_gl_api_get(void *data, int version)
|
|||
|
||||
|
||||
static void
|
||||
eng_gl_direct_override_get(void *data, int *override, int *force_off)
|
||||
eng_gl_direct_override_get(void *data, Eina_Bool *override, Eina_Bool *force_off)
|
||||
{
|
||||
EVGLINIT(data, );
|
||||
evgl_direct_override_get(override, force_off);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
eng_gl_surface_direct_renderable_get(void *data, Evas_Native_Surface *ns)
|
||||
eng_gl_surface_direct_renderable_get(void *data, Evas_Native_Surface *ns, Eina_Bool *override)
|
||||
{
|
||||
Render_Engine_GL_Generic *re = data;
|
||||
Eina_Bool direct_render, client_side_rotation;
|
||||
|
||||
EVGLINIT(data, EINA_FALSE);
|
||||
if (!re || !ns) return EINA_FALSE;
|
||||
if (!evgl_native_surface_direct_opts_get(ns, &direct_render, &client_side_rotation))
|
||||
if (!evgl_native_surface_direct_opts_get(ns, &direct_render, &client_side_rotation, override))
|
||||
return EINA_FALSE;
|
||||
|
||||
if (!direct_render)
|
||||
|
|
Loading…
Reference in New Issue