summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWonsik Jung <sidein@samsung.com>2015-03-16 14:14:12 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-03-16 14:26:41 +0900
commit47b5ce6da8a2ce0ca6e36c6f11bec190895806f9 (patch)
tree502a8f007fc230b141d46b579504e08874e8e9cd
parent841fcdfb18a414a7381910bcbb0b0ef4807bc5c2 (diff)
downloadelementary-47b5ce6da8a2ce0ca6e36c6f11bec190895806f9.tar.gz
elm_config: Add feature to set depth/stencil/msaa bit to window surface
Summary: When evas gl/elm glview runs with direct rendering, it can not set these bits to window surface. Because of no interface and method.This patch can do that. This patch just uses current interface as a elm_config_accel_preference_set instead of new API. Also, it is related D2144 patch. Test Plan: ElmGL View test menu in elementary_test app JP's test app. Reviewers: spacegrapher, cedric, raster, jpeg Reviewed By: jpeg Subscribers: mer.kim Differential Revision: https://phab.enlightenment.org/D2145 Signed-off-by: Jean-Philippe Andre <jp.andre@samsung.com>
-rw-r--r--src/lib/elm_config.c85
-rw-r--r--src/lib/elm_priv.h3
-rw-r--r--src/lib/elm_win.c19
3 files changed, 103 insertions, 4 deletions
diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c
index b11bb0b5b..46b9f7ac4 100644
--- a/src/lib/elm_config.c
+++ b/src/lib/elm_config.c
@@ -24,6 +24,7 @@ static Eet_Data_Descriptor *_config_binding_key_edd = NULL;
static Eet_Data_Descriptor *_config_binding_modifier_edd = NULL;
const char *_elm_preferred_engine = NULL;
const char *_elm_accel_preference = NULL;
+const char *_elm_gl_preference = NULL;
Eina_List *_font_overlays_del = NULL;
Eina_List *_color_overlays_del = NULL;
@@ -1615,6 +1616,9 @@ _config_load(void)
_elm_config->win_auto_focus_enable = 1;
_elm_config->win_auto_focus_animate = 1;
_elm_config->atspi_mode = ELM_ATSPI_MODE_OFF;
+ _elm_config->gl_depth = 0;
+ _elm_config->gl_msaa = 0;
+ _elm_config->gl_stencil = 0;
}
static const char *
@@ -3237,6 +3241,7 @@ _elm_config_init(void)
_config_load();
_env_get();
ELM_SAFE_FREE(_elm_accel_preference, eina_stringshare_del);
+ ELM_SAFE_FREE(_elm_gl_preference, eina_stringshare_del);
_translation_init();
_config_apply();
_elm_config_font_overlay_apply();
@@ -3385,6 +3390,7 @@ elm_config_preferred_engine_set(const char *engine)
EAPI const char *
elm_config_accel_preference_get(void)
{
+ if (_elm_gl_preference) return _elm_gl_preference;
if (_elm_accel_preference) return _elm_accel_preference;
return _elm_config->accel;
}
@@ -3394,11 +3400,86 @@ elm_config_accel_preference_set(const char *pref)
{
if (pref)
{
- eina_stringshare_replace(&(_elm_accel_preference), pref);
- eina_stringshare_replace(&(_elm_config->accel), pref);
+ Eina_Bool is_hw_accel = EINA_FALSE;
+ unsigned int tokens = 0, i;
+ char **arr;
+
+ /* Accel preference's string has the window surface configuration as a hw accel, depth, stencil and msaa.
+ * The string format is "{HW Accel}:depth{value}:stencil{value}:msaa{msaa string}"
+ * Especially, msaa string is related Evas GL MSAA enum value(low, mid, high)
+ * so msaa string has four types as msaa, msaa_low, msaa_mid, msaa_high
+ * For instance, "opengl:depth24:stencil8:msaa_high".
+ * It means that using hw accelation, window surface depth buffer's size is 24, stencil buffer's size 8 and msaa bits is the highest.
+ * The other use-case is "opengl:depth24".
+ * It measn that using hw accelation, depth buffer size is 24. stencil and msaa are not used.
+ * The simple case is "opengl:depth:stencil:msaa".
+ * It means that depth, stencil and msaa are setted by pre-defined value(depth:24, stencil:8, msaa:low)
+ */
+
+ DBG("accel preference's string: %s",pref);
+ /* full string */
+ eina_stringshare_replace(&(_elm_gl_preference), pref);
+ ELM_SAFE_FREE(_elm_accel_preference, eina_stringshare_del);
+ ELM_SAFE_FREE(_elm_config->accel, eina_stringshare_del);
+
+ /* split GL items (hw accel, gl depth, gl stencil, gl msaa */
+ arr = eina_str_split_full(pref, ":", 0, &tokens);
+ for (i = 0; arr && arr[i]; i++)
+ {
+ if ((!strcasecmp(arr[i], "gl")) ||
+ (!strcasecmp(arr[i], "opengl")) ||
+ (!strcasecmp(arr[i], "3d")) ||
+ (!strcasecmp(arr[i], "hw")) ||
+ (!strcasecmp(arr[i], "accel")) ||
+ (!strcasecmp(arr[i], "hardware"))
+ )
+ {
+ eina_stringshare_replace(&(_elm_accel_preference), arr[i]);
+ eina_stringshare_replace(&(_elm_config->accel), arr[i]);
+ is_hw_accel = EINA_TRUE;
+ }
+ else if (!strncmp(arr[i], "depth", 5))
+ {
+ char *value_str = arr[i] + 5;
+ if ((value_str) && (isdigit(*value_str)))
+ _elm_config->gl_depth = atoi(value_str);
+ else
+ _elm_config->gl_depth = 24;
+ }
+ else if (!strncmp(arr[i], "stencil", 7))
+ {
+ char *value_str = arr[i] + 7;
+ if ((value_str) && (isdigit(*value_str)))
+ _elm_config->gl_stencil = atoi(value_str);
+ else
+ _elm_config->gl_stencil = 8;
+ }
+ else if (!strncmp(arr[i], "msaa_low", 8))
+ _elm_config->gl_msaa = 1; // 1 means msaa low
+ else if (!strncmp(arr[i], "msaa_mid", 8))
+ _elm_config->gl_msaa = 2; // 2 means msaa mid
+ else if (!strncmp(arr[i], "msaa_high", 9))
+ _elm_config->gl_msaa = 4; // 4 means msaa high
+ else if (!strncmp(arr[i], "msaa", 4))
+ _elm_config->gl_msaa = 1; // 1 means msaa low
+ }
+
+ DBG("accel: %s", _elm_accel_preference);
+ DBG("gl depth: %d", _elm_config->gl_depth);
+ DBG("gl stencil: %d", _elm_config->gl_stencil);
+ DBG("gl msaa: %d", _elm_config->gl_msaa);
+ free(arr[0]);
+ free(arr);
+
+ if (is_hw_accel == EINA_FALSE)
+ {
+ ELM_SAFE_FREE(_elm_accel_preference, eina_stringshare_del);
+ ELM_SAFE_FREE(_elm_config->accel, eina_stringshare_del);
+ }
}
else
{
+ ELM_SAFE_FREE(_elm_gl_preference, eina_stringshare_del);
ELM_SAFE_FREE(_elm_accel_preference, eina_stringshare_del);
ELM_SAFE_FREE(_elm_config->accel, eina_stringshare_del);
}
diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h
index 1ddf9aa6c..2c0876bab 100644
--- a/src/lib/elm_priv.h
+++ b/src/lib/elm_priv.h
@@ -290,6 +290,9 @@ struct _Elm_Config
unsigned char win_auto_focus_animate;
Eina_List *bindings;
Eina_Bool atspi_mode;
+ int gl_depth;
+ int gl_stencil;
+ int gl_msaa;
/* Not part of the EET file */
Eina_Bool is_mirrored : 1;
diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c
index 27eb1168e..e64257060 100644
--- a/src/lib/elm_win.c
+++ b/src/lib/elm_win.c
@@ -3326,14 +3326,29 @@ _elm_win_constructor(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_Type t
tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
else if (!strcmp(enginelist[i], ELM_OPENGL_X11))
{
- int opt[10], opt_i = 0;
+ int opt[20], opt_i = 0;
if (_elm_config->vsync)
{
opt[opt_i++] = ECORE_EVAS_GL_X11_OPT_VSYNC;
opt[opt_i++] = 1;
- opt[opt_i++] = 0;
}
+ if (_elm_config->gl_depth)
+ {
+ opt[opt_i++] = ECORE_EVAS_GL_X11_OPT_GL_DEPTH;
+ opt[opt_i++] = _elm_config->gl_depth;
+ }
+ if (_elm_config->gl_stencil)
+ {
+ opt[opt_i++] = ECORE_EVAS_GL_X11_OPT_GL_STENCIL;
+ opt[opt_i++] = _elm_config->gl_stencil;
+ }
+ if (_elm_config->gl_msaa)
+ {
+ opt[opt_i++] = ECORE_EVAS_GL_X11_OPT_GL_MSAA;
+ opt[opt_i++] = _elm_config->gl_msaa;
+ }
+ opt[opt_i] = 0;
if (opt_i > 0)
tmp_sd.ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
else