#include "evas_engine.h"
-#define MAXSCRN 16
-
static Evas_GL_X11_Window *_evas_gl_x11_window = NULL;
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
-static EGLContext context [MAXSCRN] = {EGL_NO_CONTEXT};
+static EGLContext context = EGL_NO_CONTEXT;
#else
// FIXME: this will only work for 1 display connection (glx land can have > 1)
-static GLXContext context [MAXSCRN] = {0};
-static GLXContext rgba_context [MAXSCRN] = {0};
-static GLXFBConfig fbconf [MAXSCRN] = {0};
-static GLXFBConfig rgba_fbconf [MAXSCRN] = {0};
+static GLXContext context = 0;
+static GLXContext rgba_context = 0;
+static GLXFBConfig fbconf = 0;
+static GLXFBConfig rgba_fbconf = 0;
#endif
// fixme: something is up/wrong here - dont know what tho...
-//#define NEWGL 1
+// #define NEWGL 1
-static XVisualInfo *_evas_gl_x11_vi [MAXSCRN] = {NULL};
-static XVisualInfo *_evas_gl_x11_rgba_vi [MAXSCRN] = {NULL};
-static Colormap _evas_gl_x11_cmap [MAXSCRN] = {0};
-static Colormap _evas_gl_x11_rgba_cmap [MAXSCRN] = {0};
+static XVisualInfo *_evas_gl_x11_vi = NULL;
+static XVisualInfo *_evas_gl_x11_rgba_vi = NULL;
+static Colormap _evas_gl_x11_cmap = 0;
+static Colormap _evas_gl_x11_rgba_cmap = 0;
static int win_count = 0;
XVisualInfo *vi_use;
const GLubyte *vendor, *renderer, *version;
- if (screen >= MAXSCRN)
- {
- ERR("Screen #%i beyond the maximum # of supported screens (%i)",
- screen, MAXSCRN);
- return NULL;
- }
-
- if (!_evas_gl_x11_vi[screen]) return NULL;
+ if (!_evas_gl_x11_vi) return NULL;
gw = calloc(1, sizeof(Evas_GL_X11_Window));
if (!gw) return NULL;
gw->h = h;
gw->rot = rot;
- vi_use = _evas_gl_x11_vi[gw->screen];
+ vi_use = _evas_gl_x11_vi;
if (gw->alpha)
{
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
}
#else
#ifdef NEWGL
-/*
if (_evas_gl_x11_rgba_vi)
{
vi_use = _evas_gl_x11_rgba_vi;
}
- */
#endif
#endif
}
gw->visualinfo = vi_use;
-#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
// EGL / GLES
+#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
context_attrs[0] = EGL_CONTEXT_CLIENT_VERSION;
context_attrs[1] = 2;
context_attrs[2] = EGL_NONE;
eng_window_free(gw);
return NULL;
}
- if (context[gw->screen] == EGL_NO_CONTEXT)
- context[gw->screen] = eglCreateContext(gw->egl_disp, gw->egl_config,
- NULL, context_attrs);
- gw->egl_context[0] = context[gw->screen];
+ if (context == EGL_NO_CONTEXT)
+ context = eglCreateContext(gw->egl_disp, gw->egl_config, NULL,
+ context_attrs);
+ gw->egl_context[0] = context;
if (gw->egl_context[0] == EGL_NO_CONTEXT)
{
ERR("eglCreateContext() fail. code=%#x", eglGetError());
fprintf(stderr, "renderer: %s\n", renderer);
fprintf(stderr, "version: %s\n", version);
}
+// GLX
#else
-// GLX
- if (!context[gw->screen])
+ if (!context)
{
#ifdef NEWGL
-/*
if (indirect)
- context[gw->screen] = glXCreateNewContext(gw->disp, fbconf[gw->screen],
+ context = glXCreateNewContext(gw->disp, fbconf,
GLX_RGBA_TYPE, NULL,
GL_TRUE);
else
- context[gw->screen] = glXCreateNewContext(gw->disp, fbconf[gw->screen],
+ context = glXCreateNewContext(gw->disp, fbconf,
GLX_RGBA_TYPE, NULL,
GL_FALSE);
- */
#else
if (indirect)
- context[gw->screen] = glXCreateContext(gw->disp, gw->visualinfo, NULL, GL_FALSE);
+ context = glXCreateContext(gw->disp, gw->visualinfo, NULL, GL_FALSE);
else
- context[gw->screen] = glXCreateContext(gw->disp, gw->visualinfo, NULL, GL_TRUE);
+ context = glXCreateContext(gw->disp, gw->visualinfo, NULL, GL_TRUE);
#endif
}
#ifdef NEWGL
-/*
- if ((gw->alpha) && (!rgba_context[gw->screen]))
+ if ((gw->alpha) && (!rgba_context))
{
if (indirect)
- rgba_context[gw->screen] = glXCreateNewContext(gw->disp, rgba_fbconf[gw->screen],
- GLX_RGBA_TYPE, context[gw->screen],
+ rgba_context = glXCreateNewContext(gw->disp, rgba_fbconf,
+ GLX_RGBA_TYPE, context,
GL_TRUE);
else
- rgba_context[gw->screen] = glXCreateNewContext(gw->disp, rgba_fbconf[gw->screen],
- GLX_RGBA_TYPE, context[gw->screen],
+ rgba_context = glXCreateNewContext(gw->disp, rgba_fbconf,
+ GLX_RGBA_TYPE, context,
GL_FALSE);
}
if (gw->alpha)
- gw->glxwin = glXCreateWindow(gw->disp, rgba_fbconf[gw->screen], gw->win, NULL);
+ gw->glxwin = glXCreateWindow(gw->disp, rgba_fbconf, gw->win, NULL);
else
- gw->glxwin = glXCreateWindow(gw->disp, fbconf[gw->screen], gw->win, NULL);
+ gw->glxwin = glXCreateWindow(gw->disp, fbconf, gw->win, NULL);
if (!gw->glxwin)
{
eng_window_free(gw);
return NULL;
}
- if (gw->alpha) gw->context = rgba_context[gw->screen];
- else gw->context = context[gw->screen];
- */
+ if (gw->alpha) gw->context = rgba_context;
+ else gw->context = context;
#else
- gw->context = context[gw->screen];
+ gw->context = context;
#endif
if (!gw->context)
eglDestroySurface(gw->egl_disp, gw->egl_surface[0]);
if (ref == 0)
{
- if (context[gw->screen]) eglDestroyContext(gw->egl_disp, context[gw->screen]);
+ if (context) eglDestroyContext(gw->egl_disp, context);
eglTerminate(gw->egl_disp);
- context[gw->screen] = EGL_NO_CONTEXT;
+ context = EGL_NO_CONTEXT;
}
eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
#else
if (gw->glxwin) glXDestroyWindow(gw->disp, gw->glxwin);
if (ref == 0)
{
- if (context[gw->screen]) glXDestroyContext(gw->disp, context[gw->screen]);
- if (rgba_context[gw->screen]) glXDestroyContext(gw->disp, rgba_context[gw->screen]);
- context[gw->screen] = 0;
- rgba_context[gw->screen] = 0;
- fbconf[gw->screen] = 0;
- rgba_fbconf[gw->screen] = 0;
+ if (context) glXDestroyContext(gw->disp, context);
+ if (rgba_context) glXDestroyContext(gw->disp, rgba_context);
+ context = 0;
+ rgba_context = 0;
+ fbconf = 0;
+ rgba_fbconf = 0;
}
#endif
free(gw);
{
if (!einfo) return NULL;
if (!einfo->info.display) return NULL;
- if (!_evas_gl_x11_vi[einfo->info.screen])
+ if (!_evas_gl_x11_vi)
{
int alpha;
}
else
{
- _evas_gl_x11_vi[einfo->info.screen] = calloc(1, sizeof(XVisualInfo));
+ _evas_gl_x11_vi = calloc(1, sizeof(XVisualInfo));
XMatchVisualInfo(einfo->info.display,
einfo->info.screen, depth, TrueColor,
- _evas_gl_x11_vi[einfo->info.screen]);
+ _evas_gl_x11_vi);
}
}
// GLX
if (!alpha)
{
config = configs[i];
- _evas_gl_x11_vi[einfo->info.screen] = malloc(sizeof(XVisualInfo));
- memcpy(_evas_gl_x11_vi[einfo->info.screen], visinfo, sizeof(XVisualInfo));
- fbconf[einfo->info.screen] = config;
+ _evas_gl_x11_vi = malloc(sizeof(XVisualInfo));
+ memcpy(_evas_gl_x11_vi, visinfo, sizeof(XVisualInfo));
+ fbconf = config;
XFree(visinfo);
break;
}
if (format->direct.alphaMask > 0)
{
config = configs[i];
- _evas_gl_x11_rgba_vi[einfo->info.screen] = malloc(sizeof(XVisualInfo));
- memcpy(_evas_gl_x11_rgba_vi[einfo->info.screen], visinfo, sizeof(XVisualInfo));
- rgba_fbconf[einfo->info.screen] = config;
+ _evas_gl_x11_rgba_vi = malloc(sizeof(XVisualInfo));
+ memcpy(_evas_gl_x11_rgba_vi, visinfo, sizeof(XVisualInfo));
+ rgba_fbconf = config;
XFree(visinfo);
break;
}
}
#endif
}
- if (!_evas_gl_x11_vi[einfo->info.screen]) return NULL;
+ if (!_evas_gl_x11_vi) return NULL;
if (einfo->info.destination_alpha)
{
// EGL / GLES
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
- if (_evas_gl_x11_rgba_vi[einfo->info.screen])
- return _evas_gl_x11_rgba_vi[einfo->info.screen]->visual;
+ if (_evas_gl_x11_rgba_vi) return _evas_gl_x11_rgba_vi->visual;
#else
# ifdef NEWGL
- if (_evas_gl_x11_rgba_vi[einfo->info.screen])
- return _evas_gl_x11_rgba_vi[einfo->info.screen]->visual;
+ if (_evas_gl_x11_rgba_vi) return _evas_gl_x11_rgba_vi->visual;
# endif
#endif
}
- return _evas_gl_x11_vi[einfo->info.screen]->visual;
+ return _evas_gl_x11_vi->visual;
}
Colormap
{
if (!einfo) return 0;
if (!einfo->info.display) return 0;
- if (!_evas_gl_x11_vi[einfo->info.screen]) eng_best_visual_get(einfo);
- if (!_evas_gl_x11_vi[einfo->info.screen]) return 0;
+ if (!_evas_gl_x11_vi) eng_best_visual_get(einfo);
+ if (!_evas_gl_x11_vi) return 0;
if (einfo->info.destination_alpha)
{
- if (!_evas_gl_x11_rgba_cmap[einfo->info.screen])
- _evas_gl_x11_rgba_cmap[einfo->info.screen] =
+ if (!_evas_gl_x11_rgba_cmap)
+ _evas_gl_x11_rgba_cmap =
XCreateColormap(einfo->info.display,
RootWindow(einfo->info.display,
einfo->info.screen),
- _evas_gl_x11_rgba_vi[einfo->info.screen]->visual,
+ _evas_gl_x11_rgba_vi->visual,
0);
- return _evas_gl_x11_rgba_cmap[einfo->info.screen];
+ return _evas_gl_x11_rgba_cmap;
}
- if (!_evas_gl_x11_cmap[einfo->info.screen])
- _evas_gl_x11_cmap[einfo->info.screen] =
+ if (!_evas_gl_x11_cmap)
+ _evas_gl_x11_cmap =
XCreateColormap(einfo->info.display,
RootWindow(einfo->info.display,
einfo->info.screen),
- _evas_gl_x11_vi[einfo->info.screen]->visual,
+ _evas_gl_x11_vi->visual,
0);
- return _evas_gl_x11_cmap[einfo->info.screen];
+ return _evas_gl_x11_cmap;
}
int
{
if (!einfo) return 0;
if (!einfo->info.display) return 0;
- if (!_evas_gl_x11_vi[einfo->info.screen]) eng_best_visual_get(einfo);
- if (!_evas_gl_x11_vi[einfo->info.screen]) return 0;
+ if (!_evas_gl_x11_vi) eng_best_visual_get(einfo);
+ if (!_evas_gl_x11_vi) return 0;
if (einfo->info.destination_alpha)
{
- if (_evas_gl_x11_rgba_vi[einfo->info.screen])
- return _evas_gl_x11_rgba_vi[einfo->info.screen]->depth;
+ if (_evas_gl_x11_rgba_vi) return _evas_gl_x11_rgba_vi->depth;
}
- return _evas_gl_x11_vi[einfo->info.screen]->depth;
+ return _evas_gl_x11_vi->depth;
}