diff options
author | Chia-I Wu <[email protected]> | 2010-01-22 14:15:14 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2010-01-22 15:03:45 +0800 |
commit | 18b63b55d5626dec86e3470bdf8c9996faf28384 (patch) | |
tree | 188683252fd9c466de6545ba3dc172beabbc5d8c /src/egl/drivers/xdri/driinit.c | |
parent | caa75a7ce07e4a5d89b0d7cf8823fe02034c1b3b (diff) |
egl_xdri: Add support for DRISW.
Try DRISW if both DRI2 and DRI fail. It can also be forced by setting
EGL_SOFTWARE. When DRISW is used, single-buffered modes are ignored.
Diffstat (limited to 'src/egl/drivers/xdri/driinit.c')
-rw-r--r-- | src/egl/drivers/xdri/driinit.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/egl/drivers/xdri/driinit.c b/src/egl/drivers/xdri/driinit.c index 12da1bcd248..3e54f0bd4d8 100644 --- a/src/egl/drivers/xdri/driinit.c +++ b/src/egl/drivers/xdri/driinit.c @@ -2,6 +2,7 @@ * DRI initialization. The DRI loaders are defined in src/glx/x11/. */ +#include <stdlib.h> #include <sys/time.h> #include "glxclient.h" @@ -42,18 +43,26 @@ __glXEnableDirectExtension(__GLXscreenConfigs * psc, const char *name) _X_HIDDEN __GLXDRIdisplay * __driCreateDisplay(__GLXdisplayPrivate *dpyPriv, int *version) { - __GLXDRIdisplay *driDisplay; + __GLXDRIdisplay *driDisplay = NULL; int ver = 0; + char *env; + int force_sw; + + env = getenv("EGL_SOFTWARE"); + force_sw = (env && *env != '0'); /* try DRI2 first */ - driDisplay = dri2CreateDisplay(dpyPriv->dpy); - if (driDisplay) { - /* fill in the required field */ - dpyPriv->dri2Display = driDisplay; - ver = 2; + if (!force_sw) { + driDisplay = dri2CreateDisplay(dpyPriv->dpy); + if (driDisplay) { + /* fill in the required field */ + dpyPriv->dri2Display = driDisplay; + ver = 2; + } } - else { - /* try DRI */ + + /* and then DRI */ + if (!force_sw && !driDisplay) { driDisplay = driCreateDisplay(dpyPriv->dpy); if (driDisplay) { dpyPriv->driDisplay = driDisplay; @@ -61,6 +70,15 @@ __driCreateDisplay(__GLXdisplayPrivate *dpyPriv, int *version) } } + /* and then DRISW */ + if (!driDisplay) { + driDisplay = driswCreateDisplay(dpyPriv->dpy); + if (driDisplay) { + dpyPriv->driDisplay = driDisplay; + ver = 0; + } + } + if (version) *version = ver; return driDisplay; |