summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac6
-rw-r--r--src/gallium/state_trackers/egl/x11/glxinit.c4
-rw-r--r--src/gallium/state_trackers/egl/x11/native_dri2.c14
-rw-r--r--src/gallium/state_trackers/egl/x11/x11_screen.c76
-rw-r--r--src/gallium/state_trackers/egl/x11/x11_screen.h26
5 files changed, 84 insertions, 42 deletions
diff --git a/configure.ac b/configure.ac
index 16fd1e43bb8..f66b93c7916 100644
--- a/configure.ac
+++ b/configure.ac
@@ -680,7 +680,7 @@ AC_SUBST([DRI_DRIVER_SEARCH_DIR])
dnl Direct rendering or just indirect rendering
AC_ARG_ENABLE([driglx-direct],
[AS_HELP_STRING([--disable-driglx-direct],
- [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
+ [enable direct rendering in GLX and EGL for DRI @<:@default=enabled@:>@])],
[driglx_direct="$enableval"],
[driglx_direct="yes"])
dnl Which drivers to build - default is chosen by platform
@@ -1292,6 +1292,10 @@ AC_SUBST([EGL_CLIENT_APIS])
if test "x$HAVE_ST_EGL" = xyes; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl"
+ # define GLX_DIRECT_RENDERING even when the driver is not dri
+ if test "x$mesa_driver" != xdri -a "x$driglx_direct" = xyes; then
+ DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
+ fi
fi
if test "x$HAVE_ST_XORG" = xyes; then
diff --git a/src/gallium/state_trackers/egl/x11/glxinit.c b/src/gallium/state_trackers/egl/x11/glxinit.c
index 1ed2afd3458..dd351899e21 100644
--- a/src/gallium/state_trackers/egl/x11/glxinit.c
+++ b/src/gallium/state_trackers/egl/x11/glxinit.c
@@ -16,6 +16,8 @@
#include "glxinit.h"
+#ifdef GLX_DIRECT_RENDERING
+
typedef struct GLXGenericGetString
{
CARD8 reqType;
@@ -680,3 +682,5 @@ __glXInitialize(Display * dpy)
return dpyPriv;
}
+
+#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c
index 1bef59d864f..1be1e42468c 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -38,6 +38,8 @@
#include "native_x11.h"
#include "x11_screen.h"
+#ifdef GLX_DIRECT_RENDERING
+
enum dri2_surface_type {
DRI2_SURFACE_TYPE_WINDOW,
DRI2_SURFACE_TYPE_PIXMAP,
@@ -784,3 +786,15 @@ x11_create_dri2_display(Display *dpy,
return &dri2dpy->base;
}
+
+#else /* GLX_DIRECT_RENDERING */
+
+struct native_display *
+x11_create_dri2_display(Display *dpy,
+ struct native_event_handler *event_handler,
+ void *user_data)
+{
+ return NULL;
+}
+
+#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/gallium/state_trackers/egl/x11/x11_screen.c b/src/gallium/state_trackers/egl/x11/x11_screen.c
index 6bdff26ec08..6a22b30c4d4 100644
--- a/src/gallium/state_trackers/egl/x11/x11_screen.c
+++ b/src/gallium/state_trackers/egl/x11/x11_screen.c
@@ -39,8 +39,10 @@
#include "glxinit.h"
struct x11_screen {
+#ifdef GLX_DIRECT_RENDERING
/* dummy base class */
struct __GLXDRIdisplayRec base;
+#endif
Display *dpy;
int number;
@@ -103,15 +105,19 @@ x11_screen_destroy(struct x11_screen *xscr)
if (xscr->dri_device)
Xfree(xscr->dri_device);
+#ifdef GLX_DIRECT_RENDERING
/* xscr->glx_dpy will be destroyed with the X display */
if (xscr->glx_dpy)
xscr->glx_dpy->dri2Display = NULL;
+#endif
if (xscr->visuals)
XFree(xscr->visuals);
FREE(xscr);
}
+#ifdef GLX_DIRECT_RENDERING
+
static boolean
x11_screen_init_dri2(struct x11_screen *xscr)
{
@@ -133,6 +139,8 @@ x11_screen_init_glx(struct x11_screen *xscr)
return (xscr->glx_dpy != NULL);
}
+#endif /* GLX_DIRECT_RENDERING */
+
/**
* Return true if the screen supports the extension.
*/
@@ -145,12 +153,14 @@ x11_screen_support(struct x11_screen *xscr, enum x11_screen_extension ext)
case X11_SCREEN_EXTENSION_XSHM:
supported = XShmQueryExtension(xscr->dpy);
break;
+#ifdef GLX_DIRECT_RENDERING
case X11_SCREEN_EXTENSION_GLX:
supported = x11_screen_init_glx(xscr);
break;
case X11_SCREEN_EXTENSION_DRI2:
supported = x11_screen_init_dri2(xscr);
break;
+#endif
default:
break;
}
@@ -177,6 +187,39 @@ x11_screen_get_visuals(struct x11_screen *xscr, int *num_visuals)
}
/**
+ * Return the depth of a drawable.
+ *
+ * Unlike other drawable functions, the drawable needs not be a DRI2 drawable.
+ */
+uint
+x11_drawable_get_depth(struct x11_screen *xscr, Drawable drawable)
+{
+ unsigned int depth;
+
+ if (drawable != xscr->last_drawable) {
+ Window root;
+ int x, y;
+ unsigned int w, h, border;
+ Status ok;
+
+ ok = XGetGeometry(xscr->dpy, drawable, &root,
+ &x, &y, &w, &h, &border, &depth);
+ if (!ok)
+ depth = 0;
+
+ xscr->last_drawable = drawable;
+ xscr->last_depth = depth;
+ }
+ else {
+ depth = xscr->last_depth;
+ }
+
+ return depth;
+}
+
+#ifdef GLX_DIRECT_RENDERING
+
+/**
* Return the GLX fbconfigs.
*/
const __GLcontextModes *
@@ -335,37 +378,6 @@ x11_drawable_get_buffers(struct x11_screen *xscr, Drawable drawable,
}
/**
- * Return the depth of a drawable.
- *
- * Unlike other drawable functions, the drawable needs not be a DRI2 drawable.
- */
-uint
-x11_drawable_get_depth(struct x11_screen *xscr, Drawable drawable)
-{
- unsigned int depth;
-
- if (drawable != xscr->last_drawable) {
- Window root;
- int x, y;
- unsigned int w, h, border;
- Status ok;
-
- ok = XGetGeometry(xscr->dpy, drawable, &root,
- &x, &y, &w, &h, &border, &depth);
- if (!ok)
- depth = 0;
-
- xscr->last_drawable = drawable;
- xscr->last_depth = depth;
- }
- else {
- depth = xscr->last_depth;
- }
-
- return depth;
-}
-
-/**
* Create a mode list of the given size.
*/
__GLcontextModes *
@@ -432,3 +444,5 @@ dri2InvalidateBuffers(Display *dpy, XID drawable)
xscr->dri_invalidate_buffers(xscr, drawable, xscr->dri_user_data);
}
+
+#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/gallium/state_trackers/egl/x11/x11_screen.h b/src/gallium/state_trackers/egl/x11/x11_screen.h
index a3c5ee1491e..bc0ef69ec66 100644
--- a/src/gallium/state_trackers/egl/x11/x11_screen.h
+++ b/src/gallium/state_trackers/egl/x11/x11_screen.h
@@ -67,20 +67,18 @@ x11_screen_support(struct x11_screen *xscr, enum x11_screen_extension ext);
const XVisualInfo *
x11_screen_get_visuals(struct x11_screen *xscr, int *num_visuals);
+uint
+x11_drawable_get_depth(struct x11_screen *xscr, Drawable drawable);
+
+#ifdef GLX_DIRECT_RENDERING
+
+/* GLX */
const __GLcontextModes *
x11_screen_get_glx_configs(struct x11_screen *xscr);
const __GLcontextModes *
x11_screen_get_glx_visuals(struct x11_screen *xscr);
-const char *
-x11_screen_probe_dri2(struct x11_screen *xscr, int *major, int *minor);
-
-int
-x11_screen_enable_dri2(struct x11_screen *xscr,
- x11_drawable_invalidate_buffers invalidate_buffers,
- void *user_data);
-
__GLcontextModes *
x11_context_modes_create(unsigned count);
@@ -90,6 +88,15 @@ x11_context_modes_destroy(__GLcontextModes *modes);
unsigned
x11_context_modes_count(const __GLcontextModes *modes);
+/* DRI2 */
+const char *
+x11_screen_probe_dri2(struct x11_screen *xscr, int *major, int *minor);
+
+int
+x11_screen_enable_dri2(struct x11_screen *xscr,
+ x11_drawable_invalidate_buffers invalidate_buffers,
+ void *user_data);
+
void
x11_drawable_enable_dri2(struct x11_screen *xscr,
Drawable drawable, boolean on);
@@ -104,7 +111,6 @@ x11_drawable_get_buffers(struct x11_screen *xscr, Drawable drawable,
int *width, int *height, unsigned int *attachments,
boolean with_format, int num_ins, int *num_outs);
-uint
-x11_drawable_get_depth(struct x11_screen *xscr, Drawable drawable);
+#endif /* GLX_DIRECT_RENDERING */
#endif /* _X11_SCREEN_H_ */