summaryrefslogtreecommitdiff
path: root/src/egl
diff options
context:
space:
mode:
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/main/Makefile6
-rw-r--r--src/egl/main/egldisplay.c30
-rw-r--r--src/egl/main/egldisplay.h4
-rw-r--r--src/egl/main/egldriver.c91
-rw-r--r--src/egl/main/egldriver.h4
-rw-r--r--src/egl/main/eglx.c100
-rw-r--r--src/egl/main/eglx.h12
7 files changed, 43 insertions, 204 deletions
diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile
index 15cd1d09c7..c951b070f1 100644
--- a/src/egl/main/Makefile
+++ b/src/egl/main/Makefile
@@ -22,8 +22,7 @@ HEADERS = \
eglmutex.h \
eglscreen.h \
eglstring.h \
- eglsurface.h \
- eglx.h
+ eglsurface.h
SOURCES = \
eglapi.c \
@@ -39,8 +38,7 @@ SOURCES = \
eglmode.c \
eglscreen.c \
eglstring.c \
- eglsurface.c \
- eglx.c
+ eglsurface.c
OBJECTS = $(SOURCES:.c=.o)
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index 9b4227f545..2c271efd67 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -40,6 +40,36 @@ _eglFiniDisplay(void)
/**
+ * 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.
*
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 20651e51ff..c7a41cd588 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -65,6 +65,10 @@ extern void
_eglFiniDisplay(void);
+extern char *
+_eglSplitDisplayString(const char *dpyString, const char **args);
+
+
extern _EGLDisplay *
_eglNewDisplay(NativeDisplayType displayName);
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index a252a9aabb..06e10f6189 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -22,7 +22,6 @@
#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
@@ -38,7 +37,6 @@
/* 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
@@ -61,8 +59,7 @@
}
#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;
@@ -80,57 +77,9 @@
#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 *
@@ -144,42 +93,16 @@ _eglChooseDriver(_EGLDisplay *dpy, char **argsRet)
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;
diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h
index 7fba938085..6c848eb35e 100644
--- a/src/egl/main/egldriver.h
+++ b/src/egl/main/egldriver.h
@@ -29,10 +29,6 @@ extern _EGLDriver *_eglMain(const char *args);
extern const char *
-_eglChooseDRMDriver(int card);
-
-
-extern const char *
_eglPreloadDriver(_EGLDisplay *dpy);
diff --git a/src/egl/main/eglx.c b/src/egl/main/eglx.c
deleted file mode 100644
index 50acc3a24f..0000000000
--- a/src/egl/main/eglx.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/**************************************************************************
- *
- * 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
-}
-
-
diff --git a/src/egl/main/eglx.h b/src/egl/main/eglx.h
deleted file mode 100644
index 4323d55838..0000000000
--- a/src/egl/main/eglx.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef EGLX_INCLUDED
-#define EGLX_INCLUDED
-
-
-#include "egldisplay.h"
-
-
-extern const char *
-_xeglChooseDriver(_EGLDisplay *dpy);
-
-
-#endif /* EGLX_INCLUDED */