diff options
-rw-r--r-- | fontconfig/configure.in | 139 | ||||
-rw-r--r-- | fontconfig/src/Makefile.am | 1 | ||||
-rw-r--r-- | fontconfig/src/fcint.h | 18 | ||||
-rw-r--r-- | fontconfig/src/fcmatch.c | 84 | ||||
-rw-r--r-- | fontconfig/src/fcstr.c | 52 | ||||
-rw-r--r-- | fontconfig/src/fcxml.c | 48 | ||||
-rw-r--r-- | mesalib/configure.ac | 15 | ||||
-rw-r--r-- | mesalib/docs/viewperf.html | 15 | ||||
-rw-r--r-- | mesalib/src/glsl/Makefile.sources | 1 | ||||
-rw-r--r-- | mesalib/src/glsl/glsl_parser_extras.cpp | 1 | ||||
-rw-r--r-- | mesalib/src/glsl/ir_optimization.h | 1 | ||||
-rw-r--r-- | mesalib/src/glsl/opt_array_splitting.cpp | 384 | ||||
-rw-r--r-- | mesalib/src/mapi/Android.mk | 11 | ||||
-rw-r--r-- | mesalib/src/mesa/main/bufferobj.c | 30 | ||||
-rw-r--r-- | mesalib/src/mesa/main/bufferobj.h | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texobj.c | 59 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texobj.h | 3 | ||||
-rw-r--r-- | mesalib/src/mesa/program/ir_to_mesa.cpp | 2 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c | 826 | ||||
-rw-r--r-- | xorg-server/xkeyboard-config/symbols/de | 4 |
20 files changed, 1262 insertions, 434 deletions
diff --git a/fontconfig/configure.in b/fontconfig/configure.in index ea44c1422..1af236719 100644 --- a/fontconfig/configure.in +++ b/fontconfig/configure.in @@ -123,7 +123,7 @@ dnl ========================================================================== # Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC -AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h]) +AC_CHECK_HEADERS([fcntl.h regex.h stdlib.h string.h unistd.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -133,38 +133,86 @@ AC_TYPE_PID_T # Checks for library functions. AC_FUNC_VPRINTF AC_FUNC_MMAP -AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr strtol getopt getopt_long sysconf ftruncate chsize rand random lrand48 random_r rand_r]) +AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr strtol getopt getopt_long sysconf ftruncate chsize rand random lrand48 random_r rand_r regcomp regerror regexec regfree]) # -# Checks for iconv +# regex # -AC_MSG_CHECKING([for a usable iconv]) -ICONV_LIBS="" -AC_TRY_LINK([#include <iconv.h>], - [iconv_open ("from", "to");], - [use_iconv=1], - [use_iconv=0]) -if test x$use_iconv = x1; then - AC_MSG_RESULT([libc]) -else - # try using libiconv - fontconfig_save_libs="$LIBS" - LIBS="$LIBS -liconv" +use_regex=0 +if test "x$ac_cv_func_regcomp" = "xyes" -a "x$ac_cv_func_regerror" = "xyes" -a "x$ac_cv_func_regexec" = "xyes" -a "x$ac_cv_func_regfree"; then + use_regex=1 +fi +AC_DEFINE_UNQUOTED(USE_REGEX,$use_regex,[Use regex.]) - AC_TRY_LINK([#include <iconv.h>], - [iconv_open ("from", "to");], - [use_iconv=1], - [use_iconv=0]) - - if test x$use_iconv = x1; then - ICONV_LIBS="-liconv" - AC_MSG_RESULT([libiconv]) +# +# Checks for iconv +# +AC_ARG_WITH(libiconv, + [AC_HELP_STRING([--with-libiconv=DIR], + [Use libiconv in DIR])], + [libiconv_prefix=$withval], + [libiconv_prefix=auto]) +AC_ARG_WITH(libiconv-includes, + [AC_HELP_STRING([--with-libiconv-includes=DIR], + [Use libiconv includes in DIR])], + [libiconv_includes=$withval], + [libiconv_includes=auto]) +AC_ARG_WITH(libiconv-lib, + [AC_HELP_STRING([--with-libiconv-lib=DIR], + [Use libiconv library in DIR])], + [libiconv_lib=$withval], + [libiconv_lib=auto]) + +# if none of libiconv,libiconv-includes,libiconv-libs are specified +if test "$libiconv_prefix" != "auto" -o "$libiconv_includes" != "auto" -o "$libiconv_lib" != "auto"; then + if test "$libiconv_includes" != "auto" -a -r ${libiconv_includes}/iconv.h; then + libiconv_cflags="-I${libiconv_includes}" + elif test "$libiconv_prefix" != "auto" -a -r ${libiconv_prefix}/include/iconv.h; then + libiconv_cflags="-I${libiconv_prefix}/include" + else + libiconv_cflags="" + fi + if test "$libiconv_lib" != "auto"; then + libiconv_lib="-L${libiconv_lib} -liconv" + elif test "$libiconv_prefix" != "auto"; then + libiconv_lib="-L${libiconv_prefix}/lib -liconv" + elif test "x$libiconv_cflags" != "x"; then + libiconv_lib="-liconv" else - AC_MSG_RESULT([no]) + libiconv_lib="" fi +fi + +use_iconv=0 +AC_MSG_CHECKING([for a usable iconv]) +if test "x$libiconv_cflags" != "x" -o "x$libiconv_lib" != "x"; then + iconvsaved_CFLAGS="$CFLAGS" + iconvsaved_LIBS="$LIBS" + CFLAGS="$CFLAGS $libiconv_cflags" + LIBS="$LIBS $libiconv_lib" - LIBS="$fontconfig_save_libs" + AC_TRY_LINK([#include <iconv.h>], + [iconv_open ("from", "to");], + [iconv_type="libiconv" + use_iconv=1], + [use_iconv=0]) + + CFLAGS="$iconvsaved_CFLAGS" + LIBS="$iconvsaved_LIBS" + ICONV_CFLAGS="$libiconv_cflags" + ICONV_LIBS="$libiconv_lib" +fi +if test "x$use_iconv" = "x0"; then + AC_TRY_LINK([#include <iconv.h>], + [iconv_open ("from", "to");], + [iconv_type="libc" + use_iconv=1], + [iconv_type="not found" + use_iconv=0]) fi + +AC_MSG_RESULT([$iconv_type]) +AC_SUBST(ICONV_CFLAGS) AC_SUBST(ICONV_LIBS) AC_DEFINE_UNQUOTED(USE_ICONV,$use_iconv,[Use iconv.]) @@ -194,10 +242,45 @@ LIBS="$fontconfig_save_libs" # # Check expat configuration # +AC_ARG_WITH(expat, + [AC_HELP_STRING([--with-expat=DIR], + [Use Expat in DIR])], + [expat_prefix=$withval], + [expat_prefix=auto]) +AC_ARG_WITH(expat-includes, + [AC_HELP_STRING([--with-expat-includes=DIR], + [Use Expat includes in DIR])], + [expat_includes=$withval], + [expat_includes=auto]) +AC_ARG_WITH(expat-lib, + [AC_HELP_STRING([--with-expat-lib=DIR])], + [expat_lib=$withval], + [expat_lib=auto]) + if test "$enable_libxml2" != "yes"; then - # specify EXPAT_CFLAGS and/or EXPAT_LIBS if you like the old behavior - # with --with-expat-includes and --with-expat-lib. - PKG_CHECK_MODULES(EXPAT, expat) + use_pkgconfig_for_expat=yes + if test "$expat_prefix" = "auto" -a "$expat_includes" = "auto" -a "$expat_lib" = "auto"; then + PKG_CHECK_MODULES(EXPAT, expat,,use_pkgconfig_for_expat=no) + else + use_pkgconfig_for_expat=no + fi + if test "x$use_pkgconfig_for_expat" = "xno"; then + if test "$expat_includes" != "auto" -a -r ${expat_includes}/expat.h; then + EXPAT_CFLAGS="-I${expat_includes}" + elif test "$expat_prefix" != "auto" -a -r ${expat_prefix}/include/expat.h; then + EXPAT_CFLAGS="-I${expat_prefix}/include" + else + EXPAT_CFLAGS="" + fi + if test "$expat_lib" != "auto"; then + EXPAT_LIBS="-L${expat_lib} -lexpat" + elif test "$expat_prefix" != "auto"; then + EXPAT_LIBS="-L${expat_prefix}/lib -lexpat" + else + EXPAT_LIBS="-lexpat" + fi + fi + expatsaved_CPPFLAGS="$CPPFLAGS" expatsaved_LIBS="$LIBS" CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS" diff --git a/fontconfig/src/Makefile.am b/fontconfig/src/Makefile.am index 591fc1613..0bd0e3ded 100644 --- a/fontconfig/src/Makefile.am +++ b/fontconfig/src/Makefile.am @@ -71,6 +71,7 @@ INCLUDES = \ -I$(top_srcdir) \ -I$(top_srcdir)/src \ $(FREETYPE_CFLAGS) \ + $(ICONV_CFLAGS) \ $(LIBXML2_CFLAGS) \ $(EXPAT_CFLAGS) \ $(WARN_CFLAGS) \ diff --git a/fontconfig/src/fcint.h b/fontconfig/src/fcint.h index 56f77efef..0dfc23659 100644 --- a/fontconfig/src/fcint.h +++ b/fontconfig/src/fcint.h @@ -55,9 +55,17 @@ #endif #ifdef _WIN32 -#define FC_SEARCH_PATH_SEPARATOR ';' +# define _WIN32_WINNT 0x0500 +# define WIN32_LEAN_AND_MEAN +# define STRICT +# include <windows.h> +typedef UINT (WINAPI *pfnGetSystemWindowsDirectory)(LPSTR, UINT); +typedef HRESULT (WINAPI *pfnSHGetFolderPathA)(HWND, int, HANDLE, DWORD, LPSTR); +extern pfnGetSystemWindowsDirectory pGetSystemWindowsDirectory; +extern pfnSHGetFolderPathA pSHGetFolderPathA; +# define FC_SEARCH_PATH_SEPARATOR ';' #else -#define FC_SEARCH_PATH_SEPARATOR ':' +# define FC_SEARCH_PATH_SEPARATOR ':' #endif #define FC_DBG_MATCH 1 @@ -1009,6 +1017,12 @@ FcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len); FcPrivate int FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2); +FcPrivate FcBool +FcStrRegexCmp (const FcChar8 *s, const FcChar8 *regex); + +FcPrivate FcBool +FcStrRegexCmpIgnoreCase (const FcChar8 *s, const FcChar8 *regex); + FcPrivate const FcChar8 * FcStrContainsIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2); diff --git a/fontconfig/src/fcmatch.c b/fontconfig/src/fcmatch.c index 92e4a6668..655e62cf5 100644 --- a/fontconfig/src/fcmatch.c +++ b/fontconfig/src/fcmatch.c @@ -174,6 +174,22 @@ FcCompareSize (FcValue *value1, FcValue *value2) return v; } +static double +FcCompareFilename (FcValue *v1, FcValue *v2) +{ + const FcChar8 *s1 = FcValueString (v1), *s2 = FcValueString (v2); + if (FcStrCmp (s1, s2) == 0) + return 0.0; + else if (FcStrCmpIgnoreCase (s1, s2) == 0) + return 1.0; + else if (FcStrRegexCmp (s2, s1)) + return 2.0; + else if (FcStrRegexCmpIgnoreCase (s2, s1)) + return 3.0; + else + return 4.0; +} + typedef struct _FcMatcher { FcObject object; double (*compare) (FcValue *value1, FcValue *value2); @@ -186,40 +202,42 @@ typedef struct _FcMatcher { * later values */ static const FcMatcher _FcMatchers [] = { - { FC_FOUNDRY_OBJECT, FcCompareString, 0, 0 }, -#define MATCH_FOUNDRY 0 - { FC_CHARSET_OBJECT, FcCompareCharSet, 1, 1 }, -#define MATCH_CHARSET 1 - { FC_FAMILY_OBJECT, FcCompareFamily, 2, 4 }, -#define MATCH_FAMILY 2 - { FC_LANG_OBJECT, FcCompareLang, 3, 3 }, -#define MATCH_LANG 3 -#define MATCH_LANG_INDEX 3 - { FC_SPACING_OBJECT, FcCompareNumber, 5, 5 }, -#define MATCH_SPACING 4 - { FC_PIXEL_SIZE_OBJECT, FcCompareSize, 6, 6 }, -#define MATCH_PIXEL_SIZE 5 - { FC_STYLE_OBJECT, FcCompareString, 7, 7 }, -#define MATCH_STYLE 6 - { FC_SLANT_OBJECT, FcCompareNumber, 8, 8 }, -#define MATCH_SLANT 7 - { FC_WEIGHT_OBJECT, FcCompareNumber, 9, 9 }, -#define MATCH_WEIGHT 8 - { FC_WIDTH_OBJECT, FcCompareNumber, 10, 10 }, -#define MATCH_WIDTH 9 - { FC_DECORATIVE_OBJECT, FcCompareBool, 11, 11 }, -#define MATCH_DECORATIVE 10 - { FC_ANTIALIAS_OBJECT, FcCompareBool, 12, 12 }, -#define MATCH_ANTIALIAS 11 - { FC_RASTERIZER_OBJECT, FcCompareString, 13, 13 }, -#define MATCH_RASTERIZER 12 - { FC_OUTLINE_OBJECT, FcCompareBool, 14, 14 }, -#define MATCH_OUTLINE 13 - { FC_FONTVERSION_OBJECT, FcCompareNumber, 15, 15 }, -#define MATCH_FONTVERSION 14 + { FC_FILE_OBJECT, FcCompareFilename, 0, 0 }, +#define MATCH_FILE 0 + { FC_FOUNDRY_OBJECT, FcCompareString, 1, 1 }, +#define MATCH_FOUNDRY 1 + { FC_CHARSET_OBJECT, FcCompareCharSet, 2, 2 }, +#define MATCH_CHARSET 2 + { FC_FAMILY_OBJECT, FcCompareFamily, 3, 5 }, +#define MATCH_FAMILY 3 + { FC_LANG_OBJECT, FcCompareLang, 4, 4 }, +#define MATCH_LANG 4 +#define MATCH_LANG_INDEX 4 + { FC_SPACING_OBJECT, FcCompareNumber, 6, 6 }, +#define MATCH_SPACING 5 + { FC_PIXEL_SIZE_OBJECT, FcCompareSize, 7, 7 }, +#define MATCH_PIXEL_SIZE 6 + { FC_STYLE_OBJECT, FcCompareString, 8, 8 }, +#define MATCH_STYLE 7 + { FC_SLANT_OBJECT, FcCompareNumber, 9, 9 }, +#define MATCH_SLANT 8 + { FC_WEIGHT_OBJECT, FcCompareNumber, 10, 10 }, +#define MATCH_WEIGHT 9 + { FC_WIDTH_OBJECT, FcCompareNumber, 11, 11 }, +#define MATCH_WIDTH 10 + { FC_DECORATIVE_OBJECT, FcCompareBool, 12, 12 }, +#define MATCH_DECORATIVE 11 + { FC_ANTIALIAS_OBJECT, FcCompareBool, 13, 13 }, +#define MATCH_ANTIALIAS 12 + { FC_RASTERIZER_OBJECT, FcCompareString, 14, 14 }, +#define MATCH_RASTERIZER 13 + { FC_OUTLINE_OBJECT, FcCompareBool, 15, 15 }, +#define MATCH_OUTLINE 14 + { FC_FONTVERSION_OBJECT, FcCompareNumber, 16, 16 }, +#define MATCH_FONTVERSION 15 }; -#define NUM_MATCH_VALUES 16 +#define NUM_MATCH_VALUES 17 static const FcMatcher* FcObjectToMatcher (FcObject object) @@ -228,6 +246,8 @@ FcObjectToMatcher (FcObject object) i = -1; switch (object) { + case FC_FILE_OBJECT: + i = MATCH_FILE; break; case FC_FOUNDRY_OBJECT: i = MATCH_FOUNDRY; break; case FC_FONTVERSION_OBJECT: diff --git a/fontconfig/src/fcstr.c b/fontconfig/src/fcstr.c index b712e5daf..a6f0ba766 100644 --- a/fontconfig/src/fcstr.c +++ b/fontconfig/src/fcstr.c @@ -26,6 +26,9 @@ #include <stdlib.h> #include <ctype.h> #include <string.h> +#ifdef HAVE_REGEX_H +#include <regex.h> +#endif #ifdef _WIN32 #include <windows.h> #endif @@ -269,6 +272,55 @@ FcStrCmp (const FcChar8 *s1, const FcChar8 *s2) return (int) c1 - (int) c2; } +#ifdef USE_REGEX +static FcBool +_FcStrRegexCmp (const FcChar8 *s, const FcChar8 *regex, int cflags, int eflags) +{ + int ret = -1; + regex_t reg; + + if ((ret = regcomp (®, (const char *)regex, cflags)) != 0) + { + if (FcDebug () & FC_DBG_MATCHV) + { + char buf[512]; + + regerror (ret, ®, buf, 512); + printf("Regexp compile error: %s\n", buf); + } + return FcFalse; + } + ret = regexec (®, (const char *)s, 0, NULL, eflags); + if (ret != 0) + { + if (FcDebug () & FC_DBG_MATCHV) + { + char buf[512]; + + regerror (ret, ®, buf, 512); + printf("Regexp exec error: %s\n", buf); + } + } + regfree (®); + + return ret == 0 ? FcTrue : FcFalse; +} +#else +# define _FcStrRegexCmp(_s_, _regex_) (FcFalse) +#endif + +FcBool +FcStrRegexCmp (const FcChar8 *s, const FcChar8 *regex) +{ + return _FcStrRegexCmp (s, regex, REG_EXTENDED | REG_NOSUB, 0); +} + +FcBool +FcStrRegexCmpIgnoreCase (const FcChar8 *s, const FcChar8 *regex) +{ + return _FcStrRegexCmp (s, regex, REG_EXTENDED | REG_NOSUB | REG_ICASE, 0); +} + /* * Return a hash value for a string */ diff --git a/fontconfig/src/fcxml.c b/fontconfig/src/fcxml.c index b8701470c..708e131f9 100644 --- a/fontconfig/src/fcxml.c +++ b/fontconfig/src/fcxml.c @@ -2323,11 +2323,7 @@ FcEndElement(void *userData, const XML_Char *name) { int rc; data = buffer; -#if _WIN32_WINNT >= 0x0500 - rc = GetSystemWindowsDirectory (buffer, sizeof (buffer) - 20); -#else - rc = GetWindowsDirectory (buffer, sizeof (buffer) - 20); -#endif + rc = pGetSystemWindowsDirectory (buffer, sizeof (buffer) - 20); if (rc == 0 || rc > sizeof (buffer) - 20) { FcConfigMessage (parse, FcSevereError, "GetSystemWindowsDirectory failed"); @@ -2377,6 +2373,27 @@ FcEndElement(void *userData, const XML_Char *name) strcat (data, "\\"); strcat (data, "fontconfig\\cache"); } + else if (strcmp (data, "LOCAL_APPDATA_FONTCONFIG_CACHE") == 0) + { + char szFPath[MAX_PATH + 1]; + size_t len; + FcStrFree (data); + if (!(pSHGetFolderPathA && SUCCEEDED(pSHGetFolderPathA(NULL, /* CSIDL_LOCAL_APPDATA */ 28, NULL, 0, szFPath)))) + { + FcConfigMessage (parse, FcSevereError, "SHGetFolderPathA failed"); + break; + } + strncat(szFPath, "\\fontconfig\\cache", MAX_PATH - 1 - strlen(szFPath)); + len = strlen(szFPath) + 1; + data = malloc(len); + if (!data) + { + FcConfigMessage (parse, FcSevereError, "out of memory"); + break; + } + FcMemAlloc (FC_MEM_STRING, len); + strncpy(data, szFPath, len); + } #endif if (!FcStrUsesHome (data) || FcConfigHome ()) { @@ -2690,6 +2707,11 @@ bail0: return ret || !complain; } +#ifdef _WIN32 +pfnGetSystemWindowsDirectory pGetSystemWindowsDirectory = NULL; +pfnSHGetFolderPathA pSHGetFolderPathA = NULL; +#endif + FcBool FcConfigParseAndLoad (FcConfig *config, const FcChar8 *name, @@ -2710,6 +2732,22 @@ FcConfigParseAndLoad (FcConfig *config, void *buf; #endif +#ifdef _WIN32 + if (!pGetSystemWindowsDirectory) + { + HMODULE hk32 = GetModuleHandleA("kernel32.dll"); + if (!(pGetSystemWindowsDirectory = (pfnGetSystemWindowsDirectory) GetProcAddress(hk32, "GetSystemWindowsDirectoryA"))) + pGetSystemWindowsDirectory = (pfnGetSystemWindowsDirectory) GetWindowsDirectory; + } + if (!pSHGetFolderPathA) + { + HMODULE hSh = LoadLibraryA("shfolder.dll"); + /* the check is done later, because there is no provided fallback */ + if (hSh) + pSHGetFolderPathA = (pfnSHGetFolderPathA) GetProcAddress(hSh, "SHGetFolderPathA"); + } +#endif + filename = FcConfigFilename (name); if (!filename) goto bail0; diff --git a/mesalib/configure.ac b/mesalib/configure.ac index 21e4308fa..65d358e0a 100644 --- a/mesalib/configure.ac +++ b/mesalib/configure.ac @@ -82,18 +82,6 @@ solaris*) ;; esac -AC_PATH_PROG([GTESTCONFIG], [gtest-config]) -if test "x$GTESTCONFIG" != "x"; then - GTEST_CFLAGS=`gtest-config --cppflags --cxxflags` - GTEST_LIBS=`gtest-config --ldflags --libs` - AC_SUBST([GTEST_CFLAGS]) - AC_SUBST([GTEST_LIBS]) - HAVE_GTEST=yes -else - HAVE_GTEST=no -fi -AM_CONDITIONAL(HAVE_GTEST, test x$HAVE_GTEST = xyes) - dnl clang is mostly GCC-compatible, but its version is much lower, dnl so we have to check for it. AC_MSG_CHECKING([if compiling with clang]) @@ -794,7 +782,7 @@ dnl dnl this variable will be prepended to SRC_DIRS and is not exported CORE_DIRS="" -SRC_DIRS="" +SRC_DIRS="gtest" GLU_DIRS="sgi" GALLIUM_DIRS="auxiliary drivers state_trackers" GALLIUM_TARGET_DIRS="" @@ -1999,6 +1987,7 @@ AC_CONFIG_FILES([configs/autoconf src/egl/wayland/wayland-drm/Makefile src/glx/Makefile src/mapi/shared-glapi/Makefile + src/gtest/Makefile src/mesa/drivers/dri/dri.pc src/mesa/drivers/dri/Makefile src/mesa/drivers/dri/common/Makefile diff --git a/mesalib/docs/viewperf.html b/mesalib/docs/viewperf.html index bb3852734..c294255ac 100644 --- a/mesalib/docs/viewperf.html +++ b/mesalib/docs/viewperf.html @@ -67,7 +67,7 @@ Subsequent drawing calls become no-ops and the rendering is incorrect. -<h2>sw-02 tests 1, 2, 4</h2> +<h2>sw-02 tests 1, 2, 4, 6</h2> <p> These tests depend on the @@ -81,6 +81,19 @@ be incorrect and the test will fail. </p> + +<h2>sw-02 test 6</h2> + +<p> +The lines drawn in this test appear in a random color. +That's because texture mapping is enabled when the lines are drawn, but no +texture image is defined (glTexImage2D() is called with pixels=NULL). +Since GL says the contents of the texture image are undefined in that +situation, we get a random color. +</p> + + + <h2>Lightwave-01 test 3</h2> <p> diff --git a/mesalib/src/glsl/Makefile.sources b/mesalib/src/glsl/Makefile.sources index 06728daf7..15f5e1f50 100644 --- a/mesalib/src/glsl/Makefile.sources +++ b/mesalib/src/glsl/Makefile.sources @@ -62,6 +62,7 @@ LIBGLSL_CXX_FILES := \ lower_vector.cpp \ lower_output_reads.cpp \ opt_algebraic.cpp \ + opt_array_splitting.cpp \ opt_constant_folding.cpp \ opt_constant_propagation.cpp \ opt_constant_variable.cpp \ diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp index 6547ad2d3..ae7a365f4 100644 --- a/mesalib/src/glsl/glsl_parser_extras.cpp +++ b/mesalib/src/glsl/glsl_parser_extras.cpp @@ -1044,6 +1044,7 @@ do_common_optimization(exec_list *ir, bool linked, progress = do_swizzle_swizzle(ir) || progress; progress = do_noop_swizzle(ir) || progress; + progress = optimize_split_arrays(ir, linked) || progress; progress = optimize_redundant_jumps(ir) || progress; loop_state *ls = analyze_loop_variables(ir); diff --git a/mesalib/src/glsl/ir_optimization.h b/mesalib/src/glsl/ir_optimization.h index 085b96903..356783583 100644 --- a/mesalib/src/glsl/ir_optimization.h +++ b/mesalib/src/glsl/ir_optimization.h @@ -74,6 +74,7 @@ bool lower_quadop_vector(exec_list *instructions, bool dont_lower_swz); bool lower_clip_distance(exec_list *instructions); void lower_output_reads(exec_list *instructions); bool optimize_redundant_jumps(exec_list *instructions); +bool optimize_split_arrays(exec_list *instructions, bool linked); ir_rvalue * compare_index_block(exec_list *instructions, ir_variable *index, diff --git a/mesalib/src/glsl/opt_array_splitting.cpp b/mesalib/src/glsl/opt_array_splitting.cpp new file mode 100644 index 000000000..f11b51631 --- /dev/null +++ b/mesalib/src/glsl/opt_array_splitting.cpp @@ -0,0 +1,384 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file opt_array_splitting.cpp + * + * If an array is always dereferenced with a constant index, then + * split it apart into its elements, making it more amenable to other + * optimization passes. + * + * This skips uniform/varying arrays, which would need careful + * handling due to their ir->location fields tying them to the GL API + * and other shader stages. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_rvalue_visitor.h" +#include "ir_print_visitor.h" +#include "glsl_types.h" + +static bool debug = false; + +namespace opt_array_splitting { + +class variable_entry : public exec_node +{ +public: + variable_entry(ir_variable *var) + { + this->var = var; + this->whole_array_access = 0; + this->declaration = false; + this->components = NULL; + this->mem_ctx = NULL; + if (var->type->is_array()) + this->size = var->type->length; + else + this->size = var->type->matrix_columns; + } + + ir_variable *var; /* The key: the variable's pointer. */ + unsigned size; /* array length or matrix columns */ + + /** Number of times the variable is referenced, including assignments. */ + unsigned whole_array_access; + + bool declaration; /* If the variable had a decl in the instruction stream */ + + ir_variable **components; + + /** ralloc_parent(this->var) -- the shader's talloc context. */ + void *mem_ctx; +}; + +} /* namespace */ +using namespace opt_array_splitting; + +/** + * This class does a walk over the tree, coming up with the set of + * variables that could be split by looking to see if they are arrays + * that are only ever constant-index dereferenced. + */ +class ir_array_reference_visitor : public ir_hierarchical_visitor { +public: + ir_array_reference_visitor(void) + { + this->mem_ctx = ralloc_context(NULL); + this->variable_list.make_empty(); + } + + ~ir_array_reference_visitor(void) + { + ralloc_free(mem_ctx); + } + + bool get_split_list(exec_list *instructions, bool linked); + + virtual ir_visitor_status visit(ir_variable *); + virtual ir_visitor_status visit(ir_dereference_variable *); + virtual ir_visitor_status visit_enter(ir_dereference_array *); + + variable_entry *get_variable_entry(ir_variable *var); + + /* List of variable_entry */ + exec_list variable_list; + + void *mem_ctx; +}; + +variable_entry * +ir_array_reference_visitor::get_variable_entry(ir_variable *var) +{ + assert(var); + + if (var->mode != ir_var_auto && + var->mode != ir_var_temporary) + return NULL; + + if (!(var->type->is_array() || var->type->is_matrix())) + return NULL; + + /* If the array hasn't been sized yet, we can't split it. After + * linking, this should be resolved. + */ + if (var->type->is_array() && var->type->length == 0) + return NULL; + + foreach_iter(exec_list_iterator, iter, this->variable_list) { + variable_entry *entry = (variable_entry *)iter.get(); + if (entry->var == var) + return entry; + } + + variable_entry *entry = new(mem_ctx) variable_entry(var); + this->variable_list.push_tail(entry); + return entry; +} + + +ir_visitor_status +ir_array_reference_visitor::visit(ir_variable *ir) +{ + variable_entry *entry = this->get_variable_entry(ir); + + if (entry) + entry->declaration = true; + + return visit_continue; +} + +ir_visitor_status +ir_array_reference_visitor::visit(ir_dereference_variable *ir) +{ + variable_entry *entry = this->get_variable_entry(ir->var); + + /* If we made it to here, then the dereference of this array didn't + * have a constant index (see the visit_continue_with_parent + * below), so we can't split the variable. + */ + if (entry) + entry->whole_array_access++; + + return visit_continue; +} + +ir_visitor_status +ir_array_reference_visitor::visit_enter(ir_dereference_array *ir) +{ + ir_dereference_variable *deref = ir->array->as_dereference_variable(); + if (!deref) + return visit_continue; + + variable_entry *entry = this->get_variable_entry(deref->var); + + if (entry && !ir->array_index->as_constant()) + entry->whole_array_access++; + + return visit_continue_with_parent; +} + +bool +ir_array_reference_visitor::get_split_list(exec_list *instructions, + bool linked) +{ + visit_list_elements(this, instructions); + + /* If the shaders aren't linked yet, we can't mess with global + * declarations, which need to be matched by name across shaders. + */ + if (!linked) { + foreach_list(node, instructions) { + ir_variable *var = ((ir_instruction *)node)->as_variable(); + if (var) { + variable_entry *entry = get_variable_entry(var); + if (entry) + entry->remove(); + } + } + } + + /* Trim out variables we found that we can't split. */ + foreach_iter(exec_list_iterator, iter, variable_list) { + variable_entry *entry = (variable_entry *)iter.get(); + + if (debug) { + printf("array %s@%p: decl %d, whole_access %d\n", + entry->var->name, (void *) entry->var, entry->declaration, + entry->whole_array_access); + } + + if (!entry->declaration || entry->whole_array_access) { + entry->remove(); + } + } + + return !variable_list.is_empty(); +} + +/** This is the class that does the actual work of splitting. */ +class ir_array_splitting_visitor : public ir_rvalue_visitor { +public: + ir_array_splitting_visitor(exec_list *vars) + { + this->variable_list = vars; + } + + virtual ~ir_array_splitting_visitor() + { + } + + virtual ir_visitor_status visit_leave(ir_assignment *); + + void split_deref(ir_dereference **deref); + void handle_rvalue(ir_rvalue **rvalue); + variable_entry *get_splitting_entry(ir_variable *var); + + exec_list *variable_list; + void *mem_ctx; +}; + +variable_entry * +ir_array_splitting_visitor::get_splitting_entry(ir_variable *var) +{ + assert(var); + + foreach_iter(exec_list_iterator, iter, *this->variable_list) { + variable_entry *entry = (variable_entry *)iter.get(); + if (entry->var == var) { + return entry; + } + } + + return NULL; +} + +void +ir_array_splitting_visitor::split_deref(ir_dereference **deref) +{ + ir_dereference_array *deref_array = (*deref)->as_dereference_array(); + if (!deref_array) + return; + + ir_dereference_variable *deref_var = deref_array->array->as_dereference_variable(); + if (!deref_var) + return; + ir_variable *var = deref_var->var; + + variable_entry *entry = get_splitting_entry(var); + if (!entry) + return; + + ir_constant *constant = deref_array->array_index->as_constant(); + assert(constant); + + if (constant->value.i[0] < (int)entry->size) { + *deref = new(entry->mem_ctx) + ir_dereference_variable(entry->components[constant->value.i[0]]); + } else { + /* There was a constant array access beyond the end of the + * array. This might have happened due to constant folding + * after the initial parse. This produces an undefined value, + * but shouldn't crash. Just give them an uninitialized + * variable. + */ + ir_variable *temp = new(entry->mem_ctx) ir_variable(deref_array->type, + "undef", + ir_var_temporary); + entry->components[0]->insert_before(temp); + *deref = new(entry->mem_ctx) ir_dereference_variable(temp); + } +} + +void +ir_array_splitting_visitor::handle_rvalue(ir_rvalue **rvalue) +{ + if (!*rvalue) + return; + + ir_dereference *deref = (*rvalue)->as_dereference(); + + if (!deref) + return; + + split_deref(&deref); + *rvalue = deref; +} + +ir_visitor_status +ir_array_splitting_visitor::visit_leave(ir_assignment *ir) +{ + /* The normal rvalue visitor skips the LHS of assignments, but we + * need to process those just the same. + */ + ir_rvalue *lhs = ir->lhs; + + handle_rvalue(&lhs); + ir->lhs = lhs->as_dereference(); + + ir->lhs->accept(this); + + handle_rvalue(&ir->rhs); + ir->rhs->accept(this); + + if (ir->condition) { + handle_rvalue(&ir->condition); + ir->condition->accept(this); + } + + return visit_continue; +} + +bool +optimize_split_arrays(exec_list *instructions, bool linked) +{ + ir_array_reference_visitor refs; + if (!refs.get_split_list(instructions, linked)) + return false; + + void *mem_ctx = ralloc_context(NULL); + + /* Replace the decls of the arrays to be split with their split + * components. + */ + foreach_iter(exec_list_iterator, iter, refs.variable_list) { + variable_entry *entry = (variable_entry *)iter.get(); + const struct glsl_type *type = entry->var->type; + const struct glsl_type *subtype; + + if (type->is_matrix()) + subtype = glsl_type::get_instance(GLSL_TYPE_FLOAT, + type->vector_elements, 1); + else + subtype = type->fields.array; + + entry->mem_ctx = ralloc_parent(entry->var); + + entry->components = ralloc_array(mem_ctx, + ir_variable *, + entry->size); + + for (unsigned int i = 0; i < entry->size; i++) { + const char *name = ralloc_asprintf(mem_ctx, "%s_%d", + entry->var->name, i); + + entry->components[i] = + new(entry->mem_ctx) ir_variable(subtype, name, ir_var_temporary); + entry->var->insert_before(entry->components[i]); + } + + entry->var->remove(); + } + + ir_array_splitting_visitor split(&refs.variable_list); + visit_list_elements(&split, instructions); + + if (debug) + _mesa_print_ir(instructions, NULL); + + ralloc_free(mem_ctx); + + return true; + +} diff --git a/mesalib/src/mapi/Android.mk b/mesalib/src/mapi/Android.mk index b75361f46..d1749a262 100644 --- a/mesalib/src/mapi/Android.mk +++ b/mesalib/src/mapi/Android.mk @@ -25,9 +25,6 @@ LOCAL_PATH := $(call my-dir) -# get MAPI_GLAPI_FILES -include $(LOCAL_PATH)/mapi/sources.mak - mapi_abi_headers := # --------------------------------------- @@ -38,7 +35,13 @@ include $(CLEAR_VARS) abi_header := shared-glapi/glapi_mapi_tmp.h -LOCAL_SRC_FILES := $(MAPI_GLAPI_FILES) +LOCAL_SRC_FILES := \ + mapi/entry.c \ + mapi/mapi_glapi.c \ + mapi/stub.c \ + mapi/table.c \ + mapi/u_current.c \ + mapi/u_execmem.c LOCAL_CFLAGS := \ -DMAPI_MODE_GLAPI \ diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c index ada42c515..33aa3b7dc 100644 --- a/mesalib/src/mesa/main/bufferobj.c +++ b/mesalib/src/mesa/main/bufferobj.c @@ -347,6 +347,36 @@ _mesa_initialize_buffer_object( struct gl_context *ctx, } + +/** + * Callback called from _mesa_HashWalk() + */ +static void +count_buffer_size(GLuint key, void *data, void *userData) +{ + const struct gl_buffer_object *bufObj = + (const struct gl_buffer_object *) data; + GLuint *total = (GLuint *) userData; + + *total = *total + bufObj->Size; +} + + +/** + * Compute total size (in bytes) of all buffer objects for the given context. + * For debugging purposes. + */ +GLuint +_mesa_total_buffer_object_memory(struct gl_context *ctx) +{ + GLuint total = 0; + + _mesa_HashWalk(ctx->Shared->BufferObjects, count_buffer_size, &total); + + return total; +} + + /** * Allocate space for and store data in a buffer object. Any data that was * previously stored in the buffer object is lost. If \c data is \c NULL, diff --git a/mesalib/src/mesa/main/bufferobj.h b/mesalib/src/mesa/main/bufferobj.h index a7ce37928..66343c3cd 100644 --- a/mesalib/src/mesa/main/bufferobj.h +++ b/mesalib/src/mesa/main/bufferobj.h @@ -89,6 +89,8 @@ _mesa_reference_buffer_object(struct gl_context *ctx, _mesa_reference_buffer_object_(ctx, ptr, bufObj); } +extern GLuint +_mesa_total_buffer_object_memory(struct gl_context *ctx); extern void _mesa_init_buffer_object_functions(struct dd_function_table *driver); diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c index 4c3eed2b6..155b255a7 100644 --- a/mesalib/src/mesa/main/texobj.c +++ b/mesalib/src/mesa/main/texobj.c @@ -841,6 +841,65 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex) } +/** + * Compute the size of the given texture object, in bytes. + */ +static GLuint +texture_size(const struct gl_texture_object *texObj) +{ + const GLuint numFaces = texObj->Target == GL_TEXTURE_CUBE_MAP ? 6 : 1; + GLuint face, level, size = 0; + + for (face = 0; face < numFaces; face++) { + for (level = 0; level < MAX_TEXTURE_LEVELS; level++) { + const struct gl_texture_image *img = texObj->Image[face][level]; + if (img) { + GLuint sz = _mesa_format_image_size(img->TexFormat, img->Width, + img->Height, img->Depth); + size += sz; + } + } + } + + return size; +} + + +/** + * Callback called from _mesa_HashWalk() + */ +static void +count_tex_size(GLuint key, void *data, void *userData) +{ + const struct gl_texture_object *texObj = + (const struct gl_texture_object *) data; + GLuint *total = (GLuint *) userData; + + *total = *total + texture_size(texObj); +} + + +/** + * Compute total size (in bytes) of all textures for the given context. + * For debugging purposes. + */ +GLuint +_mesa_total_texture_memory(struct gl_context *ctx) +{ + GLuint tgt, total = 0; + + _mesa_HashWalk(ctx->Shared->TexObjects, count_tex_size, &total); + + /* plus, the default texture objects */ + for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) { + total += texture_size(ctx->Shared->DefaultTex[tgt]); + } + + return total; +} + + + /*@}*/ diff --git a/mesalib/src/mesa/main/texobj.h b/mesalib/src/mesa/main/texobj.h index c020b9013..23e1ade09 100644 --- a/mesalib/src/mesa/main/texobj.h +++ b/mesalib/src/mesa/main/texobj.h @@ -112,6 +112,9 @@ _mesa_dirty_texobj(struct gl_context *ctx, struct gl_texture_object *texObj, extern struct gl_texture_object * _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex); +extern GLuint +_mesa_total_texture_memory(struct gl_context *ctx); + extern void _mesa_unlock_context_textures( struct gl_context *ctx ); diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index 6f4a095dd..840648e04 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -2358,7 +2358,7 @@ class add_uniform_to_shader : public uniform_field_visitor { public: add_uniform_to_shader(struct gl_shader_program *shader_program, struct gl_program_parameter_list *params) - : shader_program(shader_program), params(params) + : shader_program(shader_program), params(params), idx(-1) { /* empty */ } diff --git a/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c b/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c index 6e2a8e9b2..68c4b583f 100644 --- a/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c +++ b/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c @@ -75,8 +75,7 @@ static unsigned char XF86VidModeReqCode = 0; #ifdef XF86VIDMODE_EVENTS static int XF86VidModeEventBase = 0; -static void SXF86VidModeNotifyEvent(); -xXF86VidModeNotifyEvent * /* from */ , xXF86VidModeNotifyEvent * /* to */ +static void SXF86VidModeNotifyEvent(xXF86VidModeNotifyEvent * /* from */ , xXF86VidModeNotifyEvent * /* to */ ); static RESTYPE EventType; /* resource type for event masks */ @@ -117,20 +116,22 @@ static DevPrivateKeyRec ScreenPrivateKeyRec; #define DEBUG_P(x) /**/ #endif static int - ClientMajorVersion(ClientPtr client) { +ClientMajorVersion(ClientPtr client) +{ VidModePrivPtr pPriv; - pPriv = VM_GETPRIV(client); + pPriv = VM_GETPRIV(client); if (!pPriv) - return 0; + return 0; else - return pPriv->major; + return pPriv->major; } + #ifdef XF86VIDMODE_EVENTS static void - CheckScreenPrivate(pScreen) +CheckScreenPrivate(pScreen) ScreenPtr - pScreen; + pScreen; { SetupScreen(pScreen); @@ -142,9 +143,10 @@ ScreenPtr } } -static XF86VidModeScreenPrivatePtr MakeScreenPrivate(pScreen) +static XF86VidModeScreenPrivatePtr +MakeScreenPrivate(pScreen) ScreenPtr - pScreen; + pScreen; { SetupScreen(pScreen); @@ -160,18 +162,22 @@ ScreenPtr } static unsigned long - getEventMask(ScreenPtr pScreen, ClientPtr client) { +getEventMask(ScreenPtr pScreen, ClientPtr client) +{ SetupScreen(pScreen); XF86VidModeEventPtr pEv; if (!pPriv) - return 0; + return 0; for (pEv = pPriv->events; pEv; pEv = pEv->next) if (pEv->client == client) return pEv->mask; - return 0; -} static Bool - setEventMask(ScreenPtr pScreen, ClientPtr client, unsigned long mask) { + return 0; +} + +static Bool +setEventMask(ScreenPtr pScreen, ClientPtr client, unsigned long mask) +{ SetupScreen(pScreen); XF86VidModeEventPtr pEv, *pPrev; @@ -181,7 +187,8 @@ static unsigned long pPriv = MakeScreenPrivate(pScreen); if (!pPriv) return FALSE; - } for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next) + } + for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next) if (pEv->client == client) break; if (mask == 0) { @@ -208,38 +215,43 @@ static unsigned long } static int - XF86VidModeFreeEvents(pointer value, XID id) { +XF86VidModeFreeEvents(pointer value, XID id) +{ XF86VidModeEventPtr pOld = (XF86VidModeEventPtr) value; ScreenPtr pScreen = pOld->screen; - SetupScreen(pScreen); + + SetupScreen(pScreen); XF86VidModeEventPtr pEv, *pPrev; if (!pPriv) - return TRUE; + return TRUE; for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next) if (pEv == pOld) break; if (!pEv) - return TRUE; + return TRUE; *pPrev = pEv->next; - free(pEv); - CheckScreenPrivate(pScreen); - return TRUE; -} static void - SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced) { + free(pEv); + CheckScreenPrivate(pScreen); + return TRUE; +} + +static void +SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced) +{ XF86VidModeScreenPrivatePtr pPriv; XF86VidModeEventPtr pEv; unsigned long mask; xXF86VidModeNotifyEvent ev; int kind; - UpdateCurrentTimeIf(); - mask = XF86VidModeNotifyMask; - pScreen = screenInfo.screens[pScreen->myNum]; - pPriv = GetScreenPrivate(pScreen); + UpdateCurrentTimeIf(); + mask = XF86VidModeNotifyMask; + pScreen = screenInfo.screens[pScreen->myNum]; + pPriv = GetScreenPrivate(pScreen); if (!pPriv) - return; - kind = XF86VidModeModeChange; + return; + kind = XF86VidModeModeChange; for (pEv = pPriv->events; pEv; pEv = pEv->next) { if (!(pEv->mask & mask)) continue; @@ -251,8 +263,10 @@ static int ev.forced = forced; WriteEventsToClient(pEv->client, 1, (xEvent *) &ev); }} static void - SXF86VidModeNotifyEvent(xXF86VidModeNotifyEvent * from, - xXF86VidModeNotifyEvent * to) { + +SXF86VidModeNotifyEvent(xXF86VidModeNotifyEvent * from, + xXF86VidModeNotifyEvent * to) +{ to->type = from->type; to->state = from->state; cpswaps(from->sequenceNumber, to->sequenceNumber); @@ -264,29 +278,31 @@ static int #endif static int - ProcXF86VidModeQueryVersion(ClientPtr client) { +ProcXF86VidModeQueryVersion(ClientPtr client) +{ xXF86VidModeQueryVersionReply rep; - DEBUG_P("XF86VidModeQueryVersion"); + DEBUG_P("XF86VidModeQueryVersion"); - REQUEST_SIZE_MATCH(xXF86VidModeQueryVersionReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.majorVersion = SERVER_XF86VIDMODE_MAJOR_VERSION; - rep.minorVersion = SERVER_XF86VIDMODE_MINOR_VERSION; + REQUEST_SIZE_MATCH(xXF86VidModeQueryVersionReq); + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.majorVersion = SERVER_XF86VIDMODE_MAJOR_VERSION; + rep.minorVersion = SERVER_XF86VIDMODE_MINOR_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.majorVersion); swaps(&rep.minorVersion); - } WriteToClient(client, sizeof(xXF86VidModeQueryVersionReply), - (char *) &rep); + } + WriteToClient(client, sizeof(xXF86VidModeQueryVersionReply), (char *) &rep); return Success; } static int - ProcXF86VidModeGetModeLine(ClientPtr client) { +ProcXF86VidModeGetModeLine(ClientPtr client) +{ REQUEST(xXF86VidModeGetModeLineReq); xXF86VidModeGetModeLineReply rep; xXF86OldVidModeGetModeLineReply oldrep; @@ -294,11 +310,11 @@ static int int dotClock; int ver; - DEBUG_P("XF86VidModeGetModeline"); + DEBUG_P("XF86VidModeGetModeline"); - ver = ClientMajorVersion(client); - REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq); - rep.type = X_Reply; + ver = ClientMajorVersion(client); + REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq); + rep.type = X_Reply; if (ver < 2) { rep.length = bytes_to_int32(SIZEOF(xXF86OldVidModeGetModeLineReply) - SIZEOF(xGenericReply)); @@ -386,7 +402,8 @@ static int } static int - ProcXF86VidModeGetAllModeLines(ClientPtr client) { +ProcXF86VidModeGetAllModeLines(ClientPtr client) +{ REQUEST(xXF86VidModeGetAllModeLinesReq); xXF86VidModeGetAllModeLinesReply rep; xXF86VidModeModeInfo mdinf; @@ -395,38 +412,39 @@ static int int modecount, dotClock; int ver; - DEBUG_P("XF86VidModeGetAllModelines"); + DEBUG_P("XF86VidModeGetAllModelines"); - REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq); + REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq); if (stuff->screen >= screenInfo.numScreens) - return BadValue; + return BadValue; - ver = ClientMajorVersion(client); + ver = ClientMajorVersion(client); - modecount = VidModeGetNumOfModes(stuff->screen); + modecount = VidModeGetNumOfModes(stuff->screen); if (modecount < 1) - return VidModeErrorBase + XF86VidModeExtensionDisabled; + return VidModeErrorBase + XF86VidModeExtensionDisabled; if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock)) - return BadValue; + return BadValue; - rep.type = X_Reply; - rep.length = SIZEOF(xXF86VidModeGetAllModeLinesReply) - + rep.type = X_Reply; + rep.length = SIZEOF(xXF86VidModeGetAllModeLinesReply) - SIZEOF(xGenericReply); if (ver < 2) - rep.length += modecount * sizeof(xXF86OldVidModeModeInfo); + rep.length += modecount * sizeof(xXF86OldVidModeModeInfo); else - rep.length += modecount * sizeof(xXF86VidModeModeInfo); - rep.length >>= 2; - rep.sequenceNumber = client->sequence; - rep.modecount = modecount; + rep.length += modecount * sizeof(xXF86VidModeModeInfo); + rep.length >>= 2; + rep.sequenceNumber = client->sequence; + rep.modecount = modecount; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.modecount); - } WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply), - (char *) &rep); + } + WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply), + (char *) &rep); do { mdinf.dotclock = dotClock; @@ -492,7 +510,8 @@ static int && VidModeGetModeValue(mode, VIDMODE_FLAGS) == stuff->flags ) static int - ProcXF86VidModeAddModeLine(ClientPtr client) { +ProcXF86VidModeAddModeLine(ClientPtr client) +{ REQUEST(xXF86VidModeAddModeLineReq); xXF86OldVidModeAddModeLineReq *oldstuff = (xXF86OldVidModeAddModeLineReq *) client->requestBuffer; @@ -502,9 +521,9 @@ static int int dotClock; int ver; - DEBUG_P("XF86VidModeAddModeline"); + DEBUG_P("XF86VidModeAddModeline"); - ver = ClientMajorVersion(client); + ver = ClientMajorVersion(client); if (ver < 2) { /* convert from old format */ stuff = &newstuff; @@ -533,7 +552,8 @@ static int stuff->after_vsyncend = oldstuff->after_vsyncend; stuff->after_vtotal = oldstuff->after_vtotal; stuff->after_flags = oldstuff->after_flags; - } if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) { + } + if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) { ErrorF("AddModeLine - scrn: %d clock: %ld\n", (int) stuff->screen, (unsigned long) stuff->dotclock); ErrorF("AddModeLine - hdsp: %d hbeg: %d hend: %d httl: %d\n", @@ -654,7 +674,8 @@ static int } static int - ProcXF86VidModeDeleteModeLine(ClientPtr client) { +ProcXF86VidModeDeleteModeLine(ClientPtr client) +{ REQUEST(xXF86VidModeDeleteModeLineReq); xXF86OldVidModeDeleteModeLineReq *oldstuff = (xXF86OldVidModeDeleteModeLineReq *) client->requestBuffer; @@ -663,9 +684,9 @@ static int int len, dotClock; int ver; - DEBUG_P("XF86VidModeDeleteModeline"); + DEBUG_P("XF86VidModeDeleteModeline"); - ver = ClientMajorVersion(client); + ver = ClientMajorVersion(client); if (ver < 2) { /* convert from old format */ stuff = &newstuff; @@ -683,7 +704,8 @@ static int stuff->vtotal = oldstuff->vtotal; stuff->flags = oldstuff->flags; stuff->privsize = oldstuff->privsize; - } if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) { + } + if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) { ErrorF("DeleteModeLine - scrn: %d clock: %ld\n", (int) stuff->screen, (unsigned long) stuff->dotclock); ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n", @@ -777,7 +799,8 @@ static int } static int - ProcXF86VidModeModModeLine(ClientPtr client) { +ProcXF86VidModeModModeLine(ClientPtr client) +{ REQUEST(xXF86VidModeModModeLineReq); xXF86OldVidModeModModeLineReq *oldstuff = (xXF86OldVidModeModModeLineReq *) client->requestBuffer; @@ -786,9 +809,9 @@ static int int len, dotClock; int ver; - DEBUG_P("XF86VidModeModModeline"); + DEBUG_P("XF86VidModeModModeline"); - ver = ClientMajorVersion(client); + ver = ClientMajorVersion(client); if (ver < 2) { /* convert from old format */ stuff = &newstuff; @@ -805,7 +828,8 @@ static int stuff->vtotal = oldstuff->vtotal; stuff->flags = oldstuff->flags; stuff->privsize = oldstuff->privsize; - } if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) { + } + if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) { ErrorF("ModModeLine - scrn: %d hdsp: %d hbeg: %d hend: %d httl: %d\n", (int) stuff->screen, stuff->hdisplay, stuff->hsyncstart, stuff->hsyncend, stuff->htotal); @@ -903,7 +927,8 @@ static int } static int - ProcXF86VidModeValidateModeLine(ClientPtr client) { +ProcXF86VidModeValidateModeLine(ClientPtr client) +{ REQUEST(xXF86VidModeValidateModeLineReq); xXF86OldVidModeValidateModeLineReq *oldstuff = (xXF86OldVidModeValidateModeLineReq *) client->requestBuffer; @@ -913,9 +938,9 @@ static int int len, status, dotClock; int ver; - DEBUG_P("XF86VidModeValidateModeline"); + DEBUG_P("XF86VidModeValidateModeline"); - ver = ClientMajorVersion(client); + ver = ClientMajorVersion(client); if (ver < 2) { /* convert from old format */ stuff = &newstuff; @@ -933,7 +958,8 @@ static int stuff->vtotal = oldstuff->vtotal; stuff->flags = oldstuff->flags; stuff->privsize = oldstuff->privsize; - } if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) { + } + if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) { ErrorF("ValidateModeLine - scrn: %d clock: %ld\n", (int) stuff->screen, (unsigned long) stuff->dotclock); ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n", @@ -1022,7 +1048,8 @@ static int } static int - ProcXF86VidModeSwitchMode(ClientPtr client) { +ProcXF86VidModeSwitchMode(ClientPtr client) +{ REQUEST(xXF86VidModeSwitchModeReq); DEBUG_P("XF86VidModeSwitchMode"); @@ -1035,8 +1062,11 @@ static int VidModeZoomViewport(stuff->screen, (short) stuff->zoom); return Success; -} static int - ProcXF86VidModeSwitchToMode(ClientPtr client) { +} + +static int +ProcXF86VidModeSwitchToMode(ClientPtr client) +{ REQUEST(xXF86VidModeSwitchToModeReq); xXF86OldVidModeSwitchToModeReq *oldstuff = (xXF86OldVidModeSwitchToModeReq *) client->requestBuffer; @@ -1045,9 +1075,9 @@ static int int len, dotClock; int ver; - DEBUG_P("XF86VidModeSwitchToMode"); + DEBUG_P("XF86VidModeSwitchToMode"); - ver = ClientMajorVersion(client); + ver = ClientMajorVersion(client); if (ver < 2) { /* convert from old format */ stuff = &newstuff; @@ -1065,7 +1095,8 @@ static int stuff->vtotal = oldstuff->vtotal; stuff->flags = oldstuff->flags; stuff->privsize = oldstuff->privsize; - } if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) { + } + if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) { ErrorF("SwitchToMode - scrn: %d clock: %ld\n", (int) stuff->screen, (unsigned long) stuff->dotclock); ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n", @@ -1138,7 +1169,8 @@ static int } static int - ProcXF86VidModeLockModeSwitch(ClientPtr client) { +ProcXF86VidModeLockModeSwitch(ClientPtr client) +{ REQUEST(xXF86VidModeLockModeSwitchReq); REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq); @@ -1152,53 +1184,57 @@ static int return VidModeErrorBase + XF86VidModeZoomLocked; return Success; -} static int - ProcXF86VidModeGetMonitor(ClientPtr client) { +} + +static int +ProcXF86VidModeGetMonitor(ClientPtr client) +{ REQUEST(xXF86VidModeGetMonitorReq); xXF86VidModeGetMonitorReply rep; CARD32 *hsyncdata, *vsyncdata; int i, nHsync, nVrefresh; pointer monitor; - DEBUG_P("XF86VidModeGetMonitor"); + DEBUG_P("XF86VidModeGetMonitor"); - REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq); + REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq); if (stuff->screen >= screenInfo.numScreens) - return BadValue; + return BadValue; if (!VidModeGetMonitor(stuff->screen, &monitor)) - return BadValue; + return BadValue; - nHsync = VidModeGetMonitorValue(monitor, VIDMODE_MON_NHSYNC, 0).i; - nVrefresh = VidModeGetMonitorValue(monitor, VIDMODE_MON_NVREFRESH, 0).i; + nHsync = VidModeGetMonitorValue(monitor, VIDMODE_MON_NHSYNC, 0).i; + nVrefresh = VidModeGetMonitorValue(monitor, VIDMODE_MON_NVREFRESH, 0).i; - rep.type = X_Reply; + rep.type = X_Reply; if ((char *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr) - rep.vendorLength = strlen((char *) (VidModeGetMonitorValue(monitor, - VIDMODE_MON_VENDOR, - 0)).ptr); + rep.vendorLength = strlen((char *) (VidModeGetMonitorValue(monitor, + VIDMODE_MON_VENDOR, + 0)).ptr); else - rep.vendorLength = 0; + rep.vendorLength = 0; if ((char *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr) - rep.modelLength = strlen((char *) (VidModeGetMonitorValue(monitor, - VIDMODE_MON_MODEL, - 0)).ptr); + rep.modelLength = strlen((char *) (VidModeGetMonitorValue(monitor, + VIDMODE_MON_MODEL, + 0)).ptr); else - rep.modelLength = 0; - rep.length = + rep.modelLength = 0; + rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetMonitorReply) - SIZEOF(xGenericReply) + (nHsync + nVrefresh) * sizeof(CARD32) + pad_to_int32(rep.vendorLength) + pad_to_int32(rep.modelLength)); - rep.sequenceNumber = client->sequence; - rep.nhsync = nHsync; - rep.nvsync = nVrefresh; - hsyncdata = malloc(nHsync * sizeof(CARD32)); + rep.sequenceNumber = client->sequence; + rep.nhsync = nHsync; + rep.nvsync = nVrefresh; + hsyncdata = malloc(nHsync * sizeof(CARD32)); if (!hsyncdata) { return BadAlloc; - } vsyncdata = malloc(nVrefresh * sizeof(CARD32)); + } + vsyncdata = malloc(nVrefresh * sizeof(CARD32)); if (!vsyncdata) { free(hsyncdata); @@ -1208,19 +1244,18 @@ static int for (i = 0; i < nHsync; i++) { hsyncdata[i] = (unsigned short) (VidModeGetMonitorValue(monitor, VIDMODE_MON_HSYNC_LO, - i)). - f | (unsigned - short) (VidModeGetMonitorValue(monitor, VIDMODE_MON_HSYNC_HI, - i)).f << 16; + i)).f | + (unsigned + short) (VidModeGetMonitorValue(monitor, VIDMODE_MON_HSYNC_HI, + i)).f << 16; } for (i = 0; i < nVrefresh; i++) { vsyncdata[i] = (unsigned short) (VidModeGetMonitorValue(monitor, VIDMODE_MON_VREFRESH_LO, - i)). - f | (unsigned - short) (VidModeGetMonitorValue(monitor, - VIDMODE_MON_VREFRESH_HI, - i)).f << 16; + i)).f | + (unsigned + short) (VidModeGetMonitorValue(monitor, VIDMODE_MON_VREFRESH_HI, + i)).f << 16; } if (client->swapped) { @@ -1249,38 +1284,40 @@ static int } static int - ProcXF86VidModeGetViewPort(ClientPtr client) { +ProcXF86VidModeGetViewPort(ClientPtr client) +{ REQUEST(xXF86VidModeGetViewPortReq); xXF86VidModeGetViewPortReply rep; int x, y; - DEBUG_P("XF86VidModeGetViewPort"); + DEBUG_P("XF86VidModeGetViewPort"); - REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq); + REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq); if (stuff->screen >= screenInfo.numScreens) - return BadValue; + return BadValue; - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; - VidModeGetViewPort(stuff->screen, &x, &y); - rep.x = x; - rep.y = y; + VidModeGetViewPort(stuff->screen, &x, &y); + rep.x = x; + rep.y = y; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.x); swapl(&rep.y); - } WriteToClient(client, SIZEOF(xXF86VidModeGetViewPortReply), - (char *) &rep); + } + WriteToClient(client, SIZEOF(xXF86VidModeGetViewPortReply), (char *) &rep); return Success; } static int - ProcXF86VidModeSetViewPort(ClientPtr client) { +ProcXF86VidModeSetViewPort(ClientPtr client) +{ REQUEST(xXF86VidModeSetViewPortReq); DEBUG_P("XF86VidModeSetViewPort"); @@ -1294,8 +1331,11 @@ static int return BadValue; return Success; -} static int - ProcXF86VidModeGetDotClocks(ClientPtr client) { +} + +static int +ProcXF86VidModeGetDotClocks(ClientPtr client) +{ REQUEST(xXF86VidModeGetDotClocksReq); xXF86VidModeGetDotClocksReply rep; int n; @@ -1304,31 +1344,33 @@ static int int *Clocks = NULL; Bool ClockProg; - DEBUG_P("XF86VidModeGetDotClocks"); + DEBUG_P("XF86VidModeGetDotClocks"); - REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq); + REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq); if (stuff->screen >= screenInfo.numScreens) - return BadValue; + return BadValue; - numClocks = VidModeGetNumOfClocks(stuff->screen, &ClockProg); + numClocks = VidModeGetNumOfClocks(stuff->screen, &ClockProg); - rep.type = X_Reply; - rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetDotClocksReply) - - SIZEOF(xGenericReply) + numClocks); - rep.sequenceNumber = client->sequence; - rep.clocks = numClocks; - rep.maxclocks = MAXCLOCKS; - rep.flags = 0; + rep.type = X_Reply; + rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetDotClocksReply) + - SIZEOF(xGenericReply) + numClocks); + rep.sequenceNumber = client->sequence; + rep.clocks = numClocks; + rep.maxclocks = MAXCLOCKS; + rep.flags = 0; if (!ClockProg) { Clocks = malloc(numClocks * sizeof(int)); if (!Clocks) - return BadValue; + return BadValue; if (!VidModeGetClocks(stuff->screen, Clocks)) { free(Clocks); return BadValue; - }} if (ClockProg) { + } + } + if (ClockProg) { rep.flags |= CLKFLAG_PROGRAMABLE; } if (client->swapped) { @@ -1356,7 +1398,8 @@ static int } static int - ProcXF86VidModeSetGamma(ClientPtr client) { +ProcXF86VidModeSetGamma(ClientPtr client) +{ REQUEST(xXF86VidModeSetGammaReq); DEBUG_P("XF86VidModeSetGamma"); @@ -1372,79 +1415,89 @@ static int return BadValue; return Success; -} static int - ProcXF86VidModeGetGamma(ClientPtr client) { +} + +static int +ProcXF86VidModeGetGamma(ClientPtr client) +{ REQUEST(xXF86VidModeGetGammaReq); xXF86VidModeGetGammaReply rep; float red, green, blue; - DEBUG_P("XF86VidModeGetGamma"); + DEBUG_P("XF86VidModeGetGamma"); - REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq); + REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq); if (stuff->screen >= screenInfo.numScreens) - return BadValue; + return BadValue; - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; if (!VidModeGetGamma(stuff->screen, &red, &green, &blue)) - return BadValue; - rep.red = (CARD32) (red * 10000.); - rep.green = (CARD32) (green * 10000.); - rep.blue = (CARD32) (blue * 10000.); + return BadValue; + rep.red = (CARD32) (red * 10000.); + rep.green = (CARD32) (green * 10000.); + rep.blue = (CARD32) (blue * 10000.); if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.red); swapl(&rep.green); swapl(&rep.blue); - } WriteToClient(client, sizeof(xXF86VidModeGetGammaReply), (char *) &rep); + } + WriteToClient(client, sizeof(xXF86VidModeGetGammaReply), (char *) &rep); return Success; } static int - ProcXF86VidModeSetGammaRamp(ClientPtr client) { +ProcXF86VidModeSetGammaRamp(ClientPtr client) +{ CARD16 *r, *g, *b; int length; - REQUEST(xXF86VidModeSetGammaRampReq); + + REQUEST(xXF86VidModeSetGammaRampReq); if (stuff->screen >= screenInfo.numScreens) - return BadValue; + return BadValue; if (stuff->size != VidModeGetGammaRampSize(stuff->screen)) - return BadValue; + return BadValue; - length = (stuff->size + 1) & ~1; + length = (stuff->size + 1) & ~1; - REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length * 6); + REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length * 6); - r = (CARD16 *) &stuff[1]; - g = r + length; - b = g + length; + r = (CARD16 *) &stuff[1]; + g = r + length; + b = g + length; if (!VidModeSetGammaRamp(stuff->screen, stuff->size, r, g, b)) - return BadValue; + return BadValue; - return Success; -} static int - ProcXF86VidModeGetGammaRamp(ClientPtr client) { + return Success; +} + +static int +ProcXF86VidModeGetGammaRamp(ClientPtr client) +{ CARD16 *ramp = NULL; int length; size_t ramplen = 0; xXF86VidModeGetGammaRampReply rep; - REQUEST(xXF86VidModeGetGammaRampReq); + + REQUEST(xXF86VidModeGetGammaRampReq); if (stuff->screen >= screenInfo.numScreens) - return BadValue; + return BadValue; if (stuff->size != VidModeGetGammaRampSize(stuff->screen)) - return BadValue; + return BadValue; - REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq); + REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq); - length = (stuff->size + 1) & ~1; + length = (stuff->size + 1) & ~1; if (stuff->size) { ramplen = length * 3 * sizeof(CARD16); @@ -1455,7 +1508,9 @@ static int ramp, ramp + length, ramp + (length * 2))) { free(ramp); return BadValue; - }} rep.type = X_Reply; + } + } + rep.type = X_Reply; rep.length = (length >> 1) * 3; rep.sequenceNumber = client->sequence; rep.size = stuff->size; @@ -1476,47 +1531,53 @@ static int } static int - ProcXF86VidModeGetGammaRampSize(ClientPtr client) { +ProcXF86VidModeGetGammaRampSize(ClientPtr client) +{ xXF86VidModeGetGammaRampSizeReply rep; - REQUEST(xXF86VidModeGetGammaRampSizeReq); + + REQUEST(xXF86VidModeGetGammaRampSizeReq); if (stuff->screen >= screenInfo.numScreens) - return BadValue; + return BadValue; - REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq); + REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.size = VidModeGetGammaRampSize(stuff->screen); + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.size = VidModeGetGammaRampSize(stuff->screen); if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.size); - } WriteToClient(client, sizeof(xXF86VidModeGetGammaRampSizeReply), - (char *) &rep); + } + WriteToClient(client, sizeof(xXF86VidModeGetGammaRampSizeReply), + (char *) &rep); return Success; } static int - ProcXF86VidModeGetPermissions(ClientPtr client) { +ProcXF86VidModeGetPermissions(ClientPtr client) +{ xXF86VidModeGetPermissionsReply rep; - REQUEST(xXF86VidModeGetPermissionsReq); + + REQUEST(xXF86VidModeGetPermissionsReq); if (stuff->screen >= screenInfo.numScreens) - return BadValue; + return BadValue; - REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq); + REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.permissions = XF86VM_READ_PERMISSION; + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.permissions = XF86VM_READ_PERMISSION; if (xf86GetVidModeEnabled() && (xf86GetVidModeAllowNonLocal() || LocalClient(client))) { rep.permissions |= XF86VM_WRITE_PERMISSION; - } if (client->swapped) { + } + if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.permissions); @@ -1528,21 +1589,23 @@ static int } static int - ProcXF86VidModeSetClientVersion(ClientPtr client) { +ProcXF86VidModeSetClientVersion(ClientPtr client) +{ REQUEST(xXF86VidModeSetClientVersionReq); VidModePrivPtr pPriv; - DEBUG_P("XF86VidModeSetClientVersion"); + DEBUG_P("XF86VidModeSetClientVersion"); - REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq); + REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq); if ((pPriv = VM_GETPRIV(client)) == NULL) { pPriv = malloc(sizeof(VidModePrivRec)); if (!pPriv) return BadAlloc; VM_SETPRIV(client, pPriv); - } pPriv->major = stuff->major; + } + pPriv->major = stuff->major; pPriv->minor = stuff->minor; @@ -1550,85 +1613,103 @@ static int } static int - ProcXF86VidModeDispatch(ClientPtr client) { +ProcXF86VidModeDispatch(ClientPtr client) +{ REQUEST(xReq); switch (stuff->data) { case X_XF86VidModeQueryVersion: return ProcXF86VidModeQueryVersion(client); - case X_XF86VidModeGetModeLine:return ProcXF86VidModeGetModeLine(client); - case X_XF86VidModeGetMonitor:return ProcXF86VidModeGetMonitor(client); - case X_XF86VidModeGetAllModeLines:return - ProcXF86VidModeGetAllModeLines(client); - case X_XF86VidModeValidateModeLine:return - ProcXF86VidModeValidateModeLine(client); - case X_XF86VidModeGetViewPort:return ProcXF86VidModeGetViewPort(client); - case X_XF86VidModeGetDotClocks:return - ProcXF86VidModeGetDotClocks(client); - case X_XF86VidModeSetClientVersion:return - ProcXF86VidModeSetClientVersion(client); - case X_XF86VidModeGetGamma:return ProcXF86VidModeGetGamma(client); - case X_XF86VidModeGetGammaRamp:return - ProcXF86VidModeGetGammaRamp(client); - case X_XF86VidModeGetGammaRampSize:return - ProcXF86VidModeGetGammaRampSize(client); - case X_XF86VidModeGetPermissions:return - ProcXF86VidModeGetPermissions(client); - default:if (!xf86GetVidModeEnabled()) + case X_XF86VidModeGetModeLine: + return ProcXF86VidModeGetModeLine(client); + case X_XF86VidModeGetMonitor: + return ProcXF86VidModeGetMonitor(client); + case X_XF86VidModeGetAllModeLines: + return ProcXF86VidModeGetAllModeLines(client); + case X_XF86VidModeValidateModeLine: + return ProcXF86VidModeValidateModeLine(client); + case X_XF86VidModeGetViewPort: + return ProcXF86VidModeGetViewPort(client); + case X_XF86VidModeGetDotClocks: + return ProcXF86VidModeGetDotClocks(client); + case X_XF86VidModeSetClientVersion: + return ProcXF86VidModeSetClientVersion(client); + case X_XF86VidModeGetGamma: + return ProcXF86VidModeGetGamma(client); + case X_XF86VidModeGetGammaRamp: + return ProcXF86VidModeGetGammaRamp(client); + case X_XF86VidModeGetGammaRampSize: + return ProcXF86VidModeGetGammaRampSize(client); + case X_XF86VidModeGetPermissions: + return ProcXF86VidModeGetPermissions(client); + default: + if (!xf86GetVidModeEnabled()) return VidModeErrorBase + XF86VidModeExtensionDisabled; if (xf86GetVidModeAllowNonLocal() || LocalClient(client)) { switch (stuff->data) { case X_XF86VidModeAddModeLine: return ProcXF86VidModeAddModeLine(client); - case X_XF86VidModeDeleteModeLine:return - ProcXF86VidModeDeleteModeLine(client); - case X_XF86VidModeModModeLine:return - ProcXF86VidModeModModeLine(client); - case X_XF86VidModeSwitchMode:return - ProcXF86VidModeSwitchMode(client); - case X_XF86VidModeSwitchToMode:return - ProcXF86VidModeSwitchToMode(client); - case X_XF86VidModeLockModeSwitch:return - ProcXF86VidModeLockModeSwitch(client); - case X_XF86VidModeSetViewPort:return - ProcXF86VidModeSetViewPort(client); - case X_XF86VidModeSetGamma:return - ProcXF86VidModeSetGamma(client); - case X_XF86VidModeSetGammaRamp:return - ProcXF86VidModeSetGammaRamp(client); - default:return BadRequest; - }} + case X_XF86VidModeDeleteModeLine: + return ProcXF86VidModeDeleteModeLine(client); + case X_XF86VidModeModModeLine: + return ProcXF86VidModeModModeLine(client); + case X_XF86VidModeSwitchMode: + return ProcXF86VidModeSwitchMode(client); + case X_XF86VidModeSwitchToMode: + return ProcXF86VidModeSwitchToMode(client); + case X_XF86VidModeLockModeSwitch: + return ProcXF86VidModeLockModeSwitch(client); + case X_XF86VidModeSetViewPort: + return ProcXF86VidModeSetViewPort(client); + case X_XF86VidModeSetGamma: + return ProcXF86VidModeSetGamma(client); + case X_XF86VidModeSetGammaRamp: + return ProcXF86VidModeSetGammaRamp(client); + default: + return BadRequest; + } + } else - return VidModeErrorBase + XF86VidModeClientNotLocal; + return VidModeErrorBase + XF86VidModeClientNotLocal; } } static int - SProcXF86VidModeQueryVersion(ClientPtr client) { +SProcXF86VidModeQueryVersion(ClientPtr client) +{ REQUEST(xXF86VidModeQueryVersionReq); swaps(&stuff->length); return ProcXF86VidModeQueryVersion(client); -} static int - SProcXF86VidModeGetModeLine(ClientPtr client) { +} + +static int +SProcXF86VidModeGetModeLine(ClientPtr client) +{ REQUEST(xXF86VidModeGetModeLineReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq); swaps(&stuff->screen); return ProcXF86VidModeGetModeLine(client); -} static int - SProcXF86VidModeGetAllModeLines(ClientPtr client) { +} + +static int +SProcXF86VidModeGetAllModeLines(ClientPtr client) +{ REQUEST(xXF86VidModeGetAllModeLinesReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq); swaps(&stuff->screen); return ProcXF86VidModeGetAllModeLines(client); -} static int - SProcXF86VidModeAddModeLine(ClientPtr client) { +} + +static int +SProcXF86VidModeAddModeLine(ClientPtr client) +{ xXF86OldVidModeAddModeLineReq *oldstuff = (xXF86OldVidModeAddModeLineReq *) client->requestBuffer; int ver; - REQUEST(xXF86VidModeAddModeLineReq); - ver = ClientMajorVersion(client); + REQUEST(xXF86VidModeAddModeLineReq); + ver = ClientMajorVersion(client); if (ver < 2) { swaps(&oldstuff->length); REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq); @@ -1666,13 +1747,14 @@ static int } static int - SProcXF86VidModeDeleteModeLine(ClientPtr client) { +SProcXF86VidModeDeleteModeLine(ClientPtr client) +{ xXF86OldVidModeDeleteModeLineReq *oldstuff = (xXF86OldVidModeDeleteModeLineReq *) client->requestBuffer; int ver; - REQUEST(xXF86VidModeDeleteModeLineReq); - ver = ClientMajorVersion(client); + REQUEST(xXF86VidModeDeleteModeLineReq); + ver = ClientMajorVersion(client); if (ver < 2) { swaps(&oldstuff->length); REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq); @@ -1710,13 +1792,14 @@ static int } static int - SProcXF86VidModeModModeLine(ClientPtr client) { +SProcXF86VidModeModModeLine(ClientPtr client) +{ xXF86OldVidModeModModeLineReq *oldstuff = (xXF86OldVidModeModModeLineReq *) client->requestBuffer; int ver; - REQUEST(xXF86VidModeModModeLineReq); - ver = ClientMajorVersion(client); + REQUEST(xXF86VidModeModModeLineReq); + ver = ClientMajorVersion(client); if (ver < 2) { swaps(&oldstuff->length); REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq); @@ -1754,13 +1837,14 @@ static int } static int - SProcXF86VidModeValidateModeLine(ClientPtr client) { +SProcXF86VidModeValidateModeLine(ClientPtr client) +{ xXF86OldVidModeValidateModeLineReq *oldstuff = (xXF86OldVidModeValidateModeLineReq *) client->requestBuffer; int ver; - REQUEST(xXF86VidModeValidateModeLineReq); - ver = ClientMajorVersion(client); + REQUEST(xXF86VidModeValidateModeLineReq); + ver = ClientMajorVersion(client); if (ver < 2) { swaps(&oldstuff->length); REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq); @@ -1798,44 +1882,60 @@ static int } static int - SProcXF86VidModeSwitchMode(ClientPtr client) { +SProcXF86VidModeSwitchMode(ClientPtr client) +{ REQUEST(xXF86VidModeSwitchModeReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq); swaps(&stuff->screen); swaps(&stuff->zoom); return ProcXF86VidModeSwitchMode(client); -} static int - SProcXF86VidModeSwitchToMode(ClientPtr client) { +} + +static int +SProcXF86VidModeSwitchToMode(ClientPtr client) +{ REQUEST(xXF86VidModeSwitchToModeReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXF86VidModeSwitchToModeReq); swapl(&stuff->screen); return ProcXF86VidModeSwitchToMode(client); -} static int - SProcXF86VidModeLockModeSwitch(ClientPtr client) { +} + +static int +SProcXF86VidModeLockModeSwitch(ClientPtr client) +{ REQUEST(xXF86VidModeLockModeSwitchReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq); swaps(&stuff->screen); swaps(&stuff->lock); return ProcXF86VidModeLockModeSwitch(client); -} static int - SProcXF86VidModeGetMonitor(ClientPtr client) { +} + +static int +SProcXF86VidModeGetMonitor(ClientPtr client) +{ REQUEST(xXF86VidModeGetMonitorReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq); swaps(&stuff->screen); return ProcXF86VidModeGetMonitor(client); -} static int - SProcXF86VidModeGetViewPort(ClientPtr client) { +} + +static int +SProcXF86VidModeGetViewPort(ClientPtr client) +{ REQUEST(xXF86VidModeGetViewPortReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq); swaps(&stuff->screen); return ProcXF86VidModeGetViewPort(client); -} static int - SProcXF86VidModeSetViewPort(ClientPtr client) { +} + +static int +SProcXF86VidModeSetViewPort(ClientPtr client) +{ REQUEST(xXF86VidModeSetViewPortReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq); @@ -1843,23 +1943,32 @@ static int swapl(&stuff->x); swapl(&stuff->y); return ProcXF86VidModeSetViewPort(client); -} static int - SProcXF86VidModeGetDotClocks(ClientPtr client) { +} + +static int +SProcXF86VidModeGetDotClocks(ClientPtr client) +{ REQUEST(xXF86VidModeGetDotClocksReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq); swaps(&stuff->screen); return ProcXF86VidModeGetDotClocks(client); -} static int - SProcXF86VidModeSetClientVersion(ClientPtr client) { +} + +static int +SProcXF86VidModeSetClientVersion(ClientPtr client) +{ REQUEST(xXF86VidModeSetClientVersionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq); swaps(&stuff->major); swaps(&stuff->minor); return ProcXF86VidModeSetClientVersion(client); -} static int - SProcXF86VidModeSetGamma(ClientPtr client) { +} + +static int +SProcXF86VidModeSetGamma(ClientPtr client) +{ REQUEST(xXF86VidModeSetGammaReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq); @@ -1868,120 +1977,145 @@ static int swapl(&stuff->green); swapl(&stuff->blue); return ProcXF86VidModeSetGamma(client); -} static int - SProcXF86VidModeGetGamma(ClientPtr client) { +} + +static int +SProcXF86VidModeGetGamma(ClientPtr client) +{ REQUEST(xXF86VidModeGetGammaReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq); swaps(&stuff->screen); return ProcXF86VidModeGetGamma(client); -} static int - SProcXF86VidModeSetGammaRamp(ClientPtr client) { +} + +static int +SProcXF86VidModeSetGammaRamp(ClientPtr client) +{ int length; - REQUEST(xXF86VidModeSetGammaRampReq); - swaps(&stuff->length); - REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq); - swaps(&stuff->size); - swaps(&stuff->screen); - length = ((stuff->size + 1) & ~1) * 6; - REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length); - SwapRestS(stuff); - return ProcXF86VidModeSetGammaRamp(client); -} static int - SProcXF86VidModeGetGammaRamp(ClientPtr client) { + + REQUEST(xXF86VidModeSetGammaRampReq); + swaps(&stuff->length); + REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq); + swaps(&stuff->size); + swaps(&stuff->screen); + length = ((stuff->size + 1) & ~1) * 6; + REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length); + SwapRestS(stuff); + return ProcXF86VidModeSetGammaRamp(client); +} + +static int +SProcXF86VidModeGetGammaRamp(ClientPtr client) +{ REQUEST(xXF86VidModeGetGammaRampReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq); swaps(&stuff->size); swaps(&stuff->screen); return ProcXF86VidModeGetGammaRamp(client); -} static int - SProcXF86VidModeGetGammaRampSize(ClientPtr client) { +} + +static int +SProcXF86VidModeGetGammaRampSize(ClientPtr client) +{ REQUEST(xXF86VidModeGetGammaRampSizeReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq); swaps(&stuff->screen); return ProcXF86VidModeGetGammaRampSize(client); -} static int - SProcXF86VidModeGetPermissions(ClientPtr client) { +} + +static int +SProcXF86VidModeGetPermissions(ClientPtr client) +{ REQUEST(xXF86VidModeGetPermissionsReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq); swaps(&stuff->screen); return ProcXF86VidModeGetPermissions(client); -} static int - SProcXF86VidModeDispatch(ClientPtr client) { +} + +static int +SProcXF86VidModeDispatch(ClientPtr client) +{ REQUEST(xReq); switch (stuff->data) { case X_XF86VidModeQueryVersion: return SProcXF86VidModeQueryVersion(client); - case X_XF86VidModeGetModeLine:return - SProcXF86VidModeGetModeLine(client); - case X_XF86VidModeGetMonitor:return SProcXF86VidModeGetMonitor(client); - case X_XF86VidModeGetAllModeLines:return - SProcXF86VidModeGetAllModeLines(client); - case X_XF86VidModeGetViewPort:return - SProcXF86VidModeGetViewPort(client); - case X_XF86VidModeValidateModeLine:return - SProcXF86VidModeValidateModeLine(client); - case X_XF86VidModeGetDotClocks:return - SProcXF86VidModeGetDotClocks(client); - case X_XF86VidModeSetClientVersion:return - SProcXF86VidModeSetClientVersion(client); - case X_XF86VidModeGetGamma:return SProcXF86VidModeGetGamma(client); - case X_XF86VidModeGetGammaRamp:return - SProcXF86VidModeGetGammaRamp(client); - case X_XF86VidModeGetGammaRampSize:return - SProcXF86VidModeGetGammaRampSize(client); - case X_XF86VidModeGetPermissions:return - SProcXF86VidModeGetPermissions(client); - default:if (!xf86GetVidModeEnabled()) + case X_XF86VidModeGetModeLine: + return SProcXF86VidModeGetModeLine(client); + case X_XF86VidModeGetMonitor: + return SProcXF86VidModeGetMonitor(client); + case X_XF86VidModeGetAllModeLines: + return SProcXF86VidModeGetAllModeLines(client); + case X_XF86VidModeGetViewPort: + return SProcXF86VidModeGetViewPort(client); + case X_XF86VidModeValidateModeLine: + return SProcXF86VidModeValidateModeLine(client); + case X_XF86VidModeGetDotClocks: + return SProcXF86VidModeGetDotClocks(client); + case X_XF86VidModeSetClientVersion: + return SProcXF86VidModeSetClientVersion(client); + case X_XF86VidModeGetGamma: + return SProcXF86VidModeGetGamma(client); + case X_XF86VidModeGetGammaRamp: + return SProcXF86VidModeGetGammaRamp(client); + case X_XF86VidModeGetGammaRampSize: + return SProcXF86VidModeGetGammaRampSize(client); + case X_XF86VidModeGetPermissions: + return SProcXF86VidModeGetPermissions(client); + default: + if (!xf86GetVidModeEnabled()) return VidModeErrorBase + XF86VidModeExtensionDisabled; if (xf86GetVidModeAllowNonLocal() || LocalClient(client)) { switch (stuff->data) { case X_XF86VidModeAddModeLine: return SProcXF86VidModeAddModeLine(client); - case X_XF86VidModeDeleteModeLine:return - SProcXF86VidModeDeleteModeLine(client); - case X_XF86VidModeModModeLine:return - SProcXF86VidModeModModeLine(client); - case X_XF86VidModeSwitchMode:return - SProcXF86VidModeSwitchMode(client); - case X_XF86VidModeSwitchToMode:return - SProcXF86VidModeSwitchToMode(client); - case X_XF86VidModeLockModeSwitch:return - SProcXF86VidModeLockModeSwitch(client); - case X_XF86VidModeSetViewPort:return - SProcXF86VidModeSetViewPort(client); - case X_XF86VidModeSetGamma:return - SProcXF86VidModeSetGamma(client); - case X_XF86VidModeSetGammaRamp:return - SProcXF86VidModeSetGammaRamp(client); - default:return BadRequest; - }} + case X_XF86VidModeDeleteModeLine: + return SProcXF86VidModeDeleteModeLine(client); + case X_XF86VidModeModModeLine: + return SProcXF86VidModeModModeLine(client); + case X_XF86VidModeSwitchMode: + return SProcXF86VidModeSwitchMode(client); + case X_XF86VidModeSwitchToMode: + return SProcXF86VidModeSwitchToMode(client); + case X_XF86VidModeLockModeSwitch: + return SProcXF86VidModeLockModeSwitch(client); + case X_XF86VidModeSetViewPort: + return SProcXF86VidModeSetViewPort(client); + case X_XF86VidModeSetGamma: + return SProcXF86VidModeSetGamma(client); + case X_XF86VidModeSetGammaRamp: + return SProcXF86VidModeSetGammaRamp(client); + default: + return BadRequest; + } + } else - return VidModeErrorBase + XF86VidModeClientNotLocal; + return VidModeErrorBase + XF86VidModeClientNotLocal; } } void - XFree86VidModeExtensionInit(void) { +XFree86VidModeExtensionInit(void) +{ ExtensionEntry *extEntry; ScreenPtr pScreen; int i; Bool enabled = FALSE; - DEBUG_P("XFree86VidModeExtensionInit"); + DEBUG_P("XFree86VidModeExtensionInit"); if (!dixRegisterPrivateKey(&VidModeClientPrivateKeyRec, PRIVATE_CLIENT, 0)) - return; + return; #ifdef XF86VIDMODE_EVENTS if (!dixRegisterPrivateKey(&ScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) - return; + return; #endif #ifdef XF86VIDMODE_EVENTS - EventType = CreateNewResourceType(XF86VidModeFreeEvents, "VidModeEvent"); + EventType = CreateNewResourceType(XF86VidModeFreeEvents, "VidModeEvent"); #endif for (i = 0; i < screenInfo.numScreens; i++) { @@ -1990,8 +2124,8 @@ void enabled = TRUE; } /* This means that the DDX doesn't want the vidmode extension enabled */ - if (!enabled) - return; + if (!enabled) + return; if ( #ifdef XF86VIDMODE_EVENTS diff --git a/xorg-server/xkeyboard-config/symbols/de b/xorg-server/xkeyboard-config/symbols/de index 13f5c8759..4a04cadae 100644 --- a/xorg-server/xkeyboard-config/symbols/de +++ b/xorg-server/xkeyboard-config/symbols/de @@ -319,7 +319,7 @@ xkb_symbols "neo_base" { key <AB02> { [ odiaeresis, Odiaeresis, dollar, U03F5, Tab, Tab, intersection, NoSymbol ] }; key <AB03> { [ adiaeresis, Adiaeresis, bar, Greek_eta, Insert, Insert, U2135, NoSymbol ] }; key <AB04> { [ p, P, asciitilde, Greek_pi, Return, Return, Greek_PI, NoSymbol ] }; - key <AB05> { [ z, Z, grave, Greek_zeta, Undo, Undo, U2124, NoSymbol ] }; + key <AB05> { [ z, Z, grave, Greek_zeta, Undo, Redo, U2124, NoSymbol ] }; key <AB06> { [ b, B, plus, Greek_beta, colon, NoSymbol, U21D0, NoSymbol ] }; key <AB07> { [ m, M, percent, Greek_mu, KP_1, KP_1, ifonlyif, NoSymbol ] }; @@ -344,7 +344,7 @@ xkb_symbols "neo_base" { // Topmost row // -------------------------------------------------------------- key <KPDV> { [ KP_Divide, KP_Divide, division, U2300, U2215, NoSymbol, U2223, NoSymbol ] }; - key <KPMU> { [ KP_Multiply, KP_Multiply, U2219, U2299, multiply, NoSymbol, U2297, NoSymbol ] }; + key <KPMU> { [ KP_Multiply, KP_Multiply, U22C5, U2299, multiply, NoSymbol, U2297, NoSymbol ] }; key <KPSU> { [ KP_Subtract, KP_Subtract, U2212, U2296, U2216, NoSymbol, U2238, NoSymbol ] }; // Top row |