xf86-video-intel: 3 commits - configure.ac src/sna/sna_acpi.c src/sna/sna_dri.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Sep 6 15:59:31 PDT 2013


 configure.ac       |  183 +++++++++++++++++++++++++++--------------------------
 src/sna/sna_acpi.c |   58 +++++++++++++---
 src/sna/sna_dri.c  |    8 +-
 3 files changed, 147 insertions(+), 102 deletions(-)

New commits:
commit ea30967245707ca4825de154e589a83dc605dae0
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Sep 6 22:54:48 2013 +0000

    configure: Disable UXA build without DRI2
    
    DRI2 is interwoven into the UXA structs, so simply disable building UXA
    if DRI2 is not available.
    
    Reported-by: Ross Burton <ross at burtonini.com>
    Bugzilla:  https://bugs.freedesktop.org/show_bug.cgi?id=69056
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/configure.ac b/configure.ac
index 8500e43..27a3354 100644
--- a/configure.ac
+++ b/configure.ac
@@ -178,8 +178,9 @@ AC_ARG_WITH(xorg-module-dir,
             [moduledir="$withval"],
             [moduledir="$libdir/xorg/modules"])
 
-AC_ARG_ENABLE(dri, AS_HELP_STRING([--disable-dri],
-                                  [Disable DRI support [[default=auto]]]))
+AC_ARG_ENABLE(dri,
+	      AS_HELP_STRING([--disable-dri],
+			     [Disable DRI support [[default=auto]]]))
 
 AC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc],
                                   [Disable XvMC support [[default=yes]]]),
@@ -326,6 +327,99 @@ fi
 AM_CONDITIONAL(DGA, test "x$DGA" = "xyes")
 AM_CONDITIONAL(XAA, test "x$XAA" = "xyes")
 
