summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-11-17 17:18:57 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-11-17 18:04:43 +0900
commitf7aa6b33b059d11c6c41ec3c339e972dfb9ef415 (patch)
tree6bba1eba20adface9708381aba4bba046f959b22
parent6748b047f501125d5e6b46e4c4ec78314e6e9888 (diff)
Evas GL: Fix BadMatch with pbuffer make current
This is the kind of horrible things you'll encounter when working with GL. The surface and context need to have matching configuration otherwise make current will fail, and the only way to get a matching config is to reuse the config selected to create the context. Gah. This is the same fix as for EGL. More a hack than a fix, to be honest. @fix
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_common.h3
-rw-r--r--src/modules/evas/engines/gl_x11/evas_engine.c12
-rw-r--r--src/modules/evas/engines/gl_x11/evas_x_main.c3
3 files changed, 17 insertions, 1 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_common.h b/src/modules/evas/engines/gl_common/evas_gl_common.h
index 202e81bc8a..378a806f80 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -334,6 +334,9 @@ struct _Evas_Engine_GL_Context
334 // FIXME: hack. expose egl display to gl core for egl image sec extn. 334 // FIXME: hack. expose egl display to gl core for egl image sec extn.
335 void *egldisp; 335 void *egldisp;
336 void *eglctxt; 336 void *eglctxt;
337#else
338 int glxcfg_rgb;
339 int glxcfg_rgba;
337#endif 340#endif
338 341
339 GLuint preserve_bit; 342 GLuint preserve_bit;
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c
index ab45b76acc..84db094fc8 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -767,19 +767,22 @@ evgl_eng_pbuffer_surface_create(void *data, EVGL_Surface *sfc,
767 767
768 return egl_sfc; 768 return egl_sfc;
769#else 769#else
770 Evas_Engine_GL_Context *evasglctx;
770 GLXPbuffer pbuf; 771 GLXPbuffer pbuf;
771 GLXFBConfig *cfgs; 772 GLXFBConfig *cfgs;
772 int config_attrs[20]; 773 int config_attrs[20];
773 int surface_attrs[20]; 774 int surface_attrs[20];
774 int ncfg = 0, i; 775 int ncfg = 0, i;
775 776
776 // TODO: Check all required config attributes 777 evasglctx = re->window_gl_context_get(re->software.ob);
777 778
778#ifndef GLX_VISUAL_ID 779#ifndef GLX_VISUAL_ID
779# define GLX_VISUAL_ID 0x800b 780# define GLX_VISUAL_ID 0x800b
780#endif 781#endif
781 782
782 i = 0; 783 i = 0;
784#if 0
785 // DISABLED BECAUSE BadMatch HAPPENS
783 if (sfc->pbuffer.color_fmt != EVAS_GL_NO_FBO) 786 if (sfc->pbuffer.color_fmt != EVAS_GL_NO_FBO)
784 { 787 {
785 config_attrs[i++] = GLX_BUFFER_SIZE; 788 config_attrs[i++] = GLX_BUFFER_SIZE;
@@ -808,6 +811,13 @@ evgl_eng_pbuffer_surface_create(void *data, EVGL_Surface *sfc,
808 } 811 }
809 //config_attrs[i++] = GLX_VISUAL_ID; 812 //config_attrs[i++] = GLX_VISUAL_ID;
810 //config_attrs[i++] = XVisualIDFromVisual(vis); 813 //config_attrs[i++] = XVisualIDFromVisual(vis);
814#else
815 config_attrs[i++] = GLX_FBCONFIG_ID;
816 if (sfc->pbuffer.color_fmt == EVAS_GL_RGB_888)
817 config_attrs[i++] = evasglctx->glxcfg_rgb;
818 else
819 config_attrs[i++] = evasglctx->glxcfg_rgba;
820#endif
811 config_attrs[i++] = 0; 821 config_attrs[i++] = 0;
812 822
813 cfgs = glXChooseFBConfig(re->software.ob->disp, re->software.ob->screen, 823 cfgs = glXChooseFBConfig(re->software.ob->disp, re->software.ob->screen,
diff --git a/src/modules/evas/engines/gl_x11/evas_x_main.c b/src/modules/evas/engines/gl_x11/evas_x_main.c
index 8ee32d2dde..d00b4ff92c 100644
--- a/src/modules/evas/engines/gl_x11/evas_x_main.c
+++ b/src/modules/evas/engines/gl_x11/evas_x_main.c
@@ -564,6 +564,9 @@ try_gles2:
564#ifdef GL_GLES 564#ifdef GL_GLES
565 gw->gl_context->egldisp = gw->egl_disp; 565 gw->gl_context->egldisp = gw->egl_disp;
566 gw->gl_context->eglctxt = gw->egl_context[0]; 566 gw->gl_context->eglctxt = gw->egl_context[0];
567#else
568 glXGetFBConfigAttrib(gw->disp, evis->config, GLX_FBCONFIG_ID, &gw->gl_context->glxcfg_rgb);
569 glXGetFBConfigAttrib(gw->disp, evis2->config, GLX_FBCONFIG_ID, &gw->gl_context->glxcfg_rgba);
567#endif 570#endif
568 eng_window_use(gw); 571 eng_window_use(gw);
569 glsym_evas_gl_common_context_resize(gw->gl_context, w, h, rot); 572 glsym_evas_gl_common_context_resize(gw->gl_context, w, h, rot);