Module Name:    xsrc
Committed By:   mrg
Date:           Thu Jul  4 21:47:04 UTC 2024

Modified Files:
        xsrc/external/mit/xorg-server/dist: configure configure.ac
        xsrc/external/mit/xorg-server/dist/Xext: sync.c
        xsrc/external/mit/xorg-server/dist/Xi: xichangehierarchy.c
            xipassivegrab.c xiquerypointer.c xiselectev.c
        xsrc/external/mit/xorg-server/dist/dix: devices.c dispatch.c
            enterleave.c
        xsrc/external/mit/xorg-server/dist/glx: glxcmds.c
        xsrc/external/mit/xorg-server/dist/hw/xfree86/common: xf86Config.c
        xsrc/external/mit/xorg-server/dist/hw/xfree86/modes: xf86Modes.c
        xsrc/external/mit/xorg-server/dist/m4: libtool.m4
        xsrc/external/mit/xorg-server/dist/os: utils.c
        xsrc/external/mit/xorg-server/dist/render: glyph.c glyphstr.h render.c
        xsrc/external/mit/xorg-server/include: dix-config.h version-config.h
            xorg-config.h xorg-server.h

Log Message:
merge xorg-server 21.1.13.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 xsrc/external/mit/xorg-server/dist/configure
cvs rdiff -u -r1.20 -r1.21 xsrc/external/mit/xorg-server/dist/configure.ac
cvs rdiff -u -r1.12 -r1.13 xsrc/external/mit/xorg-server/dist/Xext/sync.c
cvs rdiff -u -r1.6 -r1.7 \
    xsrc/external/mit/xorg-server/dist/Xi/xichangehierarchy.c
cvs rdiff -u -r1.7 -r1.8 \
    xsrc/external/mit/xorg-server/dist/Xi/xipassivegrab.c
cvs rdiff -u -r1.4 -r1.5 \
    xsrc/external/mit/xorg-server/dist/Xi/xiquerypointer.c
cvs rdiff -u -r1.5 -r1.6 xsrc/external/mit/xorg-server/dist/Xi/xiselectev.c
cvs rdiff -u -r1.13 -r1.14 xsrc/external/mit/xorg-server/dist/dix/devices.c
cvs rdiff -u -r1.7 -r1.8 xsrc/external/mit/xorg-server/dist/dix/dispatch.c \
    xsrc/external/mit/xorg-server/dist/dix/enterleave.c
cvs rdiff -u -r1.15 -r1.16 xsrc/external/mit/xorg-server/dist/glx/glxcmds.c
cvs rdiff -u -r1.17 -r1.18 \
    xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Config.c
cvs rdiff -u -r1.2 -r1.3 \
    xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c
cvs rdiff -u -r1.3 -r1.4 xsrc/external/mit/xorg-server/dist/m4/libtool.m4
cvs rdiff -u -r1.13 -r1.14 xsrc/external/mit/xorg-server/dist/os/utils.c
cvs rdiff -u -r1.5 -r1.6 xsrc/external/mit/xorg-server/dist/render/glyph.c
cvs rdiff -u -r1.3 -r1.4 xsrc/external/mit/xorg-server/dist/render/glyphstr.h
cvs rdiff -u -r1.8 -r1.9 xsrc/external/mit/xorg-server/dist/render/render.c
cvs rdiff -u -r1.51 -r1.52 xsrc/external/mit/xorg-server/include/dix-config.h
cvs rdiff -u -r1.21 -r1.22 \
    xsrc/external/mit/xorg-server/include/version-config.h
cvs rdiff -u -r1.31 -r1.32 \
    xsrc/external/mit/xorg-server/include/xorg-config.h \
    xsrc/external/mit/xorg-server/include/xorg-server.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xorg-server/dist/configure
diff -u xsrc/external/mit/xorg-server/dist/configure:1.18 xsrc/external/mit/xorg-server/dist/configure:1.19
--- xsrc/external/mit/xorg-server/dist/configure:1.18	Wed Oct 25 04:35:07 2023
+++ xsrc/external/mit/xorg-server/dist/configure	Thu Jul  4 21:47:02 2024
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for xorg-server 21.1.9.
+# Generated by GNU Autoconf 2.71 for xorg-server 21.1.13.
 #
 # Report bugs to <https://gitlab.freedesktop.org/xorg/xserver/issues>.
 #
@@ -682,8 +682,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='xorg-server'
 PACKAGE_TARNAME='xorg-server'
-PACKAGE_VERSION='21.1.9'
-PACKAGE_STRING='xorg-server 21.1.9'
+PACKAGE_VERSION='21.1.13'
+PACKAGE_STRING='xorg-server 21.1.13'
 PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/xserver/issues'
 PACKAGE_URL=''
 
