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
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
#include "glxinit.h"
struct x11_screen {
+#ifdef GLX_DIRECT_RENDERING
/* dummy base class */
struct __GLXDRIdisplayRec base;
+#endif
Display *dpy;
int number;
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)
{
return (xscr->glx_dpy != NULL);
}
+#endif /* GLX_DIRECT_RENDERING */
+
/**
* Return true if the screen supports the extension.
*/
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;
}
return xscr->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.
*/
return (struct x11_drawable_buffer *) dri2bufs;
}
-/**
- * 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.
*/
xscr->dri_invalidate_buffers(xscr, drawable, xscr->dri_user_data);
}
+
+#endif /* GLX_DIRECT_RENDERING */
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);
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);
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_ */