aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/gallium')
-rw-r--r--mesalib/src/gallium/Automake.inc2
-rw-r--r--mesalib/src/gallium/Makefile.am8
-rw-r--r--mesalib/src/gallium/SConscript2
-rw-r--r--mesalib/src/gallium/auxiliary/Makefile.am4
-rw-r--r--mesalib/src/gallium/auxiliary/Makefile.sources2
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_atomic.h401
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blend.h25
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_debug.h2
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_debug_flush.c12
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_math.h8
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_prim.h6
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_tests.c1
12 files changed, 54 insertions, 419 deletions
diff --git a/mesalib/src/gallium/Automake.inc b/mesalib/src/gallium/Automake.inc
index 9b312b113..95aae50d6 100644
--- a/mesalib/src/gallium/Automake.inc
+++ b/mesalib/src/gallium/Automake.inc
@@ -32,6 +32,7 @@ GALLIUM_DRIVER_CXXFLAGS = \
$(VISIBILITY_CXXFLAGS)
GALLIUM_TARGET_CFLAGS = \
+ -I$(top_srcdir)/src \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/loader \
-I$(top_srcdir)/src/gallium/include \
@@ -50,6 +51,7 @@ GALLIUM_COMMON_LIB_DEPS = \
$(DLOPEN_LIBS)
GALLIUM_WINSYS_CFLAGS = \
+ -I$(top_srcdir)/src \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/gallium/include \
-I$(top_srcdir)/src/gallium/auxiliary \
diff --git a/mesalib/src/gallium/Makefile.am b/mesalib/src/gallium/Makefile.am
index 81840b208..6a2a86654 100644
--- a/mesalib/src/gallium/Makefile.am
+++ b/mesalib/src/gallium/Makefile.am
@@ -112,7 +112,13 @@ SUBDIRS += winsys/sw/wrapper
##
EXTRA_DIST = \
- winsys/sw/android \
+ docs \
+ README.portability \
+ SConscript \
+ state_trackers/egl \
+ state_trackers/gbm \
+ targets/egl-static \
+ targets/gbm \
winsys/sw/gdi \
winsys/sw/hgl
diff --git a/mesalib/src/gallium/SConscript b/mesalib/src/gallium/SConscript
index 977e3fbf4..25d0af6f9 100644
--- a/mesalib/src/gallium/SConscript
+++ b/mesalib/src/gallium/SConscript
@@ -63,7 +63,7 @@ SConscript([
if not env['embedded']:
SConscript('state_trackers/vega/SConscript')
- if env['platform'] not in ('cygwin', 'darwin', 'freebsd', 'haiku', 'sunos'):
+ if env['platform'] not in ('cygwin', 'darwin', 'freebsd', 'sunos'):
SConscript([
'state_trackers/egl/SConscript',
'targets/egl-static/SConscript',
diff --git a/mesalib/src/gallium/auxiliary/Makefile.am b/mesalib/src/gallium/auxiliary/Makefile.am
index 4085e510b..1053ce4ee 100644
--- a/mesalib/src/gallium/auxiliary/Makefile.am
+++ b/mesalib/src/gallium/auxiliary/Makefile.am
@@ -74,11 +74,13 @@ libgalliumvl_la_SOURCES = \
endif
EXTRA_DIST = \
- Android.mk SConscript \
+ SConscript \
indices/u_indices.c \
indices/u_unfilled_indices.c \
indices/u_indices_gen.py \
indices/u_unfilled_gen.py \
+ postprocess/ADDING \
+ rbug/README \
target-helpers \
util/u_format.csv \
util/u_format_pack.py \
diff --git a/mesalib/src/gallium/auxiliary/Makefile.sources b/mesalib/src/gallium/auxiliary/Makefile.sources
index 862626461..3460482c1 100644
--- a/mesalib/src/gallium/auxiliary/Makefile.sources
+++ b/mesalib/src/gallium/auxiliary/Makefile.sources
@@ -165,9 +165,9 @@ C_SOURCES := \
translate/translate_generic.c \
translate/translate_sse.c \
util/dbghelp.h \
- util/u_atomic.h \
util/u_bitmask.c \
util/u_bitmask.h \
+ util/u_blend.h \
util/u_blit.c \
util/u_blit.h \
util/u_blitter.c \
diff --git a/mesalib/src/gallium/auxiliary/util/u_atomic.h b/mesalib/src/gallium/auxiliary/util/u_atomic.h
deleted file mode 100644
index 2500bc752..000000000
--- a/mesalib/src/gallium/auxiliary/util/u_atomic.h
+++ /dev/null
@@ -1,401 +0,0 @@
-/**
- * Many similar implementations exist. See for example libwsbm
- * or the linux kernel include/atomic.h
- *
- * No copyright claimed on this file.
- *
- */
-
-#ifndef U_ATOMIC_H
-#define U_ATOMIC_H
-
-#include "pipe/p_compiler.h"
-#include "pipe/p_defines.h"
-
-/* Favor OS-provided implementations.
- *
- * Where no OS-provided implementation is available, fall back to
- * locally coded assembly, compiler intrinsic or ultimately a
- * mutex-based implementation.
- */
-#if defined(PIPE_OS_SOLARIS)
-#define PIPE_ATOMIC_OS_SOLARIS
-#elif defined(PIPE_CC_MSVC)
-#define PIPE_ATOMIC_MSVC_INTRINSIC
-#elif (defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86))
-#define PIPE_ATOMIC_ASM_MSVC_X86
-#elif defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 401)
-#define PIPE_ATOMIC_GCC_INTRINSIC
-#elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86))
-#define PIPE_ATOMIC_ASM_GCC_X86
-#elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64))
-#define PIPE_ATOMIC_ASM_GCC_X86_64
-#else
-#error "Unsupported platform"
-#endif
-
-
-#if defined(PIPE_ATOMIC_ASM_GCC_X86_64)
-#define PIPE_ATOMIC "GCC x86_64 assembly"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define p_atomic_set(_v, _i) (*(_v) = (_i))
-#define p_atomic_read(_v) (*(_v))
-
-static INLINE boolean
-p_atomic_dec_zero(int32_t *v)
-{
- unsigned char c;
-
- __asm__ __volatile__("lock; decl %0; sete %1":"+m"(*v), "=qm"(c)
- ::"memory");
-
- return c != 0;
-}
-
-static INLINE void
-p_atomic_inc(int32_t *v)
-{
- __asm__ __volatile__("lock; incl %0":"+m"(*v));
-}
-
-static INLINE void
-p_atomic_dec(int32_t *v)
-{
- __asm__ __volatile__("lock; decl %0":"+m"(*v));
-}
-
-static INLINE int32_t
-p_atomic_inc_return(int32_t *v)
-{
- return __sync_add_and_fetch(v, 1);
-}
-
-static INLINE int32_t
-p_atomic_dec_return(int32_t *v)
-{
- return __sync_sub_and_fetch(v, 1);
-}
-
-static INLINE int32_t
-p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new)
-{
- return __sync_val_compare_and_swap(v, old, _new);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* PIPE_ATOMIC_ASM_GCC_X86_64 */
-
-
-#if defined(PIPE_ATOMIC_ASM_GCC_X86)
-
-#define PIPE_ATOMIC "GCC x86 assembly"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define p_atomic_set(_v, _i) (*(_v) = (_i))
-#define p_atomic_read(_v) (*(_v))
-
-static INLINE boolean
-p_atomic_dec_zero(int32_t *v)
-{
- unsigned char c;
-
- __asm__ __volatile__("lock; decl %0; sete %1":"+m"(*v), "=qm"(c)
- ::"memory");
-
- return c != 0;
-}
-
-static INLINE void
-p_atomic_inc(int32_t *v)
-{
- __asm__ __volatile__("lock; incl %0":"+m"(*v));
-}
-
-static INLINE void
-p_atomic_dec(int32_t *v)
-{
- __asm__ __volatile__("lock; decl %0":"+m"(*v));
-}
-
-static INLINE int32_t
-p_atomic_inc_return(int32_t *v)
-{
- return __sync_add_and_fetch(v, 1);
-}
-
-static INLINE int32_t
-p_atomic_dec_return(int32_t *v)
-{
- return __sync_sub_and_fetch(v, 1);
-}
-
-static INLINE int32_t
-p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new)
-{
- return __sync_val_compare_and_swap(v, old, _new);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
-
-/* Implementation using GCC-provided synchronization intrinsics
- */
-#if defined(PIPE_ATOMIC_GCC_INTRINSIC)
-
-#define PIPE_ATOMIC "GCC Sync Intrinsics"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define p_atomic_set(_v, _i) (*(_v) = (_i))
-#define p_atomic_read(_v) (*(_v))
-
-static INLINE boolean
-p_atomic_dec_zero(int32_t *v)
-{
- return (__sync_sub_and_fetch(v, 1) == 0);
-}
-
-static INLINE void
-p_atomic_inc(int32_t *v)
-{
- (void) __sync_add_and_fetch(v, 1);
-}
-
-static INLINE void
-p_atomic_dec(int32_t *v)
-{
- (void) __sync_sub_and_fetch(v, 1);
-}
-
-static INLINE int32_t
-p_atomic_inc_return(int32_t *v)
-{
- return __sync_add_and_fetch(v, 1);
-}
-
-static INLINE int32_t
-p_atomic_dec_return(int32_t *v)
-{
- return __sync_sub_and_fetch(v, 1);
-}
-
-static INLINE int32_t
-p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new)
-{
- return __sync_val_compare_and_swap(v, old, _new);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
-
-/* Unlocked version for single threaded environments, such as some
- * windows kernel modules.
- */
-#if defined(PIPE_ATOMIC_OS_UNLOCKED)
-
-#define PIPE_ATOMIC "Unlocked"
-
-#define p_atomic_set(_v, _i) (*(_v) = (_i))
-#define p_atomic_read(_v) (*(_v))
-#define p_atomic_dec_zero(_v) ((boolean) --(*(_v)))
-#define p_atomic_inc(_v) ((void) (*(_v))++)
-#define p_atomic_dec(_v) ((void) (*(_v))--)
-#define p_atomic_inc_return(_v) ((*(_v))++)
-#define p_atomic_dec_return(_v) ((*(_v))--)
-#define p_atomic_cmpxchg(_v, old, _new) (*(_v) == old ? *(_v) = (_new) : *(_v))
-
-#endif
-
-
-/* Locally coded assembly for MSVC on x86:
- */
-#if defined(PIPE_ATOMIC_ASM_MSVC_X86)
-
-#define PIPE_ATOMIC "MSVC x86 assembly"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define p_atomic_set(_v, _i) (*(_v) = (_i))
-#define p_atomic_read(_v) (*(_v))
-
-static INLINE boolean
-p_atomic_dec_zero(int32_t *v)
-{
- unsigned char c;
-
- __asm {
- mov eax, [v]
- lock dec dword ptr [eax]
- sete byte ptr [c]
- }
-
- return c != 0;
-}
-
-static INLINE void
-p_atomic_inc(int32_t *v)
-{
- __asm {
- mov eax, [v]
- lock inc dword ptr [eax]
- }
-}
-
-static INLINE void
-p_atomic_dec(int32_t *v)
-{
- __asm {
- mov eax, [v]
- lock dec dword ptr [eax]
- }
-}
-
-static INLINE int32_t
-p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new)
-{
- int32_t orig;
-
- __asm {
- mov ecx, [v]
- mov eax, [old]
- mov edx, [_new]
- lock cmpxchg [ecx], edx
- mov [orig], eax
- }
-
- return orig;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
-#if defined(PIPE_ATOMIC_MSVC_INTRINSIC)
-
-#define PIPE_ATOMIC "MSVC Intrinsics"
-
-#include <intrin.h>
-
-#pragma intrinsic(_InterlockedIncrement)
-#pragma intrinsic(_InterlockedDecrement)
-#pragma intrinsic(_InterlockedCompareExchange)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define p_atomic_set(_v, _i) (*(_v) = (_i))
-#define p_atomic_read(_v) (*(_v))
-
-static INLINE boolean
-p_atomic_dec_zero(int32_t *v)
-{
- return _InterlockedDecrement((long *)v) == 0;
-}
-
-static INLINE void
-p_atomic_inc(int32_t *v)
-{
- _InterlockedIncrement((long *)v);
-}
-
-static INLINE int32_t
-p_atomic_inc_return(int32_t *v)
-{
- return _InterlockedIncrement((long *)v);
-}
-
-static INLINE void
-p_atomic_dec(int32_t *v)
-{
- _InterlockedDecrement((long *)v);
-}
-
-static INLINE int32_t
-p_atomic_dec_return(int32_t *v)
-{
- return _InterlockedDecrement((long *)v);
-}
-
-static INLINE int32_t
-p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new)
-{
- return _InterlockedCompareExchange((long *)v, _new, old);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-#if defined(PIPE_ATOMIC_OS_SOLARIS)
-
-#define PIPE_ATOMIC "Solaris OS atomic functions"
-
-#include <atomic.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define p_atomic_set(_v, _i) (*(_v) = (_i))
-#define p_atomic_read(_v) (*(_v))
-
-static INLINE boolean
-p_atomic_dec_zero(int32_t *v)
-{
- uint32_t n = atomic_dec_32_nv((uint32_t *) v);
-
- return n != 0;
-}
-
-#define p_atomic_inc(_v) atomic_inc_32((uint32_t *) _v)
-#define p_atomic_dec(_v) atomic_dec_32((uint32_t *) _v)
-#define p_atomic_inc_return(_v) atomic_inc_32_nv((uint32_t *) _v)
-#define p_atomic_dec_return(_v) atomic_dec_32_nv((uint32_t *) _v)
-
-#define p_atomic_cmpxchg(_v, _old, _new) \
- atomic_cas_32( (uint32_t *) _v, (uint32_t) _old, (uint32_t) _new)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
-#ifndef PIPE_ATOMIC
-#error "No pipe_atomic implementation selected"
-#endif
-
-
-
-#endif /* U_ATOMIC_H */
diff --git a/mesalib/src/gallium/auxiliary/util/u_blend.h b/mesalib/src/gallium/auxiliary/util/u_blend.h
new file mode 100644
index 000000000..2485c34d4
--- /dev/null
+++ b/mesalib/src/gallium/auxiliary/util/u_blend.h
@@ -0,0 +1,25 @@
+#ifndef U_BLEND_H
+#define U_BLEND_H
+
+#include "pipe/p_state.h"
+
+/**
+ * When faking RGBX render target formats with RGBA ones, the blender is still
+ * supposed to treat the destination's alpha channel as 1 instead of the
+ * garbage that's there. Return a blend factor that will take that into
+ * account.
+ */
+static INLINE int
+util_blend_dst_alpha_to_one(int factor)
+{
+ switch (factor) {
+ case PIPE_BLENDFACTOR_DST_ALPHA:
+ return PIPE_BLENDFACTOR_ONE;
+ case PIPE_BLENDFACTOR_INV_DST_ALPHA:
+ return PIPE_BLENDFACTOR_ZERO;
+ default:
+ return factor;
+ }
+}
+
+#endif /* U_BLEND_H */
diff --git a/mesalib/src/gallium/auxiliary/util/u_debug.h b/mesalib/src/gallium/auxiliary/util/u_debug.h
index badd5e296..4c22fdfb6 100644
--- a/mesalib/src/gallium/auxiliary/util/u_debug.h
+++ b/mesalib/src/gallium/auxiliary/util/u_debug.h
@@ -185,7 +185,7 @@ void _debug_assert_fail(const char *expr,
#ifdef DEBUG
#define debug_assert(expr) ((expr) ? (void)0 : _debug_assert_fail(#expr, __FILE__, __LINE__, __FUNCTION__))
#else
-#define debug_assert(expr) do { } while (0 && (expr))
+#define debug_assert(expr) (void)(0 && (expr))
#endif
diff --git a/mesalib/src/gallium/auxiliary/util/u_debug_flush.c b/mesalib/src/gallium/auxiliary/util/u_debug_flush.c
index fdb248c23..cdefca2fb 100644
--- a/mesalib/src/gallium/auxiliary/util/u_debug_flush.c
+++ b/mesalib/src/gallium/auxiliary/util/u_debug_flush.c
@@ -132,8 +132,7 @@ debug_flush_buf_reference(struct debug_flush_buf **dst,
struct debug_flush_buf *fbuf = *dst;
if (pipe_reference(&(*dst)->reference, &src->reference)) {
- if (fbuf->map_frame)
- FREE(fbuf->map_frame);
+ FREE(fbuf->map_frame);
FREE(fbuf);
}
@@ -146,8 +145,7 @@ debug_flush_item_destroy(struct debug_flush_item *item)
{
debug_flush_buf_reference(&item->fbuf, NULL);
- if (item->ref_frame)
- FREE(item->ref_frame);
+ FREE(item->ref_frame);
FREE(item);
}
@@ -263,10 +261,8 @@ debug_flush_unmap(struct debug_flush_buf *fbuf)
fbuf->mapped_sync = FALSE;
fbuf->mapped = FALSE;
- if (fbuf->map_frame) {
- FREE(fbuf->map_frame);
- fbuf->map_frame = NULL;
- }
+ FREE(fbuf->map_frame);
+ fbuf->map_frame = NULL;
pipe_mutex_unlock(fbuf->mutex);
}
diff --git a/mesalib/src/gallium/auxiliary/util/u_math.h b/mesalib/src/gallium/auxiliary/util/u_math.h
index 0113fb1a0..19c7343b1 100644
--- a/mesalib/src/gallium/auxiliary/util/u_math.h
+++ b/mesalib/src/gallium/auxiliary/util/u_math.h
@@ -541,7 +541,7 @@ unsigned ffs( unsigned u )
static INLINE unsigned
util_last_bit(unsigned u)
{
-#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304)
+#if defined(__GNUC__)
return u == 0 ? 0 : 32 - __builtin_clz(u);
#else
unsigned r = 0;
@@ -658,7 +658,7 @@ float_to_byte_tex(float f)
static INLINE unsigned
util_logbase2(unsigned n)
{
-#if defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 304)
+#if defined(PIPE_CC_GCC)
return ((sizeof(unsigned) * 8 - 1) - __builtin_clz(n | 1));
#else
unsigned pos = 0;
@@ -678,7 +678,7 @@ util_logbase2(unsigned n)
static INLINE unsigned
util_next_power_of_two(unsigned x)
{
-#if defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 304)
+#if defined(PIPE_CC_GCC)
if (x <= 1)
return 1;
@@ -710,7 +710,7 @@ util_next_power_of_two(unsigned x)
static INLINE unsigned
util_bitcount(unsigned n)
{
-#if defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 304)
+#if defined(PIPE_CC_GCC)
return __builtin_popcount(n);
#else
/* K&R classic bitcount.
diff --git a/mesalib/src/gallium/auxiliary/util/u_prim.h b/mesalib/src/gallium/auxiliary/util/u_prim.h
index cf1a18f42..b2dd44df2 100644
--- a/mesalib/src/gallium/auxiliary/util/u_prim.h
+++ b/mesalib/src/gallium/auxiliary/util/u_prim.h
@@ -280,4 +280,10 @@ u_reduced_prims_for_vertices(int primitive, int vertices)
const char *u_prim_name( unsigned pipe_prim );
+
+#ifdef __cplusplus
+}
+#endif
+
+
#endif
diff --git a/mesalib/src/gallium/auxiliary/util/u_tests.c b/mesalib/src/gallium/auxiliary/util/u_tests.c
index c0f6327b6..b42f5e137 100644
--- a/mesalib/src/gallium/auxiliary/util/u_tests.c
+++ b/mesalib/src/gallium/auxiliary/util/u_tests.c
@@ -248,7 +248,6 @@ tgsi_vs_window_space_position(struct pipe_context *ctx)
cb->width0, cb->height0, red);
/* Cleanup. */
- cso_release_all(cso);
cso_destroy_context(cso);
ctx->delete_vs_state(ctx, vs);
ctx->delete_fs_state(ctx, fs);