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;
49 if (!_evas_gl_x11_vi) return NULL;
51 gw = calloc(1, sizeof(Evas_GL_X11_Window));
66 vi_use = _evas_gl_x11_vi;
69 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
70 if (_evas_gl_x11_rgba_vi)
72 vi_use = _evas_gl_x11_rgba_vi;
76 if (_evas_gl_x11_rgba_vi)
78 vi_use = _evas_gl_x11_rgba_vi;
83 gw->visualinfo = vi_use;
86 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
87 context_attrs[0] = EGL_CONTEXT_CLIENT_VERSION;
89 context_attrs[2] = EGL_NONE;
91 # if defined(GLES_VARIETY_S3C6410)
92 if (gw->visualinfo->depth == 16) // 16bpp
94 config_attrs[n++] = EGL_SURFACE_TYPE;
95 config_attrs[n++] = EGL_WINDOW_BIT;
96 config_attrs[n++] = EGL_RENDERABLE_TYPE;
97 config_attrs[n++] = EGL_OPENGL_ES2_BIT;
98 config_attrs[n++] = EGL_RED_SIZE;
99 config_attrs[n++] = 5;
100 config_attrs[n++] = EGL_GREEN_SIZE;
101 config_attrs[n++] = 6;
102 config_attrs[n++] = EGL_BLUE_SIZE;
103 config_attrs[n++] = 5;
104 config_attrs[n++] = EGL_DEPTH_SIZE;
105 config_attrs[n++] = 0;
106 config_attrs[n++] = EGL_STENCIL_SIZE;
107 config_attrs[n++] = 0;
108 config_attrs[n++] = EGL_NONE;
110 else // 24/32bit. no one does 8bpp anymore. and 15bpp... dead
112 config_attrs[n++] = EGL_SURFACE_TYPE;
113 config_attrs[n++] = EGL_WINDOW_BIT;
114 config_attrs[n++] = EGL_RENDERABLE_TYPE;
115 config_attrs[n++] = EGL_OPENGL_ES2_BIT;
116 config_attrs[n++] = EGL_RED_SIZE;
117 config_attrs[n++] = 8;
118 config_attrs[n++] = EGL_GREEN_SIZE;
119 config_attrs[n++] = 8;
120 config_attrs[n++] = EGL_BLUE_SIZE;
121 config_attrs[n++] = 8;
122 config_attrs[n++] = EGL_DEPTH_SIZE;
123 config_attrs[n++] = 0;
124 config_attrs[n++] = EGL_STENCIL_SIZE;
125 config_attrs[n++] = 0;
126 config_attrs[n++] = EGL_NONE;
128 # elif defined(GLES_VARIETY_SGX)
129 config_attrs[n++] = EGL_SURFACE_TYPE;
130 config_attrs[n++] = EGL_WINDOW_BIT;
131 config_attrs[n++] = EGL_RENDERABLE_TYPE;
132 config_attrs[n++] = EGL_OPENGL_ES2_BIT;
134 // FIXME: n900 - omap3 sgx libs break here
135 config_attrs[n++] = EGL_RED_SIZE;
136 config_attrs[n++] = 1;
137 config_attrs[n++] = EGL_GREEN_SIZE;
138 config_attrs[n++] = 1;
139 config_attrs[n++] = EGL_BLUE_SIZE;
140 config_attrs[n++] = 1;
141 // FIXME: end n900 breakage
145 config_attrs[n++] = EGL_ALPHA_SIZE;
146 config_attrs[n++] = 1;
150 config_attrs[n++] = EGL_ALPHA_SIZE;
151 config_attrs[n++] = 0;
153 config_attrs[n++] = EGL_DEPTH_SIZE;
154 config_attrs[n++] = 0;
155 config_attrs[n++] = EGL_STENCIL_SIZE;
156 config_attrs[n++] = 0;
157 config_attrs[n++] = EGL_NONE;
160 gw->egl_disp = eglGetDisplay((EGLNativeDisplayType)(gw->disp));
163 ERR("eglGetDisplay() fail. code=%#x", eglGetError());
167 if (!eglInitialize(gw->egl_disp, &major_version, &minor_version))
169 ERR("eglInitialize() fail. code=%#x", eglGetError());
173 eglBindAPI(EGL_OPENGL_ES_API);
174 if (eglGetError() != EGL_SUCCESS)
176 ERR("eglBindAPI() fail. code=%#x", eglGetError());
182 if (!eglChooseConfig(gw->egl_disp, config_attrs, &gw->egl_config,
183 1, &num_config) || (num_config != 1))
185 ERR("eglChooseConfig() fail. code=%#x", eglGetError());
189 gw->egl_surface[0] = eglCreateWindowSurface(gw->egl_disp, gw->egl_config,
190 (EGLNativeWindowType)gw->win,
192 if (gw->egl_surface[0] == EGL_NO_SURFACE)
194 ERR("eglCreateWindowSurface() fail for %#x. code=%#x",
195 (unsigned int)gw->win, eglGetError());
199 if (context == EGL_NO_CONTEXT)
200 context = eglCreateContext(gw->egl_disp, gw->egl_config, NULL,
202 gw->egl_context[0] = context;
203 if (gw->egl_context[0] == EGL_NO_CONTEXT)
205 ERR("eglCreateContext() fail. code=%#x", eglGetError());
209 if (eglMakeCurrent(gw->egl_disp,
212 gw->egl_context[0]) == EGL_FALSE)
214 ERR("eglMakeCurrent() fail. code=%#x", eglGetError());
219 vendor = glGetString(GL_VENDOR);
220 renderer = glGetString(GL_RENDERER);
221 version = glGetString(GL_VERSION);
222 if (!vendor) vendor = (unsigned char *)"-UNKNOWN-";
223 if (!renderer) renderer = (unsigned char *)"-UNKNOWN-";
224 if (!version) version = (unsigned char *)"-UNKNOWN-";
225 if (getenv("EVAS_GL_INFO"))
227 fprintf(stderr, "vendor: %s\n", vendor);
228 fprintf(stderr, "renderer: %s\n", renderer);
229 fprintf(stderr, "version: %s\n", version);
232 if (strstr((const char *)vendor, "Mesa Project"))
234 if (strstr((const char *)renderer, "Software Rasterizer"))
237 if (strstr((const char *)renderer, "softpipe"))
241 ERR("OpenGL Driver blacklisted:");
242 ERR("Vendor: %s", (const char *)vendor);
243 ERR("Renderer: %s", (const char *)renderer);
244 ERR("Version: %s", (const char *)version);
254 context = glXCreateNewContext(gw->disp, fbconf,
258 context = glXCreateNewContext(gw->disp, fbconf,
263 context = glXCreateContext(gw->disp, gw->visualinfo, NULL, GL_FALSE);
265 context = glXCreateContext(gw->disp, gw->visualinfo, NULL, GL_TRUE);
269 if ((gw->alpha) && (!rgba_context))
272 rgba_context = glXCreateNewContext(gw->disp, rgba_fbconf,
273 GLX_RGBA_TYPE, context,
276 rgba_context = glXCreateNewContext(gw->disp, rgba_fbconf,
277 GLX_RGBA_TYPE, context,
281 gw->glxwin = glXCreateWindow(gw->disp, rgba_fbconf, gw->win, NULL);
283 gw->glxwin = glXCreateWindow(gw->disp, fbconf, gw->win, NULL);
290 if (gw->alpha) gw->context = rgba_context;
291 else gw->context = context;
293 gw->context = context;
308 if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin,
311 printf("Error: glXMakeContextCurrent(%p, %p, %p, %p)\n", (void *)gw->disp, (void *)gw->glxwin, (void *)gw->glxwin, (void *)gw->context);
318 if (!glXMakeCurrent(gw->disp, gw->win, gw->context))
320 printf("Error: glXMakeCurrent(%p, 0x%x, %p) failed\n", (void *)gw->disp, (unsigned int)gw->win, (void *)gw->context);
326 // FIXME: move this up to context creation
328 vendor = glGetString(GL_VENDOR);
329 renderer = glGetString(GL_RENDERER);
330 version = glGetString(GL_VERSION);
331 if (getenv("EVAS_GL_INFO"))
333 fprintf(stderr, "vendor: %s\n", vendor);
334 fprintf(stderr, "renderer: %s\n", renderer);
335 fprintf(stderr, "version: %s\n", version);
338 // vendor: NVIDIA Corporation
339 // renderer: NVIDIA Tegra
340 // version: OpenGL ES 2.0
342 // vendor: Imagination Technologies
343 // renderer: PowerVR SGX 540
344 // version: OpenGL ES 2.0
346 // vendor: NVIDIA Corporation
347 // renderer: GeForce GT 330M/PCI/SSE2
348 // version: 3.3.0 NVIDIA 256.53
350 // vendor: NVIDIA Corporation
351 // renderer: GeForce GT 220/PCI/SSE2
352 // version: 3.2.0 NVIDIA 195.36.24
354 // vendor: NVIDIA Corporation
355 // renderer: GeForce 8600 GTS/PCI/SSE2
356 // version: 3.3.0 NVIDIA 260.19.36
358 // vendor: ATI Technologies Inc.
359 // renderer: ATI Mobility Radeon HD 4650
360 // version: 3.2.9756 Compatibility Profile Context
362 // vendor: Tungsten Graphics, Inc
363 // renderer: Mesa DRI Mobile Intel® GM45 Express Chipset GEM 20100330 DEVELOPMENT x86/MMX/SSE2
364 // version: 2.1 Mesa 7.9-devel
366 // vendor: Advanced Micro Devices, Inc.
367 // renderer: Mesa DRI R600 (RS780 9610) 20090101 TCL DRI2
368 // version: 2.1 Mesa 7.9-devel
370 // vendor: NVIDIA Corporation
371 // renderer: GeForce 9600 GT/PCI/SSE2
372 // version: 3.3.0 NVIDIA 260.19.29
374 // vendor: ATI Technologies Inc.
375 // renderer: ATI Radeon HD 4800 Series
376 // version: 3.3.10237 Compatibility Profile Context
378 // vendor: Advanced Micro Devices, Inc.
379 // renderer: Mesa DRI R600 (RV770 9442) 20090101 TCL DRI2
380 // version: 2.0 Mesa 7.8.2
382 // vendor: Tungsten Graphics, Inc
383 // renderer: Mesa DRI Mobile Intel® GM45 Express Chipset GEM 20100330 DEVELOPMENT
384 // version: 2.1 Mesa 7.9-devel
385 // or (bad - software renderer)
386 // vendor: Mesa Project
387 // renderer: Software Rasterizer
388 // version: 2.1 Mesa 7.9-devel
389 // or (bad - software renderer)
390 // vendor: VMware, Inc.
391 // renderer: Gallium 0.4 on softpipe
392 // version: 2.1 Mesa 7.9-devel
394 if (strstr((const char *)vendor, "Mesa Project"))
396 if (strstr((const char *)renderer, "Software Rasterizer"))
399 if (strstr((const char *)renderer, "softpipe"))
403 ERR("OpenGL Driver blacklisted:");
404 ERR("Vendor: %s", (const char *)vendor);
405 ERR("Renderer: %s", (const char *)renderer);
406 ERR("Version: %s", (const char *)version);
410 if (strstr((const char *)vendor, "NVIDIA"))
412 if (!strstr((const char *)renderer, "NVIDIA Tegra"))
414 int v1 = 0, v2 = 0, v3 = 0;
416 if (sscanf((const char *)version,
421 if (sscanf((const char *)version,
426 // ALSO as of some nvidia driver version loose binding is
427 // probably not needed
428 if (v1 < 195) gw->detected.loose_binding = 1;
433 // noothing yet. add more cases and options over time
436 fbc = glXGetFBConfigs(gw->disp, screen, &num);
439 ERR("glXGetFBConfigs() returned no fb configs");
443 for (i = 0; i <= 32; i++)
445 for (j = 0; j < num; j++)
449 int alph, val, dbuf, stencil, tdepth;
452 vi = glXGetVisualFromFBConfig(gw->disp, fbc[j]);
457 if (vd != i) continue;
459 glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_ALPHA_SIZE, &alph);
460 glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BUFFER_SIZE, &val);
462 if ((val != i) && ((val - alph) != i)) continue;
469 glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_TEXTURE_RGBA_EXT, &val);
473 gw->depth_cfg[i].tex_format = GLX_TEXTURE_FORMAT_RGBA_EXT;
479 glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_TEXTURE_RGB_EXT, &val);
481 gw->depth_cfg[i].tex_format = GLX_TEXTURE_FORMAT_RGB_EXT;
485 glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_DOUBLEBUFFER, &val);
486 if (val > dbuf) continue;
490 glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_STENCIL_SIZE, &val);
491 if (val > stencil) continue;
495 glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_DEPTH_SIZE, &val);
496 if (val > tdepth) continue;
499 glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_MIPMAP_TEXTURE_EXT, &val);
500 if (val < 0) continue;
501 gw->depth_cfg[i].mipmap = val;
503 glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_Y_INVERTED_EXT, &val);
504 gw->depth_cfg[i].yinvert = val;
506 glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_TEXTURE_TARGETS_EXT, &val);
507 gw->depth_cfg[i].tex_target = val;
509 gw->depth_cfg[i].fbc = fbc[j];
513 if (!gw->depth_cfg[DefaultDepth(gw->disp, screen)].fbc)
515 WRN("texture from pixmap not going to work");
520 gw->gl_context = evas_gl_common_context_new();
526 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
527 gw->gl_context->egldisp = gw->egl_disp;
530 evas_gl_common_context_resize(gw->gl_context, w, h, rot);
537 eng_window_free(Evas_GL_X11_Window *gw)
542 if (gw == _evas_gl_x11_window) _evas_gl_x11_window = NULL;
545 ref = gw->gl_context->references - 1;
546 evas_gl_common_context_free(gw->gl_context);
548 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
549 if (gw->egl_surface[0] != EGL_NO_SURFACE)
550 eglDestroySurface(gw->egl_disp, gw->egl_surface[0]);
551 eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
554 if (context) eglDestroyContext(gw->egl_disp, context);
555 eglTerminate(gw->egl_disp);
556 context = EGL_NO_CONTEXT;
558 eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
560 if (gw->glxwin) glXDestroyWindow(gw->disp, gw->glxwin);
563 if (context) glXDestroyContext(gw->disp, context);
564 if (rgba_context) glXDestroyContext(gw->disp, rgba_context);
575 eng_window_use(Evas_GL_X11_Window *gw)
577 Eina_Bool force_use = EINA_FALSE;
579 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
580 if (_evas_gl_x11_window)
582 if ((eglGetCurrentContext() !=
583 _evas_gl_x11_window->egl_context[0]) ||
584 (eglGetCurrentSurface(EGL_READ) !=
585 _evas_gl_x11_window->egl_surface[0]) ||
586 (eglGetCurrentSurface(EGL_DRAW) !=
587 _evas_gl_x11_window->egl_surface[0]))
588 force_use = EINA_TRUE;
591 if (_evas_gl_x11_window)
593 if (glXGetCurrentContext() != _evas_gl_x11_window->context)
594 force_use = EINA_TRUE;
597 if ((_evas_gl_x11_window != gw) || (force_use))
599 if (_evas_gl_x11_window)
601 evas_gl_common_context_use(_evas_gl_x11_window->gl_context);
602 evas_gl_common_context_flush(_evas_gl_x11_window->gl_context);
604 _evas_gl_x11_window = gw;
608 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
609 if (gw->egl_surface[0] != EGL_NO_SURFACE)
611 if (eglMakeCurrent(gw->egl_disp,
614 gw->egl_context[0]) == EGL_FALSE)
616 ERR("eglMakeCurrent() failed!");
623 if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin,
626 ERR("glXMakeContextCurrent(%p, %p, %p, %p)", (void *)gw->disp, (void *)gw->glxwin, (void *)gw->glxwin, (void *)gw->context);
631 if (!glXMakeCurrent(gw->disp, gw->win, gw->context))
633 ERR("glXMakeCurrent(%p, 0x%x, %p) failed", gw->disp, (unsigned int)gw->win, (void *)gw->context);
639 if (gw) evas_gl_common_context_use(gw->gl_context);
643 eng_window_unsurf(Evas_GL_X11_Window *gw)
645 if (!gw->surf) return;
646 if (!getenv("EVAS_GL_WIN_RESURF")) return;
647 if (getenv("EVAS_GL_INFO"))
648 printf("unsurf %p\n", gw);
649 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
650 if (_evas_gl_x11_window)
651 evas_gl_common_context_flush(_evas_gl_x11_window->gl_context);
652 if (_evas_gl_x11_window == gw)
654 eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
655 if (gw->egl_surface[0] != EGL_NO_SURFACE)
656 eglDestroySurface(gw->egl_disp, gw->egl_surface[0]);
657 gw->egl_surface[0] = EGL_NO_SURFACE;
658 _evas_gl_x11_window = NULL;
663 glXDestroyWindow(gw->disp, gw->glxwin);
673 eng_window_resurf(Evas_GL_X11_Window *gw)
675 if (gw->surf) return;
676 if (getenv("EVAS_GL_INFO"))
677 printf("resurf %p\n", gw);
678 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
679 gw->egl_surface[0] = eglCreateWindowSurface(gw->egl_disp, gw->egl_config,
680 (EGLNativeWindowType)gw->win,
682 if (gw->egl_surface[0] == EGL_NO_SURFACE)
684 ERR("eglCreateWindowSurface() fail for %#x. code=%#x",
685 (unsigned int)gw->win, eglGetError());
688 if (eglMakeCurrent(gw->egl_disp,
691 gw->egl_context[0]) == EGL_FALSE)
693 ERR("eglMakeCurrent() failed!");
698 gw->glxwin = glXCreateWindow(gw->disp, rgba_fbconf, gw->win, NULL);
700 gw->glxwin = glXCreateWindow(gw->disp, fbconf, gw->win, NULL);
701 if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin,
704 ERR("glXMakeContextCurrent(%p, %p, %p, %p)", (void *)gw->disp, (void *)gw->glxwin, (void *)gw->glxwin, (void *)gw->context);
707 if (!glXMakeCurrent(gw->disp, gw->win, gw->context))
709 ERR("glXMakeCurrent(%p, 0x%x, %p) failed", (void *)gw->disp, (unsigned int)gw->win, (void *)gw->context);
717 eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo)
719 if (!einfo) return NULL;
720 if (!einfo->info.display) return NULL;
721 if (!_evas_gl_x11_vi)
726 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
727 for (alpha = 0; alpha < 2; alpha++)
729 int depth = DefaultDepth(einfo->info.display,
733 XVisualInfo *xvi, vi_in;
735 XRenderPictFormat *fmt;
737 vi_in.screen = einfo->info.screen;
739 vi_in.class = TrueColor;
740 xvi = XGetVisualInfo(einfo->info.display,
741 VisualScreenMask | VisualDepthMask |
746 for (i = 0; i < nvi; i++)
748 fmt = XRenderFindVisualFormat(einfo->info.display,
750 if ((fmt->type == PictTypeDirect) &&
751 (fmt->direct.alphaMask))
753 _evas_gl_x11_rgba_vi =
754 calloc(1, sizeof(XVisualInfo));
755 if (_evas_gl_x11_rgba_vi)
756 memcpy(_evas_gl_x11_rgba_vi,
757 &(xvi[i]), sizeof(XVisualInfo));
766 _evas_gl_x11_vi = calloc(1, sizeof(XVisualInfo));
767 XMatchVisualInfo(einfo->info.display,
768 einfo->info.screen, depth, TrueColor,
774 for (alpha = 0; alpha < 2; alpha++)
776 int config_attrs[40];
777 GLXFBConfig *configs = NULL, config = 0;
781 config_attrs[i++] = GLX_DRAWABLE_TYPE;
782 config_attrs[i++] = GLX_WINDOW_BIT;
783 config_attrs[i++] = GLX_DOUBLEBUFFER;
784 config_attrs[i++] = 1;
785 config_attrs[i++] = GLX_RED_SIZE;
786 config_attrs[i++] = 1;
787 config_attrs[i++] = GLX_GREEN_SIZE;
788 config_attrs[i++] =1;
789 config_attrs[i++] = GLX_BLUE_SIZE;
790 config_attrs[i++] = 1;
793 config_attrs[i++] = GLX_RENDER_TYPE;
794 config_attrs[i++] = GLX_RGBA_BIT;
795 config_attrs[i++] = GLX_ALPHA_SIZE;
796 config_attrs[i++] = 1;
800 config_attrs[i++] = GLX_ALPHA_SIZE;
801 config_attrs[i++] = 0;
803 config_attrs[i++] = GLX_DEPTH_SIZE;
804 config_attrs[i++] = 0;
805 config_attrs[i++] = GLX_STENCIL_SIZE;
806 config_attrs[i++] = 0;
807 config_attrs[i++] = GLX_AUX_BUFFERS;
808 config_attrs[i++] = 0;
809 config_attrs[i++] = GLX_STEREO;
810 config_attrs[i++] = 0;
811 config_attrs[i++] = GLX_TRANSPARENT_TYPE;
812 config_attrs[i++] = GLX_NONE;//GLX_NONE;//GLX_TRANSPARENT_INDEX//GLX_TRANSPARENT_RGB;
813 config_attrs[i++] = 0;
815 configs = glXChooseFBConfig(einfo->info.display,
818 if ((!configs) || (num < 1))
820 ERR("glXChooseFBConfig returned no configs");
823 for (i = 0; i < num; i++)
825 XVisualInfo *visinfo;
826 XRenderPictFormat *format = NULL;
828 visinfo = glXGetVisualFromFBConfig(einfo->info.display,
830 if (!visinfo) continue;
834 _evas_gl_x11_vi = malloc(sizeof(XVisualInfo));
835 memcpy(_evas_gl_x11_vi, visinfo, sizeof(XVisualInfo));
842 format = XRenderFindVisualFormat
843 (einfo->info.display, visinfo->visual);
849 if (format->direct.alphaMask > 0)
852 _evas_gl_x11_rgba_vi = malloc(sizeof(XVisualInfo));
853 memcpy(_evas_gl_x11_rgba_vi, visinfo, sizeof(XVisualInfo));
854 rgba_fbconf = config;
864 if (!_evas_gl_x11_vi) return NULL;
865 if (einfo->info.destination_alpha)
868 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
869 if (_evas_gl_x11_rgba_vi) return _evas_gl_x11_rgba_vi->visual;
872 if (_evas_gl_x11_rgba_vi) return _evas_gl_x11_rgba_vi->visual;
876 return _evas_gl_x11_vi->visual;
880 eng_best_colormap_get(Evas_Engine_Info_GL_X11 *einfo)
882 if (!einfo) return 0;
883 if (!einfo->info.display) return 0;
884 if (!_evas_gl_x11_vi) eng_best_visual_get(einfo);
885 if (!_evas_gl_x11_vi) return 0;
886 if (einfo->info.destination_alpha)
888 if (!_evas_gl_x11_rgba_cmap)
889 _evas_gl_x11_rgba_cmap =
890 XCreateColormap(einfo->info.display,
891 RootWindow(einfo->info.display,
893 _evas_gl_x11_rgba_vi->visual,
895 return _evas_gl_x11_rgba_cmap;
897 if (!_evas_gl_x11_cmap)
899 XCreateColormap(einfo->info.display,
900 RootWindow(einfo->info.display,
902 _evas_gl_x11_vi->visual,
904 return _evas_gl_x11_cmap;
908 eng_best_depth_get(Evas_Engine_Info_GL_X11 *einfo)
910 if (!einfo) return 0;
911 if (!einfo->info.display) return 0;
912 if (!_evas_gl_x11_vi) eng_best_visual_get(einfo);
913 if (!_evas_gl_x11_vi) return 0;
914 if (einfo->info.destination_alpha)
916 if (_evas_gl_x11_rgba_vi) return _evas_gl_x11_rgba_vi->depth;
918 return _evas_gl_x11_vi->depth;