summaryrefslogtreecommitdiff
path: root/src/gallium/include/pipe
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/include/pipe')
-rw-r--r--src/gallium/include/pipe/internal/p_winsys_screen.h190
-rw-r--r--src/gallium/include/pipe/p_atomic.h353
-rw-r--r--src/gallium/include/pipe/p_compiler.h60
-rw-r--r--src/gallium/include/pipe/p_config.h8
-rw-r--r--src/gallium/include/pipe/p_context.h55
-rw-r--r--src/gallium/include/pipe/p_defines.h10
-rw-r--r--src/gallium/include/pipe/p_format.h4
-rw-r--r--src/gallium/include/pipe/p_inlines.h199
-rw-r--r--src/gallium/include/pipe/p_refcnt.h95
-rw-r--r--src/gallium/include/pipe/p_screen.h3
-rw-r--r--src/gallium/include/pipe/p_shader_tokens.h49
-rw-r--r--src/gallium/include/pipe/p_state.h67
-rw-r--r--src/gallium/include/pipe/p_thread.h279
-rw-r--r--src/gallium/include/pipe/p_video_state.h4
14 files changed, 157 insertions, 1219 deletions
diff --git a/src/gallium/include/pipe/internal/p_winsys_screen.h b/src/gallium/include/pipe/internal/p_winsys_screen.h
deleted file mode 100644
index a1542dada7..0000000000
--- a/src/gallium/include/pipe/internal/p_winsys_screen.h
+++ /dev/null
@@ -1,190 +0,0 @@
- /**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/**
- * \file
- * This is the interface that Gallium3D requires any window system
- * hosting it to implement. This is the only include file in Gallium3D
- * which is public.
- */
-
-#ifndef P_WINSYS_H
-#define P_WINSYS_H
-
-
-#include "pipe/p_format.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/** Opaque type */
-struct pipe_fence_handle;
-
-struct pipe_surface;
-
-
-/**
- * Gallium3D drivers are (meant to be!) independent of both GL and the
- * window system. The window system provides a buffer manager and a
- * set of additional hooks for things like command buffer submission,
- * etc.
- *
- * There clearly has to be some agreement between the window system
- * driver and the hardware driver about the format of command buffers,
- * etc.
- */
-struct pipe_winsys
-{
- void (*destroy)( struct pipe_winsys *ws );
-
- /** Returns name of this winsys interface */
- const char *(*get_name)( struct pipe_winsys *ws );
-
- /**
- * Do any special operations to ensure buffer size is correct
- */
- void (*update_buffer)( struct pipe_winsys *ws,
- void *context_private );
- /**
- * Do any special operations to ensure frontbuffer contents are
- * displayed, eg copy fake frontbuffer.
- */
- void (*flush_frontbuffer)( struct pipe_winsys *ws,
- struct pipe_surface *surf,
- void *context_private );
-
-
- /**
- * Buffer management. Buffer attributes are mostly fixed over its lifetime.
- *
- * Remember that gallium gets to choose the interface it needs, and the
- * window systems must then implement that interface (rather than the
- * other way around...).
- *
- * usage is a bitmask of PIPE_BUFFER_USAGE_PIXEL/VERTEX/INDEX/CONSTANT. This
- * usage argument is only an optimization hint, not a guarantee, therefore
- * proper behavior must be observed in all circumstances.
- *
- * alignment indicates the client's alignment requirements, eg for
- * SSE instructions.
- */
- struct pipe_buffer *(*buffer_create)( struct pipe_winsys *ws,
- unsigned alignment,
- unsigned usage,
- unsigned size );
-
- /**
- * Create a buffer that wraps user-space data.
- *
- * Effectively this schedules a delayed call to buffer_create
- * followed by an upload of the data at *some point in the future*,
- * or perhaps never. Basically the allocate/upload is delayed
- * until the buffer is actually passed to hardware.
- *
- * The intention is to provide a quick way to turn regular data
- * into a buffer, and secondly to avoid a copy operation if that
- * data subsequently turns out to be only accessed by the CPU.
- *
- * Common example is OpenGL vertex buffers that are subsequently
- * processed either by software TNL in the driver or by passing to
- * hardware.
- *
- * XXX: What happens if the delayed call to buffer_create() fails?
- *
- * Note that ptr may be accessed at any time upto the time when the
- * buffer is destroyed, so the data must not be freed before then.
- */
- struct pipe_buffer *(*user_buffer_create)(struct pipe_winsys *ws,
- void *ptr,
- unsigned bytes);
-
- /**
- * Allocate storage for a display target surface.
- *
- * Often surfaces which are meant to be blitted to the front screen (i.e.,
- * display targets) must be allocated with special characteristics, memory
- * pools, or obtained directly from the windowing system.
- *
- * This callback is invoked by the pipe_screenwhen creating a texture marked
- * with the PIPE_TEXTURE_USAGE_DISPLAY_TARGET flag to get the underlying
- * buffer storage.
- */
- struct pipe_buffer *(*surface_buffer_create)(struct pipe_winsys *ws,
- unsigned width, unsigned height,
- enum pipe_format format,
- unsigned usage,
- unsigned tex_usage,
- unsigned *stride);
-
-
- /**
- * Map the entire data store of a buffer object into the client's address.
- * flags is bitmask of PIPE_BUFFER_USAGE_CPU_READ/WRITE flags.
- */
- void *(*buffer_map)( struct pipe_winsys *ws,
- struct pipe_buffer *buf,
- unsigned usage );
-
- void (*buffer_unmap)( struct pipe_winsys *ws,
- struct pipe_buffer *buf );
-
- void (*buffer_destroy)( struct pipe_buffer *buf );
-
-
- /** Set ptr = fence, with reference counting */
- void (*fence_reference)( struct pipe_winsys *ws,
- struct pipe_fence_handle **ptr,
- struct pipe_fence_handle *fence );
-
- /**
- * Checks whether the fence has been signalled.
- * \param flags driver-specific meaning
- * \return zero on success.
- */
- int (*fence_signalled)( struct pipe_winsys *ws,
- struct pipe_fence_handle *fence,
- unsigned flag );
-
- /**
- * Wait for the fence to finish.
- * \param flags driver-specific meaning
- * \return zero on success.
- */
- int (*fence_finish)( struct pipe_winsys *ws,
- struct pipe_fence_handle *fence,
- unsigned flag );
-
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* P_WINSYS_H */
diff --git a/src/gallium/include/pipe/p_atomic.h b/src/gallium/include/pipe/p_atomic.h
deleted file mode 100644
index 0c3fbae428..0000000000
--- a/src/gallium/include/pipe/p_atomic.h
+++ /dev/null
@@ -1,353 +0,0 @@
-/**
- * Many similar implementations exist. See for example libwsbm
- * or the linux kernel include/atomic.h
- *
- * No copyright claimed on this file.
- *
- */
-
-#ifndef P_ATOMIC_H
-#define P_ATOMIC_H
-
-#include "p_compiler.h"
-#include "p_defines.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* 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_SUBSYSTEM_WINDOWS_DISPLAY) || \
- defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT))
-#define PIPE_ATOMIC_OS_UNLOCKED
-#elif (defined(PIPE_CC_MSVC) && defined(PIPE_SUBSYSTEM_WINDOWS_USER))
-#define PIPE_ATOMIC_OS_MS_INTERLOCK
-#elif (defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86))
-#define PIPE_ATOMIC_ASM_MSVC_X86
-#elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86))
-#define PIPE_ATOMIC_ASM_GCC_X86
-#elif defined(PIPE_CC_GCC)
-#define PIPE_ATOMIC_GCC_INTRINSIC
-#else
-#define PIPE_ATOMIC_MUTEX
-#endif
-
-
-
-#if defined(PIPE_ATOMIC_ASM_GCC_X86)
-
-#define PIPE_ATOMIC "GCC x86 assembly"
-
-struct pipe_atomic {
- int32_t count;
-};
-
-#define p_atomic_set(_v, _i) ((_v)->count = (_i))
-#define p_atomic_read(_v) ((_v)->count)
-
-
-static INLINE boolean
-p_atomic_dec_zero(struct pipe_atomic *v)
-{
- unsigned char c;
-
- __asm__ __volatile__("lock; decl %0; sete %1":"+m"(v->count), "=qm"(c)
- ::"memory");
-
- return c != 0;
-}
-
-static INLINE void
-p_atomic_inc(struct pipe_atomic *v)
-{
- __asm__ __volatile__("lock; incl %0":"+m"(v->count));
-}
-
-static INLINE void
-p_atomic_dec(struct pipe_atomic *v)
-{
- __asm__ __volatile__("lock; decl %0":"+m"(v->count));
-}
-
-static INLINE int32_t
-p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new)
-{
- return __sync_val_compare_and_swap(&v->count, old, _new);
-}
-#endif
-
-
-
-/* Implementation using GCC-provided synchronization intrinsics
- */
-#if defined(PIPE_ATOMIC_GCC_INTRINSIC)
-
-#define PIPE_ATOMIC "GCC Sync Intrinsics"
-
-struct pipe_atomic {
- int32_t count;
-};
-
-#define p_atomic_set(_v, _i) ((_v)->count = (_i))
-#define p_atomic_read(_v) ((_v)->count)
-
-
-static INLINE boolean
-p_atomic_dec_zero(struct pipe_atomic *v)
-{
- return (__sync_sub_and_fetch(&v->count, 1) == 0);
-}
-
-static INLINE void
-p_atomic_inc(struct pipe_atomic *v)
-{
- (void) __sync_add_and_fetch(&v->count, 1);
-}
-
-static INLINE void
-p_atomic_dec(struct pipe_atomic *v)
-{
- (void) __sync_sub_and_fetch(&v->count, 1);
-}
-
-static INLINE int32_t
-p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new)
-{
- return __sync_val_compare_and_swap(&v->count, old, _new);
-}
-#endif
-
-
-
-/* Unlocked version for single threaded environments, such as some
- * windows kernel modules.
- */
-#if defined(PIPE_ATOMIC_OS_UNLOCKED)
-
-#define PIPE_ATOMIC "Unlocked"
-
-struct pipe_atomic
-{
- int32_t count;
-};
-
-#define p_atomic_set(_v, _i) ((_v)->count = (_i))
-#define p_atomic_read(_v) ((_v)->count)
-#define p_atomic_dec_zero(_v) ((boolean) --(_v)->count)
-#define p_atomic_inc(_v) ((void) (_v)->count++)
-#define p_atomic_dec(_v) ((void) (_v)->count--)
-#define p_atomic_cmpxchg(_v, old, _new) ((_v)->count == old ? (_v)->count = (_new) : (_v)->count)
-
-#endif
-
-
-/* Locally coded assembly for MSVC on x86:
- */
-#if defined(PIPE_ATOMIC_ASM_MSVC_X86)
-
-#define PIPE_ATOMIC "MSVC x86 assembly"
-
-struct pipe_atomic
-{
- int32_t count;
-};
-
-#define p_atomic_set(_v, _i) ((_v)->count = (_i))
-#define p_atomic_read(_v) ((_v)->count)
-
-static INLINE boolean
-p_atomic_dec_zero(struct pipe_atomic *v)
-{
- int32_t *pcount = &v->count;
- unsigned char c;
-
- __asm {
- mov eax, [pcount]
- lock dec dword ptr [eax]
- sete byte ptr [c]
- }
-
- return c != 0;
-}
-
-static INLINE void
-p_atomic_inc(struct pipe_atomic *v)
-{
- int32_t *pcount = &v->count;
-
- __asm {
- mov eax, [pcount]
- lock inc dword ptr [eax]
- }
-}
-
-static INLINE void
-p_atomic_dec(struct pipe_atomic *v)
-{
- int32_t *pcount = &v->count;
-
- __asm {
- mov eax, [pcount]
- lock dec dword ptr [eax]
- }
-}
-
-static INLINE int32_t
-p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new)
-{
- int32_t *pcount = &v->count;
- int32_t orig;
-
- __asm {
- mov ecx, [pcount]
- mov eax, [old]
- mov edx, [_new]
- lock cmpxchg [ecx], edx
- mov [orig], eax
- }
-
- return orig;
-}
-#endif
-
-
-#if defined(PIPE_ATOMIC_OS_MS_INTERLOCK)
-
-#define PIPE_ATOMIC "MS userspace interlocks"
-
-#include <windows.h>
-
-struct pipe_atomic
-{
- volatile long count;
-};
-
-#define p_atomic_set(_v, _i) ((_v)->count = (_i))
-#define p_atomic_read(_v) ((_v)->count)
-
-static INLINE boolean
-p_atomic_dec_zero(struct pipe_atomic *v)
-{
- return InterlockedDecrement(&v->count) == 0;
-}
-
-static INLINE void
-p_atomic_inc(struct pipe_atomic *v)
-{
- InterlockedIncrement(&v->count);
-}
-
-static INLINE void
-p_atomic_dec(struct pipe_atomic *v)
-{
- InterlockedDecrement(&v->count);
-}
-
-static INLINE int32_t
-p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new)
-{
- return InterlockedCompareExchange(&v->count, _new, old);
-}
-
-#endif
-
-
-
-#if defined(PIPE_ATOMIC_MUTEX)
-
-#define PIPE_ATOMIC "mutex-based fallback"
-
-#include "pipe/p_thread.h"
-
-/**
- * This implementation should really not be used.
- * Add an assembly port instead. It may abort and
- * doesn't destroy used mutexes.
- */
-
-struct pipe_atomic {
- pipe_mutex mutex;
- int32_t count;
-};
-
-static INLINE void
-p_atomic_set(struct pipe_atomic *v, int32_t i)
-{
- pipe_mutex_init(v->mutex);
- pipe_mutex_lock(v->mutex);
- v->count = i;
- pipe_mutex_unlock(v->mutex);
-}
-
-static INLINE int32_t
-p_atomic_read(struct pipe_atomic *v)
-{
- int32_t ret;
-
- pipe_mutex_lock(v->mutex);
- ret = v->count;
- pipe_mutex_unlock(v->mutex);
- return ret;
-}
-
-static INLINE void
-p_atomic_inc(struct pipe_atomic *v)
-{
- pipe_mutex_lock(v->mutex);
- ++v->count;
- pipe_mutex_unlock(v->mutex);
-}
-
-static INLINE void
-p_atomic_dec(struct pipe_atomic *v)
-{
- pipe_mutex_lock(v->mutex);
- --v->count;
- pipe_mutex_unlock(v->mutex);
-}
-
-static INLINE boolean
-p_atomic_dec_zero(struct pipe_atomic *v)
-{
- boolean ret;
-
- pipe_mutex_lock(v->mutex);
- ret = (--v->count == 0);
- pipe_mutex_unlock(v->mutex);
- return ret;
-}
-
-static INLINE int32_t
-p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new)
-{
- int32_t ret;
-
- pipe_mutex_lock(v->mutex);
- ret = v->count;
- if (ret == old)
- v->count = _new;
- pipe_mutex_unlock(v->mutex);
-
- return ret;
-}
-
-#endif
-
-
-#ifndef PIPE_ATOMIC
-#error "No pipe_atomic implementation selected"
-#endif
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* P_ATOMIC_H */
diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h
index 26a940593f..c7d3507494 100644
--- a/src/gallium/include/pipe/p_compiler.h
+++ b/src/gallium/include/pipe/p_compiler.h
@@ -38,6 +38,8 @@
#include "xf86_ansic.h"
#include "xf86_libc.h"
#endif
+#include <stddef.h>
+#include <stdarg.h>
#if defined(_WIN32) && !defined(__WIN32__)
@@ -63,7 +65,7 @@
#include <stdbool.h>
-#ifndef __HAIKU__
+#if !defined(__HAIKU__) && !defined(__USE_MISC)
typedef unsigned int uint;
typedef unsigned short ushort;
#endif
@@ -104,7 +106,8 @@ typedef unsigned char boolean;
/* Function visibility */
#ifndef PUBLIC
-# if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
+# if (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303) \
+ || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
# define PUBLIC __attribute__((visibility("default")))
# else
# define PUBLIC
@@ -124,6 +127,9 @@ typedef unsigned char boolean;
# define __FUNCTION__ "<unknown>"
# endif
# endif
+# if defined(_MSC_VER) && _MSC_VER < 1300
+# define __FUNCTION__ "<unknown>"
+# endif
#endif
@@ -139,22 +145,48 @@ typedef unsigned char boolean;
-#if defined(__GNUC__)
-#define ALIGN16_DECL(TYPE, NAME, SIZE) TYPE NAME##___aligned[SIZE] __attribute__(( aligned( 16 ) ))
-#define ALIGN16_ASSIGN(NAME) NAME##___aligned
-#define ALIGN16_ATTRIB __attribute__(( aligned( 16 ) ))
-#define ALIGN8_ATTRIB __attribute__(( aligned( 8 ) ))
+#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
+#define PIPE_DEPRECATED __attribute__((__deprecated__))
+#else
+#define PIPE_DEPRECATED
+#endif
+
+
+
+/* Macros for data alignment. */
+#if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+
+/* See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Type-Attributes.html */
+#define PIPE_ALIGN_TYPE(_alignment, _type) _type __attribute__((aligned(_alignment)))
+
+/* See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Variable-Attributes.html */
+#define PIPE_ALIGN_VAR(_alignment) __attribute__((aligned(_alignment)))
+
#if (__GNUC__ > 4 || (__GNUC__ == 4 &&__GNUC_MINOR__>1)) && !defined(PIPE_ARCH_X86_64)
-#define ALIGN_STACK __attribute__((force_align_arg_pointer))
+#define PIPE_ALIGN_STACK __attribute__((force_align_arg_pointer))
#else
-#define ALIGN_STACK
+#define PIPE_ALIGN_STACK
#endif
+
+#elif defined(_MSC_VER)
+
+/* See http://msdn.microsoft.com/en-us/library/83ythb65.aspx */
+#define PIPE_ALIGN_TYPE(_alignment, _type) __declspec(align(_alignment)) _type
+#define PIPE_ALIGN_VAR(_alignment) __declspec(align(_alignment))
+
+#define PIPE_ALIGN_STACK
+
+#elif defined(SWIG)
+
+#define PIPE_ALIGN_TYPE(_alignment, _type) _type
+#define PIPE_ALIGN_VAR(_alignment)
+
+#define PIPE_ALIGN_STACK
+
#else
-#define ALIGN16_DECL(TYPE, NAME, SIZE) TYPE NAME##___unaligned[SIZE + 1]
-#define ALIGN16_ASSIGN(NAME) align16(NAME##___unaligned)
-#define ALIGN16_ATTRIB
-#define ALIGN8_ATTRIB
-#define ALIGN_STACK
+
+#error "Unsupported compiler"
+
#endif
diff --git a/src/gallium/include/pipe/p_config.h b/src/gallium/include/pipe/p_config.h
index 064605a4a0..c5928dde47 100644
--- a/src/gallium/include/pipe/p_config.h
+++ b/src/gallium/include/pipe/p_config.h
@@ -115,8 +115,10 @@
#endif
+#if !defined(PIPE_OS_EMBEDDED)
+
/*
- * Operating system family.
+ * Auto-detect the operating system family.
*
* See subsystem below for a more fine-grained distinction.
*/
@@ -164,7 +166,7 @@
#endif
/*
- * Subsystem.
+ * Try to auto-detect the subsystem.
*
* NOTE: There is no way to auto-detect most of these.
*/
@@ -191,5 +193,7 @@
#endif
#endif /* PIPE_OS_WINDOWS */
+#endif /* !PIPE_OS_EMBEDDED */
+
#endif /* P_CONFIG_H_ */
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index d2f8085b42..f1e6a60e04 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -69,6 +69,22 @@ struct pipe_context {
unsigned indexSize,
unsigned mode, unsigned start, unsigned count);
+ void (*draw_arrays_instanced)(struct pipe_context *pipe,
+ unsigned mode,
+ unsigned start,
+ unsigned count,
+ unsigned startInstance,
+ unsigned instanceCount);
+
+ void (*draw_elements_instanced)(struct pipe_context *pipe,
+ struct pipe_buffer *indexBuffer,
+ unsigned indexSize,
+ unsigned mode,
+ unsigned start,
+ unsigned count,
+ unsigned startInstance,
+ unsigned instanceCount);
+
/* XXX: this is (probably) a temporary entrypoint, as the range
* information should be available from the vertex_buffer state.
* Using this to quickly evaluate a specialized path in the draw
@@ -87,7 +103,7 @@ struct pipe_context {
/**
* Predicate subsequent rendering on occlusion query result
* \param query the query predicate, or NULL if no predicate
- * \param mode one of PIPE_COND_RENDER_x
+ * \param mode one of PIPE_RENDER_COND_x
*/
void (*render_condition)( struct pipe_context *pipe,
struct pipe_query *query,
@@ -106,6 +122,11 @@ struct pipe_context {
void (*begin_query)(struct pipe_context *pipe, struct pipe_query *q);
void (*end_query)(struct pipe_context *pipe, struct pipe_query *q);
+ /**
+ * Get results of a query.
+ * \param wait if true, this query will block until the result is ready
+ * \return TRUE if results are ready, FALSE otherwise
+ */
boolean (*get_query_result)(struct pipe_context *pipe,
struct pipe_query *q,
boolean wait,
@@ -170,7 +191,7 @@ struct pipe_context {
void (*set_constant_buffer)( struct pipe_context *,
uint shader, uint index,
- const struct pipe_constant_buffer *buf );
+ struct pipe_buffer *buf );
void (*set_framebuffer_state)( struct pipe_context *,
const struct pipe_framebuffer_state * );
@@ -255,30 +276,30 @@ struct pipe_context {
/**
* Check whether a texture is referenced by an unflushed hw command.
- * The state-tracker uses this function to optimize away unnecessary
- * flushes. It is safe (but wasteful) to always return.
+ * The state-tracker uses this function to avoid unnecessary flushes.
+ * It is safe (but wasteful) to always return
* PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE.
- * \param pipe The pipe context whose unflushed hw commands will be
- * checked.
- * \param level mipmap level.
+ * \param pipe context whose unflushed hw commands will be checked.
* \param texture texture to check.
* \param face cubemap face. Use 0 for non-cubemap texture.
+ * \param level mipmap level.
+ * \return mask of PIPE_REFERENCED_FOR_READ/WRITE or PIPE_UNREFERENCED
*/
- unsigned int (*is_texture_referenced) (struct pipe_context *pipe,
- struct pipe_texture *texture,
- unsigned face, unsigned level);
+ unsigned int (*is_texture_referenced)(struct pipe_context *pipe,
+ struct pipe_texture *texture,
+ unsigned face, unsigned level);
/**
* Check whether a buffer is referenced by an unflushed hw command.
- * The state-tracker uses this function to optimize away unnecessary
- * flushes. It is safe (but wasteful) to always return
+ * The state-tracker uses this function to avoid unnecessary flushes.
+ * It is safe (but wasteful) to always return
* PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE.
- * \param pipe The pipe context whose unflushed hw commands will be
- * checked.
- * \param buf Buffer to check.
+ * \param pipe context whose unflushed hw commands will be checked.
+ * \param buf buffer to check.
+ * \return mask of PIPE_REFERENCED_FOR_READ/WRITE or PIPE_UNREFERENCED
*/
- unsigned int (*is_buffer_referenced) (struct pipe_context *pipe,
- struct pipe_buffer *buf);
+ unsigned int (*is_buffer_referenced)(struct pipe_context *pipe,
+ struct pipe_buffer *buf);
};
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index a85a170153..5cebd43ace 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -376,7 +376,7 @@ enum pipe_transfer_usage {
#define PIPE_CAP_NPOT_TEXTURES 2
#define PIPE_CAP_TWO_SIDED_STENCIL 3
#define PIPE_CAP_GLSL 4 /* XXX need something better */
-#define PIPE_CAP_S3TC 5 /* XXX: deprecated; cap determined via supported sampler formats */
+#define PIPE_CAP_DUAL_SOURCE_BLEND 5
#define PIPE_CAP_ANISOTROPIC_FILTER 6
#define PIPE_CAP_POINT_SPRITE 7
#define PIPE_CAP_MAX_RENDER_TARGETS 8
@@ -404,6 +404,14 @@ enum pipe_transfer_usage {
#define PIPE_CAP_MAX_PREDICATE_REGISTERS 30
#define PIPE_CAP_MAX_COMBINED_SAMPLERS 31 /*< Maximum texture image units accessible from vertex
and fragment shaders combined */
+#define PIPE_CAP_MAX_CONST_BUFFERS 32
+#define PIPE_CAP_MAX_CONST_BUFFER_SIZE 33 /*< In bytes */
+#define PIPE_CAP_INDEP_BLEND_ENABLE 34 /*< blend enables and write masks per rendertarget */
+#define PIPE_CAP_INDEP_BLEND_FUNC 35 /*< different blend funcs per rendertarget */
+#define PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT 36
+#define PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT 37
+#define PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER 38
+#define PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER 39
/**
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index 6bfff1cc59..2894e13e7d 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -31,10 +31,6 @@
#include "p_compiler.h"
-/* FIXME: remove these header dependencies */
-#include "util/u_debug.h"
-#include "util/u_string.h"
-
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/src/gallium/include/pipe/p_inlines.h b/src/gallium/include/pipe/p_inlines.h
deleted file mode 100644
index 5fbd62a03d..0000000000
--- a/src/gallium/include/pipe/p_inlines.h
+++ /dev/null
@@ -1,199 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef P_INLINES_H
-#define P_INLINES_H
-
-#include "p_context.h"
-#include "p_defines.h"
-#include "p_screen.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * Convenience wrappers for screen buffer functions.
- */
-
-static INLINE struct pipe_buffer *
-pipe_buffer_create( struct pipe_screen *screen,
- unsigned alignment, unsigned usage, unsigned size )
-{
- return screen->buffer_create(screen, alignment, usage, size);
-}
-
-static INLINE struct pipe_buffer *
-pipe_user_buffer_create( struct pipe_screen *screen, void *ptr, unsigned size )
-{
- return screen->user_buffer_create(screen, ptr, size);
-}
-
-static INLINE void *
-pipe_buffer_map(struct pipe_screen *screen,
- struct pipe_buffer *buf,
- unsigned usage)
-{
- if(screen->buffer_map_range) {
- unsigned offset = 0;
- unsigned length = buf->size;
-
- /* XXX: Actually we should be using/detecting DISCARD
- * instead of assuming that WRITE implies discard */
- if((usage & PIPE_BUFFER_USAGE_CPU_WRITE) &&
- !(usage & PIPE_BUFFER_USAGE_DISCARD))
- usage |= PIPE_BUFFER_USAGE_CPU_READ;
-
- return screen->buffer_map_range(screen, buf, offset, length, usage);
- }
- else
- return screen->buffer_map(screen, buf, usage);
-}
-
-static INLINE void
-pipe_buffer_unmap(struct pipe_screen *screen,
- struct pipe_buffer *buf)
-{
- screen->buffer_unmap(screen, buf);
-}
-
-static INLINE void *
-pipe_buffer_map_range(struct pipe_screen *screen,
- struct pipe_buffer *buf,
- unsigned offset,
- unsigned length,
- unsigned usage)
-{
- assert(offset < buf->size);
- assert(offset + length <= buf->size);
- assert(length);
- if(screen->buffer_map_range)
- return screen->buffer_map_range(screen, buf, offset, length, usage);
- else
- return screen->buffer_map(screen, buf, usage);
-}
-
-static INLINE void
-pipe_buffer_flush_mapped_range(struct pipe_screen *screen,
- struct pipe_buffer *buf,
- unsigned offset,
- unsigned length)
-{
- assert(offset < buf->size);
- assert(offset + length <= buf->size);
- assert(length);
- if(screen->buffer_flush_mapped_range)
- screen->buffer_flush_mapped_range(screen, buf, offset, length);
-}
-
-static INLINE void
-pipe_buffer_write(struct pipe_screen *screen,
- struct pipe_buffer *buf,
- unsigned offset, unsigned size,
- const void *data)
-{
- void *map;
-
- assert(offset < buf->size);
- assert(offset + size <= buf->size);
- assert(size);
-
- map = pipe_buffer_map_range(screen, buf, offset, size,
- PIPE_BUFFER_USAGE_CPU_WRITE |
- PIPE_BUFFER_USAGE_FLUSH_EXPLICIT);
- assert(map);
- if(map) {
- memcpy((uint8_t *)map + offset, data, size);
- pipe_buffer_flush_mapped_range(screen, buf, offset, size);
- pipe_buffer_unmap(screen, buf);
- }
-}
-
-static INLINE void
-pipe_buffer_read(struct pipe_screen *screen,
- struct pipe_buffer *buf,
- unsigned offset, unsigned size,
- void *data)
-{
- void *map;
-
- assert(offset < buf->size);
- assert(offset + size <= buf->size);
- assert(size);
-
- map = pipe_buffer_map_range(screen, buf, offset, size, PIPE_BUFFER_USAGE_CPU_READ);
- assert(map);
- if(map) {
- memcpy(data, (const uint8_t *)map + offset, size);
- pipe_buffer_unmap(screen, buf);
- }
-}
-
-static INLINE void *
-pipe_transfer_map( struct pipe_transfer *transf )
-{
- struct pipe_screen *screen = transf->texture->screen;
- return screen->transfer_map(screen, transf);
-}
-
-static INLINE void
-pipe_transfer_unmap( struct pipe_transfer *transf )
-{
- struct pipe_screen *screen = transf->texture->screen;
- screen->transfer_unmap(screen, transf);
-}
-
-static INLINE void
-pipe_transfer_destroy( struct pipe_transfer *transf )
-{
- struct pipe_screen *screen = transf->texture->screen;
- screen->tex_transfer_destroy(transf);
-}
-
-static INLINE unsigned
-pipe_transfer_buffer_flags( struct pipe_transfer *transf )
-{
- switch (transf->usage & PIPE_TRANSFER_READ_WRITE) {
- case PIPE_TRANSFER_READ_WRITE:
- return PIPE_BUFFER_USAGE_CPU_READ | PIPE_BUFFER_USAGE_CPU_WRITE;
- case PIPE_TRANSFER_READ:
- return PIPE_BUFFER_USAGE_CPU_READ;
- case PIPE_TRANSFER_WRITE:
- return PIPE_BUFFER_USAGE_CPU_WRITE;
- default:
- debug_assert(0);
- return 0;
- }
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* P_INLINES_H */
diff --git a/src/gallium/include/pipe/p_refcnt.h b/src/gallium/include/pipe/p_refcnt.h
deleted file mode 100644
index c1c7415e02..0000000000
--- a/src/gallium/include/pipe/p_refcnt.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef P_REFCNT_H
-#define P_REFCNT_H
-
-
-#include "p_defines.h"
-#include "p_atomic.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-struct pipe_reference
-{
- struct pipe_atomic count;
-};
-
-
-static INLINE void
-pipe_reference_init(struct pipe_reference *reference, unsigned count)
-{
- p_atomic_set(&reference->count, count);
-}
-
-
-static INLINE boolean
-pipe_is_referenced(struct pipe_reference *reference)
-{
- return p_atomic_read(&reference->count) != 0;
-}
-
-
-/**
- * Update reference counting.
- * The old thing pointed to, if any, will be unreferenced.
- * Both 'ptr' and 'reference' may be NULL.
- * \return TRUE if the object's refcount hits zero and should be destroyed.
- */
-static INLINE boolean
-pipe_reference(struct pipe_reference *ptr, struct pipe_reference *reference)
-{
- boolean destroy = FALSE;
-
- if(ptr != reference) {
- /* bump the reference.count first */
- if (reference) {
- assert(pipe_is_referenced(reference));
- p_atomic_inc(&reference->count);
- }
-
- if (ptr) {
- assert(pipe_is_referenced(ptr));
- if (p_atomic_dec_zero(&ptr->count)) {
- destroy = TRUE;
- }
- }
- }
-
- return destroy;
-}
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* P_REFCNT_H */
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index b8e001a6b0..48625bf312 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -86,6 +86,9 @@ struct pipe_screen {
*/
float (*get_paramf)( struct pipe_screen *, int param );
+ struct pipe_context * (*context_create)( struct pipe_screen *,
+ void *priv );
+
/**
* Check if the given pipe_format is supported as a texture or
* drawing surface.
diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
index 550e2abc32..c5c480f1f0 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -1,7 +1,7 @@
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * Copyright 2009 VMware, Inc.
+ * Copyright 2009-2010 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -102,6 +102,11 @@ enum tgsi_file_type {
#define TGSI_INTERPOLATE_PERSPECTIVE 2
#define TGSI_INTERPOLATE_COUNT 3
+#define TGSI_CYLINDRICAL_WRAP_X (1 << 0)
+#define TGSI_CYLINDRICAL_WRAP_Y (1 << 1)
+#define TGSI_CYLINDRICAL_WRAP_Z (1 << 2)
+#define TGSI_CYLINDRICAL_WRAP_W (1 << 3)
+
struct tgsi_declaration
{
unsigned Type : 4; /**< TGSI_TOKEN_TYPE_DECLARATION */
@@ -109,10 +114,11 @@ struct tgsi_declaration
unsigned File : 4; /**< one of TGSI_FILE_x */
unsigned UsageMask : 4; /**< bitmask of TGSI_WRITEMASK_x flags */
unsigned Interpolate : 4; /**< one of TGSI_INTERPOLATE_x */
+ unsigned Dimension : 1; /**< any extra dimension info? */
unsigned Semantic : 1; /**< BOOL, any semantic info? */
unsigned Centroid : 1; /**< centroid sampling? */
unsigned Invariant : 1; /**< invariant optimization? */
- unsigned Padding : 5;
+ unsigned CylindricalWrap:4; /**< TGSI_CYLINDRICAL_WRAP_x flags */
};
struct tgsi_declaration_range
@@ -121,17 +127,24 @@ struct tgsi_declaration_range
unsigned Last : 16; /**< UINT */
};
-#define TGSI_SEMANTIC_POSITION 0
-#define TGSI_SEMANTIC_COLOR 1
-#define TGSI_SEMANTIC_BCOLOR 2 /**< back-face color */
-#define TGSI_SEMANTIC_FOG 3
-#define TGSI_SEMANTIC_PSIZE 4
-#define TGSI_SEMANTIC_GENERIC 5
-#define TGSI_SEMANTIC_NORMAL 6
-#define TGSI_SEMANTIC_FACE 7
-#define TGSI_SEMANTIC_EDGEFLAG 8
-#define TGSI_SEMANTIC_PRIMID 9
-#define TGSI_SEMANTIC_COUNT 10 /**< number of semantic values */
+struct tgsi_declaration_dimension
+{
+ unsigned Index2D:16; /**< UINT */
+ unsigned Padding:16;
+};
+
+#define TGSI_SEMANTIC_POSITION 0
+#define TGSI_SEMANTIC_COLOR 1
+#define TGSI_SEMANTIC_BCOLOR 2 /**< back-face color */
+#define TGSI_SEMANTIC_FOG 3
+#define TGSI_SEMANTIC_PSIZE 4
+#define TGSI_SEMANTIC_GENERIC 5
+#define TGSI_SEMANTIC_NORMAL 6
+#define TGSI_SEMANTIC_FACE 7
+#define TGSI_SEMANTIC_EDGEFLAG 8
+#define TGSI_SEMANTIC_PRIMID 9
+#define TGSI_SEMANTIC_INSTANCEID 10
+#define TGSI_SEMANTIC_COUNT 11 /**< number of semantic values */
struct tgsi_declaration_semantic
{
@@ -162,7 +175,9 @@ union tgsi_immediate_data
#define TGSI_PROPERTY_GS_INPUT_PRIM 0
#define TGSI_PROPERTY_GS_OUTPUT_PRIM 1
#define TGSI_PROPERTY_GS_MAX_VERTICES 2
-#define TGSI_PROPERTY_COUNT 3
+#define TGSI_PROPERTY_FS_COORD_ORIGIN 3
+#define TGSI_PROPERTY_FS_COORD_PIXEL_CENTER 4
+#define TGSI_PROPERTY_COUNT 5
struct tgsi_property {
unsigned Type : 4; /**< TGSI_TOKEN_TYPE_PROPERTY */
@@ -171,6 +186,12 @@ struct tgsi_property {
unsigned Padding : 12;
};
+#define TGSI_FS_COORD_ORIGIN_UPPER_LEFT 0
+#define TGSI_FS_COORD_ORIGIN_LOWER_LEFT 1
+
+#define TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER 0
+#define TGSI_FS_COORD_PIXEL_CENTER_INTEGER 1
+
struct tgsi_property_data {
unsigned Data;
};
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 4387b92be2..68369570b9 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -43,7 +43,6 @@
#include "p_compiler.h"
#include "p_defines.h"
#include "p_format.h"
-#include "p_refcnt.h"
#include "p_screen.h"
@@ -58,7 +57,7 @@ extern "C" {
#define PIPE_MAX_ATTRIBS 32
#define PIPE_MAX_CLIP_PLANES 6
#define PIPE_MAX_COLOR_BUFS 8
-#define PIPE_MAX_CONSTANT 32
+#define PIPE_MAX_CONSTANT_BUFFERS 32
#define PIPE_MAX_SAMPLERS 16
#define PIPE_MAX_VERTEX_SAMPLERS 16
#define PIPE_MAX_SHADER_INPUTS 16
@@ -66,8 +65,10 @@ extern "C" {
#define PIPE_MAX_TEXTURE_LEVELS 16
-/* fwd decls */
-struct pipe_surface;
+struct pipe_reference
+{
+ int32_t count; /* atomic */
+};
/**
@@ -177,15 +178,6 @@ struct pipe_clip_state
};
-/**
- * Constants for vertex/fragment shaders
- */
-struct pipe_constant_buffer
-{
- struct pipe_buffer *buffer;
-};
-
-
struct pipe_shader_state
{
const struct tgsi_token *tokens;
@@ -229,7 +221,7 @@ struct pipe_depth_stencil_alpha_state
};
-struct pipe_blend_state
+struct pipe_rt_blend_state
{
unsigned blend_enable:1;
@@ -241,11 +233,16 @@ struct pipe_blend_state
unsigned alpha_src_factor:5; /**< PIPE_BLENDFACTOR_x */
unsigned alpha_dst_factor:5; /**< PIPE_BLENDFACTOR_x */
+ unsigned colormask:4; /**< bitmask of PIPE_MASK_R/G/B/A */
+};
+
+struct pipe_blend_state
+{
+ unsigned independent_blend_enable:1;
unsigned logicop_enable:1;
unsigned logicop_func:4; /**< PIPE_LOGICOP_x */
-
- unsigned colormask:4; /**< bitmask of PIPE_MASK_R/G/B/A */
unsigned dither:1;
+ struct pipe_rt_blend_state rt[PIPE_MAX_COLOR_BUFS];
};
@@ -281,7 +278,6 @@ struct pipe_sampler_state
unsigned compare_mode:1; /**< PIPE_TEX_COMPARE_x */
unsigned compare_func:3; /**< PIPE_FUNC_x */
unsigned normalized_coords:1; /**< Are coords normalized to [0,1]? */
- unsigned prefilter:4; /**< Wierd sampling state exposed by some api's */
float lod_bias; /**< LOD/lambda bias */
float min_lod, max_lod; /**< LOD clamp range, after bias */
float border_color[4];
@@ -375,6 +371,11 @@ struct pipe_vertex_element
/** Offset of this attribute, in bytes, from the start of the vertex */
unsigned src_offset;
+ /** Instance data rate divisor. 0 means this is per-vertex data,
+ * n means per-instance data used for n consecutive instances (n > 0).
+ */
+ unsigned instance_divisor;
+
/** Which vertex_buffer (as given to pipe->set_vertex_buffer()) does
* this attribute live in?
*/
@@ -385,38 +386,6 @@ struct pipe_vertex_element
};
-/* Reference counting helper functions */
-static INLINE void
-pipe_buffer_reference(struct pipe_buffer **ptr, struct pipe_buffer *buf)
-{
- struct pipe_buffer *old_buf = *ptr;
-
- if (pipe_reference(&(*ptr)->reference, &buf->reference))
- old_buf->screen->buffer_destroy(old_buf);
- *ptr = buf;
-}
-
-static INLINE void
-pipe_surface_reference(struct pipe_surface **ptr, struct pipe_surface *surf)
-{
- struct pipe_surface *old_surf = *ptr;
-
- if (pipe_reference(&(*ptr)->reference, &surf->reference))
- old_surf->texture->screen->tex_surface_destroy(old_surf);
- *ptr = surf;
-}
-
-static INLINE void
-pipe_texture_reference(struct pipe_texture **ptr, struct pipe_texture *tex)
-{
- struct pipe_texture *old_tex = *ptr;
-
- if (pipe_reference(&(*ptr)->reference, &tex->reference))
- old_tex->screen->texture_destroy(old_tex);
- *ptr = tex;
-}
-
-
#ifdef __cplusplus
}
#endif
diff --git a/src/gallium/include/pipe/p_thread.h b/src/gallium/include/pipe/p_thread.h
deleted file mode 100644
index 25e4148232..0000000000
--- a/src/gallium/include/pipe/p_thread.h
+++ /dev/null
@@ -1,279 +0,0 @@
-/**************************************************************************
- *
- * Copyright 1999-2006 Brian Paul
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-/**
- * @file
- *
- * Thread, mutex, condition var and thread-specific data functions.
- */
-
-
-#ifndef _P_THREAD2_H_
-#define _P_THREAD2_H_
-
-
-#include "pipe/p_compiler.h"
-#include "util/u_debug.h" /* for assert */
-
-
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU)
-
-#include <pthread.h> /* POSIX threads headers */
-#include <stdio.h> /* for perror() */
-
-#define PIPE_THREAD_HAVE_CONDVAR
-
-typedef pthread_t pipe_thread;
-
-#define PIPE_THREAD_ROUTINE( name, param ) \
- void *name( void *param )
-
-static INLINE pipe_thread pipe_thread_create( void *(* routine)( void *), void *param )
-{
- pipe_thread thread;
- if (pthread_create( &thread, NULL, routine, param ))
- return 0;
- return thread;
-}
-
-static INLINE int pipe_thread_wait( pipe_thread thread )
-{
- return pthread_join( thread, NULL );
-}
-
-static INLINE int pipe_thread_destroy( pipe_thread thread )
-{
- return pthread_detach( thread );
-}
-
-typedef pthread_mutex_t pipe_mutex;
-typedef pthread_cond_t pipe_condvar;
-
-#define pipe_static_mutex(mutex) \
- static pipe_mutex mutex = PTHREAD_MUTEX_INITIALIZER
-
-#define pipe_mutex_init(mutex) \
- (void) pthread_mutex_init(&(mutex), NULL)
-
-#define pipe_mutex_destroy(mutex) \
- pthread_mutex_destroy(&(mutex))
-
-#define pipe_mutex_lock(mutex) \
- (void) pthread_mutex_lock(&(mutex))
-
-#define pipe_mutex_unlock(mutex) \
- (void) pthread_mutex_unlock(&(mutex))
-
-#define pipe_static_condvar(mutex) \
- static pipe_condvar mutex = PTHREAD_COND_INITIALIZER
-
-#define pipe_condvar_init(cond) \
- pthread_cond_init(&(cond), NULL)
-
-#define pipe_condvar_destroy(cond) \
- pthread_cond_destroy(&(cond))
-
-#define pipe_condvar_wait(cond, mutex) \
- pthread_cond_wait(&(cond), &(mutex))
-
-#define pipe_condvar_signal(cond) \
- pthread_cond_signal(&(cond))
-
-#define pipe_condvar_broadcast(cond) \
- pthread_cond_broadcast(&(cond))
-
-
-#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
-
-#include <windows.h>
-
-typedef HANDLE pipe_thread;
-
-#define PIPE_THREAD_ROUTINE( name, param ) \
- void * WINAPI name( void *param )
-
-static INLINE pipe_thread pipe_thread_create( void *(WINAPI * routine)( void *), void *param )
-{
- DWORD id;
- return CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE) routine, param, 0, &id );
-}
-
-static INLINE int pipe_thread_wait( pipe_thread thread )
-{
- if (WaitForSingleObject( thread, INFINITE ) == WAIT_OBJECT_0)
- return 0;
- return -1;
-}
-
-static INLINE int pipe_thread_destroy( pipe_thread thread )
-{
- if (CloseHandle( thread ))
- return 0;
- return -1;
-}
-
-typedef CRITICAL_SECTION pipe_mutex;
-
-#define pipe_static_mutex(mutex) \
- /*static*/ pipe_mutex mutex = {0,0,0,0,0,0}
-
-#define pipe_mutex_init(mutex) \
- InitializeCriticalSection(&mutex)
-
-#define pipe_mutex_destroy(mutex) \
- DeleteCriticalSection(&mutex)
-
-#define pipe_mutex_lock(mutex) \
- EnterCriticalSection(&mutex)
-
-#define pipe_mutex_unlock(mutex) \
- LeaveCriticalSection(&mutex)
-
-/* XXX: dummy definitions, make it compile */
-
-typedef unsigned pipe_condvar;
-
-#define pipe_condvar_init(condvar) \
- (void) condvar
-
-#define pipe_condvar_broadcast(condvar) \
- (void) condvar
-
-#else
-
-/** Dummy definitions */
-
-typedef unsigned pipe_thread;
-typedef unsigned pipe_mutex;
-typedef unsigned pipe_condvar;
-
-#define pipe_static_mutex(mutex) \
- static pipe_mutex mutex = 0
-
-#define pipe_mutex_init(mutex) \
- (void) mutex
-
-#define pipe_mutex_destroy(mutex) \
- (void) mutex
-
-#define pipe_mutex_lock(mutex) \
- (void) mutex
-
-#define pipe_mutex_unlock(mutex) \
- (void) mutex
-
-#define pipe_static_condvar(condvar) \
- static unsigned condvar = 0
-
-#define pipe_condvar_init(condvar) \
- (void) condvar
-
-#define pipe_condvar_destroy(condvar) \
- (void) condvar
-
-#define pipe_condvar_wait(condvar, mutex) \
- (void) condvar
-
-#define pipe_condvar_signal(condvar) \
- (void) condvar
-
-#define pipe_condvar_broadcast(condvar) \
- (void) condvar
-
-
-#endif /* PIPE_OS_? */
-
-
-
-/*
- * Thread-specific data.
- */
-
-typedef struct {
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU)
- pthread_key_t key;
-#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
- DWORD key;
-#endif
- int initMagic;
-} pipe_tsd;
-
-
-#define PIPE_TSD_INIT_MAGIC 0xff8adc98
-
-
-static INLINE void
-pipe_tsd_init(pipe_tsd *tsd)
-{
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU)
- if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) {
- perror("pthread_key_create(): failed to allocate key for thread specific data");
- exit(-1);
- }
-#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
- assert(0);
-#endif
- tsd->initMagic = PIPE_TSD_INIT_MAGIC;
-}
-
-static INLINE void *
-pipe_tsd_get(pipe_tsd *tsd)
-{
- if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) {
- pipe_tsd_init(tsd);
- }
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU)
- return pthread_getspecific(tsd->key);
-#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
- assert(0);
- return NULL;
-#else
- assert(0);
- return NULL;
-#endif
-}
-
-static INLINE void
-pipe_tsd_set(pipe_tsd *tsd, void *value)
-{
- if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) {
- pipe_tsd_init(tsd);
- }
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU)
- if (pthread_setspecific(tsd->key, value) != 0) {
- perror("pthread_set_specific() failed");
- exit(-1);
- }
-#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
- assert(0);
-#else
- assert(0);
-#endif
-}
-
-
-
-#endif /* _P_THREAD2_H_ */
diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h
index b85f01c2b0..77e22d0a56 100644
--- a/src/gallium/include/pipe/p_video_state.h
+++ b/src/gallium/include/pipe/p_video_state.h
@@ -30,12 +30,12 @@
/* u_reduce_video_profile() needs these */
#include <pipe/p_compiler.h>
-#include <util/u_debug.h>
#include <pipe/p_defines.h>
#include <pipe/p_format.h>
-#include <pipe/p_refcnt.h>
+#include <pipe/p_state.h>
#include <pipe/p_screen.h>
+#include <util/u_inlines.h>
#ifdef __cplusplus
extern "C" {