# Library dependencies
#EXTRA_LIB_PATH ?=
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread
-EGL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -ldl -lpthread
+EGL_LIB_DEPS = $(EXTRA_LIB_PATH) -ldl -lpthread
OSMESA_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
GLU_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm
GLUT_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXmu -lXi -lm
eglmutex.h \
eglscreen.h \
eglstring.h \
- eglsurface.h \
- eglx.h
+ eglsurface.h
SOURCES = \
eglapi.c \
eglmode.c \
eglscreen.c \
eglstring.c \
- eglsurface.c \
- eglx.c
+ eglsurface.c
OBJECTS = $(SOURCES:.c=.o)
}
+/**
+ * If the first character is '!' we interpret it as specific driver name
+ * (i.e. "!r200" or "!i830"). Whatever follows ':' is interpreted as
+ * arguments.
+ *
+ * The caller may free() the returned driver name.
+ */
+char *
+_eglSplitDisplayString(const char *dpyString, const char **args)
+{
+ char *drv, *p;
+
+ if (!dpyString || dpyString[0] != '!')
+ return NULL;
+ drv = _eglstrdup(dpyString + 1);
+ if (!drv)
+ return NULL;
+
+ p = strchr(dpyString, ':');
+ if (p) {
+ drv[p - dpyString] = '\0';
+ p++;
+ }
+ if (args)
+ *args = p;
+
+ return drv;
+}
+
+
/**
* Allocate a new _EGLDisplay object for the given nativeDisplay handle.
* We'll also try to determine the device driver name at this time.
_eglFiniDisplay(void);
+extern char *
+_eglSplitDisplayString(const char *dpyString, const char **args);
+
+
extern _EGLDisplay *
_eglNewDisplay(NativeDisplayType displayName);
#if defined(_EGL_PLATFORM_X)
#include <dlfcn.h>
-#include "eglx.h"
#elif defined(_EGL_PLATFORM_WINDOWS)
/* Use static linking on Windows for now */
#define WINDOWS_STATIC_LINK
/* XXX Need to decide how to do dynamic name lookup on Windows */
static const char *DefaultDriverName = "TBD";
#endif
- static const char *SysFS = NULL;
typedef HMODULE lib_handle;
static HMODULE
}
#elif defined(_EGL_PLATFORM_X)
- static const char *DefaultDriverName = ":0";
- static const char *SysFS = "/sys/class";
+ static const char *DefaultDriverName = "egl_softpipe";
typedef void * lib_handle;
#endif
-/**
- * Given a card number, use sysfs to determine the DRI driver name.
- */
-const char *
-_eglChooseDRMDriver(int card)
-{
-#if 0
- return _eglstrdup("libEGLdri");
-#else
- char path[2000], driverName[2000];
- FILE *f;
- int length;
-
- snprintf(path, sizeof(path), "%s/drm/card%d/dri_library_name", SysFS, card);
-
- f = fopen(path, "r");
- if (!f)
- return NULL;
-
- fgets(driverName, sizeof(driverName), f);
- fclose(f);
-
- if ((length = strlen(driverName)) > 1) {
- /* remove the trailing newline from sysfs */
- driverName[length - 1] = '\0';
- strncat(driverName, "_dri", sizeof(driverName));
- return _eglstrdup(driverName);
- }
- else {
- return NULL;
- }
-#endif
-}
-
/**
- * XXX this function is totally subject change!!!
- *
- *
- * Determine/return the path of the driver to use for the given native display.
- *
- * Try to be clever and determine if nativeDisplay is an Xlib Display
- * ptr or a string (naming a driver or screen number, etc).
- *
- * If the first character is ':' we interpret it as a screen or card index
- * number (i.e. ":0" or ":1", etc)
- * Else if the first character is '!' we interpret it as specific driver name
- * (i.e. "!r200" or "!i830".
- *
- * Whatever follows ':' is interpreted as arguments.
- *
+ * Choose a driver for a given display.
* The caller may free() the returned strings.
*/
static char *
path = _eglstrdup(path);
#if defined(_EGL_PLATFORM_X)
- (void) DefaultDriverName;
-
if (!path && dpy->NativeDisplay) {
- const char *dpyString = (const char *) dpy->NativeDisplay;
- char *p;
- /* parse the display string */
- if (dpyString[0] == '!' || dpyString[0] == ':') {
- if (dpyString[0] == '!') {
- path = _eglstrdup(dpyString);
- p = strchr(path, ':');
- if (p)
- *p++ = '\0';
- } else {
- p = strchr(dpyString, ':');
- if (p)
- p++;
- }
-
- if (p) {
- if (!path && p[0] >= '0' && p[0] <= '9' && !p[1]) {
- int card = atoi(p);
- path = (char *) _eglChooseDRMDriver(card);
- }
- args = p;
- }
- }
- else {
- path = (char *) _xeglChooseDriver(dpy);
- }
+ /* assume (wrongly!) that the native display is a display string */
+ path = _eglSplitDisplayString((const char *) dpy->NativeDisplay, &args);
}
-#elif defined(_EGL_PLATFORM_WINDOWS)
+#endif /* _EGL_PLATFORM_X */
+
if (!path)
path = _eglstrdup(DefaultDriverName);
-#endif /* _EGL_PLATFORM_X */
- if (path && argsRet)
+ if (argsRet)
*argsRet = (args) ? _eglstrdup(args) : NULL;
return path;
extern _EGLDriver *_eglMain(const char *args);
-extern const char *
-_eglChooseDRMDriver(int card);
-
-
extern const char *
_eglPreloadDriver(_EGLDisplay *dpy);
+++ /dev/null
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-/**
- * X-specific EGL code.
- *
- * Any glue code needed to make EGL work with X is placed in this file.
- */
-
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <X11/Xlib.h>
-
-#include "egldriver.h"
-#include "egllog.h"
-#include "eglstring.h"
-#include "eglx.h"
-
-
-static const char *DefaultGLXDriver = "egl_glx";
-static const char *DefaultSoftDriver = "egl_softpipe";
-
-
-/**
- * Given an X Display ptr (at dpy->Xdpy) try to determine the appropriate
- * device driver. Return its name.
- *
- * This boils down to whether to use the egl_glx.so driver which will
- * load a DRI driver or the egl_softpipe.so driver that'll do software
- * rendering on Xlib.
- */
-const char *
-_xeglChooseDriver(_EGLDisplay *dpy)
-{
-#ifdef _EGL_PLATFORM_X
- _XPrivDisplay xdpy;
- int screen;
- const char *driverName;
-
- assert(dpy);
-
- if (!dpy->Xdpy) {
- dpy->Xdpy = XOpenDisplay(NULL);
- if (!dpy->Xdpy) {
- /* can't open X display -> can't use X-based driver */
- return NULL;
- }
- }
- xdpy = (_XPrivDisplay) dpy->Xdpy;
-
- assert(dpy->Xdpy);
-
- screen = DefaultScreen(dpy->Xdpy);
-
- /* See if we can choose a DRI/DRM driver */
- driverName = _eglChooseDRMDriver(screen);
- if (driverName) {
- free((void *) driverName);
- driverName = _eglstrdup(DefaultGLXDriver);
- }
- else {
- driverName = _eglstrdup(DefaultSoftDriver);
- }
-
- _eglLog(_EGL_DEBUG, "_xeglChooseDriver: %s", driverName);
-
- return driverName;
-#else
- return NULL;
-#endif
-}
-
-
+++ /dev/null
-#ifndef EGLX_INCLUDED
-#define EGLX_INCLUDED
-
-
-#include "egldisplay.h"
-
-
-extern const char *
-_xeglChooseDriver(_EGLDisplay *dpy);
-
-
-#endif /* EGLX_INCLUDED */