summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2014-12-22 22:08:24 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2014-12-22 22:15:12 +0900
commitaf43bc67e4a79b18343f7f8f55754b3eceaa48a3 (patch)
tree523a4896a6d1a6c947bb62926793e01fe8e26123 /src/modules
parent48920920a581a14da7f093748540f608a70e0513 (diff)
Evas GL: Try harder to find a matching config for GLESv1
If MSAA was requested, it is very likely that no config was found (depending on the driver), so we'll try again without MSAA. Yeah, this might not look very smooth but it should be better that failing at eglMakeCurrent.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/evas/engines/gl_x11/evas_engine.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c
index 7effa53334..3721d31f00 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -914,12 +914,13 @@ evgl_eng_gles1_surface_create(EVGL_Engine *evgl EINA_UNUSED, void *data,
914#ifdef GL_GLES 914#ifdef GL_GLES
915 EGLSurface egl_sfc; 915 EGLSurface egl_sfc;
916 EGLConfig egl_cfg; 916 EGLConfig egl_cfg;
917 int i, num = 0, best = 0; 917 int i, num = 0, best = -1;
918 EGLConfig configs[200]; 918 EGLConfig configs[200];
919 int config_attrs[40]; 919 int config_attrs[40];
920 Eina_Bool found = EINA_FALSE; 920 Eina_Bool found = EINA_FALSE;
921 int msaa = 0, depth = 0, stencil = 0; 921 int msaa = 0, depth = 0, stencil = 0;
922 Visual *visual = NULL; 922 Visual *visual = NULL;
923 Eina_Bool retried = EINA_FALSE;
923 924
924 /* Now we need to iterate over all EGL configurations to check the compatible 925 /* Now we need to iterate over all EGL configurations to check the compatible
925 * ones and finally check their visual ID. */ 926 * ones and finally check their visual ID. */
@@ -936,6 +937,7 @@ evgl_eng_gles1_surface_create(EVGL_Engine *evgl EINA_UNUSED, void *data,
936 (cfg->multisample_bits <= EVAS_GL_MULTISAMPLE_HIGH)) 937 (cfg->multisample_bits <= EVAS_GL_MULTISAMPLE_HIGH))
937 msaa = evgl->caps.msaa_samples[(int) cfg->multisample_bits - 1]; 938 msaa = evgl->caps.msaa_samples[(int) cfg->multisample_bits - 1];
938 939
940try_again:
939 i = 0; 941 i = 0;
940 config_attrs[i++] = EGL_SURFACE_TYPE; 942 config_attrs[i++] = EGL_SURFACE_TYPE;
941 config_attrs[i++] = EGL_PIXMAP_BIT; 943 config_attrs[i++] = EGL_PIXMAP_BIT;
@@ -1013,7 +1015,7 @@ evgl_eng_gles1_surface_create(EVGL_Engine *evgl EINA_UNUSED, void *data,
1013 { 1015 {
1014 if (xvi[j].depth >= colordepth) 1016 if (xvi[j].depth >= colordepth)
1015 { 1017 {
1016 if (!best) best = i; 1018 if (best < 0) best = i;
1017 if (alpha) 1019 if (alpha)
1018 { 1020 {
1019 fmt = XRenderFindVisualFormat(eng_get_ob(re)->disp, xvi[j].visual); 1021 fmt = XRenderFindVisualFormat(eng_get_ob(re)->disp, xvi[j].visual);
@@ -1036,12 +1038,26 @@ evgl_eng_gles1_surface_create(EVGL_Engine *evgl EINA_UNUSED, void *data,
1036 1038
1037 if (!found) 1039 if (!found)
1038 { 1040 {
1039 // This config will probably not work, but we try anyways. 1041 if (num && (best >= 0))
1040 ERR("XGetVisualInfo failed. Trying with EGL config #%d", best); 1042 {
1041 if (num) 1043 ERR("No matching config found. Trying with EGL config #%d", best);
1042 egl_cfg = configs[best]; 1044 egl_cfg = configs[best];
1045 }
1046 else if (msaa && !retried)
1047 {
1048 ERR("Trying again without MSAA.");
1049 msaa = 0;
1050 retried = EINA_TRUE;
1051 goto try_again;
1052 }
1043 else 1053 else
1044 egl_cfg = eng_get_ob(re)->egl_config; 1054 {
1055 // This config will probably not work, but we try anyways.
1056 // NOTE: Maybe it would be safer to just return NULL here, leaving
1057 // the app responsible for changing its config.
1058 ERR("XGetVisualInfo failed. Trying with the window's EGL config.");
1059 egl_cfg = eng_get_ob(re)->egl_config;
1060 }
1045 } 1061 }
1046 1062
1047 egl_sfc = eglCreatePixmapSurface(eng_get_ob(re)->egl_disp, egl_cfg, px, NULL); 1063 egl_sfc = eglCreatePixmapSurface(eng_get_ob(re)->egl_disp, egl_cfg, px, NULL);