diff options
author | marha <marha@users.sourceforge.net> | 2013-03-06 08:37:36 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-03-06 08:37:36 +0100 |
commit | 84798668341b15890d625e3bffbbc2d19f434568 (patch) | |
tree | 50cb332dfbdac780fb24daa6cb0ca03cc8b297fc | |
parent | d4d629b77742e60caac3d120ff40e9f386380af2 (diff) | |
download | vcxsrv-84798668341b15890d625e3bffbbc2d19f434568.tar.gz vcxsrv-84798668341b15890d625e3bffbbc2d19f434568.tar.bz2 vcxsrv-84798668341b15890d625e3bffbbc2d19f434568.zip |
fontconfig libfontenc mesa xserver git update 6 Mar 2013
xserver commit 103b77c59e3638a45179bf6d7908f5c738d2d872
libfontenc commit 624508365ec3279bc74ce523d024533e062629e1
fontconfig commit e96d7760886a3781a46b3271c76af99e15cb0146
mesa commit 88b20d58344ed336b146799c0bf1149a932dc2d7
26 files changed, 651 insertions, 455 deletions
diff --git a/fontconfig/doc/fcconfig.fncs b/fontconfig/doc/fcconfig.fncs index 10028b465..0491a566f 100644 --- a/fontconfig/doc/fcconfig.fncs +++ b/fontconfig/doc/fcconfig.fncs @@ -371,3 +371,24 @@ and parsed. If 'complain' is FcFalse, no warning will be displayed if Returns FcFalse if some error occurred while loading the file, either a parse error, semantic error or allocation failure. Otherwise returns FcTrue. @@ + +@RET@ const FcChar8 * +@FUNC@ FcConfigGetSysRoot +@TYPE1@ const FcConfig * @ARG1@ config +@PURPOSE@ Obtain the system root directory +@DESC@ +Obtrains the system root directory in 'config' if available. +@@ + +@RET@ void +@FUNC@ FcConfigSetSysRoot +@TYPE1@ FcConfig * @ARG1@ config +@TYPE2@ const FcChar8 * @ARG2@ sysroot +@PURPOSE@ Set the system root directory +@DESC@ +Set 'sysroot' as the system root directory. fontconfig prepend 'sysroot' +to the cache directories in order to allow people to generate caches at +the build time. Note that this causes changing current config. i.e. +this function calls FcConfigSetCurrent() internally. +@@ + diff --git a/fontconfig/fc-cache/fc-cache.c b/fontconfig/fc-cache/fc-cache.c index 220609604..aeb0af29b 100644 --- a/fontconfig/fc-cache/fc-cache.c +++ b/fontconfig/fc-cache/fc-cache.c @@ -67,6 +67,7 @@ const struct option longopts[] = { {"force", 0, 0, 'f'}, {"really-force", 0, 0, 'r'}, + {"sysroot", 0, 0, 'y'}, {"system-only", 0, 0, 's'}, {"version", 0, 0, 'V'}, {"verbose", 0, 0, 'v'}, @@ -85,26 +86,28 @@ usage (char *program, int error) { FILE *file = error ? stderr : stdout; #if HAVE_GETOPT_LONG - fprintf (file, "usage: %s [-frsvVh] [--force|--really-force] [--system-only] [--verbose] [--version] [--help] [dirs]\n", + fprintf (file, "usage: %s [-frsvVh] [-y SYSROOT] [--force|--really-force] [--sysroot=SYSROOT] [--system-only] [--verbose] [--version] [--help] [dirs]\n", program); #else - fprintf (file, "usage: %s [-frsvVh] [dirs]\n", + fprintf (file, "usage: %s [-frsvVh] [-y SYSROOT] [dirs]\n", program); #endif fprintf (file, "Build font information caches in [dirs]\n" "(all directories in font configuration by default).\n"); fprintf (file, "\n"); #if HAVE_GETOPT_LONG - fprintf (file, " -f, --force scan directories with apparently valid caches\n"); - fprintf (file, " -r, --really-force erase all existing caches, then rescan\n"); - fprintf (file, " -s, --system-only scan system-wide directories only\n"); - fprintf (file, " -v, --verbose display status information while busy\n"); - fprintf (file, " -V, --version display font config version and exit\n"); - fprintf (file, " -h, --help display this help and exit\n"); + fprintf (file, " -f, --force scan directories with apparently valid caches\n"); + fprintf (file, " -r, --really-force erase all existing caches, then rescan\n"); + fprintf (file, " -s, --system-only scan system-wide directories only\n"); + fprintf (file, " -y, --sysroot=SYSROOT prepend SYSROOT to all paths for scanning\n"); + fprintf (file, " -v, --verbose display status information while busy\n"); + fprintf (file, " -V, --version display font config version and exit\n"); + fprintf (file, " -h, --help display this help and exit\n"); #else fprintf (file, " -f (force) scan directories with apparently valid caches\n"); fprintf (file, " -r, (really force) erase all existing caches, then rescan\n"); fprintf (file, " -s (system) scan system-wide directories only\n"); + fprintf (file, " -y SYSROOT (sysroot) prepend SYSROOT to all paths for scanning\n"); fprintf (file, " -v (verbose) display status information while busy\n"); fprintf (file, " -V (version) display font config version and exit\n"); fprintf (file, " -h (help) display this help and exit\n"); @@ -270,6 +273,7 @@ main (int argc, char **argv) FcBool really_force = FcFalse; FcBool systemOnly = FcFalse; FcConfig *config; + FcChar8 *sysroot = NULL; int i; int changed; int ret; @@ -277,9 +281,9 @@ main (int argc, char **argv) int c; #if HAVE_GETOPT_LONG - while ((c = getopt_long (argc, argv, "frsVvh", longopts, NULL)) != -1) + while ((c = getopt_long (argc, argv, "frsy:Vvh", longopts, NULL)) != -1) #else - while ((c = getopt (argc, argv, "frsVvh")) != -1) + while ((c = getopt (argc, argv, "frsy:Vvh")) != -1) #endif { switch (c) { @@ -292,6 +296,9 @@ main (int argc, char **argv) case 's': systemOnly = FcTrue; break; + case 'y': + sysroot = FcStrCopy ((const FcChar8 *)optarg); + break; case 'V': fprintf (stderr, "fontconfig version %d.%d.%d\n", FC_MAJOR, FC_MINOR, FC_REVISION); @@ -312,7 +319,16 @@ main (int argc, char **argv) if (systemOnly) FcConfigEnableHome (FcFalse); - config = FcInitLoadConfig (); + if (sysroot) + { + FcConfigSetSysRoot (NULL, sysroot); + FcStrFree (sysroot); + config = FcConfigGetCurrent(); + } + else + { + config = FcInitLoadConfig (); + } if (!config) { fprintf (stderr, "%s: Can't init font config library\n", argv[0]); diff --git a/fontconfig/fontconfig/fontconfig.h b/fontconfig/fontconfig/fontconfig.h index ba4ee6102..fc0ed1ab0 100644 --- a/fontconfig/fontconfig/fontconfig.h +++ b/fontconfig/fontconfig/fontconfig.h @@ -420,6 +420,13 @@ FcConfigSubstitute (FcConfig *config, FcPattern *p, FcMatchKind kind); +FcPublic const FcChar8 * +FcConfigGetSysRoot (const FcConfig *config); + +FcPublic void +FcConfigSetSysRoot (FcConfig *config, + const FcChar8 *sysroot); + /* fccharset.c */ FcPublic FcCharSet* FcCharSetCreate (void); diff --git a/fontconfig/src/fccache.c b/fontconfig/src/fccache.c index 2c631256b..9f1c29827 100644 --- a/fontconfig/src/fccache.c +++ b/fontconfig/src/fccache.c @@ -124,6 +124,7 @@ FcDirCacheUnlink (const FcChar8 *dir, FcConfig *config) FcChar8 cache_base[CACHEBASE_LEN]; FcStrList *list; FcChar8 *cache_dir; + const FcChar8 *sysroot = FcConfigGetSysRoot (config); FcDirCacheBasename (dir, cache_base); @@ -133,7 +134,10 @@ FcDirCacheUnlink (const FcChar8 *dir, FcConfig *config) while ((cache_dir = FcStrListNext (list))) { - cache_hashed = FcStrPlus (cache_dir, cache_base); + if (sysroot) + cache_hashed = FcStrBuildFilename (sysroot, cache_dir, cache_base, NULL); + else + cache_hashed = FcStrBuildFilename (cache_dir, cache_base, NULL); if (!cache_hashed) break; (void) unlink ((char *) cache_hashed); @@ -197,7 +201,13 @@ FcDirCacheProcess (FcConfig *config, const FcChar8 *dir, while ((cache_dir = FcStrListNext (list))) { - FcChar8 *cache_hashed = FcStrPlus (cache_dir, cache_base); + const FcChar8 *sysroot = FcConfigGetSysRoot (config); + FcChar8 *cache_hashed; + + if (sysroot) + cache_hashed = FcStrBuildFilename (sysroot, cache_dir, cache_base, NULL); + else + cache_hashed = FcStrBuildFilename (cache_dir, cache_base, NULL); if (!cache_hashed) break; fd = FcDirCacheOpenFile (cache_hashed, &file_stat); @@ -859,11 +869,12 @@ FcDirCacheWrite (FcCache *cache, FcConfig *config) FcAtomic *atomic; FcStrList *list; FcChar8 *cache_dir = NULL; - FcChar8 *test_dir; + FcChar8 *test_dir, *d = NULL; FcCacheSkip *skip; struct stat cache_stat; unsigned int magic; int written; + const FcChar8 *sysroot = FcConfigGetSysRoot (config); /* * Write it to the first directory in the list which is writable @@ -872,10 +883,18 @@ FcDirCacheWrite (FcCache *cache, FcConfig *config) list = FcStrListCreate (config->cacheDirs); if (!list) return FcFalse; - while ((test_dir = FcStrListNext (list))) { - if (access ((char *) test_dir, W_OK) == 0) + while ((test_dir = FcStrListNext (list))) + { + if (d) + FcStrFree (d); + if (sysroot) + d = FcStrBuildFilename (sysroot, test_dir, NULL); + else + d = FcStrCopyFilename (test_dir); + + if (access ((char *) d, W_OK) == 0) { - cache_dir = test_dir; + cache_dir = FcStrCopyFilename (d); break; } else @@ -883,35 +902,38 @@ FcDirCacheWrite (FcCache *cache, FcConfig *config) /* * If the directory doesn't exist, try to create it */ - if (access ((char *) test_dir, F_OK) == -1) { - if (FcMakeDirectory (test_dir)) + if (access ((char *) d, F_OK) == -1) { + if (FcMakeDirectory (d)) { - cache_dir = test_dir; + cache_dir = FcStrCopyFilename (d); /* Create CACHEDIR.TAG */ - FcDirCacheCreateTagFile (cache_dir); + FcDirCacheCreateTagFile (d); break; } } /* * Otherwise, try making it writable */ - else if (chmod ((char *) test_dir, 0755) == 0) + else if (chmod ((char *) d, 0755) == 0) { - cache_dir = test_dir; + cache_dir = FcStrCopyFilename (d); /* Try to create CACHEDIR.TAG too */ - FcDirCacheCreateTagFile (cache_dir); + FcDirCacheCreateTagFile (d); break; } } } + if (d) + FcStrFree (d); FcStrListDone (list); if (!cache_dir) return FcFalse; FcDirCacheBasename (dir, cache_base); - cache_hashed = FcStrPlus (cache_dir, cache_base); + cache_hashed = FcStrBuildFilename (cache_dir, cache_base, NULL); if (!cache_hashed) return FcFalse; + FcStrFree (cache_dir); if (FcDebug () & FC_DBG_CACHE) printf ("FcDirCacheWriteDir dir \"%s\" file \"%s\"\n", @@ -989,31 +1011,37 @@ FcDirCacheClean (const FcChar8 *cache_dir, FcBool verbose) { DIR *d; struct dirent *ent; - FcChar8 *dir_base; + FcChar8 *dir; FcBool ret = FcTrue; FcBool remove; FcCache *cache; struct stat target_stat; + const FcChar8 *sysroot; - dir_base = FcStrPlus (cache_dir, (FcChar8 *) FC_DIR_SEPARATOR_S); - if (!dir_base) + /* FIXME: this API needs to support non-current FcConfig */ + sysroot = FcConfigGetSysRoot (NULL); + if (sysroot) + dir = FcStrBuildFilename (sysroot, cache_dir, NULL); + else + dir = FcStrCopyFilename (cache_dir); + if (!dir) { fprintf (stderr, "Fontconfig error: %s: out of memory\n", cache_dir); return FcFalse; } - if (access ((char *) cache_dir, W_OK) != 0) + if (access ((char *) dir, W_OK) != 0) { if (verbose || FcDebug () & FC_DBG_CACHE) - printf ("%s: not cleaning %s cache directory\n", cache_dir, - access ((char *) cache_dir, F_OK) == 0 ? "unwritable" : "non-existent"); + printf ("%s: not cleaning %s cache directory\n", dir, + access ((char *) dir, F_OK) == 0 ? "unwritable" : "non-existent"); goto bail0; } if (verbose || FcDebug () & FC_DBG_CACHE) - printf ("%s: cleaning cache directory\n", cache_dir); - d = opendir ((char *) cache_dir); + printf ("%s: cleaning cache directory\n", dir); + d = opendir ((char *) dir); if (!d) { - perror ((char *) cache_dir); + perror ((char *) dir); ret = FcFalse; goto bail0; } @@ -1030,10 +1058,10 @@ FcDirCacheClean (const FcChar8 *cache_dir, FcBool verbose) strcmp(ent->d_name + 32, "-" FC_ARCHITECTURE FC_CACHE_SUFFIX)) continue; - file_name = FcStrPlus (dir_base, (FcChar8 *) ent->d_name); + file_name = FcStrBuildFilename (dir, (FcChar8 *)ent->d_name, NULL); if (!file_name) { - fprintf (stderr, "Fontconfig error: %s: allocation failure\n", cache_dir); + fprintf (stderr, "Fontconfig error: %s: allocation failure\n", dir); ret = FcFalse; break; } @@ -1042,7 +1070,7 @@ FcDirCacheClean (const FcChar8 *cache_dir, FcBool verbose) if (!cache) { if (verbose || FcDebug () & FC_DBG_CACHE) - printf ("%s: invalid cache file: %s\n", cache_dir, ent->d_name); + printf ("%s: invalid cache file: %s\n", dir, ent->d_name); remove = FcTrue; } else @@ -1052,7 +1080,7 @@ FcDirCacheClean (const FcChar8 *cache_dir, FcBool verbose) { if (verbose || FcDebug () & FC_DBG_CACHE) printf ("%s: %s: missing directory: %s \n", - cache_dir, ent->d_name, target_dir); + dir, ent->d_name, target_dir); remove = FcTrue; } FcDirCacheUnload (cache); @@ -1070,7 +1098,7 @@ FcDirCacheClean (const FcChar8 *cache_dir, FcBool verbose) closedir (d); bail0: - FcStrFree (dir_base); + FcStrFree (dir); return ret; } @@ -1394,7 +1422,7 @@ FcDirCacheCreateTagFile (const FcChar8 *cache_dir) if (access ((char *) cache_dir, W_OK) == 0) { /* Create CACHEDIR.TAG */ - cache_tag = FcStrPlus (cache_dir, (const FcChar8 *) FC_DIR_SEPARATOR_S "CACHEDIR.TAG"); + cache_tag = FcStrBuildFilename (cache_dir, "CACHEDIR.TAG", NULL); if (!cache_tag) return FcFalse; atomic = FcAtomicCreate ((FcChar8 *)cache_tag); @@ -1438,8 +1466,9 @@ FcDirCacheCreateTagFile (const FcChar8 *cache_dir) void FcCacheCreateTagFile (const FcConfig *config) { - FcChar8 *cache_dir = NULL; + FcChar8 *cache_dir = NULL, *d = NULL; FcStrList *list; + const FcChar8 *sysroot = FcConfigGetSysRoot (config); list = FcConfigGetCacheDirs (config); if (!list) @@ -1447,9 +1476,17 @@ FcCacheCreateTagFile (const FcConfig *config) while ((cache_dir = FcStrListNext (list))) { - if (FcDirCacheCreateTagFile (cache_dir)) + if (d) + FcStrFree (d); + if (sysroot) + d = FcStrBuildFilename (sysroot, cache_dir, NULL); + else + d = FcStrCopyFilename (cache_dir); + if (FcDirCacheCreateTagFile (d)) break; } + if (d) + FcStrFree (d); FcStrListDone (list); } diff --git a/fontconfig/src/fccfg.c b/fontconfig/src/fccfg.c index db878d5f4..b762376ae 100644 --- a/fontconfig/src/fccfg.c +++ b/fontconfig/src/fccfg.c @@ -123,6 +123,8 @@ FcConfigCreate (void) config->expr_pool = NULL; + config->sysRoot = NULL; + FcRefInit (&config->ref, 1); return config; @@ -292,6 +294,8 @@ FcConfigDestroy (FcConfig *config) free (page); page = next; } + if (config->sysRoot) + FcStrFree (config->sysRoot); free (config); } @@ -2309,6 +2313,59 @@ FcConfigAcceptFont (FcConfig *config, return FcFalse; return FcTrue; } + +const FcChar8 * +FcConfigGetSysRoot (const FcConfig *config) +{ + if (!config) + { + config = FcConfigGetCurrent (); + if (!config) + return NULL; + } + + return config->sysRoot; +} + +void +FcConfigSetSysRoot (FcConfig *config, + const FcChar8 *sysroot) +{ + FcChar8 *s; + FcBool init = FcFalse; + + if (!config) + { + /* We can't use FcConfigGetCurrent() here to ensure + * the sysroot is set prior to initialize FcConfig, + * to avoid loading caches from non-sysroot dirs. + * So postpone the initialization later. + */ + config = fc_atomic_ptr_get (&_fcConfig); + if (!config) + { + config = FcConfigCreate (); + if (!config) + return; + init = FcTrue; + } + } + + s = FcStrCopyFilename (sysroot); + if (!s) + return; + + if (config->sysRoot) + FcStrFree (config->sysRoot); + + config->sysRoot = s; + if (init) + { + config = FcInitLoadOwnConfigAndFonts (config); + FcConfigSetCurrent (config); + } +} + #define __fccfg__ #include "fcaliastail.h" #undef __fccfg__ diff --git a/fontconfig/src/fcinit.c b/fontconfig/src/fcinit.c index 2360764fc..b8d5d060c 100644 --- a/fontconfig/src/fcinit.c +++ b/fontconfig/src/fcinit.c @@ -65,14 +65,16 @@ FcGetVersion (void) * Load the configuration files */ FcConfig * -FcInitLoadConfig (void) +FcInitLoadOwnConfig (FcConfig *config) { - FcConfig *config; + if (!config) + { + config = FcConfigCreate (); + if (!config) + return NULL; + } FcInitDebug (); - config = FcConfigCreate (); - if (!config) - return NULL; if (!FcConfigParseAndLoad (config, 0, FcTrue)) { @@ -120,15 +122,19 @@ FcInitLoadConfig (void) return config; } +FcConfig * +FcInitLoadConfig (void) +{ + return FcInitLoadOwnConfig (NULL); +} + /* * Load the configuration files and scan for available fonts */ FcConfig * -FcInitLoadConfigAndFonts (void) +FcInitLoadOwnConfigAndFonts (FcConfig *config) { - FcConfig *config = FcInitLoadConfig (); - - FcInitDebug (); + config = FcInitLoadOwnConfig (config); if (!config) return 0; if (!FcConfigBuildFonts (config)) @@ -139,6 +145,12 @@ FcInitLoadConfigAndFonts (void) return config; } +FcConfig * +FcInitLoadConfigAndFonts (void) +{ + return FcInitLoadOwnConfigAndFonts (NULL); +} + /* * Initialize the default library configuration */ diff --git a/fontconfig/src/fcint.h b/fontconfig/src/fcint.h index 4eac6105a..d5a7217cc 100644 --- a/fontconfig/src/fcint.h +++ b/fontconfig/src/fcint.h @@ -501,7 +501,9 @@ struct _FcConfig { FcRef ref; /* reference count */ - FcExprPage *expr_pool; /* pool of FcExpr's */ + FcExprPage *expr_pool; /* pool of FcExpr's */ + + FcChar8 *sysRoot; /* override the system root directory */ }; typedef struct _FcFileTime { @@ -819,6 +821,13 @@ FcHashGetSHA256Digest (const FcChar8 *input_strings, FcPrivate FcChar8 * FcHashGetSHA256DigestFromFile (const FcChar8 *filename); +/* fcinit.c */ +FcPrivate FcConfig * +FcInitLoadOwnConfig (FcConfig *config); + +FcPrivate FcConfig * +FcInitLoadOwnConfigAndFonts (FcConfig *config); + /* fcxml.c */ FcPrivate void FcTestDestroy (FcTest *test); @@ -1073,6 +1082,10 @@ FcPrivate FcBool FcStrUsesHome (const FcChar8 *s); FcPrivate FcChar8 * +FcStrBuildFilename (const FcChar8 *path, + ...); + +FcPrivate FcChar8 * FcStrLastSlash (const FcChar8 *path); FcPrivate FcChar32 diff --git a/fontconfig/src/fclang.c b/fontconfig/src/fclang.c index 8e9b094b2..9f685f6fd 100644 --- a/fontconfig/src/fclang.c +++ b/fontconfig/src/fclang.c @@ -1027,9 +1027,11 @@ FcLangSetOperate(const FcLangSet *a, const FcChar8 *s)) { FcLangSet *langset = FcLangSetCopy (a); - FcStrList *sl = FcStrListCreate (FcLangSetGetLangs (b)); + FcStrSet *set = FcLangSetGetLangs (b); + FcStrList *sl = FcStrListCreate (set); FcChar8 *str; + FcStrSetDestroy (set); while ((str = FcStrListNext (sl))) { func (langset, str); diff --git a/fontconfig/src/fcstr.c b/fontconfig/src/fcstr.c index 414d6dd6b..4d11a4c65 100644 --- a/fontconfig/src/fcstr.c +++ b/fontconfig/src/fcstr.c @@ -30,6 +30,7 @@ #include <regex.h> #endif + /* Objects MT-safe for readonly access. */ FcChar8 * @@ -864,6 +865,64 @@ FcStrUsesHome (const FcChar8 *s) } FcChar8 * +FcStrBuildFilename (const FcChar8 *path, + ...) +{ + va_list ap; + FcStrSet *sset = FcStrSetCreate (); + FcStrList *list; + FcChar8 *s, *ret = NULL, *p; + size_t len = 0; + + if (!sset || !path) + return NULL; + + if (!FcStrSetAdd (sset, path)) + goto bail0; + + va_start (ap, path); + while (1) + { + s = (FcChar8 *)va_arg (ap, FcChar8 *); + if (!s) + break; + if (!FcStrSetAdd (sset, s)) + goto bail1; + } + list = FcStrListCreate (sset); + while ((s = FcStrListNext (list))) + { + len += strlen ((const char *)s) + 1; + } + list->n = 0; + ret = malloc (sizeof (FcChar8) * (len + 1)); + if (!ret) + goto bail2; + p = ret; + while ((s = FcStrListNext (list))) + { + if (p != ret) + { + p[0] = FC_DIR_SEPARATOR; + p++; + } + len = strlen ((const char *)s); + memcpy (p, s, len); + p += len; + } + *p = 0; + +bail2: + FcStrListDone (list); +bail1: + va_end (ap); +bail0: + FcStrSetDestroy (sset); + + return ret; +} + +FcChar8 * FcStrCopyFilename (const FcChar8 *s) { FcChar8 *new; @@ -1052,8 +1111,7 @@ FcStrCanonFilename (const FcChar8 *s) FcChar8 cwd[FC_MAX_FILE_LEN + 2]; if (getcwd ((char *) cwd, FC_MAX_FILE_LEN) == NULL) return NULL; - strcat ((char *) cwd, "/"); - full = FcStrPlus (cwd, s); + full = FcStrBuildFilename (cwd, s, NULL); file = FcStrCanonAbsoluteFilename (full); FcStrFree (full); return file; diff --git a/libfontenc/src/encparse.c b/libfontenc/src/encparse.c index cbcac8023..ee18b3f96 100644 --- a/libfontenc/src/encparse.c +++ b/libfontenc/src/encparse.c @@ -426,7 +426,7 @@ setCode(unsigned from, unsigned to, unsigned row_size, } } else if(*encsize <= index) { *encsize = 0x10000; - if((newenc = realloc(enc, *encsize))==NULL) + if((newenc = realloc(*enc, (*encsize) * sizeof(unsigned short)))==NULL) return 1; *enc = newenc; } diff --git a/mesalib/bin/get-pick-list.sh b/mesalib/bin/get-pick-list.sh index a141afe26..d3ac511c1 100644 --- a/mesalib/bin/get-pick-list.sh +++ b/mesalib/bin/get-pick-list.sh @@ -8,7 +8,7 @@ git log --reverse --grep="cherry picked from commit" origin/master..HEAD |\ sed -e 's/^[[:space:]]*(cherry picked from commit[[:space:]]*//' -e 's/)//' > already_picked # Grep for commits that were marked as a candidate for the stable tree. -git log --reverse --pretty=%H -i --grep='^[[:space:]]*NOTE: This is a candidate' HEAD..origin/master |\ +git log --reverse --pretty=%H -i --grep='^[[:space:]]*NOTE: .*[Cc]andidate' HEAD..origin/master |\ while read sha do # Check to see whether the patch is on the ignore list. diff --git a/mesalib/configure.ac b/mesalib/configure.ac index 5f95a78d2..ea56a044d 100644 --- a/mesalib/configure.ac +++ b/mesalib/configure.ac @@ -832,20 +832,6 @@ if test "x$enable_dri" = xyes; then fi fi -dnl Find out if X is available. -PKG_CHECK_MODULES([X11], [x11], [no_x=no], [no_x=yes]) - -dnl Try to tell the user that the --x-* options are only used when -dnl pkg-config is not available. This must be right after AC_PATH_XTRA. -m4_divert_once([HELP_BEGIN], -[These options are only used when the X libraries cannot be found by the -pkg-config utility.]) - -dnl We need X for xlib and dri, so bomb now if it's not found -if test "x$enable_glx" = xyes -a "x$no_x" = xyes; then - AC_MSG_ERROR([X11 development libraries needed for GLX]) -fi - dnl Direct rendering or just indirect rendering case "$host_os" in gnu*) @@ -1095,7 +1081,7 @@ if test "x$enable_dri" = xyes; then fi # if we are building any dri driver other than swrast or using the dri state tracker ... - if test -n "$DRI_DIRS" -a x"$DRI_DIRS" != xswrast || test "x$enable_dri" = xyes; then + if test -n "$DRI_DIRS" -a x"$DRI_DIRS" != xswrast -a "x$enable_dri" = xyes; then # ... libdrm is required if test "x$have_libdrm" != xyes; then AC_MSG_ERROR([DRI drivers requires libdrm >= $LIBDRM_REQUIRED]) diff --git a/mesalib/scons/llvm.py b/mesalib/scons/llvm.py index 7f00c6ce1..7cd609c20 100644 --- a/mesalib/scons/llvm.py +++ b/mesalib/scons/llvm.py @@ -174,7 +174,7 @@ def generate(env): env.Append(LINKFLAGS = ['/nodefaultlib:LIBCMT']) else: if not env.Detect('llvm-config'): - print 'scons: llvm-config script not found' % llvm_version + print 'scons: llvm-config script not found' return llvm_version = env.backtick('llvm-config --version').rstrip() diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c index e37be4e0a..a85183644 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blitter.c +++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c @@ -924,6 +924,11 @@ void util_blitter_cache_all_shaders(struct blitter_context *blitter) (target == PIPE_TEXTURE_CUBE_ARRAY)) continue; + if (i > 1 && + (target != PIPE_TEXTURE_2D && + target != PIPE_TEXTURE_2D_ARRAY)) + continue; + blitter_get_fs_texfetch_col(ctx, target, i); blitter_get_fs_texfetch_depth(ctx, target, i); if (ctx->has_stencil_export) { diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp index 9d7de3381..56082f761 100644 --- a/mesalib/src/glsl/glsl_parser_extras.cpp +++ b/mesalib/src/glsl/glsl_parser_extras.cpp @@ -308,9 +308,10 @@ _mesa_glsl_shader_target_name(enum _mesa_glsl_parser_targets target) 'id' is the implementation-defined ID of the given message. */ static void _mesa_glsl_msg(const YYLTYPE *locp, _mesa_glsl_parse_state *state, - GLenum type, GLuint id, const char *fmt, va_list ap) + GLenum type, const char *fmt, va_list ap) { - bool error = (type == GL_DEBUG_TYPE_ERROR_ARB); + bool error = (type == MESA_DEBUG_TYPE_ERROR); + GLuint msg_id = 0; assert(state->info_log != NULL); @@ -326,9 +327,9 @@ _mesa_glsl_msg(const YYLTYPE *locp, _mesa_glsl_parse_state *state, const char *const msg = &state->info_log[msg_offset]; struct gl_context *ctx = state->ctx; + /* Report the error via GL_ARB_debug_output. */ - if (error) - _mesa_shader_debug(ctx, type, id, msg, strlen(msg)); + _mesa_shader_debug(ctx, type, &msg_id, msg, strlen(msg)); ralloc_strcat(&state->info_log, "\n"); } @@ -338,12 +339,11 @@ _mesa_glsl_error(YYLTYPE *locp, _mesa_glsl_parse_state *state, const char *fmt, ...) { va_list ap; - GLenum type = GL_DEBUG_TYPE_ERROR_ARB; state->error = true; va_start(ap, fmt); - _mesa_glsl_msg(locp, state, type, SHADER_ERROR_UNKNOWN, fmt, ap); + _mesa_glsl_msg(locp, state, MESA_DEBUG_TYPE_ERROR, fmt, ap); va_end(ap); } @@ -353,10 +353,9 @@ _mesa_glsl_warning(const YYLTYPE *locp, _mesa_glsl_parse_state *state, const char *fmt, ...) { va_list ap; - GLenum type = GL_DEBUG_TYPE_OTHER_ARB; va_start(ap, fmt); - _mesa_glsl_msg(locp, state, type, 0, fmt, ap); + _mesa_glsl_msg(locp, state, MESA_DEBUG_TYPE_OTHER, fmt, ap); va_end(ap); } diff --git a/mesalib/src/glsl/standalone_scaffolding.cpp b/mesalib/src/glsl/standalone_scaffolding.cpp index 8c0091e84..b5ef768bd 100644 --- a/mesalib/src/glsl/standalone_scaffolding.cpp +++ b/mesalib/src/glsl/standalone_scaffolding.cpp @@ -60,7 +60,7 @@ _mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr, } void -_mesa_shader_debug(struct gl_context *, GLenum, GLuint, +_mesa_shader_debug(struct gl_context *, GLenum, GLuint *id, const char *, int) { } diff --git a/mesalib/src/glsl/standalone_scaffolding.h b/mesalib/src/glsl/standalone_scaffolding.h index 096b2f114..0a2cde8a3 100644 --- a/mesalib/src/glsl/standalone_scaffolding.h +++ b/mesalib/src/glsl/standalone_scaffolding.h @@ -44,7 +44,7 @@ extern "C" struct gl_shader * _mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type); extern "C" void -_mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint id, +_mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id, const char *msg, int len); /** diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c index 0c5e36d5a..97f1b8a03 100644 --- a/mesalib/src/mesa/main/errors.c +++ b/mesalib/src/mesa/main/errors.c @@ -29,19 +29,20 @@ #include "errors.h" - +#include "enums.h" #include "imports.h" #include "context.h" #include "dispatch.h" #include "hash.h" #include "mtypes.h" #include "version.h" +#include "hash_table.h" +#include "glapi/glthread.h" +_glthread_DECLARE_STATIC_MUTEX(DynamicIDMutex); +static GLuint NextDynamicID = 1; -#define MAXSTRING MAX_DEBUG_MESSAGE_LENGTH - - -struct gl_client_severity +struct gl_debug_severity { struct simple_node link; GLuint ID; @@ -49,82 +50,89 @@ struct gl_client_severity static char out_of_memory[] = "Debugging error: out of memory"; -#define enum_is(e, kind1, kind2) \ - ((e) == GL_DEBUG_##kind1##_##kind2##_ARB || (e) == GL_DONT_CARE) -#define severity_is(sev, kind) enum_is(sev, SEVERITY, kind) -#define source_is(s, kind) enum_is(s, SOURCE, kind) -#define type_is(t, kind) enum_is(t, TYPE, kind) - -/* Prevent define collision on Windows */ -#undef ERROR - -enum { - SOURCE_APPLICATION, - SOURCE_THIRD_PARTY, - - SOURCE_COUNT, - SOURCE_ANY = -1 +static const GLenum debug_source_enums[] = { + GL_DEBUG_SOURCE_API, + GL_DEBUG_SOURCE_WINDOW_SYSTEM, + GL_DEBUG_SOURCE_SHADER_COMPILER, + GL_DEBUG_SOURCE_THIRD_PARTY, + GL_DEBUG_SOURCE_APPLICATION, + GL_DEBUG_SOURCE_OTHER, }; -enum { - TYPE_ERROR, - TYPE_DEPRECATED, - TYPE_UNDEFINED, - TYPE_PORTABILITY, - TYPE_PERFORMANCE, - TYPE_OTHER, - - TYPE_COUNT, - TYPE_ANY = -1 +static const GLenum debug_type_enums[] = { + GL_DEBUG_TYPE_ERROR, + GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR, + GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR, + GL_DEBUG_TYPE_PORTABILITY, + GL_DEBUG_TYPE_PERFORMANCE, + GL_DEBUG_TYPE_OTHER, }; -enum { - SEVERITY_LOW, - SEVERITY_MEDIUM, - SEVERITY_HIGH, - - SEVERITY_COUNT, - SEVERITY_ANY = -1 +static const GLenum debug_severity_enums[] = { + GL_DEBUG_SEVERITY_LOW, + GL_DEBUG_SEVERITY_MEDIUM, + GL_DEBUG_SEVERITY_HIGH, }; -static int -enum_to_index(GLenum e) +static enum mesa_debug_source +gl_enum_to_debug_source(GLenum e) { - switch (e) { - case GL_DEBUG_SOURCE_APPLICATION_ARB: - return (int)SOURCE_APPLICATION; - case GL_DEBUG_SOURCE_THIRD_PARTY_ARB: - return (int)SOURCE_THIRD_PARTY; + int i; - case GL_DEBUG_TYPE_ERROR_ARB: - return (int)TYPE_ERROR; - case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB: - return (int)TYPE_DEPRECATED; - case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB: - return (int)TYPE_UNDEFINED; - case GL_DEBUG_TYPE_PERFORMANCE_ARB: - return (int)TYPE_PERFORMANCE; - case GL_DEBUG_TYPE_PORTABILITY_ARB: - return (int)TYPE_PORTABILITY; - case GL_DEBUG_TYPE_OTHER_ARB: - return (int)TYPE_OTHER; + for (i = 0; i < Elements(debug_source_enums); i++) { + if (debug_source_enums[i] == e) + break; + } + return i; +} - case GL_DEBUG_SEVERITY_LOW_ARB: - return (int)SEVERITY_LOW; - case GL_DEBUG_SEVERITY_MEDIUM_ARB: - return (int)SEVERITY_MEDIUM; - case GL_DEBUG_SEVERITY_HIGH_ARB: - return (int)SEVERITY_HIGH; +static enum mesa_debug_type +gl_enum_to_debug_type(GLenum e) +{ + int i; - case GL_DONT_CARE: - return (int)TYPE_ANY; + for (i = 0; i < Elements(debug_type_enums); i++) { + if (debug_type_enums[i] == e) + break; + } + return i; +} - default: - assert(0 && "unreachable"); - return -2; - }; +static enum mesa_debug_severity +gl_enum_to_debug_severity(GLenum e) +{ + int i; + + for (i = 0; i < Elements(debug_severity_enums); i++) { + if (debug_severity_enums[i] == e) + break; + } + return i; } +/** + * Handles generating a GL_ARB_debug_output message ID generated by the GL or + * GLSL compiler. + * + * The GL API has this "ID" mechanism, where the intention is to allow a + * client to filter in/out messages based on source, type, and ID. Of course, + * building a giant enum list of all debug output messages that Mesa might + * generate is ridiculous, so instead we have our caller pass us a pointer to + * static storage where the ID should get stored. This ID will be shared + * across all contexts for that message (which seems like a desirable + * property, even if it's not expected by the spec), but note that it won't be + * the same between executions if messages aren't generated in the same order. + */ +static void +debug_get_id(GLuint *id) +{ + if (!(*id)) { + _glthread_LOCK_MUTEX(DynamicIDMutex); + if (!(*id)) + *id = NextDynamicID++; + _glthread_UNLOCK_MUTEX(DynamicIDMutex); + } +} /* * We store a bitfield in the hash table, with five possible values total. @@ -168,17 +176,17 @@ enum { }; /** - * Returns the state of the given message ID in a client-controlled - * namespace. - * 'source', 'type', and 'severity' are array indices like TYPE_ERROR, - * not GL enums. + * Returns the state of the given message source/type/ID tuple. */ static GLboolean -get_message_state(struct gl_context *ctx, int source, int type, - GLuint id, int severity) +should_log(struct gl_context *ctx, + enum mesa_debug_source source, + enum mesa_debug_type type, + GLuint id, + enum mesa_debug_severity severity) { - struct gl_client_namespace *nspace = - &ctx->Debug.ClientIDs.Namespaces[source][type]; + struct gl_debug_namespace *nspace = + &ctx->Debug.Namespaces[source][type]; uintptr_t state; /* In addition to not being able to store zero as a value, HashTable also @@ -191,10 +199,10 @@ get_message_state(struct gl_context *ctx, int source, int type, /* Only do this once for each ID. This makes sure the ID exists in, at most, one list, and does not pointlessly appear multiple times. */ if (!(state & KNOWN_SEVERITY)) { - struct gl_client_severity *entry; + struct gl_debug_severity *entry; if (state == NOT_FOUND) { - if (ctx->Debug.ClientIDs.Defaults[severity][source][type]) + if (ctx->Debug.Defaults[severity][source][type]) state = ENABLED; else state = DISABLED; @@ -220,16 +228,16 @@ out: } /** - * Sets the state of the given message ID in a client-controlled - * namespace. - * 'source' and 'type' are array indices like TYPE_ERROR, not GL enums. + * Sets the state of the given message source/type/ID tuple. */ static void -set_message_state(struct gl_context *ctx, int source, int type, +set_message_state(struct gl_context *ctx, + enum mesa_debug_source source, + enum mesa_debug_type type, GLuint id, GLboolean enabled) { - struct gl_client_namespace *nspace = - &ctx->Debug.ClientIDs.Namespaces[source][type]; + struct gl_debug_namespace *nspace = + &ctx->Debug.Namespaces[source][type]; uintptr_t state; /* In addition to not being able to store zero as a value, HashTable also @@ -255,49 +263,15 @@ set_message_state(struct gl_context *ctx, int source, int type, } /** - * Whether a debugging message should be logged or not. - * For implementation-controlled namespaces, we keep an array - * of booleans per namespace, per context, recording whether - * each individual message is enabled or not. The message ID - * is an index into the namespace's array. - */ -static GLboolean -should_log(struct gl_context *ctx, GLenum source, GLenum type, - GLuint id, GLenum severity) -{ - if (source == GL_DEBUG_SOURCE_APPLICATION_ARB || - source == GL_DEBUG_SOURCE_THIRD_PARTY_ARB) { - int s, t, sev; - s = enum_to_index(source); - t = enum_to_index(type); - sev = enum_to_index(severity); - - return get_message_state(ctx, s, t, sev, id); - } - - if (type_is(type, ERROR)) { - if (source_is(source, API)) - return ctx->Debug.ApiErrors[id]; - if (source_is(source, WINDOW_SYSTEM)) - return ctx->Debug.WinsysErrors[id]; - if (source_is(source, SHADER_COMPILER)) - return ctx->Debug.ShaderErrors[id]; - if (source_is(source, OTHER)) - return ctx->Debug.OtherErrors[id]; - } - - return (severity != GL_DEBUG_SEVERITY_LOW_ARB); -} - -/** * 'buf' is not necessarily a null-terminated string. When logging, copy * 'len' characters from it, store them in a new, null-terminated string, * and remember the number of bytes used by that string, *including* * the null terminator this time. */ static void -_mesa_log_msg(struct gl_context *ctx, GLenum source, GLenum type, - GLuint id, GLenum severity, GLint len, const char *buf) +_mesa_log_msg(struct gl_context *ctx, enum mesa_debug_source source, + enum mesa_debug_type type, GLuint id, + enum mesa_debug_severity severity, GLint len, const char *buf) { GLint nextEmpty; struct gl_debug_msg *emptySlot; @@ -308,7 +282,10 @@ _mesa_log_msg(struct gl_context *ctx, GLenum source, GLenum type, return; if (ctx->Debug.Callback) { - ctx->Debug.Callback(source, type, id, severity, + ctx->Debug.Callback(debug_source_enums[source], + debug_type_enums[type], + id, + debug_severity_enums[severity], len, buf, ctx->Debug.CallbackData); return; } @@ -333,13 +310,16 @@ _mesa_log_msg(struct gl_context *ctx, GLenum source, GLenum type, emptySlot->id = id; emptySlot->severity = severity; } else { + static GLuint oom_msg_id = 0; + debug_get_id(&oom_msg_id); + /* malloc failed! */ emptySlot->message = out_of_memory; emptySlot->length = strlen(out_of_memory)+1; - emptySlot->source = GL_DEBUG_SOURCE_OTHER_ARB; - emptySlot->type = GL_DEBUG_TYPE_ERROR_ARB; - emptySlot->id = OTHER_ERROR_OUT_OF_MEMORY; - emptySlot->severity = GL_DEBUG_SEVERITY_HIGH_ARB; + emptySlot->source = MESA_DEBUG_SOURCE_OTHER; + emptySlot->type = MESA_DEBUG_TYPE_ERROR; + emptySlot->id = oom_msg_id; + emptySlot->severity = MESA_DEBUG_SEVERITY_HIGH; } if (ctx->Debug.NumMessages == 0) @@ -377,11 +357,11 @@ _mesa_get_msg(struct gl_context *ctx, GLenum *source, GLenum *type, return 0; if (severity) - *severity = msg->severity; + *severity = debug_severity_enums[msg->severity]; if (source) - *source = msg->source; + *source = debug_source_enums[msg->source]; if (type) - *type = msg->type; + *type = debug_type_enums[msg->type]; if (id) *id = msg->id; @@ -498,7 +478,10 @@ _mesa_DebugMessageInsertARB(GLenum source, GLenum type, GLuint id, return; } - _mesa_log_msg(ctx, source, type, id, severity, length, buf); + _mesa_log_msg(ctx, + gl_enum_to_debug_source(source), + gl_enum_to_debug_type(type), id, + gl_enum_to_debug_severity(severity), length, buf); } GLuint GLAPIENTRY @@ -547,42 +530,9 @@ _mesa_GetDebugMessageLogARB(GLuint count, GLsizei logSize, GLenum* sources, } /** - * 'array' is an array representing a particular debugging-message namespace. - * I.e., the set of all API errors, or the set of all Shader Compiler errors. - * 'size' is the size of 'array'. 'count' is the size of 'ids', an array - * of indices into 'array'. All the elements of 'array' at the indices - * listed in 'ids' will be overwritten with the value of 'enabled'. - * - * If 'count' is zero, all elements in 'array' are overwritten with the - * value of 'enabled'. - */ -static void -control_messages(GLboolean *array, GLuint size, - GLsizei count, const GLuint *ids, GLboolean enabled) -{ - GLsizei i; - - if (!count) { - GLuint id; - for (id = 0; id < size; id++) { - array[id] = enabled; - } - return; - } - - for (i = 0; i < count; i++) { - if (ids[i] >= size) { - /* XXX: The spec doesn't say what to do with a non-existent ID. */ - continue; - } - array[ids[i]] = enabled; - } -} - -/** - * Set the state of all message IDs found in the given intersection - * of 'source', 'type', and 'severity'. Note that all three of these - * parameters are array indices, not the corresponding GL enums. + * Set the state of all message IDs found in the given intersection of + * 'source', 'type', and 'severity'. The _COUNT enum can be used for + * GL_DONT_CARE (include all messages in the class). * * This requires both setting the state of all previously seen message * IDs in the hash table, and setting the default state for all @@ -591,29 +541,31 @@ control_messages(GLboolean *array, GLuint size, * impacted as if they were already known. */ static void -control_app_messages_by_group(struct gl_context *ctx, int source, int type, - int severity, GLboolean enabled) +control_messages(struct gl_context *ctx, + enum mesa_debug_source source, + enum mesa_debug_type type, + enum mesa_debug_severity severity, + GLboolean enabled) { - struct gl_client_debug *ClientIDs = &ctx->Debug.ClientIDs; int s, t, sev, smax, tmax, sevmax; - if (source == SOURCE_ANY) { + if (source == MESA_DEBUG_SOURCE_COUNT) { source = 0; - smax = SOURCE_COUNT; + smax = MESA_DEBUG_SOURCE_COUNT; } else { smax = source+1; } - if (type == TYPE_ANY) { + if (type == MESA_DEBUG_TYPE_COUNT) { type = 0; - tmax = TYPE_COUNT; + tmax = MESA_DEBUG_TYPE_COUNT; } else { tmax = type+1; } - if (severity == SEVERITY_ANY) { + if (severity == MESA_DEBUG_SEVERITY_COUNT) { severity = 0; - sevmax = SEVERITY_COUNT; + sevmax = MESA_DEBUG_SEVERITY_COUNT; } else { sevmax = severity+1; } @@ -622,14 +574,14 @@ control_app_messages_by_group(struct gl_context *ctx, int source, int type, for (s = source; s < smax; s++) for (t = type; t < tmax; t++) { struct simple_node *node; - struct gl_client_severity *entry; + struct gl_debug_severity *entry; /* change the default for IDs we've never seen before. */ - ClientIDs->Defaults[sev][s][t] = enabled; + ctx->Debug.Defaults[sev][s][t] = enabled; /* Now change the state of IDs we *have* seen... */ - foreach(node, &ClientIDs->Namespaces[s][t].Severity[sev]) { - entry = (struct gl_client_severity *)node; + foreach(node, &ctx->Debug.Namespaces[s][t].Severity[sev]) { + entry = (struct gl_debug_severity *)node; set_message_state(ctx, s, t, entry->ID, enabled); } } @@ -652,16 +604,15 @@ control_app_messages(struct gl_context *ctx, GLenum esource, GLenum etype, GLenum eseverity, GLsizei count, const GLuint *ids, GLboolean enabled) { - int source, type, severity; GLsizei i; - - source = enum_to_index(esource); - type = enum_to_index(etype); - severity = enum_to_index(eseverity); + enum mesa_debug_source source = gl_enum_to_debug_source(esource); + enum mesa_debug_type type = gl_enum_to_debug_type(etype); + enum mesa_debug_severity severity = gl_enum_to_debug_severity(eseverity); if (count) - assert(severity == SEVERITY_ANY && type != TYPE_ANY - && source != SOURCE_ANY); + assert(severity == MESA_DEBUG_SEVERITY_COUNT + && type != MESA_DEBUG_TYPE_COUNT + && source != MESA_DEBUG_SOURCE_COUNT); for (i = 0; i < count; i++) set_message_state(ctx, source, type, ids[i], enabled); @@ -669,14 +620,18 @@ control_app_messages(struct gl_context *ctx, GLenum esource, GLenum etype, if (count) return; - control_app_messages_by_group(ctx, source, type, severity, enabled); + control_messages(ctx, source, type, severity, enabled); } void GLAPIENTRY -_mesa_DebugMessageControlARB(GLenum source, GLenum type, GLenum severity, +_mesa_DebugMessageControlARB(GLenum gl_source, GLenum gl_type, + GLenum gl_severity, GLsizei count, const GLuint *ids, GLboolean enabled) { + enum mesa_debug_source source; + enum mesa_debug_type type; + enum mesa_debug_severity severity; GET_CURRENT_CONTEXT(ctx); if (count < 0) { @@ -685,36 +640,22 @@ _mesa_DebugMessageControlARB(GLenum source, GLenum type, GLenum severity, return; } - if (!validate_params(ctx, CONTROL, source, type, severity)) + if (!validate_params(ctx, CONTROL, gl_source, gl_type, gl_severity)) return; /* GL_INVALID_ENUM */ - if (count && (severity != GL_DONT_CARE || type == GL_DONT_CARE - || source == GL_DONT_CARE)) { + if (count && (gl_severity != GL_DONT_CARE || gl_type == GL_DONT_CARE + || gl_source == GL_DONT_CARE)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glDebugMessageControlARB" "(When passing an array of ids, severity must be" " GL_DONT_CARE, and source and type must not be GL_DONT_CARE."); return; } - if (source_is(source, APPLICATION) || source_is(source, THIRD_PARTY)) - control_app_messages(ctx, source, type, severity, count, ids, enabled); - - if (severity_is(severity, HIGH)) { - if (type_is(type, ERROR)) { - if (source_is(source, API)) - control_messages(ctx->Debug.ApiErrors, API_ERROR_COUNT, - count, ids, enabled); - if (source_is(source, WINDOW_SYSTEM)) - control_messages(ctx->Debug.WinsysErrors, WINSYS_ERROR_COUNT, - count, ids, enabled); - if (source_is(source, SHADER_COMPILER)) - control_messages(ctx->Debug.ShaderErrors, SHADER_ERROR_COUNT, - count, ids, enabled); - if (source_is(source, OTHER)) - control_messages(ctx->Debug.OtherErrors, OTHER_ERROR_COUNT, - count, ids, enabled); - } - } + source = gl_enum_to_debug_severity(gl_source); + type = gl_enum_to_debug_severity(gl_type); + severity = gl_enum_to_debug_severity(gl_severity); + + control_app_messages(ctx, source, type, severity, count, ids, enabled); } void GLAPIENTRY @@ -729,7 +670,6 @@ void _mesa_init_errors(struct gl_context *ctx) { int s, t, sev; - struct gl_client_debug *ClientIDs = &ctx->Debug.ClientIDs; ctx->Debug.Callback = NULL; ctx->Debug.SyncOutput = GL_FALSE; @@ -739,44 +679,47 @@ _mesa_init_errors(struct gl_context *ctx) ctx->Debug.NextMsgLength = 0; /* Enable all the messages with severity HIGH or MEDIUM by default. */ - memset(ctx->Debug.ApiErrors, GL_TRUE, sizeof ctx->Debug.ApiErrors); - memset(ctx->Debug.WinsysErrors, GL_TRUE, sizeof ctx->Debug.WinsysErrors); - memset(ctx->Debug.ShaderErrors, GL_TRUE, sizeof ctx->Debug.ShaderErrors); - memset(ctx->Debug.OtherErrors, GL_TRUE, sizeof ctx->Debug.OtherErrors); - memset(ClientIDs->Defaults[SEVERITY_HIGH], GL_TRUE, - sizeof ClientIDs->Defaults[SEVERITY_HIGH]); - memset(ClientIDs->Defaults[SEVERITY_MEDIUM], GL_TRUE, - sizeof ClientIDs->Defaults[SEVERITY_MEDIUM]); - memset(ClientIDs->Defaults[SEVERITY_LOW], GL_FALSE, - sizeof ClientIDs->Defaults[SEVERITY_LOW]); - - /* Initialize state for filtering client-provided debug messages. */ - for (s = 0; s < SOURCE_COUNT; s++) - for (t = 0; t < TYPE_COUNT; t++) { - ClientIDs->Namespaces[s][t].IDs = _mesa_NewHashTable(); - assert(ClientIDs->Namespaces[s][t].IDs); - - for (sev = 0; sev < SEVERITY_COUNT; sev++) - make_empty_list(&ClientIDs->Namespaces[s][t].Severity[sev]); + memset(ctx->Debug.Defaults[MESA_DEBUG_SEVERITY_HIGH], GL_TRUE, + sizeof ctx->Debug.Defaults[MESA_DEBUG_SEVERITY_HIGH]); + memset(ctx->Debug.Defaults[MESA_DEBUG_SEVERITY_MEDIUM], GL_TRUE, + sizeof ctx->Debug.Defaults[MESA_DEBUG_SEVERITY_MEDIUM]); + memset(ctx->Debug.Defaults[MESA_DEBUG_SEVERITY_LOW], GL_FALSE, + sizeof ctx->Debug.Defaults[MESA_DEBUG_SEVERITY_LOW]); + + /* Initialize state for filtering known debug messages. */ + for (s = 0; s < MESA_DEBUG_SOURCE_COUNT; s++) + for (t = 0; t < MESA_DEBUG_TYPE_COUNT; t++) { + ctx->Debug.Namespaces[s][t].IDs = _mesa_NewHashTable(); + assert(ctx->Debug.Namespaces[s][t].IDs); + + for (sev = 0; sev < MESA_DEBUG_SEVERITY_COUNT; sev++) + make_empty_list(&ctx->Debug.Namespaces[s][t].Severity[sev]); } } +static void +do_nothing(GLuint key, void *data, void *userData) +{ +} + void _mesa_free_errors_data(struct gl_context *ctx) { - int s, t, sev; - struct gl_client_debug *ClientIDs = &ctx->Debug.ClientIDs; - - /* Tear down state for filtering client-provided debug messages. */ - for (s = 0; s < SOURCE_COUNT; s++) - for (t = 0; t < TYPE_COUNT; t++) { - _mesa_DeleteHashTable(ClientIDs->Namespaces[s][t].IDs); - for (sev = 0; sev < SEVERITY_COUNT; sev++) { + enum mesa_debug_type t; + enum mesa_debug_source s; + enum mesa_debug_severity sev; + + /* Tear down state for filtering debug messages. */ + for (s = 0; s < MESA_DEBUG_SOURCE_COUNT; s++) + for (t = 0; t < MESA_DEBUG_TYPE_COUNT; t++) { + _mesa_HashDeleteAll(ctx->Debug.Namespaces[s][t].IDs, do_nothing, NULL); + _mesa_DeleteHashTable(ctx->Debug.Namespaces[s][t].IDs); + for (sev = 0; sev < MESA_DEBUG_SEVERITY_COUNT; sev++) { struct simple_node *node, *tmp; - struct gl_client_severity *entry; + struct gl_debug_severity *entry; - foreach_s(node, tmp, &ClientIDs->Namespaces[s][t].Severity[sev]) { - entry = (struct gl_client_severity *)node; + foreach_s(node, tmp, &ctx->Debug.Namespaces[s][t].Severity[sev]) { + entry = (struct gl_debug_severity *)node; free(entry); } } @@ -838,38 +781,6 @@ output_if_debug(const char *prefixString, const char *outputString, } } - -/** - * Return string version of GL error code. - */ -static const char * -error_string( GLenum error ) -{ - switch (error) { - case GL_NO_ERROR: - return "GL_NO_ERROR"; - case GL_INVALID_VALUE: - return "GL_INVALID_VALUE"; - case GL_INVALID_ENUM: - return "GL_INVALID_ENUM"; - case GL_INVALID_OPERATION: - return "GL_INVALID_OPERATION"; - case GL_STACK_OVERFLOW: - return "GL_STACK_OVERFLOW"; - case GL_STACK_UNDERFLOW: - return "GL_STACK_UNDERFLOW"; - case GL_OUT_OF_MEMORY: - return "GL_OUT_OF_MEMORY"; - case GL_TABLE_TOO_LARGE: - return "GL_TABLE_TOO_LARGE"; - case GL_INVALID_FRAMEBUFFER_OPERATION_EXT: - return "GL_INVALID_FRAMEBUFFER_OPERATION"; - default: - return "unknown"; - } -} - - /** * When a new type of error is recorded, print a message describing * previous errors which were accumulated. @@ -877,12 +788,12 @@ error_string( GLenum error ) static void flush_delayed_errors( struct gl_context *ctx ) { - char s[MAXSTRING]; + char s[MAX_DEBUG_MESSAGE_LENGTH]; if (ctx->ErrorDebugCount) { - _mesa_snprintf(s, MAXSTRING, "%d similar %s errors", + _mesa_snprintf(s, MAX_DEBUG_MESSAGE_LENGTH, "%d similar %s errors", ctx->ErrorDebugCount, - error_string(ctx->ErrorValue)); + _mesa_lookup_enum_by_nr(ctx->ErrorValue)); output_if_debug("Mesa", s, GL_TRUE); @@ -901,10 +812,10 @@ flush_delayed_errors( struct gl_context *ctx ) void _mesa_warning( struct gl_context *ctx, const char *fmtString, ... ) { - char str[MAXSTRING]; + char str[MAX_DEBUG_MESSAGE_LENGTH]; va_list args; va_start( args, fmtString ); - (void) _mesa_vsnprintf( str, MAXSTRING, fmtString, args ); + (void) _mesa_vsnprintf( str, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args ); va_end( args ); if (ctx) @@ -925,7 +836,7 @@ void _mesa_problem( const struct gl_context *ctx, const char *fmtString, ... ) { va_list args; - char str[MAXSTRING]; + char str[MAX_DEBUG_MESSAGE_LENGTH]; static int numCalls = 0; (void) ctx; @@ -934,7 +845,7 @@ _mesa_problem( const struct gl_context *ctx, const char *fmtString, ... ) numCalls++; va_start( args, fmtString ); - _mesa_vsnprintf( str, MAXSTRING, fmtString, args ); + _mesa_vsnprintf( str, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args ); va_end( args ); fprintf(stderr, "Mesa %s implementation error: %s\n", MESA_VERSION_STRING, str); @@ -978,6 +889,27 @@ should_output(struct gl_context *ctx, GLenum error, const char *fmtString) return GL_FALSE; } +void +_mesa_gl_debug(struct gl_context *ctx, + GLuint *id, + enum mesa_debug_type type, + enum mesa_debug_severity severity, + const char *fmtString, ...) +{ + char s[MAX_DEBUG_MESSAGE_LENGTH]; + int len; + va_list args; + + debug_get_id(id); + + va_start(args, fmtString); + len = _mesa_vsnprintf(s, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args); + va_end(args); + + _mesa_log_msg(ctx, MESA_DEBUG_SOURCE_API, type, + *id, severity, len, s); +} + /** * Record an OpenGL state error. These usually occur when the user @@ -995,29 +927,39 @@ void _mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... ) { GLboolean do_output, do_log; + /* Ideally this would be set up by the caller, so that we had proper IDs + * per different message. + */ + static GLuint error_msg_id = 0; + + debug_get_id(&error_msg_id); do_output = should_output(ctx, error, fmtString); - do_log = should_log(ctx, GL_DEBUG_SOURCE_API_ARB, GL_DEBUG_TYPE_ERROR_ARB, - API_ERROR_UNKNOWN, GL_DEBUG_SEVERITY_HIGH_ARB); + do_log = should_log(ctx, + MESA_DEBUG_SOURCE_API, + MESA_DEBUG_TYPE_ERROR, + error_msg_id, + MESA_DEBUG_SEVERITY_HIGH); if (do_output || do_log) { - char s[MAXSTRING], s2[MAXSTRING]; + char s[MAX_DEBUG_MESSAGE_LENGTH], s2[MAX_DEBUG_MESSAGE_LENGTH]; int len; va_list args; va_start(args, fmtString); - len = _mesa_vsnprintf(s, MAXSTRING, fmtString, args); + len = _mesa_vsnprintf(s, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args); va_end(args); - if (len >= MAXSTRING) { + if (len >= MAX_DEBUG_MESSAGE_LENGTH) { /* Too long error message. Whoever calls _mesa_error should use * shorter strings. */ ASSERT(0); return; } - len = _mesa_snprintf(s2, MAXSTRING, "%s in %s", error_string(error), s); - if (len >= MAXSTRING) { + len = _mesa_snprintf(s2, MAX_DEBUG_MESSAGE_LENGTH, "%s in %s", + _mesa_lookup_enum_by_nr(error), s); + if (len >= MAX_DEBUG_MESSAGE_LENGTH) { /* Same as above. */ ASSERT(0); return; @@ -1030,8 +972,11 @@ _mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... ) /* Log the error via ARB_debug_output if needed.*/ if (do_log) { - _mesa_log_msg(ctx, GL_DEBUG_SOURCE_API_ARB, GL_DEBUG_TYPE_ERROR_ARB, - API_ERROR_UNKNOWN, GL_DEBUG_SEVERITY_HIGH_ARB, len, s2); + _mesa_log_msg(ctx, + MESA_DEBUG_SOURCE_API, + MESA_DEBUG_TYPE_ERROR, + error_msg_id, + MESA_DEBUG_SEVERITY_HIGH, len, s2); } } @@ -1051,10 +996,10 @@ void _mesa_debug( const struct gl_context *ctx, const char *fmtString, ... ) { #ifdef DEBUG - char s[MAXSTRING]; + char s[MAX_DEBUG_MESSAGE_LENGTH]; va_list args; va_start(args, fmtString); - _mesa_vsnprintf(s, MAXSTRING, fmtString, args); + _mesa_vsnprintf(s, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args); va_end(args); output_if_debug("Mesa", s, GL_FALSE); #endif /* DEBUG */ @@ -1073,27 +1018,13 @@ _mesa_debug( const struct gl_context *ctx, const char *fmtString, ... ) * \param len The length of 'msg'. If negative, 'msg' must be null-terminated. */ void -_mesa_shader_debug( struct gl_context *ctx, GLenum type, GLuint id, +_mesa_shader_debug( struct gl_context *ctx, GLenum type, GLuint *id, const char *msg, int len ) { - GLenum source = GL_DEBUG_SOURCE_SHADER_COMPILER_ARB, - severity; + enum mesa_debug_source source = MESA_DEBUG_SOURCE_SHADER_COMPILER; + enum mesa_debug_severity severity = MESA_DEBUG_SEVERITY_HIGH; - switch (type) { - case GL_DEBUG_TYPE_ERROR_ARB: - assert(id < SHADER_ERROR_COUNT); - severity = GL_DEBUG_SEVERITY_HIGH_ARB; - break; - case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB: - case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB: - case GL_DEBUG_TYPE_PORTABILITY_ARB: - case GL_DEBUG_TYPE_PERFORMANCE_ARB: - case GL_DEBUG_TYPE_OTHER_ARB: - assert(0 && "other categories not implemented yet"); - default: - _mesa_problem(ctx, "bad enum in _mesa_shader_debug()"); - return; - } + debug_get_id(id); if (len < 0) len = strlen(msg); @@ -1102,7 +1033,7 @@ _mesa_shader_debug( struct gl_context *ctx, GLenum type, GLuint id, if (len >= MAX_DEBUG_MESSAGE_LENGTH) len = MAX_DEBUG_MESSAGE_LENGTH - 1; - _mesa_log_msg(ctx, source, type, id, severity, len, msg); + _mesa_log_msg(ctx, source, type, *id, severity, len, msg); } /*@}*/ diff --git a/mesalib/src/mesa/main/errors.h b/mesalib/src/mesa/main/errors.h index c92ee0a6e..7d8be5aca 100644 --- a/mesalib/src/mesa/main/errors.h +++ b/mesalib/src/mesa/main/errors.h @@ -44,8 +44,9 @@ extern "C" { #endif +#include "mtypes.h" + struct _glapi_table; -struct gl_context; extern void _mesa_init_errors( struct gl_context *ctx ); @@ -66,7 +67,15 @@ extern void _mesa_debug( const struct gl_context *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3); extern void -_mesa_shader_debug( struct gl_context *ctx, GLenum type, GLuint id, const char *msg, int len ); +_mesa_gl_debug(struct gl_context *ctx, + GLuint *id, + enum mesa_debug_type type, + enum mesa_debug_severity severity, + const char *fmtString, ...) PRINTFLIKE(5, 6); + +extern void +_mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id, + const char *msg, int len); void GLAPIENTRY _mesa_DebugMessageInsertARB(GLenum source, GLenum type, GLuint id, diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py index 5022ddc40..7d4f7e2a4 100644 --- a/mesalib/src/mesa/main/get_hash_params.py +++ b/mesalib/src/mesa/main/get_hash_params.py @@ -412,7 +412,7 @@ descriptor=[ [ "DEPTH_SCALE", "CONTEXT_FLOAT(Pixel.DepthScale), NO_EXTRA" ], [ "DOUBLEBUFFER", "BUFFER_INT(Visual.doubleBufferMode), NO_EXTRA" ], [ "DRAW_BUFFER", "BUFFER_ENUM(ColorDrawBuffer[0]), NO_EXTRA" ], - [ "EDGE_FLAG", "LOC_CUSTOM, TYPE_BOOLEAN, 0, NO_EXTRA" ], + [ "EDGE_FLAG", "LOC_CUSTOM, TYPE_BOOLEAN, 0, extra_flush_current" ], [ "FEEDBACK_BUFFER_SIZE", "CONTEXT_INT(Feedback.BufferSize), NO_EXTRA" ], [ "FEEDBACK_BUFFER_TYPE", "CONTEXT_ENUM(Feedback.Type), NO_EXTRA" ], [ "FOG_INDEX", "CONTEXT_FLOAT(Fog.Index), NO_EXTRA" ], diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index a80944c81..4f0951339 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -3368,52 +3368,61 @@ struct gl_dlist_state } Current; }; +/** @{ + * + * These are a mapping of the GL_ARB_debug_output enums to small enums + * suitable for use as an array index. + */ + +enum mesa_debug_source { + MESA_DEBUG_SOURCE_API, + MESA_DEBUG_SOURCE_WINDOW_SYSTEM, + MESA_DEBUG_SOURCE_SHADER_COMPILER, + MESA_DEBUG_SOURCE_THIRD_PARTY, + MESA_DEBUG_SOURCE_APPLICATION, + MESA_DEBUG_SOURCE_OTHER, + MESA_DEBUG_SOURCE_COUNT, +}; + +enum mesa_debug_type { + MESA_DEBUG_TYPE_ERROR, + MESA_DEBUG_TYPE_DEPRECATED, + MESA_DEBUG_TYPE_UNDEFINED, + MESA_DEBUG_TYPE_PORTABILITY, + MESA_DEBUG_TYPE_PERFORMANCE, + MESA_DEBUG_TYPE_OTHER, + MESA_DEBUG_TYPE_COUNT, +}; + +enum mesa_debug_severity { + MESA_DEBUG_SEVERITY_LOW, + MESA_DEBUG_SEVERITY_MEDIUM, + MESA_DEBUG_SEVERITY_HIGH, + MESA_DEBUG_SEVERITY_COUNT, +}; + +/** @} */ + /** * An error, warning, or other piece of debug information for an application * to consume via GL_ARB_debug_output. */ struct gl_debug_msg { - GLenum source; - GLenum type; + enum mesa_debug_source source; + enum mesa_debug_type type; GLuint id; - GLenum severity; + enum mesa_debug_severity severity; GLsizei length; GLcharARB *message; }; -typedef enum { - API_ERROR_UNKNOWN, - API_ERROR_COUNT -} gl_api_error; - -typedef enum { - WINSYS_ERROR_UNKNOWN, - WINSYS_ERROR_COUNT -} gl_winsys_error; - -typedef enum { - SHADER_ERROR_UNKNOWN, - SHADER_ERROR_COUNT -} gl_shader_error; - -typedef enum { - OTHER_ERROR_UNKNOWN, - OTHER_ERROR_OUT_OF_MEMORY, - OTHER_ERROR_COUNT -} gl_other_error; - -struct gl_client_namespace +struct gl_debug_namespace { struct _mesa_HashTable *IDs; unsigned ZeroID; /* a HashTable won't take zero, so store its state here */ - struct simple_node Severity[3]; /* lists of IDs in the hash table */ -}; - -struct gl_client_debug -{ - GLboolean Defaults[3][2][6]; /* severity, source, type */ - struct gl_client_namespace Namespaces[2][6]; /* source, type */ + /** lists of IDs in the hash table at each severity */ + struct simple_node Severity[MESA_DEBUG_SEVERITY_COUNT]; }; struct gl_debug_state @@ -3421,11 +3430,8 @@ struct gl_debug_state GLDEBUGPROCARB Callback; GLvoid *CallbackData; GLboolean SyncOutput; - GLboolean ApiErrors[API_ERROR_COUNT]; - GLboolean WinsysErrors[WINSYS_ERROR_COUNT]; - GLboolean ShaderErrors[SHADER_ERROR_COUNT]; - GLboolean OtherErrors[OTHER_ERROR_COUNT]; - struct gl_client_debug ClientIDs; + GLboolean Defaults[MESA_DEBUG_SEVERITY_COUNT][MESA_DEBUG_SOURCE_COUNT][MESA_DEBUG_TYPE_COUNT]; + struct gl_debug_namespace Namespaces[MESA_DEBUG_SOURCE_COUNT][MESA_DEBUG_TYPE_COUNT]; struct gl_debug_msg Log[MAX_DEBUG_LOGGED_MESSAGES]; GLint NumMessages; GLint NextMsg; diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 0dcf88ae4..9d4a17052 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -1416,6 +1416,7 @@ _mesa_legal_texture_dimensions(struct gl_context *ctx, GLenum target, return GL_FALSE; return GL_TRUE; + case GL_TEXTURE_CUBE_MAP: case GL_TEXTURE_CUBE_MAP_POSITIVE_X: case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index c41b5833e..131ecb22a 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -2714,16 +2714,28 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) switch (ir->op) { case ir_tex: opcode = (is_cube_array && ir->shadow_comparitor) ? TGSI_OPCODE_TEX2 : TGSI_OPCODE_TEX; + if (ir->offset) { + ir->offset->accept(this); + offset = this->result; + } break; case ir_txb: opcode = is_cube_array ? TGSI_OPCODE_TXB2 : TGSI_OPCODE_TXB; ir->lod_info.bias->accept(this); lod_info = this->result; + if (ir->offset) { + ir->offset->accept(this); + offset = this->result; + } break; case ir_txl: opcode = is_cube_array ? TGSI_OPCODE_TXL2 : TGSI_OPCODE_TXL; ir->lod_info.lod->accept(this); lod_info = this->result; + if (ir->offset) { + ir->offset->accept(this); + offset = this->result; + } break; case ir_txd: opcode = TGSI_OPCODE_TXD; @@ -2731,6 +2743,10 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) dx = this->result; ir->lod_info.grad.dPdy->accept(this); dy = this->result; + if (ir->offset) { + ir->offset->accept(this); + offset = this->result; + } break; case ir_txs: opcode = TGSI_OPCODE_TXQ; @@ -2742,8 +2758,8 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) ir->lod_info.lod->accept(this); lod_info = this->result; if (ir->offset) { - ir->offset->accept(this); - offset = this->result; + ir->offset->accept(this); + offset = this->result; } break; case ir_txf_ms: diff --git a/xorg-server/Xi/xibarriers.c b/xorg-server/Xi/xibarriers.c index 7b7b83f1c..fccab8615 100644 --- a/xorg-server/Xi/xibarriers.c +++ b/xorg-server/Xi/xibarriers.c @@ -435,6 +435,7 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen, dir = barrier_get_direction(current_x, current_y, x, y); while (dir != 0) { + int new_sequence; struct PointerBarrierDevice *pbd; c = barrier_find_nearest(cs, master, dir, current_x, current_y, x, y); @@ -444,6 +445,8 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen, nearest = &c->barrier; pbd = GetBarrierDevice(c, master->id); + new_sequence = !pbd->hit; + pbd->seen = TRUE; pbd->hit = TRUE; @@ -466,7 +469,7 @@ input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen, ev.event_id = pbd->barrier_event_id; ev.barrierid = c->id; - ev.dt = ms - pbd->last_timestamp; + ev.dt = new_sequence ? 0 : ms - pbd->last_timestamp; ev.window = c->window; pbd->last_timestamp = ms; @@ -676,8 +679,8 @@ BarrierFreeBarrier(void *data, XID id) continue; ev.deviceid = dev->id; - ev.event_id = pbd->barrier_event_id, - ev.dt = ms - pbd->last_timestamp, + ev.event_id = pbd->barrier_event_id; + ev.dt = ms - pbd->last_timestamp; GetSpritePosition(dev, &root_x, &root_y); ev.root_x = root_x; diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac index 53335b1d1..6e1ff65c4 100644 --- a/xorg-server/configure.ac +++ b/xorg-server/configure.ac @@ -26,9 +26,9 @@ dnl dnl Process this file with autoconf to create configure. AC_PREREQ(2.60) -AC_INIT([xorg-server], 1.13.99.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server) -RELEASE_DATE="2013-02-12" -RELEASE_NAME="Ginger Beer" +AC_INIT([xorg-server], 1.14.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server) +RELEASE_DATE="2013-03-05" +RELEASE_NAME="Keemun Mao Feng" AC_CONFIG_SRCDIR([Makefile.am]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) diff --git a/xorg-server/hw/xfree86/common/xf86DPMS.c b/xorg-server/hw/xfree86/common/xf86DPMS.c index ef4a2c19b..3f1e142c7 100644 --- a/xorg-server/hw/xfree86/common/xf86DPMS.c +++ b/xorg-server/hw/xfree86/common/xf86DPMS.c @@ -130,6 +130,19 @@ DPMSClose(ScreenPtr pScreen) return pScreen->CloseScreen(pScreen); } +static void +DPMSSetScreen(ScrnInfoPtr pScrn, int level) +{ + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); + DPMSPtr pDPMS = dixLookupPrivate(&pScreen->devPrivates, DPMSKey); + + if (pDPMS && pScrn->DPMSSet && pDPMS->Enabled && pScrn->vtSema) { + xf86VGAarbiterLock(pScrn); + pScrn->DPMSSet(pScrn, level, 0); + xf86VGAarbiterUnlock(pScrn); + } +} + /* * DPMSSet -- * Device dependent DPMS mode setting hook. This is called whenever @@ -139,8 +152,6 @@ int DPMSSet(ClientPtr client, int level) { int rc, i; - DPMSPtr pDPMS; - ScrnInfoPtr pScrn; DPMSPowerLevel = level; @@ -155,17 +166,23 @@ DPMSSet(ClientPtr client, int level) /* For each screen, set the DPMS level */ for (i = 0; i < xf86NumScreens; i++) { - pScrn = xf86Screens[i]; - pDPMS = dixLookupPrivate(&screenInfo.screens[i]->devPrivates, DPMSKey); - if (pDPMS && pScrn->DPMSSet && pDPMS->Enabled && pScrn->vtSema) { - xf86VGAarbiterLock(pScrn); - pScrn->DPMSSet(pScrn, level, 0); - xf86VGAarbiterUnlock(pScrn); - } + DPMSSetScreen(xf86Screens[i], level); + } + for (i = 0; i < xf86NumGPUScreens; i++) { + DPMSSetScreen(xf86GPUScreens[i], level); } return Success; } +static Bool +DPMSSupportedOnScreen(ScrnInfoPtr pScrn) +{ + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); + DPMSPtr pDPMS = dixLookupPrivate(&pScreen->devPrivates, DPMSKey); + + return pDPMS && pScrn->DPMSSet; +} + /* * DPMSSupported -- * Return TRUE if any screen supports DPMS. @@ -174,8 +191,6 @@ Bool DPMSSupported(void) { int i; - DPMSPtr pDPMS; - ScrnInfoPtr pScrn; if (DPMSKey == NULL) { return FALSE; @@ -183,9 +198,11 @@ DPMSSupported(void) /* For each screen, check if DPMS is supported */ for (i = 0; i < xf86NumScreens; i++) { - pScrn = xf86Screens[i]; - pDPMS = dixLookupPrivate(&screenInfo.screens[i]->devPrivates, DPMSKey); - if (pDPMS && pScrn->DPMSSet) + if (DPMSSupportedOnScreen(xf86Screens[i])) + return TRUE; + } + for (i = 0; i < xf86NumGPUScreens; i++) { + if (DPMSSupportedOnScreen(xf86GPUScreens[i])) return TRUE; } return FALSE; |