wizard - comp - fix checking of gl/hw accel

using just evas_gl_new() will lead to almost always using just
software rendering... because often osmesa is not installed and e will
start in software rendering by default until it switches properly
after the wizard. this appropriately checks in an x path vs. wayland
path in different ways as to if we should do gl by default and ALWAYS
offers a checkbox to the user, just the default value/state of that
checkbox depends on what is detected and a user can override.
This commit is contained in:
Carsten Haitzler 2019-09-20 10:11:46 +01:00
parent 822680869f
commit 17e375c5a7
1 changed files with 41 additions and 2 deletions

View File

@ -6,6 +6,7 @@
static Eina_Bool do_gl = 0;
static Eina_Bool do_vsync = 0;
static void
check_add(Evas_Object *box, const char *txt, Eina_Bool *val)
{
@ -22,7 +23,7 @@ check_add(Evas_Object *box, const char *txt, Eina_Bool *val)
E_API int
wizard_page_show(E_Wizard_Page *pg EINA_UNUSED)
{
Evas_Object *o, *of, *ob;
Evas_Object *o, *of;
api->wizard_title_set(_("Compositing"));
@ -47,8 +48,46 @@ wizard_page_show(E_Wizard_Page *pg EINA_UNUSED)
evas_gl_free(gl);
}
}
if (!do_gl)
{
#ifdef HAVE_WAYLAND
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
{
if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_OPENGL_DRM))
{
void *egl = dlopen("libEGL.so.1", RTLD_NOW | RTLD_LOCAL);
if (!egl) egl = dlopen("libEGL.so", RTLD_NOW | RTLD_LOCAL);
if (egl)
{
do_gl = 1;
dlclose(egl);
}
}
do_vsync = 1;
}
#endif
#ifndef HAVE_WAYLAND_ONLY
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
{
Ecore_X_Window_Attributes att;
memset((&att), 0, sizeof(Ecore_X_Window_Attributes));
ecore_x_window_attributes_get(ecore_x_window_root_first_get(), &att);
if ((att.depth > 8) &&
(ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_OPENGL_X11)))
{
Ecore_Evas *ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 32, 32);
if (ee)
{
do_gl = do_vsync = 1;
ecore_evas_free(ee);
}
}
}
}
#endif
check_add(o, _("Hardware Accelerated (OpenGL)"), &do_gl);
check_add(o, _("Tear-free Rendering (OpenGL only)"), &do_vsync);
check_add(o, _("Tear-free Rendering"), &do_vsync);
evas_object_show(of);
api->wizard_page_show(of);