summaryrefslogtreecommitdiff
path: root/lib/mesa
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2015-11-22 02:38:47 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2015-11-22 02:38:47 +0000
commitf5c2c82a99d05995f5189545c1eeac685ff5108f (patch)
tree344efb24f27d7c5b457d1c40058459308fc77302 /lib/mesa
parentb833e8964efde39fb7b9e8b075eb053b4d8d03b5 (diff)
import Mesa 11.0.6
Diffstat (limited to 'lib/mesa')
-rw-r--r--lib/mesa/include/EGL/eglextchromium.h11
-rw-r--r--lib/mesa/include/c11/threads_posix.h124
-rw-r--r--lib/mesa/include/c99_math.h72
-rw-r--r--lib/mesa/src/mesa/main/streaming-load-memcpy.c3
4 files changed, 93 insertions, 117 deletions
diff --git a/lib/mesa/include/EGL/eglextchromium.h b/lib/mesa/include/EGL/eglextchromium.h
index 695894368..0cc097658 100644
--- a/lib/mesa/include/EGL/eglextchromium.h
+++ b/lib/mesa/include/EGL/eglextchromium.h
@@ -53,17 +53,6 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCVALUESCHROMIUMPROC)
#endif
#endif
-#ifndef EGL_EXT_image_flush_external
-#define EGL_EXT_image_flush_external 1
-#define EGL_IMAGE_EXTERNAL_FLUSH_EXT 0x32A2
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLIMAGEFLUSHEXTERNALEXTPROC) (EGLDisplay dpy, EGLImageKHR image, const EGLAttrib *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLIMAGEINVALIDATEEXTERNALEXTPROC) (EGLDisplay dpy, EGLImageKHR image, const EGLAttrib *attrib_list);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglImageFlushExternalEXT (EGLDisplay dpy, EGLImageKHR image, const EGLAttrib *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglImageInvalidateExternalEXT (EGLDisplay dpy, EGLImageKHR image, const EGLAttrib *attrib_list);
-#endif
-#endif /* EGL_EXT_image_flush_external */
-
#ifdef __cplusplus
}
#endif
diff --git a/lib/mesa/include/c11/threads_posix.h b/lib/mesa/include/c11/threads_posix.h
index 802526a77..2182c2835 100644
--- a/lib/mesa/include/c11/threads_posix.h
+++ b/lib/mesa/include/c11/threads_posix.h
@@ -102,8 +102,9 @@ call_once(once_flag *flag, void (*func)(void))
static inline int
cnd_broadcast(cnd_t *cond)
{
- assert(cond != NULL);
- return (pthread_cond_broadcast(cond) == 0) ? thrd_success : thrd_error;
+ if (!cond) return thrd_error;
+ pthread_cond_broadcast(cond);
+ return thrd_success;
}
// 7.25.3.2
@@ -118,31 +119,30 @@ cnd_destroy(cnd_t *cond)
static inline int
cnd_init(cnd_t *cond)
{
- assert(cond != NULL);
- return (pthread_cond_init(cond, NULL) == 0) ? thrd_success : thrd_error;
+ if (!cond) return thrd_error;
+ pthread_cond_init(cond, NULL);
+ return thrd_success;
}
// 7.25.3.4
static inline int
cnd_signal(cnd_t *cond)
{
- assert(cond != NULL);
- return (pthread_cond_signal(cond) == 0) ? thrd_success : thrd_error;
+ if (!cond) return thrd_error;
+ pthread_cond_signal(cond);
+ return thrd_success;
}
// 7.25.3.5
static inline int
-cnd_timedwait(cnd_t *cond, mtx_t *mtx, const struct timespec *abs_time)
+cnd_timedwait(cnd_t *cond, mtx_t *mtx, const xtime *xt)
{
+ struct timespec abs_time;
int rt;
-
- assert(mtx != NULL);
- assert(cond != NULL);
- assert(abs_time != NULL);
-
- rt = pthread_cond_timedwait(cond, mtx, abs_time);
+ if (!cond || !mtx || !xt) return thrd_error;
+ rt = pthread_cond_timedwait(cond, mtx, &abs_time);
if (rt == ETIMEDOUT)
- return thrd_timedout;
+ return thrd_busy;
return (rt == 0) ? thrd_success : thrd_error;
}
@@ -150,9 +150,9 @@ cnd_timedwait(cnd_t *cond, mtx_t *mtx, const struct timespec *abs_time)
static inline int
cnd_wait(cnd_t *cond, mtx_t *mtx)
{
- assert(mtx != NULL);
- assert(cond != NULL);
- return (pthread_cond_wait(cond, mtx) == 0) ? thrd_success : thrd_error;
+ if (!cond || !mtx) return thrd_error;
+ pthread_cond_wait(cond, mtx);
+ return thrd_success;
}
@@ -161,55 +161,24 @@ cnd_wait(cnd_t *cond, mtx_t *mtx)
static inline void
mtx_destroy(mtx_t *mtx)
{
- assert(mtx != NULL);
+ assert(mtx);
pthread_mutex_destroy(mtx);
}
-/*
- * XXX: Workaround when building with -O0 and without pthreads link.
- *
- * In such cases constant folding and dead code elimination won't be
- * available, thus the compiler will always add the pthread_mutexattr*
- * functions into the binary. As we try to link, we'll fail as the
- * symbols are unresolved.
- *
- * Ideally we'll enable the optimisations locally, yet that does not
- * seem to work.
- *
- * So the alternative workaround is to annotate the symbols as weak.
- * Thus the linker will be happy and things don't clash when building
- * with -O1 or greater.
- */
-#if defined(HAVE_FUNC_ATTRIBUTE_WEAK) && !defined(__CYGWIN__)
-__attribute__((weak))
-int pthread_mutexattr_init(pthread_mutexattr_t *attr);
-
-__attribute__((weak))
-int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type);
-
-__attribute__((weak))
-int pthread_mutexattr_destroy(pthread_mutexattr_t *attr);
-#endif
-
// 7.25.4.2
static inline int
mtx_init(mtx_t *mtx, int type)
{
pthread_mutexattr_t attr;
- assert(mtx != NULL);
+ if (!mtx) return thrd_error;
if (type != mtx_plain && type != mtx_timed && type != mtx_try
&& type != (mtx_plain|mtx_recursive)
&& type != (mtx_timed|mtx_recursive)
&& type != (mtx_try|mtx_recursive))
return thrd_error;
-
- if ((type & mtx_recursive) == 0) {
- pthread_mutex_init(mtx, NULL);
- return thrd_success;
- }
-
pthread_mutexattr_init(&attr);
- pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ if ((type & mtx_recursive) != 0)
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(mtx, &attr);
pthread_mutexattr_destroy(&attr);
return thrd_success;
@@ -219,8 +188,9 @@ mtx_init(mtx_t *mtx, int type)
static inline int
mtx_lock(mtx_t *mtx)
{
- assert(mtx != NULL);
- return (pthread_mutex_lock(mtx) == 0) ? thrd_success : thrd_error;
+ if (!mtx) return thrd_error;
+ pthread_mutex_lock(mtx);
+ return thrd_success;
}
static inline int
@@ -231,25 +201,26 @@ thrd_yield(void);
// 7.25.4.4
static inline int
-mtx_timedlock(mtx_t *mtx, const struct timespec *ts)
+mtx_timedlock(mtx_t *mtx, const xtime *xt)
{
- assert(mtx != NULL);
- assert(ts != NULL);
-
+ if (!mtx || !xt) return thrd_error;
{
#ifdef EMULATED_THREADS_USE_NATIVE_TIMEDLOCK
+ struct timespec ts;
int rt;
- rt = pthread_mutex_timedlock(mtx, ts);
+ ts.tv_sec = xt->sec;
+ ts.tv_nsec = xt->nsec;
+ rt = pthread_mutex_timedlock(mtx, &ts);
if (rt == 0)
return thrd_success;
- return (rt == ETIMEDOUT) ? thrd_timedout : thrd_error;
+ return (rt == ETIMEDOUT) ? thrd_busy : thrd_error;
#else
time_t expire = time(NULL);
- expire += ts->tv_sec;
+ expire += xt->sec;
while (mtx_trylock(mtx) != thrd_success) {
time_t now = time(NULL);
if (expire < now)
- return thrd_timedout;
+ return thrd_busy;
// busy loop!
thrd_yield();
}
@@ -262,7 +233,7 @@ mtx_timedlock(mtx_t *mtx, const struct timespec *ts)
static inline int
mtx_trylock(mtx_t *mtx)
{
- assert(mtx != NULL);
+ if (!mtx) return thrd_error;
return (pthread_mutex_trylock(mtx) == 0) ? thrd_success : thrd_busy;
}
@@ -270,8 +241,9 @@ mtx_trylock(mtx_t *mtx)
static inline int
mtx_unlock(mtx_t *mtx)
{
- assert(mtx != NULL);
- return (pthread_mutex_unlock(mtx) == 0) ? thrd_success : thrd_error;
+ if (!mtx) return thrd_error;
+ pthread_mutex_unlock(mtx);
+ return thrd_success;
}
@@ -281,7 +253,7 @@ static inline int
thrd_create(thrd_t *thr, thrd_start_t func, void *arg)
{
struct impl_thrd_param *pack;
- assert(thr != NULL);
+ if (!thr) return thrd_error;
pack = (struct impl_thrd_param *)malloc(sizeof(struct impl_thrd_param));
if (!pack) return thrd_nomem;
pack->func = func;
@@ -335,10 +307,13 @@ thrd_join(thrd_t thr, int *res)
// 7.25.5.7
static inline void
-thrd_sleep(const struct timespec *time_point, struct timespec *remaining)
+thrd_sleep(const xtime *xt)
{
- assert(time_point != NULL);
- nanosleep(time_point, remaining);
+ struct timespec req;
+ assert(xt);
+ req.tv_sec = xt->sec;
+ req.tv_nsec = xt->nsec;
+ nanosleep(&req, NULL);
}
// 7.25.5.8
@@ -354,7 +329,7 @@ thrd_yield(void)
static inline int
tss_create(tss_t *key, tss_dtor_t dtor)
{
- assert(key != NULL);
+ if (!key) return thrd_error;
return (pthread_key_create(key, dtor) == 0) ? thrd_success : thrd_error;
}
@@ -382,15 +357,14 @@ tss_set(tss_t key, void *val)
/*-------------------- 7.25.7 Time functions --------------------*/
// 7.25.6.1
-#ifndef HAVE_TIMESPEC_GET
static inline int
-timespec_get(struct timespec *ts, int base)
+xtime_get(xtime *xt, int base)
{
- if (!ts) return 0;
+ if (!xt) return 0;
if (base == TIME_UTC) {
- clock_gettime(CLOCK_REALTIME, ts);
+ xt->sec = time(NULL);
+ xt->nsec = 0;
return base;
}
return 0;
}
-#endif
diff --git a/lib/mesa/include/c99_math.h b/lib/mesa/include/c99_math.h
index e906c26aa..8a67fb133 100644
--- a/lib/mesa/include/c99_math.h
+++ b/lib/mesa/include/c99_math.h
@@ -38,16 +38,55 @@
#include "c99_compat.h"
+#if defined(_MSC_VER)
+
/* This is to ensure that we get M_PI, etc. definitions */
-#if defined(_MSC_VER) && !defined(_USE_MATH_DEFINES)
+#if !defined(_USE_MATH_DEFINES)
#error _USE_MATH_DEFINES define required when building with MSVC
#endif
+#if _MSC_VER < 1800
+#define isfinite(x) _finite((double)(x))
+#define isnan(x) _isnan((double)(x))
+#endif /* _MSC_VER < 1800 */
+
+#if _MSC_VER < 1800
+static inline double log2( double x )
+{
+ const double invln2 = 1.442695041;
+ return log( x ) * invln2;
+}
+
+static inline double
+round(double x)
+{
+ return x >= 0.0 ? floor(x + 0.5) : ceil(x - 0.5);
+}
-#if !defined(_MSC_VER) && \
- __STDC_VERSION__ < 199901L && \
- (!defined(_XOPEN_SOURCE) || _XOPEN_SOURCE < 600) && \
- !defined(__cplusplus)
+static inline float
+roundf(float x)
+{
+ return x >= 0.0f ? floorf(x + 0.5f) : ceilf(x - 0.5f);
+}
+#endif
+
+#ifndef INFINITY
+#include <float.h> // DBL_MAX
+#define INFINITY (DBL_MAX + DBL_MAX)
+#endif
+
+#ifndef NAN
+#define NAN (INFINITY - INFINITY)
+#endif
+
+#endif /* _MSC_VER */
+
+
+#if (defined(_MSC_VER) && _MSC_VER < 1800) || \
+ (!defined(_MSC_VER) && \
+ __STDC_VERSION__ < 199901L && \
+ (!defined(_XOPEN_SOURCE) || _XOPEN_SOURCE < 600) && \
+ !defined(__cplusplus))
static inline long int
lrint(double d)
@@ -185,27 +224,4 @@ fpclassify(double x)
#endif
-/* Since C++11, the following functions are part of the std namespace. Their C
- * counteparts should still exist in the global namespace, however cmath
- * undefines those functions, which in glibc 2.23, are defined as macros rather
- * than functions as in glibc 2.22.
- */
-#if __cplusplus >= 201103L && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 23))
-#include <cmath>
-
-using std::fpclassify;
-using std::isfinite;
-using std::isinf;
-using std::isnan;
-using std::isnormal;
-using std::signbit;
-using std::isgreater;
-using std::isgreaterequal;
-using std::isless;
-using std::islessequal;
-using std::islessgreater;
-using std::isunordered;
-#endif
-
-
#endif /* #define _C99_MATH_H_ */
diff --git a/lib/mesa/src/mesa/main/streaming-load-memcpy.c b/lib/mesa/src/mesa/main/streaming-load-memcpy.c
index 32854b60e..d7147afdc 100644
--- a/lib/mesa/src/mesa/main/streaming-load-memcpy.c
+++ b/lib/mesa/src/mesa/main/streaming-load-memcpy.c
@@ -59,9 +59,6 @@ _mesa_streaming_load_memcpy(void *restrict dst, void *restrict src, size_t len)
len -= MIN2(bytes_before_alignment_boundary, len);
}
- if (len >= 64)
- _mm_mfence();
-
while (len >= 64) {
__m128i *dst_cacheline = (__m128i *)d;
__m128i *src_cacheline = (__m128i *)s;