summaryrefslogtreecommitdiff
path: root/src/egl
diff options
context:
space:
mode:
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/drivers/glx/egl_glx.c44
-rw-r--r--src/egl/main/Makefile5
-rw-r--r--src/egl/main/eglconfig.c3
3 files changed, 38 insertions, 14 deletions
diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c
index 8ba70ba7a6..155caa413c 100644
--- a/src/egl/drivers/glx/egl_glx.c
+++ b/src/egl/drivers/glx/egl_glx.c
@@ -267,15 +267,17 @@ glx_token_to_visual_class(int visual_type)
return None;
}
}
-static GLboolean
+static int
get_fbconfig_attribs(Display *dpy, GLXFBConfig fbconfig,
struct visual_attribs *attribs)
{
int visual_type;
+ int fbconfig_id;
memset(attribs, 0, sizeof(struct visual_attribs));
- /* We don't use the GLX_FBCONFIG_ID here */
+ glXGetFBConfigAttrib(dpy, fbconfig, GLX_FBCONFIG_ID, &fbconfig_id);
+
glXGetFBConfigAttrib(dpy, fbconfig, GLX_VISUAL_ID, &attribs->id);
#if 0
@@ -294,11 +296,11 @@ get_fbconfig_attribs(Display *dpy, GLXFBConfig fbconfig,
glXGetFBConfigAttrib(dpy, fbconfig, GLX_LEVEL, &attribs->level);
glXGetFBConfigAttrib(dpy, fbconfig, GLX_RENDER_TYPE, &attribs->render_type);
if (!(attribs->render_type & GLX_RGBA_BIT))
- return GL_FALSE;
+ return 0;
glXGetFBConfigAttrib(dpy, fbconfig, GLX_DOUBLEBUFFER, &attribs->doubleBuffer);
if (!attribs->doubleBuffer)
- return GL_FALSE;
+ return 0;
glXGetFBConfigAttrib(dpy, fbconfig, GLX_STEREO, &attribs->stereo);
glXGetFBConfigAttrib(dpy, fbconfig, GLX_AUX_BUFFERS, &attribs->auxBuffers);
@@ -332,7 +334,12 @@ get_fbconfig_attribs(Display *dpy, GLXFBConfig fbconfig,
glXGetFBConfigAttrib(dpy, fbconfig, GLX_CONFIG_CAVEAT, &attribs->visualCaveat);
- return GL_TRUE;
+ if (attribs->id == 0) {
+ attribs->id = fbconfig_id;
+ return EGL_PBUFFER_BIT | EGL_PIXMAP_BIT;
+ }
+
+ return EGL_WINDOW_BIT;
}
#endif
@@ -344,6 +351,7 @@ create_configs(_EGLDisplay *disp, struct GLX_egl_driver *GLX_drv)
int numVisuals;
long mask;
int i;
+ int egl_configs = 1;
struct visual_attribs attribs;
GLX_drv->fbconfigs = NULL;
@@ -359,13 +367,15 @@ create_configs(_EGLDisplay *disp, struct GLX_egl_driver *GLX_drv)
for (i = 0; i < numVisuals; i++) {
struct GLX_egl_config *config;
+ int bit;
- if (!get_fbconfig_attribs(disp->Xdpy, GLX_drv->fbconfigs[i], &attribs))
+ bit = get_fbconfig_attribs(disp->Xdpy, GLX_drv->fbconfigs[i], &attribs);
+ if (!bit)
continue;
config = CALLOC_STRUCT(GLX_egl_config);
- _eglInitConfig(&config->Base, i+1);
+ _eglInitConfig(&config->Base, (i+1));
SET_CONFIG_ATTRIB(&config->Base, EGL_NATIVE_VISUAL_ID, attribs.id);
SET_CONFIG_ATTRIB(&config->Base, EGL_BUFFER_SIZE, attribs.bufferSize);
SET_CONFIG_ATTRIB(&config->Base, EGL_RED_SIZE, attribs.redSize);
@@ -378,8 +388,7 @@ create_configs(_EGLDisplay *disp, struct GLX_egl_driver *GLX_drv)
SET_CONFIG_ATTRIB(&config->Base, EGL_SAMPLE_BUFFERS, attribs.numMultisample);
SET_CONFIG_ATTRIB(&config->Base, EGL_CONFORMANT, all_apis);
SET_CONFIG_ATTRIB(&config->Base, EGL_RENDERABLE_TYPE, all_apis);
- SET_CONFIG_ATTRIB(&config->Base, EGL_SURFACE_TYPE,
- (EGL_WINDOW_BIT | EGL_PBUFFER_BIT | EGL_PIXMAP_BIT));
+ SET_CONFIG_ATTRIB(&config->Base, EGL_SURFACE_TYPE, bit);
/* XXX possibly other things to init... */
@@ -403,7 +412,7 @@ xvisual:
config = CALLOC_STRUCT(GLX_egl_config);
- _eglInitConfig(&config->Base, i+1);
+ _eglInitConfig(&config->Base, (i+1));
SET_CONFIG_ATTRIB(&config->Base, EGL_NATIVE_VISUAL_ID, attribs.id);
SET_CONFIG_ATTRIB(&config->Base, EGL_BUFFER_SIZE, attribs.bufferSize);
SET_CONFIG_ATTRIB(&config->Base, EGL_RED_SIZE, attribs.redSize);
@@ -788,7 +797,20 @@ GLX_eglSwapBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw)
static _EGLProc
GLX_eglGetProcAddress(const char *procname)
{
- return (_EGLProc)glXGetProcAddress((const GLubyte *)procname);
+ /* This is a bit of a hack to get at the gallium/Mesa state tracker
+ * function st_get_proc_address(). This will probably change at
+ * some point.
+ */
+ _EGLProc (*get_proc_addr)(const char *procname);
+ get_proc_addr = dlsym(NULL, "st_get_proc_address");
+ if (get_proc_addr)
+ return get_proc_addr(procname);
+
+ get_proc_addr = glXGetProcAddress((const GLubyte *)procname);
+ if (get_proc_addr)
+ return get_proc_addr(procname);
+
+ return (_EGLProc)dlsym(NULL, procname);
}
diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile
index 89b4a200bc..5ee246dc3f 100644
--- a/src/egl/main/Makefile
+++ b/src/egl/main/Makefile
@@ -46,8 +46,6 @@ OBJECTS = $(SOURCES:.c=.o)
# Undefined for now
LOCAL_CFLAGS = -D_EGL_PLATFORM_X=1
-LIBS = -lX11
-
.c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(LOCAL_CFLAGS) $< -o $@
@@ -63,7 +61,8 @@ library: $(TOP)/$(LIB_DIR)/libEGL.so
$(TOP)/$(LIB_DIR)/libEGL.so: $(OBJECTS)
$(MKLIB) -o EGL -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major 1 -minor 0 \
- -install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS) $(LIBS)
+ -install $(TOP)/$(LIB_DIR) \
+ $(EGL_LIB_DEPS) $(OBJECTS)
install:
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c
index b19988f49a..f2f32585c7 100644
--- a/src/egl/main/eglconfig.c
+++ b/src/egl/main/eglconfig.c
@@ -133,6 +133,9 @@ _eglParseConfigAttribs(_EGLConfig *config, const EGLint *attrib_list)
config->Attrib[i] = EGL_DONT_CARE;
}
+ /* by default choose windows unless otherwise specified */
+ config->Attrib[EGL_SURFACE_TYPE - FIRST_ATTRIB] = EGL_WINDOW_BIT;
+
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
const EGLint attr = attrib_list[i];
if (attr >= EGL_BUFFER_SIZE &&