Why do I think I want to be able to do this?
Currently, libGL is built for cygwin using --with-driver=xlibI've written a GLX provider for the Xwin Xserver which uses the native WGL interface, so now indirect GLX can be accelerated.
So now I need a libGL which can make use of this, but the realglx code in the x11 driver which implemented the indirect path has been disabled from building for a while (see commit f440b0d and [1])
I've no idea when it last worked, and even if I could get it working again, I don't really want to be using code I am the only user of :-)
I've done various build tests on linux, which seem to work correctly, but, even if this is the correct approach, this could probably use a review to ensure I haven't broken anything.
[1] http://www.mail-archive.com/mesa3d-dev@lists.sourceforge.net/msg05067.html
>From 129f206d63d355504c58c121346619b58d996e03 Mon Sep 17 00:00:00 2001 From: Jon TURNEY <jon.tur...@dronecode.org.uk> Date: Thu, 23 Jul 2009 19:28:24 +0100 Subject: [PATCH] Cygwin: Enable mesa to be built for Cygwin -with-driver=dri -with-dri-driver=swrast Various changes to enable mesa to be built for Cygwin -with-driver=dri -with-dri-driver=swrast rather than -with-driver=xlib 1) Allow the DRI driver to be built with only the swrast driver, and don't require the platform to have DRM support In configure.ac, no_drm_is_fatal is introduced to try to make behaviour on platforms which expect to have DRM available the same as before, i.e. terminating configure with an error if DRM is not available 2) Code in glx/glxcmds.c which uses the XF86VIDMODE extension is already guarded. Also use that guard to control inclusion of the xf86vmode.h header, and only enable that guard if the XF86VIDMODE extension is found by pkgconfig. This changes the behaviour on platforms which XF86VIDMODE exists, in that XF86VIDMODE used to be mandatory, but is now optional. Signed-off-by: Jon TURNEY <jon.tur...@dronecode.org.uk> --- configs/autoconf.in | 4 +++ configure.ac | 58 ++++++++++++++++++++++++++++++++++++++++++++++---- src/glx/Makefile | 20 +++++++++++++---- src/glx/glxcmds.c | 5 ++- src/glx/glxext.c | 5 ++++ 5 files changed, 80 insertions(+), 12 deletions(-) diff --git a/configs/autoconf.in b/configs/autoconf.in index 3063787..dc1c9cf 100644 --- a/configs/autoconf.in +++ b/configs/autoconf.in @@ -156,3 +156,7 @@ OSMESA_PC_LIB_PRIV = @OSMESA_PC_LIB_PRIV@ EGL_DRI2_CFLAGS = @EGL_DRI2_CFLAGS@ EGL_DRI2_LIBS = @EGL_DRI2_LIBS@ + +# +HAVE_XF86VIDMODE = @HAVE_XF86VIDMODE@ +HAVE_LIBDRM = @HAVE_LIBDRM@ diff --git a/configure.ac b/configure.ac index 5c75446..49db17c 100644 --- a/configure.ac +++ b/configure.ac @@ -571,6 +571,22 @@ else enable_xcb=no fi +dnl is DRM expected on the target platform? +case "$host_os" in +linux*|*-gnu*|gnu*) + no_drm_is_fatal=yes + ;; +solaris*) + no_drm_is_fatal=yes + ;; +cygwin*) + no_drm_is_fatal=no + ;; +darwin* ) + no_drm_is_fatal=no + ;; +esac + dnl dnl libGL configuration per driver dnl @@ -605,16 +621,35 @@ dri) fi # Check for libdrm - PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED]) - PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED]) + PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED], HAVE_LIBDRM=yes, HAVE_LIBDRM=no) + PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED], HAVE_DRI2PROTO=yes, HAVE_DRI2PROTO=no) PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED]) - GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED glproto >= $GLPROTO_REQUIRED" - DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED" + + if test "$HAVE_LIBDRM" = no; then + if test "$no_drm_is_fatal" = yes; then + AC_MSG_ERROR([LIBDRM $LIBDRM_REQUIRED is required by DRI driver]) + fi + DEFINES="$DEFINES -DNO_LIBDRM" + else + GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED glproto >= $GLPROTO_REQUIRED" + DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED" + fi + + if test "$HAVE_DRI2PROTO" = yes; then + DEFINES="$DEFINES -DHAVE_DRI2PROTO" + fi # find the DRI deps for libGL if test "$x11_pkgconfig" = yes; then + dri_modules="x11 xext xdamage xfixes" + + # add xf86vidmode if available + PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no) + if test "$HAVE_XF86VIDMODE" = yes ; then + dri_modules="$dri_modules xxf86vm" + fi + # add xcb modules if necessary - dri_modules="x11 xext xxf86vm xdamage xfixes" if test "$enable_xcb" = yes; then dri_modules="$dri_modules x11-xcb xcb-glx" fi @@ -654,6 +689,9 @@ AC_SUBST([GL_PC_LIB_PRIV]) AC_SUBST([GL_PC_CFLAGS]) AC_SUBST([DRI_PC_REQ_PRIV]) +AC_SUBST([HAVE_XF86VIDMODE]) +AC_SUBST([HAVE_LIBDRM]) + dnl dnl More X11 setup dnl @@ -790,6 +828,16 @@ if test "$mesa_driver" = dri; then DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" fi ;; + cygwin*) + DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER" + if test "x$driglx_direct" = xyes; then + DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" + fi + DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING" + if test "x$DRI_DIRS" = "xyes"; then + DRI_DIRS="swrast" + fi + ;; esac # default drivers diff --git a/src/glx/Makefile b/src/glx/Makefile index 6711fdc..7f9db95 100644 --- a/src/glx/Makefile +++ b/src/glx/Makefile @@ -1,9 +1,22 @@ TOP = ../.. include $(TOP)/configs/current -EXTRA_DEFINES = -DXF86VIDMODE -D_REENTRANT \ +ifeq ($(HAVE_XF86VIDMODE),yes) +EXTRA_DEFINES_XF86VIDMODE = -DXF86VIDMODE +endif + +EXTRA_DEFINES = $(EXTRA_DEFINES_XF86VIDMODE) -D_REENTRANT \ -DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" + +ifeq ($(HAVE_LIBDRM),yes) +DRI_SOURCES = \ + dri_glx.c \ + XF86dri.c \ + dri2_glx.c \ + dri2.c +endif + SOURCES = \ glcontextmodes.c \ clientattrib.c \ @@ -33,11 +46,8 @@ SOURCES = \ glx_query.c \ drisw_glx.c \ dri_common.c \ - dri_glx.c \ - XF86dri.c \ glxhash.c \ - dri2_glx.c \ - dri2.c + $(DRI_SOURCES) GLAPI_LIB = $(TOP)/src/mesa/libglapi.a diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index 4fbc6b6..23e7b68 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -40,8 +40,9 @@ #ifdef GLX_DIRECT_RENDERING #include <sys/time.h> +#ifdef XF86VIDMODE #include <X11/extensions/xf86vmode.h> -#include "xf86dri.h" +#endif #define GC_IS_DIRECT(gc) ((gc)->driContext != NULL) #else #define GC_IS_DIRECT(gc) (0) @@ -3065,7 +3066,7 @@ static const struct name_address_pair GLX_functions[] = { GLX_FUNCTION2(glXBindTexImageEXT, __glXBindTexImageEXT), GLX_FUNCTION2(glXReleaseTexImageEXT, __glXReleaseTexImageEXT), -#ifdef GLX_DIRECT_RENDERING +#if defined(GLX_DIRECT_RENDERING) && !defined(NO_LIBDRM) /*** DRI configuration ***/ GLX_FUNCTION(glXGetScreenDriver), GLX_FUNCTION(glXGetDriverConfig), diff --git a/src/glx/glxext.c b/src/glx/glxext.c index b5657ba..ee561e1 100644 --- a/src/glx/glxext.c +++ b/src/glx/glxext.c @@ -41,7 +41,9 @@ #include "glxclient.h" #include <X11/extensions/Xext.h> #include <X11/extensions/extutil.h> +#ifdef HAVE_DRI2PROTO #include <X11/extensions/dri2proto.h> +#endif #include "glxextensions.h" #include "glcontextmodes.h" @@ -816,10 +818,13 @@ __glXInitialize(Display * dpy) ** Note: This _must_ be done before calling any other DRI routines ** (e.g., those called in AllocAndFetchScreenConfigs). */ +#ifndef NO_LIBDRM if (glx_direct && glx_accel) { dpyPriv->dri2Display = dri2CreateDisplay(dpy); dpyPriv->driDisplay = driCreateDisplay(dpy); } +#endif + if (glx_direct) dpyPriv->driswDisplay = driswCreateDisplay(dpy); #endif -- 1.6.6.1
------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev
_______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev