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);
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);
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:
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);
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;
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;
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");
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))
{
};
// 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))
{
};
// 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))
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;
}
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;
}
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.");
}
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;