2011-08-15 02:21:12 -07:00
|
|
|
/* Ask about compositing */
|
2012-11-30 06:38:34 -08:00
|
|
|
#include "e_wizard.h"
|
2018-05-27 06:51:15 -07:00
|
|
|
#include "e_wizard_api.h"
|
2016-03-11 11:58:19 -08:00
|
|
|
#include <Evas_GL.h>
|
2011-12-25 22:24:59 -08:00
|
|
|
|
2016-03-11 14:14:17 -08:00
|
|
|
static Eina_Bool do_gl = 0;
|
|
|
|
static Eina_Bool do_vsync = 0;
|
2011-08-15 02:21:12 -07:00
|
|
|
|
2019-09-20 02:11:46 -07:00
|
|
|
|
2016-03-11 14:14:17 -08:00
|
|
|
static void
|
|
|
|
check_add(Evas_Object *box, const char *txt, Eina_Bool *val)
|
|
|
|
{
|
|
|
|
Evas_Object *ck;
|
|
|
|
|
|
|
|
ck = elm_check_add(box);
|
|
|
|
E_ALIGN(ck, 0, 0.5);
|
|
|
|
elm_object_text_set(ck, txt);
|
|
|
|
elm_check_state_pointer_set(ck, val);
|
|
|
|
elm_box_pack_end(box, ck);
|
2019-09-19 12:02:41 -07:00
|
|
|
evas_object_show(ck);
|
2016-03-11 14:14:17 -08:00
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2016-03-11 14:14:17 -08:00
|
|
|
wizard_page_show(E_Wizard_Page *pg EINA_UNUSED)
|
2011-08-15 02:21:12 -07:00
|
|
|
{
|
2019-09-20 02:11:46 -07:00
|
|
|
Evas_Object *o, *of;
|
2013-08-20 07:07:44 -07:00
|
|
|
|
2018-05-27 06:51:15 -07:00
|
|
|
api->wizard_title_set(_("Compositing"));
|
2013-01-04 10:35:32 -08:00
|
|
|
|
2016-03-11 14:14:17 -08:00
|
|
|
of = elm_frame_add(e_comp->elm);
|
|
|
|
elm_object_text_set(of, _("Settings"));
|
2012-06-28 06:12:13 -07:00
|
|
|
|
2016-03-11 14:14:17 -08:00
|
|
|
o = elm_box_add(of);
|
|
|
|
elm_box_homogeneous_set(o, 1);
|
|
|
|
elm_object_content_set(of, o);
|
2016-03-11 11:58:19 -08:00
|
|
|
if (e_comp->gl)
|
2013-01-10 05:55:41 -08:00
|
|
|
{
|
2016-03-11 11:58:19 -08:00
|
|
|
Evas_GL *gl;
|
|
|
|
|
|
|
|
gl = evas_gl_new(e_comp->evas);
|
|
|
|
if (gl)
|
2013-01-10 05:55:41 -08:00
|
|
|
{
|
2016-03-11 11:58:19 -08:00
|
|
|
const char *str;
|
|
|
|
Evas_GL_API *glapi = evas_gl_api_get(gl);
|
|
|
|
str = (char*)glapi->glGetString(GL_RENDERER);
|
|
|
|
if (str && (!strcasestr(str, "llvmpipe")))
|
|
|
|
do_gl = do_vsync = 1;
|
|
|
|
evas_gl_free(gl);
|
2013-01-10 05:55:41 -08:00
|
|
|
}
|
|
|
|
}
|
2019-09-20 02:11:46 -07:00
|
|
|
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
|
2020-05-25 00:16:54 -07:00
|
|
|
}
|
2019-09-19 12:02:41 -07:00
|
|
|
check_add(o, _("Hardware Accelerated (OpenGL)"), &do_gl);
|
2019-09-20 02:11:46 -07:00
|
|
|
check_add(o, _("Tear-free Rendering"), &do_vsync);
|
2012-06-28 06:12:13 -07:00
|
|
|
|
2011-08-15 02:21:12 -07:00
|
|
|
evas_object_show(of);
|
2018-05-27 06:51:15 -07:00
|
|
|
api->wizard_page_show(of);
|
2013-01-04 10:35:32 -08:00
|
|
|
|
2011-08-15 02:21:12 -07:00
|
|
|
return 1; /* 1 == show ui, and wait for user, 0 == just continue */
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2015-03-18 15:09:09 -07:00
|
|
|
wizard_page_hide(E_Wizard_Page *pg EINA_UNUSED)
|
2011-08-15 02:21:12 -07:00
|
|
|
{
|
2013-01-10 05:55:41 -08:00
|
|
|
E_Comp_Config *conf = NULL;
|
2013-01-04 10:35:32 -08:00
|
|
|
|
2013-01-10 05:55:41 -08:00
|
|
|
conf = e_comp_config_get();
|
2013-01-04 10:35:32 -08:00
|
|
|
if (do_gl)
|
|
|
|
{
|
2013-01-10 05:55:41 -08:00
|
|
|
conf->engine = E_COMP_ENGINE_GL;
|
|
|
|
conf->smooth_windows = 1;
|
|
|
|
conf->vsync = do_vsync;
|
2011-08-15 02:21:12 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-01-10 05:55:41 -08:00
|
|
|
conf->engine = E_COMP_ENGINE_SW;
|
|
|
|
conf->smooth_windows = 0;
|
|
|
|
conf->vsync = 0;
|
|
|
|
}
|
2012-06-28 06:12:13 -07:00
|
|
|
|
2013-01-10 05:55:41 -08:00
|
|
|
e_comp_internal_save();
|
2013-01-04 10:35:32 -08:00
|
|
|
|
2011-08-15 02:21:12 -07:00
|
|
|
return 1;
|
|
|
|
}
|