xf86-video-intel: 2 commits - configure.ac src/sna/sna_dri2.c tools/virtual.c

Chris Wilson ickle at kemper.freedesktop.org
Thu Jul 17 23:39:37 PDT 2014


 configure.ac       |   21 +++++++++++++++------
 src/sna/sna_dri2.c |    7 ++++---
 tools/virtual.c    |   22 ++++++++++++++++++++--
 3 files changed, 39 insertions(+), 11 deletions(-)

New commits:
commit 4ae346e7647fd2c01324f1a6d3b37674e858486d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Jul 18 07:31:25 2014 +0100

    configure: Double check xinerama's headers
    
    Having the pkgconfig present doesn't always necessarily imply the
    headers are installed correctly - just fail over gracefully for xinerama
    and intel-virtual-output
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/configure.ac b/configure.ac
index eec9f89..953f09c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -262,13 +262,20 @@ if test "x$shm" != "xyes"; then
 	tools="no"
 fi
 if test "x$tools" != "xno"; then
-	ivo_requires="xinerama xrandr xdamage xfixes xcursor xtst xrender xext x11 pixman-1"
+	ivo_requires="xrandr xdamage xfixes xcursor xtst xrender xext x11 pixman-1"
+	extra_cflags=""
+
+	ignore="xinerama"
+	PKG_CHECK_MODULES(IVO_EXTRA, [$ignore],
+			  [AC_CHECK_HEADERS([X11/extensions/Xinerama.h], [ivo_requires="$ignore $ivo_requires"], [],
+					    [#include <X11/Xlibint.h>
+					     #include <X11/Xproto.h>
+					    ])], [ignore=""])
+
+	ignore="xcb-dri3 xcb-sync x11-xcb xshmfence x11"
+	PKG_CHECK_MODULES(IVO_EXTRA, [$ignore], [ivo_requires="$ivo_requires $ignore"; extra_cflags="-DDRI3"], [ignore=""])
+
 	PKG_CHECK_MODULES(IVO, [$ivo_requires], [ivo="yes"], [ivo="no"])
-	PKG_CHECK_MODULES(IVO_DRI3, [xcb-dri3 xcb-sync x11-xcb xshmfence x11], [ivo_dri3="yes"], [ivo_dri3="no"])
-	if test "x$ivo_dri3" = "xyes"; then
-		IVO_CFLAGS="$IVO_CFLAGS $IVO_DRI3_CFLAGS -DDRI3"
-		IVO_LIBS="$IVO_LIBS $IVO_DRI3_LIBS"
-	fi
 	AC_CHECK_HEADER([sys/timerfd.h], [], [ivo="no"])
 	if test "x$ivo" = "xno"; then
 		if test "x$tools" = "xyes"; then
@@ -276,6 +283,8 @@ if test "x$tools" != "xno"; then
 		fi
 		tools="no"
 	fi
+
+	IVO_CFLAGS="$IVO_CFLAGS $extra_cflags"
 fi
 if test "x$tools" != "xno"; then
       tools_msg="$tools_msg intel-virtual-output"
diff --git a/tools/virtual.c b/tools/virtual.c
index 9ed1d03..83b934a 100644
--- a/tools/virtual.c
+++ b/tools/virtual.c
@@ -40,7 +40,10 @@
 #error Failed to find the right header for X11 MIT-SHM protocol definitions
 #endif
 #include <X11/extensions/Xdamage.h>
+#if HAVE_X11_EXTENSIONS_XINERAMA_H
 #include <X11/extensions/Xinerama.h>
+#define USE_XINERAMA
+#endif
 #include <X11/extensions/Xrandr.h>
 #include <X11/extensions/Xrender.h>
 #include <X11/Xcursor/Xcursor.h>
@@ -2263,6 +2266,18 @@ static int clone_init_depth(struct clone *clone)
 	return 0;
 }
 
+#if defined(USE_XINERAMA)
+static int xinerama_active(struct display *display)
+{
+	int active = 0;
+	if (XineramaQueryExtension(display->dpy, &display->xinerama_event, &display->xinerama_error))
+		active = XineramaIsActive(display->dpy);
+	return active;
+}
+#else
+#define xinerama_active(d) 0
+#endif
+
 static int add_display(struct context *ctx, Display *dpy)
 {
 	struct display *display;
@@ -2315,8 +2330,7 @@ static int add_display(struct context *ctx, Display *dpy)
 	     display->rr_event,
 	     display->rr_error));
 
-	if (XineramaQueryExtension(dpy, &display->xinerama_event, &display->xinerama_error))
-		display->xinerama_active = XineramaIsActive(dpy);
+	display->xinerama_active = xinerama_active(display);
 	DBG(X11, ("%s: xinerama_active?=%d, event=%d, error=%d\n",
 	     DisplayString(dpy),
 	     display->xinerama_active,
@@ -2598,6 +2612,7 @@ static int last_display_add_clones__randr(struct context *ctx)
 	return 0;
 }
 
+#if defined(USE_XINERAMA)
 static int last_display_add_clones__xinerama(struct context *ctx)
 {
 	struct display *display = last_display(ctx);
@@ -2672,6 +2687,9 @@ static int last_display_add_clones__xinerama(struct context *ctx)
 	reverse_clone_list(display);
 	return 0;
 }
+#else
+#define last_display_add_clones__xinerama(ctx) -1
+#endif
 
 static int last_display_add_clones__display(struct context *ctx)
 {
commit fac6845820e49dbbea2a625b7bb745d8f9159b56
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Jul 18 07:14:19 2014 +0100

    sna/dri2: Protect compsiteext.h include with build check
    
    We shouldn't include calls to the composite extension if it has not been
    built.
    
    Reported-by: Ben Widawsky <ben at bwidawsk.net>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index 286be66..69496c3 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -48,8 +48,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <xf86drm.h>
 #include <i915_drm.h>
 #include <dri2.h>
-#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,12,99,901,0)
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,12,99,901,0) && defined(COMPOSITE)
 #include <compositeext.h>
+#define CHECK_FOR_COMPOSITOR
 #endif
 
 #define DBG_CAN_FLIP 1
@@ -2425,7 +2426,7 @@ get_current_msc(struct sna *sna, DrawablePtr draw, xf86CrtcPtr crtc)
 	return draw_current_msc(draw, crtc, ret);
 }
 
-#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,12,99,901,0)
+#if defined(CHECK_FOR_COMPOSITOR)
 static Bool find(pointer value, XID id, pointer cdata)
 {
 	return TRUE;
@@ -2450,7 +2451,7 @@ static int use_triple_buffer(struct sna *sna, ClientPtr client, bool async)
 		return FLIP_THROTTLE;
 	}
 
-#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,12,99,901,0)
+#if defined(CHECK_FOR_COMPOSITOR)
 	/* Hack: Disable triple buffering for compositors */
 	{
 		struct sna_client *priv = sna_client(client);


More information about the xorg-commit mailing list