xserver: Branch 'master' - 3 commits

Eric Anholt anholt at kemper.freedesktop.org
Fri Apr 21 18:55:54 UTC 2017


 configure.ac            |   65 ------------------------------------------------
 glamor/glamor_xv.c      |    9 ++++--
 glx/glxbyteorder.h      |   40 ++++++++++++++---------------
 include/dix-config.h.in |   15 -----------
 4 files changed, 27 insertions(+), 102 deletions(-)

New commits:
commit 7bfb87a2137853295ecc9e544a15626cfd773a02
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Fri Apr 21 09:05:51 2017 +0200

    glamor: an FBO is not needed for Xv pixmaps
    
    It appears that on some hardware/diver combo such as nv30/nouveau, using
    GL_ALPHA as format for 8-bit depth will cause an incomplete attachment
    error (GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT) when trying to bind the
    texture.
    
    As a result, the FBO is NULL and glamor segfaults when trying to access
    the FBO width/height in pixmap_priv_get_scale() in glamor_xv_render().
    
    This happens with glamor-xv which uses 8-bit pixmaps, meaning that on
    such hardware/driver, trying to play a video using Xv will lead to a
    crash of the Xserver. This affects Xwayland, Xephyr, modesetting driver
    with glamor accel.
    
    But the use of an FBO is not actually needed for glamox-xv, so by
    disabling FBO at pixmap creation, we can avoid the issue entirely.
    
    Fix suggested by Eric Anholt <eric at anholt.net>
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=100710
    Fixes: https://bugzilla.redhat.com/1412814
    Reviewed-by: Eric Anholt <eric at anholt.net>