+AM_CONDITIONAL(KMS, test "x$KMS" = "xyes")
+if test "x$KMS" = "xyes"; then
+	AC_DEFINE(KMS,1,[Assume KMS support])
+fi
+AM_CONDITIONAL(UMS, test "x$UMS" = "xyes")
+if test "x$UMS" = "xyes"; then
+	AC_DEFINE(UMS,1,[Assume UMS support])
+fi
+
+
+DRI1=no
+if test "x$enable_dri" != "xno" -a "x$UMS" = "xyes"; then
+	PKG_CHECK_MODULES(DRI1, [xf86driproto], [DRI1="yes"], [DRI1="no"])
+        save_CFLAGS="$CFLAGS"
+        save_CPPFLAGS="$CPPFLAGS"
+        CFLAGS="$CFLAGS $XORG_CFLAGS $DRI_CFLAGS $DRM_CFLAGS"
+        CPPFLAGS="$CPPFLAGS $XORG_CFLAGS $DRI_CFLAGS $DRM_CFLAGS"
+        AC_CHECK_HEADERS([dri.h sarea.h dristruct.h], [DRI1="yes"], [DRI1="no"],
+                [/* for dri.h */
+                 #include <xf86str.h>
+                 /* for dristruct.h */
+                 #include <xorg-server.h>
+                 #ifdef HAVE_DRI_H
+                 # include <dri.h>
+                 #endif
+                 #ifdef HAVE_SAREA_H
+                 # include <sarea.h>
+                 #endif
+                ])
+        CFLAGS="$save_CFLAGS $DEBUGFLAGS"
+        CPPFLAGS="$save_CPPFLAGS"
+fi
+
+AC_MSG_CHECKING([whether to include DRI1 support])
+AC_MSG_RESULT([$DRI1])
+
+AM_CONDITIONAL(DRI1, test "x$DRI1" != "xno")
+if test "x$DRI1" != "xno"; then
+        AC_DEFINE(HAVE_DRI1,1,[Enable DRI1 driver support])
+	dri_msg="$dri_msg DRI1"
+else
+        DRI1_CFLAGS=""
+        DRI1_LIBS=""
+
+        if test "x$enable_dri" = "xyes" -a "x$UMS" = "xyes"; then
+                AC_MSG_ERROR([DRI1 requested but prerequisites not found])
+        fi
+fi
+
+DRI2=no
+if test "x$enable_dri" != "xno"; then
+	PKG_CHECK_MODULES(DRI2, [dri2proto >= 2.6], DRI2="yes", DRI2="no")
+	dridriverdir=`$PKG_CONFIG --variable=dridriverdir dri`
+	if test "x$dridriverdir" = "x"; then
+		dridriverdir="$libdir/dri"
+	fi
+	AC_DEFINE_DIR(DRI_DRIVER_PATH, dridriverdir, [Default DRI2 driver path])
+	if test "x$DRI2" != "xno"; then
+		save_CFLAGS=$CFLAGS
+		CFLAGS="$XORG_CFLAGS $DRM_CFLAGS $DRI_CFLAGS $DRI2_CFLAGS"
+		AC_CHECK_HEADERS([dri2.h], DRI2="yes", DRI2="no", [#include <dixstruct.h>])
+		CFLAGS=$save_CFLAGS
+	fi
+fi
+AC_MSG_CHECKING([whether to include DRI2 support])
+AM_CONDITIONAL(DRI2, test "x$DRI2" = "xyes")
+AC_MSG_RESULT([$DRI2])
+if test "x$enable_dri" = "xyes" -a "x$KMS" = "xyes"; then
+	AC_MSG_ERROR([DRI2 requested but prerequisites not found])
+fi
+if test "x$DRI2" != "xno"; then
+        AC_DEFINE(HAVE_DRI2,1,[Enable DRI2 driver support])
+	dri_msg="$dri_msg DRI2"
+else
+	# UXA doesn't build without DRI2 headers, too late to fix
+	UXA=no
+fi
+
+if test "$XVMC" = "yes"; then
+	PKG_CHECK_MODULES(XVMCLIB, [xvmc dri2proto x11], [], [XVMC="no"])
+	PKG_CHECK_MODULES(XCB, [x11-xcb xcb-dri2 xcb-aux], [], [XVMC="no"])
+fi
+AC_MSG_CHECKING([whether to include XvMC support])
+AC_MSG_RESULT([$XVMC])
+AM_CONDITIONAL(XVMC, test "x$XVMC" = "xyes")
+if test "x$XVMC" = "xyes"; then
+	AC_DEFINE(ENABLE_XVMC,1,[Enable XvMC support])
+	xvmc_msg=" yes"
+else
+	xvmc_msg=" no"
+fi
+
+
 AC_ARG_WITH(default-accel,
 	    AS_HELP_STRING([--with-default-accel],
 			   [Select the default acceleration method [default=sna if enabled, otherwise uxa]]),
@@ -446,91 +540,6 @@ AC_SUBST(CLOCK_GETTIME_LIBS)
 
 sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
 
-DRI1=no
-if test "x$enable_dri" != "xno" -a "x$UMS" = "xyes"; then
-	PKG_CHECK_MODULES(DRI1, [xf86driproto], [DRI1="yes"], [DRI1="no"])
-        save_CFLAGS="$CFLAGS"
-        save_CPPFLAGS="$CPPFLAGS"
-        CFLAGS="$CFLAGS $XORG_CFLAGS $DRI_CFLAGS $DRM_CFLAGS"
-        CPPFLAGS="$CPPFLAGS $XORG_CFLAGS $DRI_CFLAGS $DRM_CFLAGS"
-        AC_CHECK_HEADERS([dri.h sarea.h dristruct.h], [DRI1="yes"], [DRI1="no"],
-                [/* for dri.h */
-                 #include <xf86str.h>
-                 /* for dristruct.h */
-                 #include <xorg-server.h>
-                 #ifdef HAVE_DRI_H
-                 # include <dri.h>
-                 #endif
-                 #ifdef HAVE_SAREA_H
-                 # include <sarea.h>
-                 #endif
-                ])
-        CFLAGS="$save_CFLAGS $DEBUGFLAGS"
-        CPPFLAGS="$save_CPPFLAGS"
-fi
-
-AC_MSG_CHECKING([whether to include DRI1 support])
-AC_MSG_RESULT([$DRI1])
-
-AM_CONDITIONAL(DRI1, test "x$DRI1" != "xno")
-if test "x$DRI1" != "xno"; then
-        AC_DEFINE(HAVE_DRI1,1,[Enable DRI1 driver support])
-	dri_msg="$dri_msg DRI1"
-else
-        DRI1_CFLAGS=""
-        DRI1_LIBS=""
-
-        if test "x$enable_dri" = "xyes" -a "x$UMS" = "xyes"; then
-                AC_MSG_ERROR([DRI1 requested but prerequisites not found])
-        fi
-fi
-
-DRI2=no
-if test "x$enable_dri" != "xno"; then
-	PKG_CHECK_MODULES(DRI2, [dri2proto >= 2.6], DRI2="yes", DRI2="no")
-	dridriverdir=`$PKG_CONFIG --variable=dridriverdir dri`
-	if test "x$dridriverdir" = "x"; then
-		dridriverdir="$libdir/dri"
-	fi
-	AC_DEFINE_DIR(DRI_DRIVER_PATH, dridriverdir, [Default DRI2 driver path])
-	if test "x$DRI2" != "xno"; then
-		save_CFLAGS=$CFLAGS
-		CFLAGS="$XORG_CFLAGS $DRM_CFLAGS $DRI_CFLAGS $DRI2_CFLAGS"
-		AC_CHECK_HEADERS([dri2.h], DRI2="yes", DRI2="no", [#include <dixstruct.h>])
-		CFLAGS=$save_CFLAGS
-	fi
-fi
-AC_MSG_CHECKING([whether to include DRI2 support])
-AM_CONDITIONAL(DRI2, test "x$DRI2" = "xyes")
-AC_MSG_RESULT([$DRI2])
-if test "x$DRI2" != "xno"; then
-        AC_DEFINE(HAVE_DRI2,1,[Enable DRI2 driver support])
-	dri_msg="$dri_msg DRI2"
-fi
-
-if test "$XVMC" = "yes"; then
-	PKG_CHECK_MODULES(XVMCLIB, [xvmc dri2proto x11], [], [XVMC="no"])
-	PKG_CHECK_MODULES(XCB, [x11-xcb xcb-dri2 xcb-aux], [], [XVMC="no"])
-fi
-AC_MSG_CHECKING([whether to include XvMC support])
-AC_MSG_RESULT([$XVMC])
-AM_CONDITIONAL(XVMC, test "x$XVMC" = "xyes")
-if test "x$XVMC" = "xyes"; then
-	AC_DEFINE(ENABLE_XVMC,1,[Enable XvMC support])
-	xvmc_msg=" yes"
-else
-	xvmc_msg=" no"
-fi
-
-AM_CONDITIONAL(KMS, test "x$KMS" = "xyes")
-if test "x$KMS" = "xyes"; then
-	AC_DEFINE(KMS,1,[Assume KMS support])
-fi
-AM_CONDITIONAL(UMS, test "x$UMS" = "xyes")
-if test "x$UMS" = "xyes"; then
-	AC_DEFINE(UMS,1,[Assume UMS support])
-fi
-
 AM_CONDITIONAL(DEBUG, test "x$DEBUG" != "xno")
 AM_CONDITIONAL(FULL_DEBUG, test "x$DEBUG" = "xfull")
 if test "x$DEBUG" = "xno"; then
commit 9fdaeec8f2ada82f790dcbd0018215103447a478
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Sep 6 22:50:06 2013 +0100

    sna: Search /sys/class/power_state for the AC adapter
    
    The adapter names are not uniform, so we need to scan the directory and
    find the entry that corresponds to the Mains power supply. However, the
    acpid does continue to report generic ac_adapter events.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_acpi.c b/src/sna/sna_acpi.c
index ff7364c..dcc0287 100644
--- a/src/sna/sna_acpi.c
+++ b/src/sna/sna_acpi.c
@@ -33,6 +33,7 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <unistd.h>
+#include <dirent.h>
 #include <fcntl.h>
 #include <errno.h>
 
@@ -135,22 +136,57 @@ void _sna_acpi_wakeup(struct sna *sna)
 	} while (n);
 }
 
-static int read_state(const char *path)
+static int read_power_state(const char *path)
 {
-	char buf[80];
-	int i, fd;
+	DIR *dir;
+	struct dirent *de;
+	int i = -1;
 
-	fd = open(path, 0);
-	if (fd < 0)
+	DBG(("%s: searching '%s'\n", __FUNCTION__, path));
+
+	dir = opendir(path);
+	if (dir == NULL)
 		return -1;
 
-	i = read(fd, buf, sizeof(buf)-1);
-	if (i > 0) {
-		buf[i] = '\0';
-		i = atoi(buf);
+	while ((de = readdir(dir))) {
+		char buf[1024];
+		int fd;
+
+		if (*de->d_name == '.')
+			continue;
+
+		DBG(("%s: checking '%s'\n", __FUNCTION__, de->d_name));
+
+		snprintf(buf, sizeof(buf), "%s/%s/type", path, de->d_name);
+		fd = open(buf, 0);
+		if (fd < 0)
+			continue;
+
+		i = read(fd, buf, sizeof(buf));
+		buf[i > 0 ? i - 1: 0] = '\0';
+		close(fd);
+
+		DBG(("%s: %s is of type '%s'\n", __FUNCTION__, de->d_name, buf));
+
+		if (strcmp(buf, "Mains"))
+			continue;
+
+		snprintf(buf, sizeof(buf), "%s/%s/online", path, de->d_name);
+		fd = open(buf, 0);
+		if (fd < 0)
+			continue;
+
+		i = read(fd, buf, sizeof(buf));
+		buf[i > 0 ? i - 1: 0] = '\0';
+		if (i > 0)
+			i = atoi(buf);
+		DBG(("%s: %s is online? '%s'\n", __FUNCTION__, de->d_name, buf));
+		close(fd);
+
+		break;
 	}
+	closedir(dir);
 
-	close(fd);
 	return i;
 }
 
@@ -169,7 +205,7 @@ void sna_acpi_init(struct sna *sna)
 	sna->acpi.offset = 0;
 
 	/* Read initial states */
-	if (read_state("/sys/class/power_supply/ACAD/online") == 0) {
+	if (read_power_state("/sys/class/power_supply") == 0) {
 		DBG(("%s: AC adapter is currently offline\n", __FUNCTION__));
 		sna->flags |= SNA_POWERSAVE;
 	}
commit 0485cdfb6dc8e51d57406f633d55f8a8ac1a0208
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Sep 6 20:46:36 2013 +0100

    sna/dri: Only the BackLeft merits special allocation flags
    
    As the BackLeft is the only that couled be flipped, it is the only one
    that may end up as the scanout and so is the only one that should be
    allocated from the scanout cache.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 5870452..f3a5d9c 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -301,15 +301,15 @@ sna_dri_create_buffer(DrawablePtr draw,
 		break;
 
 	case DRI2BufferBackLeft:
+		if (draw->width  == sna->front->drawable.width &&
+		    draw->height == sna->front->drawable.height &&
+		    (sna->flags & SNA_NO_FLIP) == 0)
+			flags |= CREATE_SCANOUT;
 	case DRI2BufferBackRight:
 	case DRI2BufferFrontRight:
 	case DRI2BufferFakeFrontLeft:
 	case DRI2BufferFakeFrontRight:
 		bpp = draw->bitsPerPixel;
-		if (draw->width  == sna->front->drawable.width &&
-		    draw->height == sna->front->drawable.height &&
-		    (sna->flags & SNA_NO_FLIP) == 0)
-			flags |= CREATE_SCANOUT;
 		DBG(("%s: creating back buffer %dx%d, suitable for scanout? %d\n",
 		     __FUNCTION__,
 		     draw->width, draw->height,


More information about the xorg-commit mailing list