summaryrefslogtreecommitdiff
path: root/src/egl/main/egldisplay.c
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2009-08-21 13:53:36 +0800
committerBrian Paul <brianp@vmware.com>2009-08-21 08:34:34 -0600
commit5a459d58fca2b71cb77c39f98df8a81ce6298421 (patch)
tree736e152e0c0da819c13482ccb183806ce2538610 /src/egl/main/egldisplay.c
parent1f871a4d1536a7124d82d4503d1167bd668f84da (diff)
egl: Remove dependency on libX11.
libX11 is used to determine the screen number, which is in turned used to determine the DRI driver. However, the sysfs interface for determining the DRI driver is gone, and no working driver depends on this mechanism. Display string parsing is moved to a new function, _eglSplitDisplayString. Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Diffstat (limited to 'src/egl/main/egldisplay.c')
-rw-r--r--src/egl/main/egldisplay.c30
1 files changed, 30 insertions, 0 deletions
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.
*