summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorChristian König <[email protected]>2011-05-21 16:43:12 +0200
committerChristian König <[email protected]>2011-05-21 16:43:12 +0200
commitaa63ebc48a2ee1ee9afbf2112d4d25e8a9a8d1e8 (patch)
treec97d505614f1fd84d498484a45156e0064daf649 /src/gallium/auxiliary
parent120b55a96e30f1f74ba3448665cef3d724fed647 (diff)
parent3c5e74186244f2d77cc711d2b487283459ed06ad (diff)
Merge remote-tracking branch 'origin/master' into pipe-video
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_misc.cpp27
-rw-r--r--src/gallium/auxiliary/os/os_thread.h9
-rw-r--r--src/gallium/auxiliary/util/u_vbuf_mgr.c7
3 files changed, 39 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index 843a14a500c..d2d7eccd92f 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -73,6 +73,19 @@ lp_set_target_options(void)
#endif
#endif
+ /*
+ * LLVM revision 123367 switched the default stack alignment to 16 bytes on
+ * Linux (and several other Unices in later revisions), to match recent gcc
+ * versions.
+ *
+ * However our drivers can be loaded by old binary applications, still
+ * maintaining a 4 bytes stack alignment. Therefore we must tell LLVM here
+ * to only assume a 4 bytes alignment for backwards compatibility.
+ */
+#if defined(PIPE_ARCH_X86)
+ llvm::StackAlignment = 4;
+#endif
+
#if defined(DEBUG) || defined(PROFILE)
llvm::NoFramePointerElim = true;
#endif
@@ -93,13 +106,23 @@ lp_set_target_options(void)
* See also:
* - http://llvm.org/bugs/show_bug.cgi?id=3287
* - http://l4.me.uk/post/2009/06/07/llvm-wrinkle-3-configuration-what-configuration/
+ *
+ * The -disable-mmx global option can be specified only once since we
+ * dynamically link against LLVM it will reside in a separate shared object,
+ * which may or not be delete when this shared object is, so we use the
+ * llvm::DisablePrettyStackTrace variable (which we set below and should
+ * reside in the same shared library) to determine whether the -disable-mmx
+ * option has been set or not.
+ *
+ * Thankfully this ugly hack is not necessary on LLVM 2.9 onwards.
*/
- static boolean first = TRUE;
- if (first) {
+ if (!llvm::DisablePrettyStackTrace) {
+ static boolean first = TRUE;
static const char* options[] = {
"prog",
"-disable-mmx"
};
+ assert(first);
llvm::cl::ParseCommandLineOptions(2, const_cast<char**>(options));
first = FALSE;
}
diff --git a/src/gallium/auxiliary/os/os_thread.h b/src/gallium/auxiliary/os/os_thread.h
index 8173d4cc37f..6b4281ad661 100644
--- a/src/gallium/auxiliary/os/os_thread.h
+++ b/src/gallium/auxiliary/os/os_thread.h
@@ -56,7 +56,14 @@ typedef pthread_t pipe_thread;
static INLINE pipe_thread pipe_thread_create( void *(* routine)( void *), void *param )
{
pipe_thread thread;
- if (pthread_create( &thread, NULL, routine, param ))
+ sigset_t saved_set, new_set;
+ int ret;
+
+ sigfillset(&new_set);
+ pthread_sigmask(SIG_SETMASK, &new_set, &saved_set);
+ ret = pthread_create( &thread, NULL, routine, param );
+ pthread_sigmask(SIG_SETMASK, &saved_set, NULL);
+ if (ret)
return 0;
return thread;
}
diff --git a/src/gallium/auxiliary/util/u_vbuf_mgr.c b/src/gallium/auxiliary/util/u_vbuf_mgr.c
index a034483ee5c..04149525ea7 100644
--- a/src/gallium/auxiliary/util/u_vbuf_mgr.c
+++ b/src/gallium/auxiliary/util/u_vbuf_mgr.c
@@ -581,7 +581,12 @@ static void u_vbuf_mgr_compute_max_index(struct u_vbuf_mgr_priv *mgr)
* for that when dividing by stride. */
unused = vb->stride -
(mgr->ve->ve[i].src_offset + mgr->ve->src_format_size[i]);
- assert(unused >= 0);
+
+ /* If src_offset is greater than stride (which means it's a buffer
+ * offset rather than a vertex offset)... */
+ if (unused < 0) {
+ unused = 0;
+ }
/* Compute the maximum index for this vertex element. */
max_index =