diff --git a/glamor/glamor_xv.c b/glamor/glamor_xv.c
index 3bcf909b0..31320d124 100644
--- a/glamor/glamor_xv.c
+++ b/glamor/glamor_xv.c
@@ -430,11 +430,14 @@ glamor_xv_put_image(glamor_port_private *port_priv,
                 glamor_destroy_pixmap(port_priv->src_pix[i]);
 
         port_priv->src_pix[0] =
-            glamor_create_pixmap(pScreen, width, height, 8, 0);
+            glamor_create_pixmap(pScreen, width, height, 8,
+                                 GLAMOR_CREATE_FBO_NO_FBO);
         port_priv->src_pix[1] =
-            glamor_create_pixmap(pScreen, width >> 1, height >> 1, 8, 0);
+            glamor_create_pixmap(pScreen, width >> 1, height >> 1, 8,
+                                 GLAMOR_CREATE_FBO_NO_FBO);
         port_priv->src_pix[2] =
-            glamor_create_pixmap(pScreen, width >> 1, height >> 1, 8, 0);
+            glamor_create_pixmap(pScreen, width >> 1, height >> 1, 8,
+                                 GLAMOR_CREATE_FBO_NO_FBO);
         port_priv->src_pix_w = width;
         port_priv->src_pix_h = height;
 
commit be80a3cb48a7860b9ed985b123f4d8a3b4ae3c89
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Mar 27 14:21:43 2017 -0700

    glx: Use the same endian swapping as the rest of the server.
    
    This dumps a ton of configure-time checks for system endian macros.
    Given that we're marking the mixed-endian fixup code as cold, getting
    at the system macros is a waste of code.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index 8881ec34f..07c552094 100644
--- a/configure.ac
+++ b/configure.ac
@@ -147,66 +147,6 @@ fi
 
 AC_TYPE_PID_T
 
-# Checks for headers/macros for byte swapping
-# Known variants:
-#	<byteswap.h> bswap_16, bswap_32, bswap_64  (glibc)
-#	<sys/endian.h> __swap16, __swap32, __swap64 (OpenBSD)
-#	<sys/endian.h> bswap16, bswap32, bswap64 (other BSD's)
-#	and a fallback to local macros if none of the above are found
-
-# if <byteswap.h> is found, assume it's the correct version
-AC_CHECK_HEADERS([byteswap.h])
-
-# if <sys/endian.h> is found, have to check which version
-AC_CHECK_HEADER([sys/endian.h], [HAVE_SYS_ENDIAN_H="yes"], [HAVE_SYS_ENDIAN_H="no"])
-
-if test "x$HAVE_SYS_ENDIAN_H" = "xyes" ; then
-	AC_MSG_CHECKING([for __swap16 variant of <sys/endian.h> byteswapping macros])
-	AC_LINK_IFELSE([AC_LANG_PROGRAM([
-#include <sys/types.h>
-#include <sys/endian.h>
- ], [
-int a = 1, b;
-b = __swap16(a);
- ])
-], [SYS_ENDIAN__SWAP='yes'], [SYS_ENDIAN__SWAP='no'])
-	AC_MSG_RESULT([$SYS_ENDIAN__SWAP])
-
-	AC_MSG_CHECKING([for bswap16 variant of <sys/endian.h> byteswapping macros])
-	AC_LINK_IFELSE([AC_LANG_PROGRAM([
-#include <sys/types.h>
-#include <sys/endian.h>
- ], [
-int a = 1, b;
-b = bswap16(a);
- ])
-], [SYS_ENDIAN_BSWAP='yes'], [SYS_ENDIAN_BSWAP='no'])
-	AC_MSG_RESULT([$SYS_ENDIAN_BSWAP])
-
-    	if test "$SYS_ENDIAN_BSWAP" = "yes" ; then
-		USE_SYS_ENDIAN_H=yes
-		BSWAP=bswap
-	else	
-	    	if test "$SYS_ENDIAN__SWAP" = "yes" ; then
-			USE_SYS_ENDIAN_H=yes
-			BSWAP=__swap
-		else
-			USE_SYS_ENDIAN_H=no
-		fi
-	fi
-
-	if test "$USE_SYS_ENDIAN_H" = "yes" ; then
-	    AC_DEFINE([USE_SYS_ENDIAN_H], 1, 
-		[Define to use byteswap macros from <sys/endian.h>])
-	    AC_DEFINE_UNQUOTED([bswap_16], ${BSWAP}16, 
-			[Define to 16-bit byteswap macro])
-	    AC_DEFINE_UNQUOTED([bswap_32], ${BSWAP}32, 
-			[Define to 32-bit byteswap macro])
-	    AC_DEFINE_UNQUOTED([bswap_64], ${BSWAP}64, 
-			[Define to 64-bit byteswap macro])
-	fi
-fi
-
 dnl Check to see if dlopen is in default libraries (like Solaris, which
 dnl has it in libc), or if libdl is needed to get it.
 AC_CHECK_FUNC([dlopen], [],
diff --git a/glx/glxbyteorder.h b/glx/glxbyteorder.h
index aa88b44b9..5e94e8626 100644
--- a/glx/glxbyteorder.h
+++ b/glx/glxbyteorder.h
@@ -35,27 +35,27 @@
 #include <dix-config.h>
 #endif
 
-#if HAVE_BYTESWAP_H
-#include <byteswap.h>
-#elif defined(USE_SYS_ENDIAN_H)
-#include <sys/endian.h>
-#elif defined(__APPLE__)
-#include <libkern/OSByteOrder.h>
-#define bswap_16 OSSwapInt16
-#define bswap_32 OSSwapInt32
-#define bswap_64 OSSwapInt64
-#else
-#define	bswap_16(value)  \
- 	((((value) & 0xff) << 8) | ((value) >> 8))
+#include "misc.h"
 
-#define	bswap_32(value)	\
- 	(((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | \
- 	(uint32_t)bswap_16((uint16_t)((value) >> 16)))
+static inline uint16_t
+bswap_16(uint16_t val)
+{
+    swap_uint16(&val);
+    return val;
+}
 
-#define	bswap_64(value)	\
- 	(((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) \
- 	    << 32) | \
- 	(uint64_t)bswap_32((uint32_t)((value) >> 32)))
-#endif
+static inline uint32_t
+bswap_32(uint32_t val)
+{
+    swap_uint32(&val);
+    return val;
+}
+
+static inline uint64_t
+bswap_64(uint64_t val)
+{
+    swap_uint64(&val);
+    return val;
+}
 
 #endif                          /* !defined(__GLXBYTEORDER_H__) */
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index a59d441bb..ad1ab20a6 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -63,9 +63,6 @@
 /* Has libunwind support */
 #undef HAVE_LIBUNWIND
 
-/* Define to 1 if you have the <byteswap.h> header file. */
-#undef HAVE_BYTESWAP_H
-
 /* Define to 1 if you have the `cbrt' function. */
 #undef HAVE_CBRT
 
@@ -322,9 +319,6 @@
 /* Support UNIX socket connections */
 #undef UNIXCONN
 
-/* Define to use byteswap macros from <sys/endian.h> */
-#undef USE_SYS_ENDIAN_H
-
 /* unaligned word accesses behave as expected */
 #undef WORKING_UNALIGNED_INT
 
@@ -454,15 +448,6 @@
 /* Define to 1 if the DTrace Xserver provider probes should be built in */
 #undef XSERVER_DTRACE
 
-/* Define to 16-bit byteswap macro */
-#undef bswap_16
-
-/* Define to 32-bit byteswap macro */
-#undef bswap_32
-
-/* Define to 64-bit byteswap macro */
-#undef bswap_64
-
 /* Define to 1 if typeof works with your compiler. */
 #undef HAVE_TYPEOF
 
commit dae97e1bb4d4f86db118c22dfeea0eef0d3f8bdd
Author: Eric Anholt <eric at anholt.net>
Date:   Thu Mar 23 17:06:17 2017 -0700

    configure: Stop checking for XdmcpWrap
    
    As far back as the initial import, it seems to have been exposed, and
    there's no explanation why the test happened in the initial xserver
    import.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index 3bc15a81a..8881ec34f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1500,9 +1500,6 @@ XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
 REQUIRED_MODULES="$REQUIRED_MODULES xkbfile"
 
 PKG_CHECK_MODULES([XDMCP], [xdmcp], [have_libxdmcp="yes"], [have_libxdmcp="no"])
-if test "x$have_libxdmcp" = xyes; then
-	AC_CHECK_LIB(Xdmcp, XdmcpWrap, [have_xdmcpwrap="yes"], [have_xdmcpwrap="no"], [$XDMCP_LIBS])
-fi
 if test "x$XDMCP" = xauto; then
 	if test "x$have_libxdmcp" = xyes; then
 		XDMCP=yes
@@ -1511,7 +1508,7 @@ if test "x$XDMCP" = xauto; then
 	fi
 fi
 if test "x$XDMAUTH" = xauto; then
-	if test "x$have_libxdmcp" = xyes && test "x$have_xdmcpwrap" = xyes; then
+	if test "x$have_libxdmcp" = xyes; then
 		XDMAUTH=yes
 	else
 		XDMAUTH=no


More information about the xorg-commit mailing list