|
|
|
|
1 |
From 849c5a06462e59646ec7dcba40a6dee784862d80 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Jon TURNEY <jon.turney@dronecode.org.uk> |
| 3 |
Date: Thu, 23 Jul 2009 19:28:24 +0100 |
| 4 |
Subject: [PATCH 8/9] Cygwin: Various changes to enable mesa to be built for Cygwin -with-driver=dri -with-dri-driver=swrast rather than -with-driver=x11 |
| 5 |
|
| 6 |
This allows DRI driver to be built with only the swrast driver, and not |
| 7 |
requiring the platform to have DRM support |
| 8 |
|
| 9 |
In configure.ac, no_drm_is_fatal is introduced to try to make behaviour on platforms which |
| 10 |
expect to have DRM available the same as before |
| 11 |
|
| 12 |
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> |
| 13 |
--- |
| 14 |
configure.ac | 51 ++++++++++++++++++++++++++++++++++++++++++++---- |
| 15 |
src/glx/x11/Makefile | 19 +++++++++++++---- |
| 16 |
src/glx/x11/glxcmds.c | 4 ++- |
| 17 |
src/glx/x11/glxext.c | 3 ++ |
| 18 |
src/glx/x11/xf86dri.h | 5 ++++ |
| 19 |
5 files changed, 71 insertions(+), 11 deletions(-) |
| 20 |
|
| 21 |
diff --git a/configure.ac b/configure.ac |
| 22 |
index b10f8b3..2c74e9f 100644 |
| 23 |
--- a/configure.ac |
| 24 |
+++ b/configure.ac |
| 25 |
@@ -538,6 +538,22 @@ else |
| 26 |
enable_xcb=no |
| 27 |
fi |
| 28 |
|
| 29 |
+dnl is DRM expected on the target platform? |
| 30 |
+case "$host_os" in |
| 31 |
+linux*|*-gnu*|gnu*) |
| 32 |
+ no_drm_is_fatal=yes |
| 33 |
+ ;; |
| 34 |
+solaris*) |
| 35 |
+ no_drm_is_fatal=yes |
| 36 |
+ ;; |
| 37 |
+cygwin*) |
| 38 |
+ no_drm_is_fatal=no |
| 39 |
+ ;; |
| 40 |
+darwin* ) |
| 41 |
+ no_drm_is_fatal=no |
| 42 |
+ ;; |
| 43 |
+esac |
| 44 |
+ |
| 45 |
dnl |
| 46 |
dnl libGL configuration per driver |
| 47 |
dnl |
| 48 |
@@ -572,10 +588,18 @@ dri) |
| 49 |
fi |
| 50 |
|
| 51 |
# Check for libdrm |
| 52 |
- PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED]) |
| 53 |
- PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED]) |
| 54 |
- GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED" |
| 55 |
- DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED" |
| 56 |
+ PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED], HAVE_LIBDRM=yes, HAVE_LIBDRM=no) |
| 57 |
+ PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED], HAVE_DRI2PROTO=yes, HAVE_DRI2PROTO=no) |
| 58 |
+ |
| 59 |
+ if test "$HAVE_LIBDRM" = no; then |
| 60 |
+ if test "$no_drm_is_fatal" = yes; then |
| 61 |
+ AC_MSG_ERROR([LIBDRM $LIBDRM_REQUIRED is required by DRI driver]) |
| 62 |
+ fi |
| 63 |
+ LIBDRM_CFLAGS=-DNO_LIBDRM |
| 64 |
+ else |
| 65 |
+ GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED" |
| 66 |
+ DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED" |
| 67 |
+ fi |
| 68 |
|
| 69 |
PKG_CHECK_MODULES([LIBDRM_RADEON], [libdrm_radeon], HAVE_LIBDRM_RADEON=yes, HAVE_LIBDRM_RADEON=no) |
| 70 |
|
| 71 |
@@ -586,8 +610,15 @@ dri) |
| 72 |
|
| 73 |
# find the DRI deps for libGL |
| 74 |
if test "$x11_pkgconfig" = yes; then |
| 75 |
+ dri_modules="x11 xext xdamage xfixes" |
| 76 |
+ |
| 77 |
+ # add xf86vidmode if available |
| 78 |
+ PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no) |
| 79 |
+ if test "$HAVE_XF86VIDMODE" = yes ; then |
| 80 |
+ dri_modules="$dri_modules xxf86vm" |
| 81 |
+ fi |
| 82 |
+ |
| 83 |
# add xcb modules if necessary |
| 84 |
- dri_modules="x11 xext xxf86vm xdamage xfixes" |
| 85 |
if test "$enable_xcb" = yes; then |
| 86 |
dri_modules="$dri_modules x11-xcb xcb-glx" |
| 87 |
fi |
| 88 |
@@ -764,6 +795,16 @@ if test "$mesa_driver" = dri; then |
| 89 |
DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" |
| 90 |
fi |
| 91 |
;; |
| 92 |
+ cygwin*) |
| 93 |
+ DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER" |
| 94 |
+ if test "x$driglx_direct" = xyes; then |
| 95 |
+ DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" |
| 96 |
+ fi |
| 97 |
+ DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING" |
| 98 |
+ if test "x$DRI_DIRS" = "xyes"; then |
| 99 |
+ DRI_DIRS="swrast" |
| 100 |
+ fi |
| 101 |
+ ;; |
| 102 |
esac |
| 103 |
|
| 104 |
# default drivers |
| 105 |
diff --git a/src/glx/x11/Makefile b/src/glx/x11/Makefile |
| 106 |
index 86d84d4..906eb95 100644 |
| 107 |
--- a/src/glx/x11/Makefile |
| 108 |
+++ b/src/glx/x11/Makefile |
| 109 |
@@ -1,9 +1,21 @@ |
| 110 |
TOP = ../../.. |
| 111 |
include $(TOP)/configs/current |
| 112 |
|
| 113 |
-EXTRA_DEFINES = -DXF86VIDMODE -D_REENTRANT -UIN_DRI_DRIVER \ |
| 114 |
+EXTRA_DEFINES = -D_REENTRANT -UIN_DRI_DRIVER \ |
| 115 |
-DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" |
| 116 |
|
| 117 |
+ifdef HAVE_XF86VIDMODE |
| 118 |
+EXTRA_DEFINES = $(EXTRA_DEFINES) -DXF86VIDMODE |
| 119 |
+endif |
| 120 |
+ |
| 121 |
+ifdef HAVE_LIBDRM |
| 122 |
+DRI_SOURCES = \ |
| 123 |
+ dri_glx.c \ |
| 124 |
+ XF86dri.c \ |
| 125 |
+ dri2_glx.c \ |
| 126 |
+ dri2.c |
| 127 |
+endif |
| 128 |
+ |
| 129 |
SOURCES = \ |
| 130 |
glcontextmodes.c \ |
| 131 |
clientattrib.c \ |
| 132 |
@@ -33,11 +45,8 @@ SOURCES = \ |
| 133 |
glx_query.c \ |
| 134 |
drisw_glx.c \ |
| 135 |
dri_common.c \ |
| 136 |
- dri_glx.c \ |
| 137 |
- XF86dri.c \ |
| 138 |
glxhash.c \ |
| 139 |
- dri2_glx.c \ |
| 140 |
- dri2.c |
| 141 |
+ $(DRI_SOURCES) |
| 142 |
|
| 143 |
include $(TOP)/src/mesa/sources.mak |
| 144 |
|
| 145 |
diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c |
| 146 |
index 820d8b9..dddf535 100644 |
| 147 |
--- a/src/glx/x11/glxcmds.c |
| 148 |
+++ b/src/glx/x11/glxcmds.c |
| 149 |
@@ -40,7 +40,9 @@ |
| 150 |
|
| 151 |
#ifdef GLX_DIRECT_RENDERING |
| 152 |
#include <sys/time.h> |
| 153 |
+#ifdef XF86VIDMODE |
| 154 |
#include <X11/extensions/xf86vmode.h> |
| 155 |
+#endif |
| 156 |
#include "xf86dri.h" |
| 157 |
#endif |
| 158 |
|
| 159 |
@@ -2895,7 +2897,7 @@ static const struct name_address_pair GLX_functions[] = { |
| 160 |
GLX_FUNCTION2( glXBindTexImageEXT, __glXBindTexImageEXT ), |
| 161 |
GLX_FUNCTION2( glXReleaseTexImageEXT, __glXReleaseTexImageEXT ), |
| 162 |
|
| 163 |
-#ifdef GLX_DIRECT_RENDERING |
| 164 |
+#if defined(GLX_DIRECT_RENDERING) && !defined(NO_LIBDRM) |
| 165 |
/*** DRI configuration ***/ |
| 166 |
GLX_FUNCTION( glXGetScreenDriver ), |
| 167 |
GLX_FUNCTION( glXGetDriverConfig ), |
| 168 |
diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c |
| 169 |
index fb2dfe4..74af9eb 100644 |
| 170 |
--- a/src/glx/x11/glxext.c |
| 171 |
+++ b/src/glx/x11/glxext.c |
| 172 |
@@ -722,10 +722,13 @@ __glXInitialize(Display * dpy) |
| 173 |
** Note: This _must_ be done before calling any other DRI routines |
| 174 |
** (e.g., those called in AllocAndFetchScreenConfigs). |
| 175 |
*/ |
| 176 |
+#ifndef NO_LIBDRM |
| 177 |
if (glx_direct && glx_accel) { |
| 178 |
dpyPriv->dri2Display = dri2CreateDisplay(dpy); |
| 179 |
dpyPriv->driDisplay = driCreateDisplay(dpy); |
| 180 |
} |
| 181 |
+#endif |
| 182 |
+ |
| 183 |
if (glx_direct) |
| 184 |
dpyPriv->driswDisplay = driswCreateDisplay(dpy); |
| 185 |
#endif |
| 186 |
diff --git a/src/glx/x11/xf86dri.h b/src/glx/x11/xf86dri.h |
| 187 |
index f2d0dd5..a4388aa 100644 |
| 188 |
--- a/src/glx/x11/xf86dri.h |
| 189 |
+++ b/src/glx/x11/xf86dri.h |
| 190 |
@@ -39,7 +39,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 191 |
#define _XF86DRI_H_ |
| 192 |
|
| 193 |
#include <X11/Xfuncproto.h> |
| 194 |
+#ifndef NO_LIBDRM |
| 195 |
#include <xf86drm.h> |
| 196 |
+#else |
| 197 |
+typedef unsigned int drm_handle_t; |
| 198 |
+typedef unsigned int drm_magic_t; |
| 199 |
+#endif |
| 200 |
|
| 201 |
#define X_XF86DRIQueryVersion 0 |
| 202 |
#define X_XF86DRIQueryDirectRenderingCapable 1 |
| 203 |
-- |
| 204 |
1.6.3.2 |
| 205 |
|