@@ -2004,7 +2004,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures xorg-server 21.1.9 to adapt to many kinds of systems.
+\`configure' configures xorg-server 21.1.13 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -2075,7 +2075,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of xorg-server 21.1.9:";;
+     short | recursive ) echo "Configuration of xorg-server 21.1.13:";;
    esac
   cat <<\_ACEOF
 
@@ -2260,10 +2260,10 @@ Optional Packages:
                           org.x)
   --with-bundle-version=VERSION
                           Version to use for X11.app's CFBundleVersion
-                          (default: 21.1.9)
+                          (default: 21.1.13)
   --with-bundle-version-string=VERSION
                           Version to use for X11.app's
-                          CFBundleShortVersionString (default: 21.1.9)
+                          CFBundleShortVersionString (default: 21.1.13)
   --with-sparkle-feed-url=URL
                           URL for the Sparkle feed (default:
                           https://www.xquartz.org/releases/sparkle/release.xml)
@@ -2480,7 +2480,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-xorg-server configure 21.1.9
+xorg-server configure 21.1.13
 generated by GNU Autoconf 2.71
 
 Copyright (C) 2021 Free Software Foundation, Inc.
@@ -2684,7 +2684,7 @@ else $as_nop
 #define $2 innocuous_$2
 
 /* System header to define __stub macros and hopefully few prototypes,
-   which can conflict with char $2 (); below.  */
+   which can conflict with char $2 (void); below.  */
 
 #include <limits.h>
 #undef $2
@@ -2695,7 +2695,7 @@ else $as_nop
 #ifdef __cplusplus
 extern "C"
 #endif
-char $2 ();
+char $2 (void);
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
@@ -3137,7 +3137,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by xorg-server $as_me 21.1.9, which was
+It was created by xorg-server $as_me 21.1.13, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   $ $0$ac_configure_args_raw
@@ -3424,9 +3424,7 @@ struct stat;
 /* Most of the following tests are stolen from RCS 5.7 src/conf.sh.  */
 struct buf { int x; };
 struct buf * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
-     char **p;
-     int i;
+static char *e (char **p, int i)
 {
   return p[i];
 }
@@ -3477,6 +3475,7 @@ extern int puts (const char *);
 extern int printf (const char *, ...);
 extern int dprintf (int, const char *, ...);
 extern void *malloc (size_t);
+extern void free (void *);
 
 // Check varargs macros.  These examples are taken from C99 6.10.3.5.
 // dprintf is used instead of fprintf to avoid needing to declare
@@ -3894,7 +3893,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLA
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-RELEASE_DATE="2023-10-25"
+RELEASE_DATE="2024-04-12"
 RELEASE_NAME="Caramel Ice Cream"
 
 
@@ -4412,7 +4411,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='xorg-server'
- VERSION='21.1.9'
+ VERSION='21.1.13'
 
 
 printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -13454,8 +13453,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char umem_alloc ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char umem_alloc (void);
 int
 main (void)
 {
@@ -16507,10 +16512,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*
 	  x86_64-*linux*)
 	    LD="${LD-ld} -m elf_x86_64"
 	    ;;
-	  powerpcle-*linux*)
+	  powerpcle-*linux*|powerpc64le-*linux*)
 	    LD="${LD-ld} -m elf64lppc"
 	    ;;
-	  powerpc-*linux*)
+	  powerpc-*linux*|powerpc64-*linux*)
 	    LD="${LD-ld} -m elf64ppc"
 	    ;;
 	  s390*-*linux*|s390*-*tpf*)
@@ -20836,11 +20841,11 @@ darwin* | rhapsody*)
   version_type=darwin
   need_lib_prefix=no
   need_version=no
-  library_names_spec='$libname$release$major$shared_ext $libname$shared_ext'
+  library_names_spec='$libname$release$versuffix$shared_ext $libname$release$major$shared_ext $libname$shared_ext'
   soname_spec='$libname$release$major$shared_ext'
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+  shrext_cmds='`test .$module = .yes && echo .bundle || echo .dylib`'
 
   sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
   sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
@@ -20866,7 +20871,14 @@ freebsd* | dragonfly* | midnightbsd*)
     *) objformat=elf ;;
     esac
   fi
-  version_type=freebsd-$objformat
+  # Handle Gentoo/FreeBSD as it was Linux
+  case $host_vendor in
+    gentoo)
+      version_type=linux ;;
+    *)
+      version_type=freebsd-$objformat ;;
+  esac
+
   case $version_type in
     freebsd-elf*)
       library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
@@ -20878,6 +20890,12 @@ freebsd* | dragonfly* | midnightbsd*)
       library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
       need_version=yes
       ;;
+    linux)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+      soname_spec='${libname}${release}${shared_ext}$major'
+      need_lib_prefix=no
+      need_version=no
+      ;;
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
@@ -21089,9 +21107,6 @@ fi
   # before this can be enabled.
   hardcode_into_libs=yes
 
-  # Add ABI-specific directories to the system library path.
-  sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib"
-
   # Ideally, we could use ldconfig to report *all* directores which are
   # searched for libraries, however this is still not possible.  Aside from not
   # being certain /sbin/ldconfig is available, command
@@ -21100,7 +21115,7 @@ fi
   # appending ld.so.conf contents (and includes) to the search path.
   if test -f /etc/ld.so.conf; then
     lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
   # We used to test for /lib/ld.so.1 and disable shared libraries on
@@ -21515,8 +21530,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char dlopen ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen (void);
 int
 main (void)
 {
@@ -21577,8 +21598,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char shl_load ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load (void);
 int
 main (void)
 {
@@ -21621,8 +21648,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char dlopen ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen (void);
 int
 main (void)
 {
@@ -21660,8 +21693,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char dlopen ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen (void);
 int
 main (void)
 {
@@ -21699,8 +21738,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char dld_link ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link (void);
 int
 main (void)
 {
@@ -22454,8 +22499,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char yywrap ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char yywrap (void);
 int
 main (void)
 {
@@ -23270,8 +23321,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char opendir ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir (void);
 int
 main (void)
 {
@@ -23330,8 +23387,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char opendir ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir (void);
 int
 main (void)
 {
@@ -23812,22 +23875,23 @@ unsigned short int ascii_mm[] =
 		int use_ebcdic (int i) {
 		  return ebcdic_mm[i] + ebcdic_ii[i];
 		}
-		extern int foo;
-
-int
-main (void)
-{
-return use_ascii (foo) == use_ebcdic (foo);
-  ;
-  return 0;
-}
+		int
+		main (int argc, char **argv)
+		{
+		  /* Intimidate the compiler so that it does not
+		     optimize the arrays away.  */
+		  char *p = argv[0];
+		  ascii_mm[1] = *p++; ebcdic_mm[1] = *p++;
+		  ascii_ii[1] = *p++; ebcdic_ii[1] = *p++;
+		  return use_ascii (argc) == use_ebcdic (*p);
+		}
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"
+if ac_fn_c_try_link "$LINENO"
 then :
-  if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
+  if grep BIGenDianSyS conftest$ac_exeext >/dev/null; then
 	      ac_cv_c_bigendian=yes
 	    fi
-	    if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+	    if grep LiTTleEnDian conftest$ac_exeext >/dev/null ; then
 	      if test "$ac_cv_c_bigendian" = unknown; then
 		ac_cv_c_bigendian=no
 	      else
@@ -23836,7 +23900,8 @@ then :
 	      fi
 	    fi
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+    conftest$ac_exeext conftest.$ac_ext
 else $as_nop
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
@@ -23987,8 +24052,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char dlopen ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen (void);
 int
 main (void)
 {
@@ -24285,8 +24356,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char arc4random_buf ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char arc4random_buf (void);
 int
 main (void)
 {
@@ -24441,8 +24518,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char sqrt ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char sqrt (void);
 int
 main (void)
 {
@@ -24620,8 +24703,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char backtrace ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char backtrace (void);
 int
 main (void)
 {
@@ -25242,7 +25331,7 @@ if test ${with_bundle_version+y}
 then :
   withval=$with_bundle_version;  BUNDLE_VERSION="${withval}"
 else $as_nop
-   BUNDLE_VERSION="21.1.9"
+   BUNDLE_VERSION="21.1.13"
 fi
 
 
@@ -25789,8 +25878,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char socket ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char socket (void);
 int
 main (void)
 {
@@ -25848,8 +25943,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char gethostbyname ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char gethostbyname (void);
 int
 main (void)
 {
@@ -26050,7 +26151,7 @@ fi
 
  fi
  case $host_os in
-	solaris*|sco*|sysv4*)	localdef="yes" ;;
+	solaris*)		localdef="yes" ;;
 	*)			localdef="no"  ;;
  esac
  # Check whether --enable-local-transport was given.
@@ -26133,8 +26234,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char getsecretkey ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char getsecretkey (void);
 int
 main (void)
 {
@@ -26510,8 +26617,14 @@ printf %s "checking for pthread_join in 
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char pthread_join ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char pthread_join (void);
 int
 main (void)
 {
@@ -27697,8 +27810,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char clock_gettime ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char clock_gettime (void);
 int
 main (void)
 {
@@ -28789,8 +28908,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char audit_open ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char audit_open (void);
 int
 main (void)
 {
@@ -29520,8 +29645,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char SHA1Init ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char SHA1Init (void);
 int
 main (void)
 {
@@ -29655,8 +29786,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char nettle_sha1_init ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char nettle_sha1_init (void);
 int
 main (void)
 {
@@ -29707,8 +29844,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char gcry_md_open ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char gcry_md_open (void);
 int
 main (void)
 {
@@ -29760,8 +29903,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char SHA1_Init ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char SHA1_Init (void);
 int
 main (void)
 {
@@ -32240,8 +32389,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char xp_init ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char xp_init (void);
 int
 main (void)
 {
@@ -32757,8 +32912,14 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-char nanosleep ();
+   builtin and then its argument prototype would still apply.
+   The 'extern "C"' is for builds by C++ compilers;
+   although this is not generally supported in C code supporting it here
+   has little cost and some practical benefit (sr 110532).  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char nanosleep (void);
 int
 main (void)
 {
@@ -33811,7 +33972,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by xorg-server $as_me 21.1.9, which was
+This file was extended by xorg-server $as_me 21.1.13, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -33879,7 +34040,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config='$ac_cs_config_escaped'
 ac_cs_version="\\
-xorg-server config.status 21.1.9
+xorg-server config.status 21.1.13
 configured by $0, generated by GNU Autoconf 2.71,
   with options \\"\$ac_cs_config\\"
 

Index: xsrc/external/mit/xorg-server/dist/configure.ac
diff -u xsrc/external/mit/xorg-server/dist/configure.ac:1.20 xsrc/external/mit/xorg-server/dist/configure.ac:1.21
--- xsrc/external/mit/xorg-server/dist/configure.ac:1.20	Wed Oct 25 04:35:07 2023
+++ xsrc/external/mit/xorg-server/dist/configure.ac	Thu Jul  4 21:47:03 2024
@@ -26,8 +26,8 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.60)
-AC_INIT([xorg-server], 21.1.9, [https://gitlab.freedesktop.org/xorg/xserver/issues], xorg-server)
-RELEASE_DATE="2023-10-25"
+AC_INIT([xorg-server], 21.1.13, [https://gitlab.freedesktop.org/xorg/xserver/issues], xorg-server)
+RELEASE_DATE="2024-04-12"
 RELEASE_NAME="Caramel Ice Cream"
 AC_CONFIG_SRCDIR([Makefile.am])
 AC_CONFIG_MACRO_DIR([m4])

Index: xsrc/external/mit/xorg-server/dist/Xext/sync.c
diff -u xsrc/external/mit/xorg-server/dist/Xext/sync.c:1.12 xsrc/external/mit/xorg-server/dist/Xext/sync.c:1.13
--- xsrc/external/mit/xorg-server/dist/Xext/sync.c:1.12	Sun Feb 23 10:26:21 2020
+++ xsrc/external/mit/xorg-server/dist/Xext/sync.c	Thu Jul  4 21:47:03 2024
@@ -2318,6 +2318,7 @@ SProcSyncCreateFence(ClientPtr client)
     REQUEST(xSyncCreateFenceReq);
     swaps(&stuff->length);
     REQUEST_SIZE_MATCH(xSyncCreateFenceReq);
+    swapl(&stuff->d);
     swapl(&stuff->fid);
 
     return ProcSyncCreateFence(client);

Index: xsrc/external/mit/xorg-server/dist/Xi/xichangehierarchy.c
diff -u xsrc/external/mit/xorg-server/dist/Xi/xichangehierarchy.c:1.6 xsrc/external/mit/xorg-server/dist/Xi/xichangehierarchy.c:1.7
--- xsrc/external/mit/xorg-server/dist/Xi/xichangehierarchy.c:1.6	Sat Dec  5 20:34:04 2020
+++ xsrc/external/mit/xorg-server/dist/Xi/xichangehierarchy.c	Thu Jul  4 21:47:03 2024
@@ -416,6 +416,11 @@ ProcXIChangeHierarchy(ClientPtr client)
     size_t len;			/* length of data remaining in request */
     int rc = Success;
     int flags[MAXDEVICES] = { 0 };
+    enum {
+        NO_CHANGE,
+        FLUSH,
+        CHANGED,
+    } changes = NO_CHANGE;
 
     REQUEST(xXIChangeHierarchyReq);
     REQUEST_AT_LEAST_SIZE(xXIChangeHierarchyReq);
@@ -465,8 +470,9 @@ ProcXIChangeHierarchy(ClientPtr client)
             rc = add_master(client, c, flags);
             if (rc != Success)
                 goto unwind;
-        }
+            changes = FLUSH;
             break;
+        }
         case XIRemoveMaster:
         {
             xXIRemoveMasterInfo *r = (xXIRemoveMasterInfo *) any;
@@ -475,8 +481,9 @@ ProcXIChangeHierarchy(ClientPtr client)
             rc = remove_master(client, r, flags);
             if (rc != Success)
                 goto unwind;
-        }
+            changes = FLUSH;
             break;
+        }
         case XIDetachSlave:
         {
             xXIDetachSlaveInfo *c = (xXIDetachSlaveInfo *) any;
@@ -485,8 +492,9 @@ ProcXIChangeHierarchy(ClientPtr client)
             rc = detach_slave(client, c, flags);
             if (rc != Success)
                 goto unwind;
-        }
+            changes = CHANGED;
             break;
+        }
         case XIAttachSlave:
         {
             xXIAttachSlaveInfo *c = (xXIAttachSlaveInfo *) any;
@@ -495,16 +503,25 @@ ProcXIChangeHierarchy(ClientPtr client)
             rc = attach_slave(client, c, flags);
             if (rc != Success)
                 goto unwind;
+            changes = CHANGED;
+            break;
         }
+        default:
             break;
         }
 
+        if (changes == FLUSH) {
+            XISendDeviceHierarchyEvent(flags);
+            memset(flags, 0, sizeof(flags));
+            changes = NO_CHANGE;
+        }
+
         len -= any->length * 4;
         any = (xXIAnyHierarchyChangeInfo *) ((char *) any + any->length * 4);
     }
 
  unwind:
-
-    XISendDeviceHierarchyEvent(flags);
+    if (changes != NO_CHANGE)
+        XISendDeviceHierarchyEvent(flags);
     return rc;
 }

Index: xsrc/external/mit/xorg-server/dist/Xi/xipassivegrab.c
diff -u xsrc/external/mit/xorg-server/dist/Xi/xipassivegrab.c:1.7 xsrc/external/mit/xorg-server/dist/Xi/xipassivegrab.c:1.8
--- xsrc/external/mit/xorg-server/dist/Xi/xipassivegrab.c:1.7	Mon Dec 19 01:37:04 2022
+++ xsrc/external/mit/xorg-server/dist/Xi/xipassivegrab.c	Thu Jul  4 21:47:03 2024
@@ -93,6 +93,7 @@ ProcXIPassiveGrabDevice(ClientPtr client
     GrabParameters param;
     void *tmp;
     int mask_len;
+    uint32_t length;
 
     REQUEST(xXIPassiveGrabDeviceReq);
     REQUEST_FIXED_SIZE(xXIPassiveGrabDeviceReq,
@@ -247,9 +248,11 @@ ProcXIPassiveGrabDevice(ClientPtr client
         }
     }
 
+    /* save the value before SRepXIPassiveGrabDevice swaps it */
+    length = rep.length;
     WriteReplyToClient(client, sizeof(rep), &rep);
     if (rep.num_modifiers)
-        WriteToClient(client, rep.length * 4, modifiers_failed);
+        WriteToClient(client, length * 4, modifiers_failed);
 
  out:
     free(modifiers_failed);

Index: xsrc/external/mit/xorg-server/dist/Xi/xiquerypointer.c
diff -u xsrc/external/mit/xorg-server/dist/Xi/xiquerypointer.c:1.4 xsrc/external/mit/xorg-server/dist/Xi/xiquerypointer.c:1.5
--- xsrc/external/mit/xorg-server/dist/Xi/xiquerypointer.c:1.4	Mon Dec 31 09:49:58 2018
+++ xsrc/external/mit/xorg-server/dist/Xi/xiquerypointer.c	Thu Jul  4 21:47:03 2024
@@ -149,8 +149,7 @@ ProcXIQueryPointer(ClientPtr client)
     if (pDev->button) {
         int i;
 
-        rep.buttons_len =
-            bytes_to_int32(bits_to_bytes(pDev->button->numButtons));
+        rep.buttons_len = bytes_to_int32(bits_to_bytes(256)); /* button map up to 255 */
         rep.length += rep.buttons_len;
         buttons = calloc(rep.buttons_len, 4);
         if (!buttons)

Index: xsrc/external/mit/xorg-server/dist/Xi/xiselectev.c
diff -u xsrc/external/mit/xorg-server/dist/Xi/xiselectev.c:1.5 xsrc/external/mit/xorg-server/dist/Xi/xiselectev.c:1.6
--- xsrc/external/mit/xorg-server/dist/Xi/xiselectev.c:1.5	Fri Jul 15 02:18:56 2022
+++ xsrc/external/mit/xorg-server/dist/Xi/xiselectev.c	Thu Jul  4 21:47:03 2024
@@ -349,6 +349,7 @@ ProcXIGetSelectedEvents(ClientPtr client
     InputClientsPtr others = NULL;
     xXIEventMask *evmask = NULL;
     DeviceIntPtr dev;
+    uint32_t length;
 
     REQUEST(xXIGetSelectedEventsReq);
     REQUEST_SIZE_MATCH(xXIGetSelectedEventsReq);
@@ -418,10 +419,12 @@ ProcXIGetSelectedEvents(ClientPtr client
         }
     }
 
+    /* save the value before SRepXIGetSelectedEvents swaps it */
+    length = reply.length;
     WriteReplyToClient(client, sizeof(xXIGetSelectedEventsReply), &reply);
 
     if (reply.num_masks)
-        WriteToClient(client, reply.length * 4, buffer);
+        WriteToClient(client, length * 4, buffer);
 
     free(buffer);
     return Success;

Index: xsrc/external/mit/xorg-server/dist/dix/devices.c
diff -u xsrc/external/mit/xorg-server/dist/dix/devices.c:1.13 xsrc/external/mit/xorg-server/dist/dix/devices.c:1.14
--- xsrc/external/mit/xorg-server/dist/dix/devices.c:1.13	Fri Jul 15 02:18:57 2022
+++ xsrc/external/mit/xorg-server/dist/dix/devices.c	Thu Jul  4 21:47:03 2024
@@ -447,14 +447,20 @@ DisableDevice(DeviceIntPtr dev, BOOL sen
 {
     DeviceIntPtr *prev, other;
     BOOL enabled;
+    BOOL dev_in_devices_list = FALSE;
     int flags[MAXDEVICES] = { 0 };
 
     if (!dev->enabled)
         return TRUE;
 
-    for (prev = &inputInfo.devices;
-         *prev && (*prev != dev); prev = &(*prev)->next);
-    if (*prev != dev)
+    for (other = inputInfo.devices; other; other = other->next) {
+        if (other == dev) {
+            dev_in_devices_list = TRUE;
+            break;
+        }
+    }
+
+    if (!dev_in_devices_list)
         return FALSE;
 
     TouchEndPhysicallyActiveTouches(dev);
@@ -471,6 +477,13 @@ DisableDevice(DeviceIntPtr dev, BOOL sen
                 flags[other->id] |= XISlaveDetached;
             }
         }
+
+        for (other = inputInfo.off_devices; other; other = other->next) {
+            if (!IsMaster(other) && GetMaster(other, MASTER_ATTACHED) == dev) {
+                AttachDevice(NULL, other, NULL);
+                flags[other->id] |= XISlaveDetached;
+            }
+        }
     }
     else {
         for (other = inputInfo.devices; other; other = other->next) {
@@ -505,6 +518,9 @@ DisableDevice(DeviceIntPtr dev, BOOL sen
     LeaveWindow(dev);
     SetFocusOut(dev);
 
+    for (prev = &inputInfo.devices;
+         *prev && (*prev != dev); prev = &(*prev)->next);
+
     *prev = dev->next;
     dev->next = inputInfo.off_devices;
     inputInfo.off_devices = dev;
@@ -520,6 +536,7 @@ DisableDevice(DeviceIntPtr dev, BOOL sen
     }
 
     RecalculateMasterButtons(dev);
+    dev->master = NULL;
 
     return TRUE;
 }
@@ -1064,6 +1081,11 @@ CloseDownDevices(void)
             dev->master = NULL;
     }
 
+    for (dev = inputInfo.off_devices; dev; dev = dev->next) {
+        if (!IsMaster(dev) && !IsFloating(dev))
+            dev->master = NULL;
+    }
+
     CloseDeviceList(&inputInfo.devices);
     CloseDeviceList(&inputInfo.off_devices);
 
@@ -2525,6 +2547,8 @@ RecalculateMasterButtons(DeviceIntPtr sl
 
     if (master->button && master->button->numButtons != maxbuttons) {
         int i;
+        int last_num_buttons = master->button->numButtons;
+
         DeviceChangedEvent event = {
             .header = ET_Internal,
             .type = ET_DeviceChanged,
@@ -2535,6 +2559,14 @@ RecalculateMasterButtons(DeviceIntPtr sl
         };
 
         master->button->numButtons = maxbuttons;
+        if (last_num_buttons < maxbuttons) {
+            master->button->xkb_acts = xnfreallocarray(master->button->xkb_acts,
+                                                       maxbuttons,
+                                                       sizeof(XkbAction));
+            memset(&master->button->xkb_acts[last_num_buttons],
+                   0,
+                   (maxbuttons - last_num_buttons) * sizeof(XkbAction));
+        }
 
         memcpy(&event.buttons.names, master->button->labels, maxbuttons *
                sizeof(Atom));

Index: xsrc/external/mit/xorg-server/dist/dix/dispatch.c
diff -u xsrc/external/mit/xorg-server/dist/dix/dispatch.c:1.7 xsrc/external/mit/xorg-server/dist/dix/dispatch.c:1.8
--- xsrc/external/mit/xorg-server/dist/dix/dispatch.c:1.7	Fri Jul 15 02:18:57 2022
+++ xsrc/external/mit/xorg-server/dist/dix/dispatch.c	Thu Jul  4 21:47:03 2024
@@ -3780,9 +3780,11 @@ ProcEstablishConnection(ClientPtr client
     auth_proto = (char *) prefix + sz_xConnClientPrefix;
     auth_string = auth_proto + pad_to_int32(prefix->nbytesAuthProto);
 
-    if ((client->req_len << 2) != sz_xReq + sz_xConnClientPrefix +
-	pad_to_int32(prefix->nbytesAuthProto) +
-	pad_to_int32(prefix->nbytesAuthString))
+    if (client->swapped && !AllowByteSwappedClients) {
+        reason = "Prohibited client endianess, see the Xserver man page ";
+    } else if ((client->req_len << 2) != sz_xReq + sz_xConnClientPrefix +
+               pad_to_int32(prefix->nbytesAuthProto) +
+               pad_to_int32(prefix->nbytesAuthString))
         reason = "Bad length";
     else if ((prefix->majorVersion != X_PROTOCOL) ||
         (prefix->minorVersion != X_PROTOCOL_REVISION))
Index: xsrc/external/mit/xorg-server/dist/dix/enterleave.c
diff -u xsrc/external/mit/xorg-server/dist/dix/enterleave.c:1.7 xsrc/external/mit/xorg-server/dist/dix/enterleave.c:1.8
--- xsrc/external/mit/xorg-server/dist/dix/enterleave.c:1.7	Fri Jul 15 02:18:57 2022
+++ xsrc/external/mit/xorg-server/dist/dix/enterleave.c	Thu Jul  4 21:47:03 2024
@@ -615,9 +615,15 @@ FixDeviceValuator(DeviceIntPtr dev, devi
 
     ev->type = DeviceValuator;
     ev->deviceid = dev->id;
-    ev->num_valuators = nval < 3 ? nval : 3;
+    ev->num_valuators = nval < 6 ? nval : 6;
     ev->first_valuator = first;
     switch (ev->num_valuators) {
+    case 6:
+        ev->valuator2 = v->axisVal[first + 5];
+    case 5:
+        ev->valuator2 = v->axisVal[first + 4];
+    case 4:
+        ev->valuator2 = v->axisVal[first + 3];
     case 3:
         ev->valuator2 = v->axisVal[first + 2];
     case 2:
@@ -626,7 +632,6 @@ FixDeviceValuator(DeviceIntPtr dev, devi
         ev->valuator0 = v->axisVal[first];
         break;
     }
-    first += ev->num_valuators;
 }
 
 static void
@@ -646,7 +651,7 @@ FixDeviceStateNotify(DeviceIntPtr dev, d
         ev->num_buttons = b->numButtons;
         memcpy((char *) ev->buttons, (char *) b->down, 4);
     }
-    else if (k) {
+    if (k) {
         ev->classes_reported |= (1 << KeyClass);
         ev->num_keys = k->xkbInfo->desc->max_key_code -
             k->xkbInfo->desc->min_key_code;
@@ -670,14 +675,26 @@ FixDeviceStateNotify(DeviceIntPtr dev, d
     }
 }
 
-
+/**
+ * The device state notify event is split across multiple 32-byte events.
+ * The first one contains the first 32 button state bits, the first 32
+ * key state bits, and the first 3 valuator values.
+ *
+ * If a device has more than that, the server sends out:
+ * - one deviceButtonStateNotify for buttons 32 and above
+ * - one deviceKeyStateNotify for keys 32 and above
+ * - one deviceValuator event per 6 valuators above valuator 4
+ *
+ * All events but the last one have the deviceid binary ORed with MORE_EVENTS,
+ */
 static void
 DeliverStateNotifyEvent(DeviceIntPtr dev, WindowPtr win)
 {
+    /* deviceStateNotify, deviceKeyStateNotify, deviceButtonStateNotify
+     * and one deviceValuator for each 6 valuators */
+    deviceStateNotify sev[3 + (MAX_VALUATORS + 6)/6];
     int evcount = 1;
-    deviceStateNotify *ev, *sev;
-    deviceKeyStateNotify *kev;
-    deviceButtonStateNotify *bev;
+    deviceStateNotify *ev = sev;
 
     KeyClassPtr k;
     ButtonClassPtr b;
@@ -690,87 +707,53 @@ DeliverStateNotifyEvent(DeviceIntPtr dev
 
     if ((b = dev->button) != NULL) {
         nbuttons = b->numButtons;
-        if (nbuttons > 32)
+        if (nbuttons > 32) /* first 32 are encoded in deviceStateNotify */
             evcount++;
     }
     if ((k = dev->key) != NULL) {
         nkeys = k->xkbInfo->desc->max_key_code - k->xkbInfo->desc->min_key_code;
-        if (nkeys > 32)
-            evcount++;
-        if (nbuttons > 0) {
+        if (nkeys > 32) /* first 32 are encoded in deviceStateNotify */
             evcount++;
-        }
     }
     if ((v = dev->valuator) != NULL) {
         nval = v->numAxes;
-
-        if (nval > 3)
-            evcount++;
-        if (nval > 6) {
-            if (!(k && b))
-                evcount++;
-            if (nval > 9)
-                evcount += ((nval - 7) / 3);
-        }
+        /* first three are encoded in deviceStateNotify, then
+         * it's 6 per deviceValuator event */
+        evcount += ((nval - 3) + 6)/6;
     }
 
-    sev = ev = xallocarray(evcount, sizeof(xEvent));
-    FixDeviceStateNotify(dev, ev, NULL, NULL, NULL, first);
-
-    if (b != NULL) {
-        FixDeviceStateNotify(dev, ev++, NULL, b, v, first);
-        first += 3;
-        nval -= 3;
-        if (nbuttons > 32) {
-            (ev - 1)->deviceid |= MORE_EVENTS;
-            bev = (deviceButtonStateNotify *) ev++;
-            bev->type = DeviceButtonStateNotify;
-            bev->deviceid = dev->id;
-            memcpy((char *) &bev->buttons[4], (char *) &b->down[4],
-                   DOWN_LENGTH - 4);
-        }
-        if (nval > 0) {
-            (ev - 1)->deviceid |= MORE_EVENTS;
-            FixDeviceValuator(dev, (deviceValuator *) ev++, v, first);
-            first += 3;
-            nval -= 3;
-        }
+    BUG_RETURN(evcount <= ARRAY_SIZE(sev));
+
+    FixDeviceStateNotify(dev, ev, k, b, v, first);
+
+    if (b != NULL && nbuttons > 32) {
+        deviceButtonStateNotify *bev = (deviceButtonStateNotify *) ++ev;
+        (ev - 1)->deviceid |= MORE_EVENTS;
+        bev->type = DeviceButtonStateNotify;
+        bev->deviceid = dev->id;
+        memcpy((char *) &bev->buttons[4], (char *) &b->down[4],
+               DOWN_LENGTH - 4);
     }
 
-    if (k != NULL) {
-        FixDeviceStateNotify(dev, ev++, k, NULL, v, first);
-        first += 3;
-        nval -= 3;
-        if (nkeys > 32) {
-            (ev - 1)->deviceid |= MORE_EVENTS;
-            kev = (deviceKeyStateNotify *) ev++;
-            kev->type = DeviceKeyStateNotify;
-            kev->deviceid = dev->id;
-            memmove((char *) &kev->keys[0], (char *) &k->down[4], 28);
-        }
-        if (nval > 0) {
-            (ev - 1)->deviceid |= MORE_EVENTS;
-            FixDeviceValuator(dev, (deviceValuator *) ev++, v, first);
-            first += 3;
-            nval -= 3;
-        }
+    if (k != NULL && nkeys > 32) {
+        deviceKeyStateNotify *kev = (deviceKeyStateNotify *) ++ev;
+        (ev - 1)->deviceid |= MORE_EVENTS;
+        kev->type = DeviceKeyStateNotify;
+        kev->deviceid = dev->id;
+        memmove((char *) &kev->keys[0], (char *) &k->down[4], 28);
     }
 
+    first = 3;
+    nval -= 3;
     while (nval > 0) {
-        FixDeviceStateNotify(dev, ev++, NULL, NULL, v, first);
-        first += 3;
-        nval -= 3;
-        if (nval > 0) {
-            (ev - 1)->deviceid |= MORE_EVENTS;
-            FixDeviceValuator(dev, (deviceValuator *) ev++, v, first);
-            first += 3;
-            nval -= 3;
-        }
+        ev->deviceid |= MORE_EVENTS;
+        FixDeviceValuator(dev, (deviceValuator *) ++ev, v, first);
+        first += 6;
+        nval -= 6;
     }
 
     DeliverEventsToWindow(dev, win, (xEvent *) sev, evcount,
                           DeviceStateNotifyMask, NullGrab);
-    free(sev);
 }
 
 void
@@ -784,8 +767,9 @@ DeviceFocusEvent(DeviceIntPtr dev, int t
 
     mouse = IsFloating(dev) ? dev : GetMaster(dev, MASTER_POINTER);
 
-    /* XI 2 event */
-    btlen = (mouse->button) ? bits_to_bytes(mouse->button->numButtons) : 0;
+    /* XI 2 event contains the logical button map - maps are CARD8
+     * so we need 256 bits for the possibly maximum mapping */
+    btlen = (mouse->button) ? bits_to_bytes(256) : 0;
     btlen = bytes_to_int32(btlen);
     len = sizeof(xXIFocusInEvent) + btlen * 4;
 

Index: xsrc/external/mit/xorg-server/dist/glx/glxcmds.c
diff -u xsrc/external/mit/xorg-server/dist/glx/glxcmds.c:1.15 xsrc/external/mit/xorg-server/dist/glx/glxcmds.c:1.16
--- xsrc/external/mit/xorg-server/dist/glx/glxcmds.c:1.15	Fri Jul 15 02:18:57 2022
+++ xsrc/external/mit/xorg-server/dist/glx/glxcmds.c	Thu Jul  4 21:47:03 2024
@@ -48,6 +48,7 @@
 #include "indirect_util.h"
 #include "protocol-versions.h"
 #include "glxvndabi.h"
+#include "xace.h"
 
 static char GLXServerVendorName[] = "SGI";
 
@@ -1392,6 +1393,13 @@ DoCreatePbuffer(ClientPtr client, int sc
     if (!pPixmap)
         return BadAlloc;
 
+    err = XaceHook(XACE_RESOURCE_ACCESS, client, glxDrawableId, RT_PIXMAP,
+                   pPixmap, RT_NONE, NULL, DixCreateAccess);
+    if (err != Success) {
+        (*pGlxScreen->pScreen->DestroyPixmap) (pPixmap);
+        return err;
+    }
+
     /* Assign the pixmap the same id as the pbuffer and add it as a
      * resource so it and the DRI2 drawable will be reclaimed when the
      * pbuffer is destroyed. */

Index: xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Config.c
diff -u xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Config.c:1.17 xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Config.c:1.18
--- xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Config.c:1.17	Fri Jul 15 02:18:59 2022
+++ xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Config.c	Thu Jul  4 21:47:03 2024
@@ -646,6 +646,7 @@ typedef enum {
     FLAG_MAX_CLIENTS,
     FLAG_IGLX,
     FLAG_DEBUG,
+    FLAG_ALLOW_BYTE_SWAPPED_CLIENTS,
 } FlagValues;
 
 /**
@@ -705,6 +706,8 @@ static OptionInfoRec FlagOptions[] = {
      {0}, FALSE},
     {FLAG_DEBUG, "Debug", OPTV_STRING,
      {0}, FALSE},
+    {FLAG_ALLOW_BYTE_SWAPPED_CLIENTS, "AllowByteSwappedClients", OPTV_BOOLEAN,
+     {0}, FALSE},
     {-1, NULL, OPTV_NONE,
      {0}, FALSE},
 };
@@ -746,6 +749,14 @@ configServerFlags(XF86ConfFlagsPtr flags
         xf86Msg(X_CONFIG, "Ignoring ABI Version\n");
     }
 
+    xf86GetOptValBool(FlagOptions, FLAG_ALLOW_BYTE_SWAPPED_CLIENTS, &AllowByteSwappedClients);
+    if (AllowByteSwappedClients) {
+        xf86Msg(X_CONFIG, "Allowing byte-swapped clients\n");
+    }
+    else {
+        xf86Msg(X_CONFIG, "Prohibiting byte-swapped clients\n");
+    }
+
     if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ADD_DEVICES)) {
         xf86GetOptValBool(FlagOptions, FLAG_AUTO_ADD_DEVICES,
                           &xf86Info.autoAddDevices);

Index: xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c
diff -u xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c:1.2 xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c:1.3
--- xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c:1.2	Mon Jun 10 22:51:01 2024
+++ xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c	Thu Jul  4 21:47:03 2024
@@ -803,10 +803,14 @@ xf86CVTMode(int HDisplay, int VDisplay, 
 {
     struct libxcvt_mode_info *libxcvt_mode_info;
     DisplayModeRec *Mode = xnfcalloc(1, sizeof(DisplayModeRec));
+    char *tmp;
 
     libxcvt_mode_info =
         libxcvt_gen_mode_info(HDisplay, VDisplay, VRefresh, Reduced, Interlaced);
 
+    XNFasprintf(&tmp, "%dx%d", HDisplay, VDisplay);
+    Mode->name = tmp;
+    
     Mode->VDisplay   = libxcvt_mode_info->vdisplay;
     Mode->HDisplay   = libxcvt_mode_info->hdisplay;
     Mode->Clock      = libxcvt_mode_info->dot_clock;

Index: xsrc/external/mit/xorg-server/dist/m4/libtool.m4
diff -u xsrc/external/mit/xorg-server/dist/m4/libtool.m4:1.3 xsrc/external/mit/xorg-server/dist/m4/libtool.m4:1.4
--- xsrc/external/mit/xorg-server/dist/m4/libtool.m4:1.3	Sun Jan  8 00:24:51 2023
+++ xsrc/external/mit/xorg-server/dist/m4/libtool.m4	Thu Jul  4 21:47:03 2024
@@ -1415,10 +1415,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*
 	  x86_64-*linux*)
 	    LD="${LD-ld} -m elf_x86_64"
 	    ;;
-	  powerpcle-*linux*)
+	  powerpcle-*linux*|powerpc64le-*linux*)
 	    LD="${LD-ld} -m elf64lppc"
 	    ;;
-	  powerpc-*linux*)
+	  powerpc-*linux*|powerpc64-*linux*)
 	    LD="${LD-ld} -m elf64ppc"
 	    ;;
 	  s390*-*linux*|s390*-*tpf*)
@@ -2656,11 +2656,11 @@ darwin* | rhapsody*)
   version_type=darwin
   need_lib_prefix=no
   need_version=no
-  library_names_spec='$libname$release$major$shared_ext $libname$shared_ext'
+  library_names_spec='$libname$release$versuffix$shared_ext $libname$release$major$shared_ext $libname$shared_ext'
   soname_spec='$libname$release$major$shared_ext'
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+  shrext_cmds='`test .$module = .yes && echo .bundle || echo .dylib`'
 m4_if([$1], [],[
   sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
   sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
@@ -2686,7 +2686,14 @@ freebsd* | dragonfly* | midnightbsd*)
     *) objformat=elf ;;
     esac
   fi
-  version_type=freebsd-$objformat
+  # Handle Gentoo/FreeBSD as it was Linux
+  case $host_vendor in
+    gentoo)
+      version_type=linux ;;
+    *)
+      version_type=freebsd-$objformat ;;
+  esac
+
   case $version_type in
     freebsd-elf*)
       library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
@@ -2698,6 +2705,12 @@ freebsd* | dragonfly* | midnightbsd*)
       library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
       need_version=yes
       ;;
+    linux)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+      soname_spec='${libname}${release}${shared_ext}$major'
+      need_lib_prefix=no
+      need_version=no
+      ;;
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
@@ -2887,9 +2900,6 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu 
   # before this can be enabled.
   hardcode_into_libs=yes
 
-  # Add ABI-specific directories to the system library path.
-  sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib"
-
   # Ideally, we could use ldconfig to report *all* directores which are
   # searched for libraries, however this is still not possible.  Aside from not
   # being certain /sbin/ldconfig is available, command
@@ -2898,7 +2908,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu 
   # appending ld.so.conf contents (and includes) to the search path.
   if test -f /etc/ld.so.conf; then
     lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
   # We used to test for /lib/ld.so.1 and disable shared libraries on

Index: xsrc/external/mit/xorg-server/dist/os/utils.c
diff -u xsrc/external/mit/xorg-server/dist/os/utils.c:1.13 xsrc/external/mit/xorg-server/dist/os/utils.c:1.14
--- xsrc/external/mit/xorg-server/dist/os/utils.c:1.13	Fri Jul 15 19:10:11 2022
+++ xsrc/external/mit/xorg-server/dist/os/utils.c	Thu Jul  4 21:47:03 2024
@@ -189,6 +189,8 @@ Bool CoreDump;
 
 Bool enableIndirectGLX = FALSE;
 
+Bool AllowByteSwappedClients = TRUE;
+
 #ifdef PANORAMIX
 Bool PanoramiXExtensionDisabledHack = FALSE;
 #endif
@@ -523,6 +525,8 @@ UseMsg(void)
     ErrorF("-br                    create root window with black background\n");
     ErrorF("+bs                    enable any backing store support\n");
     ErrorF("-bs                    disable any backing store support\n");
+    ErrorF("+byteswappedclients    Allow clients with endianess different to that of the server\n");
+    ErrorF("-byteswappedclients    Prohibit clients with endianess different to that of the server\n");
     ErrorF("-c                     turns off key-click\n");
     ErrorF("c #                    key-click volume (0-100)\n");
     ErrorF("-cc int                default color visual class\n");
@@ -720,6 +724,11 @@ ProcessCommandLine(int argc, char *argv[
             else
                 UseMsg();
         }
+        else if (strcmp(argv[i], "-byteswappedclients") == 0) {
+            AllowByteSwappedClients = FALSE;
+        } else if (strcmp(argv[i], "+byteswappedclients") == 0) {
+            AllowByteSwappedClients = TRUE;
+        }
         else if (strcmp(argv[i], "-br") == 0);  /* default */
         else if (strcmp(argv[i], "+bs") == 0)
             enableBackingStore = TRUE;

Index: xsrc/external/mit/xorg-server/dist/render/glyph.c
diff -u xsrc/external/mit/xorg-server/dist/render/glyph.c:1.5 xsrc/external/mit/xorg-server/dist/render/glyph.c:1.6
--- xsrc/external/mit/xorg-server/dist/render/glyph.c:1.5	Mon Dec 31 09:50:02 2018
+++ xsrc/external/mit/xorg-server/dist/render/glyph.c	Thu Jul  4 21:47:04 2024
@@ -245,10 +245,11 @@ FreeGlyphPicture(GlyphPtr glyph)
     }
 }
 
-static void
+void
 FreeGlyph(GlyphPtr glyph, int format)
 {
     CheckDuplicates(&globalGlyphs[format], "FreeGlyph");
+    BUG_RETURN(glyph->refcnt == 0);
     if (--glyph->refcnt == 0) {
         GlyphRefPtr gr;
         int i;
@@ -290,8 +291,6 @@ AddGlyph(GlyphSetPtr glyphSet, GlyphPtr 
     gr = FindGlyphRef(&globalGlyphs[glyphSet->fdepth], signature,
                       TRUE, glyph->sha1);
     if (gr->glyph && gr->glyph != DeletedGlyph && gr->glyph != glyph) {
-        FreeGlyphPicture(glyph);
-        dixFreeObjectWithPrivates(glyph, PRIVATE_GLYPH);
         glyph = gr->glyph;
     }
     else if (gr->glyph != glyph) {
@@ -354,7 +353,7 @@ AllocateGlyph(xGlyphInfo * gi, int fdept
     glyph = (GlyphPtr) malloc(size);
     if (!glyph)
         return 0;
-    glyph->refcnt = 0;
+    glyph->refcnt = 1;
     glyph->size = size + sizeof(xGlyphInfo);
     glyph->info = *gi;
     dixInitPrivates(glyph, (char *) glyph + head_size, PRIVATE_GLYPH);

Index: xsrc/external/mit/xorg-server/dist/render/glyphstr.h
diff -u xsrc/external/mit/xorg-server/dist/render/glyphstr.h:1.3 xsrc/external/mit/xorg-server/dist/render/glyphstr.h:1.4
--- xsrc/external/mit/xorg-server/dist/render/glyphstr.h:1.3	Thu Aug 11 00:04:35 2016
+++ xsrc/external/mit/xorg-server/dist/render/glyphstr.h	Thu Jul  4 21:47:04 2024
@@ -109,6 +109,8 @@ extern GlyphPtr FindGlyph(GlyphSetPtr gl
 
 extern GlyphPtr AllocateGlyph(xGlyphInfo * gi, int format);
 
+extern void FreeGlyph(GlyphPtr glyph, int format);
+
 extern Bool
  ResizeGlyphSet(GlyphSetPtr glyphSet, CARD32 change);
 

Index: xsrc/external/mit/xorg-server/dist/render/render.c
diff -u xsrc/external/mit/xorg-server/dist/render/render.c:1.8 xsrc/external/mit/xorg-server/dist/render/render.c:1.9
--- xsrc/external/mit/xorg-server/dist/render/render.c:1.8	Fri Jul 15 02:19:02 2022
+++ xsrc/external/mit/xorg-server/dist/render/render.c	Thu Jul  4 21:47:04 2024
@@ -1076,6 +1076,7 @@ ProcRenderAddGlyphs(ClientPtr client)
 
         if (glyph_new->glyph && glyph_new->glyph != DeletedGlyph) {
             glyph_new->found = TRUE;
+            ++glyph_new->glyph->refcnt;
         }
         else {
             GlyphPtr glyph;
@@ -1168,8 +1169,10 @@ ProcRenderAddGlyphs(ClientPtr client)
         err = BadAlloc;
         goto bail;
     }
-    for (i = 0; i < nglyphs; i++)
+    for (i = 0; i < nglyphs; i++) {
         AddGlyph(glyphSet, glyphs[i].glyph, glyphs[i].id);
+        FreeGlyph(glyphs[i].glyph, glyphSet->fdepth);
+    }
 
     if (glyphsBase != glyphsLocal)
         free(glyphsBase);
@@ -1179,9 +1182,13 @@ ProcRenderAddGlyphs(ClientPtr client)
         FreePicture((void *) pSrc, 0);
     if (pSrcPix)
         FreeScratchPixmapHeader(pSrcPix);
-    for (i = 0; i < nglyphs; i++)
-        if (glyphs[i].glyph && !glyphs[i].found)
-            free(glyphs[i].glyph);
+    for (i = 0; i < nglyphs; i++) {
+        if (glyphs[i].glyph) {
+            --glyphs[i].glyph->refcnt;
+            if (!glyphs[i].found)
+                free(glyphs[i].glyph);
+        }
+    }
     if (glyphsBase != glyphsLocal)
         free(glyphsBase);
     return err;

Index: xsrc/external/mit/xorg-server/include/dix-config.h
diff -u xsrc/external/mit/xorg-server/include/dix-config.h:1.51 xsrc/external/mit/xorg-server/include/dix-config.h:1.52
--- xsrc/external/mit/xorg-server/include/dix-config.h:1.51	Wed Oct 25 04:35:07 2023
+++ xsrc/external/mit/xorg-server/include/dix-config.h	Thu Jul  4 21:47:04 2024
@@ -343,7 +343,7 @@
 #define XINERAMA 1
 
 /* Current Xorg version */
-#define XORG_VERSION_CURRENT ((10000000) + ((21) * 100000) + ((1) * 1000) + 9)
+#define XORG_VERSION_CURRENT ((10000000) + ((21) * 100000) + ((1) * 1000) + 13)
 
 /* Build Xv Extension */
 #define XvExtension 1

Index: xsrc/external/mit/xorg-server/include/version-config.h
diff -u xsrc/external/mit/xorg-server/include/version-config.h:1.21 xsrc/external/mit/xorg-server/include/version-config.h:1.22
--- xsrc/external/mit/xorg-server/include/version-config.h:1.21	Wed Oct 25 04:35:07 2023
+++ xsrc/external/mit/xorg-server/include/version-config.h	Thu Jul  4 21:47:04 2024
@@ -5,13 +5,13 @@
 #define VERSION_CONFIG_H
 
 /* Vendor man version */
-#define VENDOR_MAN_VERSION "Version 21.1.9"
+#define VENDOR_MAN_VERSION "Version 21.1.13"
 
 /* Vendor name */
 #define VENDOR_NAME "The X.Org Foundation"
 
 /* Vendor release */
-#define VENDOR_RELEASE ((10000000) + ((21) * 100000) + ((1) * 1000) + 9)
+#define VENDOR_RELEASE ((10000000) + ((21) * 100000) + ((1) * 1000) + 13)
 
 #endif /* VERSION_CONFIG_H */
 

Index: xsrc/external/mit/xorg-server/include/xorg-config.h
diff -u xsrc/external/mit/xorg-server/include/xorg-config.h:1.31 xsrc/external/mit/xorg-server/include/xorg-config.h:1.32
--- xsrc/external/mit/xorg-server/include/xorg-config.h:1.31	Wed Oct 25 04:35:07 2023
+++ xsrc/external/mit/xorg-server/include/xorg-config.h	Thu Jul  4 21:47:04 2024
@@ -17,7 +17,7 @@
 #define XORGSERVER 1
 
 /* Current X.Org version. */
-#define XORG_VERSION_CURRENT ((10000000) + ((21) * 100000) + ((1) * 1000) + 9)
+#define XORG_VERSION_CURRENT ((10000000) + ((21) * 100000) + ((1) * 1000) + 13)
 
 /* Name of X server. */
 #define __XSERVERNAME__ "Xorg"
Index: xsrc/external/mit/xorg-server/include/xorg-server.h
diff -u xsrc/external/mit/xorg-server/include/xorg-server.h:1.31 xsrc/external/mit/xorg-server/include/xorg-server.h:1.32
--- xsrc/external/mit/xorg-server/include/xorg-server.h:1.31	Wed Oct 25 04:35:07 2023
+++ xsrc/external/mit/xorg-server/include/xorg-server.h	Thu Jul  4 21:47:04 2024
@@ -140,7 +140,7 @@
 #define XORGSERVER 1
 
 /* Current Xorg version */
-#define XORG_VERSION_CURRENT ((10000000) + ((21) * 100000) + ((1) * 1000) + 9)
+#define XORG_VERSION_CURRENT ((10000000) + ((21) * 100000) + ((1) * 1000) + 13)
 
 /* Build Xv Extension */
 #define XvExtension 1

Reply via email to