1 #include "evas_engine.h"
3 static Evas_GL_X11_Window *_evas_gl_x11_window = NULL;
5 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
6 static EGLContext context = EGL_NO_CONTEXT;
8 // FIXME: this will only work for 1 display connection (glx land can have > 1)
9 static GLXContext context = 0;
10 static GLXContext rgba_context = 0;
11 static GLXFBConfig fbconf = 0;
12 static GLXFBConfig rgba_fbconf = 0;
15 // fixme: something is up/wrong here - dont know what tho...
18 static XVisualInfo *_evas_gl_x11_vi = NULL;
19 static XVisualInfo *_evas_gl_x11_rgba_vi = NULL;
20 static Colormap _evas_gl_x11_cmap = 0;
21 static Colormap _evas_gl_x11_rgba_cmap = 0;
23 static int win_count = 0;
26 eng_window_new(Display *disp,
38 Evas_GL_X11_Window *gw;
39 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
42 int major_version, minor_version;
43 int num_config, n = 0;
46 const GLubyte *vendor, *renderer, *version;
48 if (!_evas_gl_x11_vi) return NULL;
50 gw = calloc(1, sizeof(Evas_GL_X11_Window));
65 vi_use = _evas_gl_x11_vi;
68 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
69 if (_evas_gl_x11_rgba_vi)
71 vi_use = _evas_gl_x11_rgba_vi;
75 if (_evas_gl_x11_rgba_vi)
77 vi_use = _evas_gl_x11_rgba_vi;
82 gw->visualinfo = vi_use;
85 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
86 context_attrs[0] = EGL_CONTEXT_CLIENT_VERSION;
88 context_attrs[2] = EGL_NONE;
90 # if defined(GLES_VARIETY_S3C6410)
91 if (gw->visualinfo->depth == 16) // 16bpp
93 config_attrs[n++] = EGL_SURFACE_TYPE;
94 config_attrs[n++] = EGL_WINDOW_BIT;
95 config_attrs[n++] = EGL_RENDERABLE_TYPE;
96 config_attrs[n++] = EGL_OPENGL_ES2_BIT;
97 config_attrs[n++] = EGL_RED_SIZE;
98 config_attrs[n++] = 5;
99 config_attrs[n++] = EGL_GREEN_SIZE;
100 config_attrs[n++] = 6;
101 config_attrs[n++] = EGL_BLUE_SIZE;
102 config_attrs[n++] = 5;
103 config_attrs[n++] = EGL_DEPTH_SIZE;
104 config_attrs[n++] = 0;
105 config_attrs[n++] = EGL_STENCIL_SIZE;
106 config_attrs[n++] = 0;
107 config_attrs[n++] = EGL_NONE;
109 else // 24/32bit. no one does 8bpp anymore. and 15bpp... dead
111 config_attrs[n++] = EGL_SURFACE_TYPE;
112 config_attrs[n++] = EGL_WINDOW_BIT;
113 config_attrs[n++] = EGL_RENDERABLE_TYPE;
114 config_attrs[n++] = EGL_OPENGL_ES2_BIT;
115 config_attrs[n++] = EGL_RED_SIZE;
116 config_attrs[n++] = 8;
117 config_attrs[n++] = EGL_GREEN_SIZE;
118 config_attrs[n++] = 8;
119 config_attrs[n++] = EGL_BLUE_SIZE;
120 config_attrs[n++] = 8;
121 config_attrs[n++] = EGL_DEPTH_SIZE;
122 config_attrs[n++] = 0;
123 config_attrs[n++] = EGL_STENCIL_SIZE;
124 config_attrs[n++] = 0;
125 config_attrs[n++] = EGL_NONE;
127 # elif defined(GLES_VARIETY_SGX)
128 config_attrs[n++] = EGL_SURFACE_TYPE;
129 config_attrs[n++] = EGL_WINDOW_BIT;
130 config_attrs[n++] = EGL_RENDERABLE_TYPE;
131 config_attrs[n++] = EGL_OPENGL_ES2_BIT;
133 // FIXME: n900 - omap3 sgx libs break here
134 config_attrs[n++] = EGL_RED_SIZE;
135 config_attrs[n++] = 1;
136 config_attrs[n++] = EGL_GREEN_SIZE;
137 config_attrs[n++] = 1;
138 config_attrs[n++] = EGL_BLUE_SIZE;
139 config_attrs[n++] = 1;
140 // FIXME: end n900 breakage
144 config_attrs[n++] = EGL_ALPHA_SIZE;
145 config_attrs[n++] = 1;
149 config_attrs[n++] = EGL_ALPHA_SIZE;
150 config_attrs[n++] = 0;
152 config_attrs[n++] = EGL_DEPTH_SIZE;
153 config_attrs[n++] = 0;
154 config_attrs[n++] = EGL_STENCIL_SIZE;
155 config_attrs[n++] = 0;
156 config_attrs[n++] = EGL_NONE;
159 gw->egl_disp = eglGetDisplay((EGLNativeDisplayType)(gw->disp));
162 ERR("eglGetDisplay() fail. code=%#x", eglGetError());
166 if (!eglInitialize(gw->egl_disp, &major_version, &minor_version))
168 ERR("eglInitialize() fail. code=%#x", eglGetError());
172 eglBindAPI(EGL_OPENGL_ES_API);
173 if (eglGetError() != EGL_SUCCESS)
175 ERR("eglBindAPI() fail. code=%#x", eglGetError());
181 if (!eglChooseConfig(gw->egl_disp, config_attrs, &gw->egl_config,
182 1, &num_config) || (num_config != 1))
184 ERR("eglChooseConfig() fail. code=%#x", eglGetError());
188 gw->egl_surface[0] = eglCreateWindowSurface(gw->egl_disp, gw->egl_config,
189 (EGLNativeWindowType)gw->win,
191 if (gw->egl_surface[0] == EGL_NO_SURFACE)
193 ERR("eglCreateWindowSurface() fail for %#x. code=%#x",
194 (unsigned int)gw->win, eglGetError());
198 if (context == EGL_NO_CONTEXT)
199 context = eglCreateContext(gw->egl_disp, gw->egl_config, NULL,
201 gw->egl_context[0] = context;
202 if (gw->egl_context[0] == EGL_NO_CONTEXT)
204 ERR("eglCreateContext() fail. code=%#x", eglGetError());
208 if (eglMakeCurrent(gw->egl_disp,
211 gw->egl_context[0]) == EGL_FALSE)
213 ERR("eglMakeCurrent() fail. code=%#x", eglGetError());
218 vendor = glGetString(GL_VENDOR);
219 renderer = glGetString(GL_RENDERER);
220 version = glGetString(GL_VERSION);
221 if (!vendor) vendor = (unsigned char *)"-UNKNOWN-";
222 if (!renderer) renderer = (unsigned char *)"-UNKNOWN-";
223 if (!version) version = (unsigned char *)"-UNKNOWN-";
224 if (getenv("EVAS_GL_INFO"))
226 fprintf(stderr, "vendor: %s\n", vendor);
227 fprintf(stderr, "renderer: %s\n", renderer);
228 fprintf(stderr, "version: %s\n", version);
236 context = glXCreateNewContext(gw->disp, fbconf,
240 context = glXCreateNewContext(gw->disp, fbconf,
245 context = glXCreateContext(gw->disp, gw->visualinfo, NULL, GL_FALSE);
247 context = glXCreateContext(gw->disp, gw->visualinfo, NULL, GL_TRUE);
251 if ((gw->alpha) && (!rgba_context))
254 rgba_context = glXCreateNewContext(gw->disp, rgba_fbconf,
255 GLX_RGBA_TYPE, context,
258 rgba_context = glXCreateNewContext(gw->disp, rgba_fbconf,
259 GLX_RGBA_TYPE, context,
263 gw->glxwin = glXCreateWindow(gw->disp, rgba_fbconf, gw->win, NULL);
265 gw->glxwin = glXCreateWindow(gw->disp, fbconf, gw->win, NULL);
272 if (gw->alpha) gw->context = rgba_context;
273 else gw->context = context;
275 gw->context = context;
291 if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin,
294 printf("Error: glXMakeContextCurrent(%p, %p, %p, %p)\n", (void *)gw->disp, (void *)gw->glxwin, (void *)gw->glxwin, (void *)gw->context);
301 if (!glXMakeCurrent(gw->disp, gw->win, gw->context))
303 printf("Error: glXMakeCurrent(%p, 0x%x, %p) failed\n", (void *)gw->disp, (unsigned int)gw->win, (void *)gw->context);
309 // FIXME: move this up to context creation
311 vendor = glGetString(GL_VENDOR);
312 renderer = glGetString(GL_RENDERER);
313 version = glGetString(GL_VERSION);
314 if (getenv("EVAS_GL_INFO"))
316 fprintf(stderr, "vendor: %s\n", vendor);
317 fprintf(stderr, "renderer: %s\n", renderer);
318 fprintf(stderr, "version: %s\n", version);
321 // vendor: NVIDIA Corporation
322 // renderer: NVIDIA Tegra
323 // version: OpenGL ES 2.0
325 // vendor: Imagination Technologies
326 // renderer: PowerVR SGX 540
327 // version: OpenGL ES 2.0
329 // vendor: NVIDIA Corporation
330 // renderer: GeForce GT 330M/PCI/SSE2
331 // version: 3.3.0 NVIDIA 256.53
333 // vendor: NVIDIA Corporation
334 // renderer: GeForce GT 220/PCI/SSE2
335 // version: 3.2.0 NVIDIA 195.36.24
337 // vendor: NVIDIA Corporation
338 // renderer: GeForce 8600 GTS/PCI/SSE2
339 // version: 3.3.0 NVIDIA 260.19.36
341 // vendor: ATI Technologies Inc.
342 // renderer: ATI Mobility Radeon HD 4650
343 // version: 3.2.9756 Compatibility Profile Context
345 // vendor: Tungsten Graphics, Inc
346 // renderer: Mesa DRI Mobile Intel® GM45 Express Chipset GEM 20100330 DEVELOPMENT x86/MMX/SSE2
347 // version: 2.1 Mesa 7.9-devel
349 // vendor: Advanced Micro Devices, Inc.
350 // renderer: Mesa DRI R600 (RS780 9610) 20090101 TCL DRI2
351 // version: 2.1 Mesa 7.9-devel
353 // vendor: NVIDIA Corporation
354 // renderer: GeForce 9600 GT/PCI/SSE2
355 // version: 3.3.0 NVIDIA 260.19.29
357 // vendor: ATI Technologies Inc.
358 // renderer: ATI Radeon HD 4800 Series
359 // version: 3.3.10237 Compatibility Profile Context
361 // vendor: Advanced Micro Devices, Inc.
362 // renderer: Mesa DRI R600 (RV770 9442) 20090101 TCL DRI2
363 // version: 2.0 Mesa 7.8.2
365 // vendor: Tungsten Graphics, Inc
366 // renderer: Mesa DRI Mobile Intel® GM45 Express Chipset GEM 20100330 DEVELOPMENT
367 // version: 2.1 Mesa 7.9-devel
368 // or (bad - software renderer)
369 // vendor: Mesa Project
370 // renderer: Software Rasterizer
371 // version: 2.1 Mesa 7.9-devel
372 // or (bad - software renderer)
373 // vendor: VMware, Inc.
374 // renderer: Gallium 0.4 on softpipe
375 // version: 2.1 Mesa 7.9-devel
377 if (strstr((const char *)vendor, "Mesa Project"))
379 if (strstr((const char *)renderer, "Software Rasterizer"))
382 if (strstr((const char *)renderer, "softpipe"))
386 ERR("OpenGL Driver blacklisted:");
387 ERR("Vendor: %s", (const char *)vendor);
388 ERR("Renderer: %s", (const char *)renderer);
389 ERR("Version: %s", (const char *)version);
393 if (strstr((const char *)vendor, "NVIDIA"))
395 if (!strstr((const char *)renderer, "NVIDIA Tegra"))
397 int v1 = 0, v2 = 0, v3 = 0;
399 if (sscanf((const char *)version,
404 if (sscanf((const char *)version,
409 // ALSO as of some nvidia driver version loose binding is
410 // probably not needed
411 if (v1 < 195) gw->detected.loose_binding = 1;
416 // noothing yet. add more cases and options over time
419 fbc = glXGetFBConfigs(gw->disp, screen, &num);
422 ERR("glXGetFBConfigs() returned no fb configs");
426 for (i = 0; i <= 32; i++)
428 for (j = 0; j < num; j++)
432 int alph, val, dbuf, stencil, tdepth;
435 vi = glXGetVisualFromFBConfig(gw->disp, fbc[j]);
440 if (vd != i) continue;
442 glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_ALPHA_SIZE, &alph);
443 glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BUFFER_SIZE, &val);
445 if ((val != i) && ((val - alph) != i)) continue;
452 glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_TEXTURE_RGBA_EXT, &val);
456 gw->depth_cfg[i].tex_format = GLX_TEXTURE_FORMAT_RGBA_EXT;
462 glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_TEXTURE_RGB_EXT, &val);
464 gw->depth_cfg[i].tex_format = GLX_TEXTURE_FORMAT_RGB_EXT;
468 glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_DOUBLEBUFFER, &val);
469 if (val > dbuf) continue;
473 glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_STENCIL_SIZE, &val);
474 if (val > stencil) continue;
478 glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_DEPTH_SIZE, &val);
479 if (val > tdepth) continue;
482 glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_MIPMAP_TEXTURE_EXT, &val);
483 if (val < 0) continue;
484 gw->depth_cfg[i].mipmap = val;
486 glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_Y_INVERTED_EXT, &val);
487 gw->depth_cfg[i].yinvert = val;
489 glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_TEXTURE_TARGETS_EXT, &val);
490 gw->depth_cfg[i].tex_target = val;
492 gw->depth_cfg[i].fbc = fbc[j];
496 if (!gw->depth_cfg[DefaultDepth(gw->disp, screen)].fbc)
498 WRN("texture from pixmap not going to work");
503 gw->gl_context = evas_gl_common_context_new();
509 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
510 gw->gl_context->egldisp = gw->egl_disp;
513 evas_gl_common_context_resize(gw->gl_context, w, h, rot);
520 eng_window_free(Evas_GL_X11_Window *gw)
525 if (gw == _evas_gl_x11_window) _evas_gl_x11_window = NULL;
528 ref = gw->gl_context->references - 1;
529 evas_gl_common_context_free(gw->gl_context);
531 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
532 if (gw->egl_surface[0] != EGL_NO_SURFACE)
533 eglDestroySurface(gw->egl_disp, gw->egl_surface[0]);
534 eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
537 if (context) eglDestroyContext(gw->egl_disp, context);
538 eglTerminate(gw->egl_disp);
539 context = EGL_NO_CONTEXT;
542 if (gw->glxwin) glXDestroyWindow(gw->disp, gw->glxwin);
545 if (context) glXDestroyContext(gw->disp, context);
546 if (rgba_context) glXDestroyContext(gw->disp, rgba_context);
557 eng_window_use(Evas_GL_X11_Window *gw)
559 Eina_Bool force_use = EINA_FALSE;
561 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
562 if (_evas_gl_x11_window)
564 if ((eglGetCurrentContext() !=
565 _evas_gl_x11_window->egl_context[0]) ||
566 (eglGetCurrentSurface(EGL_READ) !=
567 _evas_gl_x11_window->egl_surface[0]) ||
568 (eglGetCurrentSurface(EGL_DRAW) !=
569 _evas_gl_x11_window->egl_surface[0]))
570 force_use = EINA_TRUE;
573 if (_evas_gl_x11_window)
575 if (glXGetCurrentContext() != _evas_gl_x11_window->context)
576 force_use = EINA_TRUE;
579 if ((_evas_gl_x11_window != gw) || (force_use))
581 if (_evas_gl_x11_window)
583 evas_gl_common_context_use(_evas_gl_x11_window->gl_context);
584 evas_gl_common_context_flush(_evas_gl_x11_window->gl_context);
586 _evas_gl_x11_window = gw;
590 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
591 if (gw->egl_surface[0] != EGL_NO_SURFACE)
593 if (eglMakeCurrent(gw->egl_disp,
596 gw->egl_context[0]) == EGL_FALSE)
598 ERR("eglMakeCurrent() failed!");
605 if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin,
608 ERR("glXMakeContextCurrent(%p, %p, %p, %p)", (void *)gw->disp, (void *)gw->glxwin, (void *)gw->glxwin, (void *)gw->context);
613 if (!glXMakeCurrent(gw->disp, gw->win, gw->context))
615 ERR("glXMakeCurrent(%p, 0x%x, %p) failed", gw->disp, (unsigned int)gw->win, (void *)gw->context);
621 if (gw) evas_gl_common_context_use(gw->gl_context);
625 eng_window_unsurf(Evas_GL_X11_Window *gw)
627 if (!gw->surf) return;
628 if (!getenv("EVAS_GL_WIN_RESURF")) return;
629 if (getenv("EVAS_GL_INFO"))
630 printf("unsurf %p\n", gw);
631 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
632 if (_evas_gl_x11_window)
633 evas_gl_common_context_flush(_evas_gl_x11_window->gl_context);
634 if (_evas_gl_x11_window == gw)
636 eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
637 if (gw->egl_surface[0] != EGL_NO_SURFACE)
638 eglDestroySurface(gw->egl_disp, gw->egl_surface[0]);
639 gw->egl_surface[0] = EGL_NO_SURFACE;
640 _evas_gl_x11_window = NULL;
645 glXDestroyWindow(gw->disp, gw->glxwin);
655 eng_window_resurf(Evas_GL_X11_Window *gw)
657 if (gw->surf) return;
658 if (getenv("EVAS_GL_INFO"))
659 printf("resurf %p\n", gw);
660 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
661 gw->egl_surface[0] = eglCreateWindowSurface(gw->egl_disp, gw->egl_config,
662 (EGLNativeWindowType)gw->win,
664 if (gw->egl_surface[0] == EGL_NO_SURFACE)
666 ERR("eglCreateWindowSurface() fail for %#x. code=%#x",
667 (unsigned int)gw->win, eglGetError());
670 if (eglMakeCurrent(gw->egl_disp,
673 gw->egl_context[0]) == EGL_FALSE)
675 ERR("eglMakeCurrent() failed!");
680 gw->glxwin = glXCreateWindow(gw->disp, rgba_fbconf, gw->win, NULL);
682 gw->glxwin = glXCreateWindow(gw->disp, fbconf, gw->win, NULL);
683 if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin,
686 ERR("glXMakeContextCurrent(%p, %p, %p, %p)", (void *)gw->disp, (void *)gw->glxwin, (void *)gw->glxwin, (void *)gw->context);
689 if (!glXMakeCurrent(gw->disp, gw->win, gw->context))
691 ERR("glXMakeCurrent(%p, 0x%x, %p) failed", (void *)gw->disp, (unsigned int)gw->win, (void *)gw->context);
699 eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo)
701 if (!einfo) return NULL;
702 if (!einfo->info.display) return NULL;
703 if (!_evas_gl_x11_vi)
708 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
709 for (alpha = 0; alpha < 2; alpha++)
711 int depth = DefaultDepth(einfo->info.display,
715 XVisualInfo *xvi, vi_in;
717 XRenderPictFormat *fmt;
719 vi_in.screen = einfo->info.screen;
721 vi_in.class = TrueColor;
722 xvi = XGetVisualInfo(einfo->info.display,
723 VisualScreenMask | VisualDepthMask |
728 for (i = 0; i < nvi; i++)
730 fmt = XRenderFindVisualFormat(einfo->info.display,
732 if ((fmt->type == PictTypeDirect) &&
733 (fmt->direct.alphaMask))
735 _evas_gl_x11_rgba_vi =
736 calloc(1, sizeof(XVisualInfo));
737 if (_evas_gl_x11_rgba_vi)
738 memcpy(_evas_gl_x11_rgba_vi,
739 &(xvi[i]), sizeof(XVisualInfo));
748 _evas_gl_x11_vi = calloc(1, sizeof(XVisualInfo));
749 XMatchVisualInfo(einfo->info.display,
750 einfo->info.screen, depth, TrueColor,
756 for (alpha = 0; alpha < 2; alpha++)
758 int config_attrs[40];
759 GLXFBConfig *configs = NULL, config = 0;
763 config_attrs[i++] = GLX_DRAWABLE_TYPE;
764 config_attrs[i++] = GLX_WINDOW_BIT;
765 config_attrs[i++] = GLX_DOUBLEBUFFER;
766 config_attrs[i++] = 1;
767 config_attrs[i++] = GLX_RED_SIZE;
768 config_attrs[i++] = 1;
769 config_attrs[i++] = GLX_GREEN_SIZE;
770 config_attrs[i++] =1;
771 config_attrs[i++] = GLX_BLUE_SIZE;
772 config_attrs[i++] = 1;
775 config_attrs[i++] = GLX_RENDER_TYPE;
776 config_attrs[i++] = GLX_RGBA_BIT;
777 config_attrs[i++] = GLX_ALPHA_SIZE;
778 config_attrs[i++] = 1;
782 config_attrs[i++] = GLX_ALPHA_SIZE;
783 config_attrs[i++] = 0;
785 config_attrs[i++] = GLX_DEPTH_SIZE;
786 config_attrs[i++] = 0;
787 config_attrs[i++] = GLX_STENCIL_SIZE;
788 config_attrs[i++] = 0;
789 config_attrs[i++] = GLX_AUX_BUFFERS;
790 config_attrs[i++] = 0;
791 config_attrs[i++] = GLX_STEREO;
792 config_attrs[i++] = 0;
793 config_attrs[i++] = GLX_TRANSPARENT_TYPE;
794 config_attrs[i++] = GLX_NONE;//GLX_NONE;//GLX_TRANSPARENT_INDEX//GLX_TRANSPARENT_RGB;
795 config_attrs[i++] = 0;
797 configs = glXChooseFBConfig(einfo->info.display,
800 if ((!configs) || (num < 1))
802 ERR("glXChooseFBConfig returned no configs");
805 for (i = 0; i < num; i++)
807 XVisualInfo *visinfo;
808 XRenderPictFormat *format = NULL;
810 visinfo = glXGetVisualFromFBConfig(einfo->info.display,
812 if (!visinfo) continue;
816 _evas_gl_x11_vi = malloc(sizeof(XVisualInfo));
817 memcpy(_evas_gl_x11_vi, visinfo, sizeof(XVisualInfo));
824 format = XRenderFindVisualFormat
825 (einfo->info.display, visinfo->visual);
831 if (format->direct.alphaMask > 0)
834 _evas_gl_x11_rgba_vi = malloc(sizeof(XVisualInfo));
835 memcpy(_evas_gl_x11_rgba_vi, visinfo, sizeof(XVisualInfo));
836 rgba_fbconf = config;
846 if (!_evas_gl_x11_vi) return NULL;
847 if (einfo->info.destination_alpha)
850 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
851 if (_evas_gl_x11_rgba_vi) return _evas_gl_x11_rgba_vi->visual;
854 if (_evas_gl_x11_rgba_vi) return _evas_gl_x11_rgba_vi->visual;
858 return _evas_gl_x11_vi->visual;
862 eng_best_colormap_get(Evas_Engine_Info_GL_X11 *einfo)
864 if (!einfo) return 0;
865 if (!einfo->info.display) return 0;
866 if (!_evas_gl_x11_vi) eng_best_visual_get(einfo);
867 if (!_evas_gl_x11_vi) return 0;
868 if (einfo->info.destination_alpha)
870 if (!_evas_gl_x11_rgba_cmap)
871 _evas_gl_x11_rgba_cmap =
872 XCreateColormap(einfo->info.display,
873 RootWindow(einfo->info.display,
875 _evas_gl_x11_rgba_vi->visual,
877 return _evas_gl_x11_rgba_cmap;
879 if (!_evas_gl_x11_cmap)
881 XCreateColormap(einfo->info.display,
882 RootWindow(einfo->info.display,
884 _evas_gl_x11_vi->visual,
886 return _evas_gl_x11_cmap;
890 eng_best_depth_get(Evas_Engine_Info_GL_X11 *einfo)
892 if (!einfo) return 0;
893 if (!einfo->info.display) return 0;
894 if (!_evas_gl_x11_vi) eng_best_visual_get(einfo);
895 if (!_evas_gl_x11_vi) return 0;
896 if (einfo->info.destination_alpha)
898 if (_evas_gl_x11_rgba_vi) return _evas_gl_x11_rgba_vi->depth;
900 return _evas_gl_x11_vi->depth;