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/p_compiler.h6
-rw-r--r--src/gallium/include/pipe/p_config.h19
-rw-r--r--src/gallium/include/pipe/p_context.h20
-rw-r--r--src/gallium/include/pipe/p_defines.h118
-rw-r--r--src/gallium/include/pipe/p_error.h65
-rw-r--r--src/gallium/include/pipe/p_format.h141
-rw-r--r--src/gallium/include/pipe/p_inlines.h16
-rw-r--r--src/gallium/include/pipe/p_refcnt.h25
-rw-r--r--src/gallium/include/pipe/p_screen.h16
-rw-r--r--src/gallium/include/pipe/p_shader_tokens.h334
-rw-r--r--src/gallium/include/pipe/p_state.h47
-rw-r--r--src/gallium/include/pipe/p_video_context.h121
-rw-r--r--src/gallium/include/pipe/p_video_state.h185
13 files changed, 649 insertions, 464 deletions
diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h
index c13cffceb0..f7368bb95b 100644
--- a/src/gallium/include/pipe/p_compiler.h
+++ b/src/gallium/include/pipe/p_compiler.h
@@ -167,11 +167,17 @@ typedef unsigned char boolean;
#define ALIGN16_ASSIGN(NAME) NAME##___aligned
#define ALIGN16_ATTRIB __attribute__(( aligned( 16 ) ))
#define ALIGN8_ATTRIB __attribute__(( aligned( 8 ) ))
+#if (__GNUC__ > 4 || (__GNUC__ == 4 &&__GNUC_MINOR__>1)) && !defined(PIPE_ARCH_X86_64)
+#define ALIGN_STACK __attribute__((force_align_arg_pointer))
+#else
+#define ALIGN_STACK
+#endif
#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
#endif
diff --git a/src/gallium/include/pipe/p_config.h b/src/gallium/include/pipe/p_config.h
index de99957d9d..064605a4a0 100644
--- a/src/gallium/include/pipe/p_config.h
+++ b/src/gallium/include/pipe/p_config.h
@@ -53,6 +53,7 @@
#if defined(__GNUC__)
#define PIPE_CC_GCC
+#define PIPE_CC_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
#endif
/*
@@ -122,18 +123,35 @@
#if defined(__linux__)
#define PIPE_OS_LINUX
+#define PIPE_OS_UNIX
#endif
#if defined(__FreeBSD__)
+#define PIPE_OS_FREEBSD
#define PIPE_OS_BSD
+#define PIPE_OS_UNIX
+#endif
+
+#if defined(__OpenBSD__)
+#define PIPE_OS_OPENBSD
+#define PIPE_OS_BSD
+#define PIPE_OS_UNIX
+#endif
+
+#if defined(__NetBSD__)
+#define PIPE_OS_NETBSD
+#define PIPE_OS_BSD
+#define PIPE_OS_UNIX
#endif
#if defined(__sun)
#define PIPE_OS_SOLARIS
+#define PIPE_OS_UNIX
#endif
#if defined(__APPLE__)
#define PIPE_OS_APPLE
+#define PIPE_OS_UNIX
#endif
#if defined(_WIN32) || defined(WIN32)
@@ -142,6 +160,7 @@
#if defined(__HAIKU__)
#define PIPE_OS_HAIKU
+#define PIPE_OS_UNIX
#endif
/*
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index 39620a7198..f896001eb1 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -123,7 +123,12 @@ struct pipe_context {
void * (*create_sampler_state)(struct pipe_context *,
const struct pipe_sampler_state *);
- void (*bind_sampler_states)(struct pipe_context *, unsigned num, void **);
+ void (*bind_fragment_sampler_states)(struct pipe_context *,
+ unsigned num_samplers,
+ void **samplers);
+ void (*bind_vertex_sampler_states)(struct pipe_context *,
+ unsigned num_samplers,
+ void **samplers);
void (*delete_sampler_state)(struct pipe_context *, void *);
void * (*create_rasterizer_state)(struct pipe_context *,
@@ -173,9 +178,13 @@ struct pipe_context {
void (*set_viewport_state)( struct pipe_context *,
const struct pipe_viewport_state * );
- void (*set_sampler_textures)( struct pipe_context *,
- unsigned num_textures,
- struct pipe_texture ** );
+ void (*set_fragment_sampler_textures)(struct pipe_context *,
+ unsigned num_textures,
+ struct pipe_texture **);
+
+ void (*set_vertex_sampler_textures)(struct pipe_context *,
+ unsigned num_textures,
+ struct pipe_texture **);
void (*set_vertex_buffers)( struct pipe_context *,
unsigned num_buffers,
@@ -189,6 +198,9 @@ struct pipe_context {
/**
* Surface functions
+ *
+ * The pipe driver is allowed to set these functions to NULL, and in that
+ * case, they will not be available.
*/
/*@{*/
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index f252d6df00..69a0970d5f 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -34,6 +34,23 @@
extern "C" {
#endif
+/**
+ * Gallium error codes.
+ *
+ * - A zero value always means success.
+ * - A negative value always means failure.
+ * - The meaning of a positive value is function dependent.
+ */
+enum pipe_error {
+ PIPE_OK = 0,
+ PIPE_ERROR = -1, /**< Generic error */
+ PIPE_ERROR_BAD_INPUT = -2,
+ PIPE_ERROR_OUT_OF_MEMORY = -3,
+ PIPE_ERROR_RETRY = -4
+ /* TODO */
+};
+
+
#define PIPE_BLENDFACTOR_ONE 0x1
#define PIPE_BLENDFACTOR_SRC_COLOR 0x2
#define PIPE_BLENDFACTOR_SRC_ALPHA 0x3
@@ -193,13 +210,25 @@ enum pipe_texture_target {
enum pipe_transfer_usage {
PIPE_TRANSFER_READ = (1 << 0),
PIPE_TRANSFER_WRITE = (1 << 1),
- PIPE_TRANSFER_READ_WRITE = PIPE_TRANSFER_READ | PIPE_TRANSFER_WRITE /**< Read/modify/write */
+ /** Read/modify/write */
+ PIPE_TRANSFER_READ_WRITE = PIPE_TRANSFER_READ | PIPE_TRANSFER_WRITE,
+ /**
+ * The transfer should map the texture storage directly. The driver may
+ * return NULL if that isn't possible, and the state tracker needs to cope
+ * with that and use an alternative path without this flag.
+ *
+ * E.g. the state tracker could have a simpler path which maps textures and
+ * does read/modify/write cycles on them directly, and a more complicated
+ * path which uses minimal read and write transfers.
+ */
+ PIPE_TRANSFER_MAP_DIRECTLY = (1 << 2)
};
-/**
+/*
* Buffer usage flags
*/
+
#define PIPE_BUFFER_USAGE_CPU_READ (1 << 0)
#define PIPE_BUFFER_USAGE_CPU_WRITE (1 << 1)
#define PIPE_BUFFER_USAGE_GPU_READ (1 << 2)
@@ -208,9 +237,63 @@ enum pipe_transfer_usage {
#define PIPE_BUFFER_USAGE_VERTEX (1 << 5)
#define PIPE_BUFFER_USAGE_INDEX (1 << 6)
#define PIPE_BUFFER_USAGE_CONSTANT (1 << 7)
+
+/*
+ * CPU access flags.
+ *
+ * These flags should only be used for texture transfers or when mapping
+ * buffers.
+ *
+ * Note that the PIPE_BUFFER_USAGE_CPU_xxx flags above are also used for
+ * mapping. Either PIPE_BUFFER_USAGE_CPU_READ or PIPE_BUFFER_USAGE_CPU_WRITE
+ * must be set.
+ */
+
+/**
+ * Discards the memory within the mapped region.
+ *
+ * It should not be used with PIPE_BUFFER_USAGE_CPU_READ.
+ *
+ * See also:
+ * - OpenGL's ARB_map_buffer_range extension, MAP_INVALIDATE_RANGE_BIT flag.
+ * - Direct3D's D3DLOCK_DISCARD flag.
+ */
#define PIPE_BUFFER_USAGE_DISCARD (1 << 8)
+
+/**
+ * Fail if the resource cannot be mapped immediately.
+ *
+ * See also:
+ * - Direct3D's D3DLOCK_DONOTWAIT flag.
+ * - Mesa3D's MESA_MAP_NOWAIT_BIT flag.
+ * - WDDM's D3DDDICB_LOCKFLAGS.DonotWait flag.
+ */
#define PIPE_BUFFER_USAGE_DONTBLOCK (1 << 9)
-#define PIPE_BUFFER_USAGE_FLUSH_EXPLICIT (1 << 10) /**< See pipe_screen::buffer_flush_mapped_range */
+
+/**
+ * Do not attempt to synchronize pending operations on the resource when mapping.
+ *
+ * It should not be used with PIPE_BUFFER_USAGE_CPU_READ.
+ *
+ * See also:
+ * - OpenGL's ARB_map_buffer_range extension, MAP_UNSYNCHRONIZED_BIT flag.
+ * - Direct3D's D3DLOCK_NOOVERWRITE flag.
+ * - WDDM's D3DDDICB_LOCKFLAGS.IgnoreSync flag.
+ */
+#define PIPE_BUFFER_USAGE_UNSYNCHRONIZED (1 << 10)
+
+/**
+ * Written ranges will be notified later with
+ * pipe_screen::buffer_flush_mapped_range.
+ *
+ * It should not be used with PIPE_BUFFER_USAGE_CPU_READ.
+ *
+ * See also:
+ * - pipe_screen::buffer_flush_mapped_range
+ * - OpenGL's ARB_map_buffer_range extension, MAP_FLUSH_EXPLICIT_BIT flag.
+ */
+#define PIPE_BUFFER_USAGE_FLUSH_EXPLICIT (1 << 11)
+
/** Pipe driver custom usage flags should be greater or equal to this value */
#define PIPE_BUFFER_USAGE_CUSTOM (1 << 16)
@@ -305,6 +388,10 @@ enum pipe_transfer_usage {
#define PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS 26
#define PIPE_CAP_TGSI_CONT_SUPPORTED 27
#define PIPE_CAP_BLEND_EQUATION_SEPARATE 28
+#define PIPE_CAP_SM3 29 /*< Shader Model 3 supported */
+#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 */
/**
@@ -315,6 +402,31 @@ enum pipe_transfer_usage {
#define PIPE_REFERENCED_FOR_READ (1 << 0)
#define PIPE_REFERENCED_FOR_WRITE (1 << 1)
+
+enum pipe_video_codec
+{
+ PIPE_VIDEO_CODEC_UNKNOWN = 0,
+ PIPE_VIDEO_CODEC_MPEG12, /**< MPEG1, MPEG2 */
+ PIPE_VIDEO_CODEC_MPEG4, /**< DIVX, XVID */
+ PIPE_VIDEO_CODEC_VC1, /**< WMV */
+ PIPE_VIDEO_CODEC_MPEG4_AVC /**< H.264 */
+};
+
+enum pipe_video_profile
+{
+ PIPE_VIDEO_PROFILE_MPEG1,
+ PIPE_VIDEO_PROFILE_MPEG2_SIMPLE,
+ PIPE_VIDEO_PROFILE_MPEG2_MAIN,
+ PIPE_VIDEO_PROFILE_MPEG4_SIMPLE,
+ PIPE_VIDEO_PROFILE_MPEG4_ADVANCED_SIMPLE,
+ PIPE_VIDEO_PROFILE_VC1_SIMPLE,
+ PIPE_VIDEO_PROFILE_VC1_MAIN,
+ PIPE_VIDEO_PROFILE_VC1_ADVANCED,
+ PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE,
+ PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN,
+ PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH
+};
+
#ifdef __cplusplus
}
#endif
diff --git a/src/gallium/include/pipe/p_error.h b/src/gallium/include/pipe/p_error.h
deleted file mode 100644
index b865b22635..0000000000
--- a/src/gallium/include/pipe/p_error.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/**************************************************************************
- *
- * 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, 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
- * Gallium error codes.
- *
- * @author José Fonseca <jrfonseca@tungstengraphics.com>
- */
-
-#ifndef P_ERROR_H_
-#define P_ERROR_H_
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * Gallium error codes.
- *
- * - A zero value always means success.
- * - A negative value always means failure.
- * - The meaning of a positive value is function dependent.
- */
-enum pipe_error {
- PIPE_OK = 0,
- PIPE_ERROR = -1, /**< Generic error */
- PIPE_ERROR_BAD_INPUT = -2,
- PIPE_ERROR_OUT_OF_MEMORY = -3,
- PIPE_ERROR_RETRY = -4
- /* TODO */
-};
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* P_ERROR_H_ */
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index c4469d4a9e..e6bba777d3 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -422,10 +422,11 @@ static INLINE uint pf_get_component_bits( enum pipe_format format, uint comp )
return size << (pf_mixed_scale8( format ) * 3);
}
+
/**
- * Return total bits needed for the pixel format.
+ * Return total bits needed for the pixel format per block.
*/
-static INLINE uint pf_get_bits( enum pipe_format format )
+static INLINE uint pf_get_blocksizebits( enum pipe_format format )
{
switch (pf_layout(format)) {
case PIPE_FORMAT_LAYOUT_RGBAZS:
@@ -441,8 +442,24 @@ static INLINE uint pf_get_bits( enum pipe_format format )
pf_get_component_bits( format, PIPE_FORMAT_COMP_S );
case PIPE_FORMAT_LAYOUT_YCBCR:
assert( format == PIPE_FORMAT_YCBCR || format == PIPE_FORMAT_YCBCR_REV );
- /* return effective bits per pixel */
- return 16;
+ return 32;
+ case PIPE_FORMAT_LAYOUT_DXT:
+ switch(format) {
+ case PIPE_FORMAT_DXT1_RGBA:
+ case PIPE_FORMAT_DXT1_RGB:
+ case PIPE_FORMAT_DXT1_SRGBA:
+ case PIPE_FORMAT_DXT1_SRGB:
+ return 64;
+ case PIPE_FORMAT_DXT3_RGBA:
+ case PIPE_FORMAT_DXT5_RGBA:
+ case PIPE_FORMAT_DXT3_SRGBA:
+ case PIPE_FORMAT_DXT5_SRGBA:
+ return 128;
+ default:
+ assert( 0 );
+ return 0;
+ }
+
default:
assert( 0 );
return 0;
@@ -450,102 +467,66 @@ static INLINE uint pf_get_bits( enum pipe_format format )
}
/**
- * Return bytes per pixel for the given format.
+ * Return bytes per element for the given format.
*/
-static INLINE uint pf_get_size( enum pipe_format format )
+static INLINE uint pf_get_blocksize( enum pipe_format format )
{
- assert(pf_get_bits(format) % 8 == 0);
- return pf_get_bits(format) / 8;
+ assert(pf_get_blocksizebits(format) % 8 == 0);
+ return pf_get_blocksizebits(format) / 8;
}
-/**
- * Describe accurately the pixel format.
- *
- * The chars-per-pixel concept falls apart with compressed and yuv images, where
- * more than one pixel are coded in a single data block. This structure
- * describes that block.
- *
- * Simple pixel formats are effectively a 1x1xcpp block.
- */
-struct pipe_format_block
+static INLINE uint pf_get_blockwidth( enum pipe_format format )
{
- /** Block size in bytes */
- unsigned size;
-
- /** Block width in pixels */
- unsigned width;
-
- /** Block height in pixels */
- unsigned height;
-};
+ switch (pf_layout(format)) {
+ case PIPE_FORMAT_LAYOUT_YCBCR:
+ return 2;
+ case PIPE_FORMAT_LAYOUT_DXT:
+ return 4;
+ default:
+ return 1;
+ }
+}
-/**
- * Describe pixel format's block.
- *
- * @sa http://msdn2.microsoft.com/en-us/library/ms796147.aspx
- */
-static INLINE void
-pf_get_block(enum pipe_format format, struct pipe_format_block *block)
+static INLINE uint pf_get_blockheight( enum pipe_format format )
{
- switch(format) {
- case PIPE_FORMAT_DXT1_RGBA:
- case PIPE_FORMAT_DXT1_RGB:
- case PIPE_FORMAT_DXT1_SRGBA:
- case PIPE_FORMAT_DXT1_SRGB:
- block->size = 8;
- block->width = 4;
- block->height = 4;
- break;
- case PIPE_FORMAT_DXT3_RGBA:
- case PIPE_FORMAT_DXT5_RGBA:
- case PIPE_FORMAT_DXT3_SRGBA:
- case PIPE_FORMAT_DXT5_SRGBA:
- block->size = 16;
- block->width = 4;
- block->height = 4;
- break;
- case PIPE_FORMAT_YCBCR:
- case PIPE_FORMAT_YCBCR_REV:
- block->size = 4; /* 2*cpp */
- block->width = 2;
- block->height = 1;
- break;
+ switch (pf_layout(format)) {
+ case PIPE_FORMAT_LAYOUT_DXT:
+ return 4;
default:
- block->size = pf_get_size(format);
- block->width = 1;
- block->height = 1;
- break;
+ return 1;
}
}
static INLINE unsigned
-pf_get_nblocksx(const struct pipe_format_block *block, unsigned x)
+pf_get_nblocksx(enum pipe_format format, unsigned x)
{
- return (x + block->width - 1)/block->width;
+ unsigned blockwidth = pf_get_blockwidth(format);
+ return (x + blockwidth - 1) / blockwidth;
}
static INLINE unsigned
-pf_get_nblocksy(const struct pipe_format_block *block, unsigned y)
+pf_get_nblocksy(enum pipe_format format, unsigned y)
{
- return (y + block->height - 1)/block->height;
+ unsigned blockheight = pf_get_blockheight(format);
+ return (y + blockheight - 1) / blockheight;
}
static INLINE unsigned
-pf_get_nblocks(const struct pipe_format_block *block, unsigned width, unsigned height)
+pf_get_nblocks(enum pipe_format format, unsigned width, unsigned height)
{
- return pf_get_nblocksx(block, width)*pf_get_nblocksy(block, height);
+ return pf_get_nblocksx(format, width) * pf_get_nblocksy(format, height);
}
static INLINE size_t
-pf_get_stride(const struct pipe_format_block *block, unsigned width)
+pf_get_stride(enum pipe_format format, unsigned width)
{
- return pf_get_nblocksx(block, width)*block->size;
+ return pf_get_nblocksx(format, width) * pf_get_blocksize(format);
}
static INLINE size_t
-pf_get_2d_size(const struct pipe_format_block *block, size_t stride, unsigned height)
+pf_get_2d_size(enum pipe_format format, size_t stride, unsigned height)
{
- return pf_get_nblocksy(block, height)*stride;
+ return pf_get_nblocksy(format, height) * stride;
}
static INLINE boolean
@@ -613,6 +594,24 @@ pf_has_alpha( enum pipe_format format )
}
}
+enum pipe_video_chroma_format
+{
+ PIPE_VIDEO_CHROMA_FORMAT_420,
+ PIPE_VIDEO_CHROMA_FORMAT_422,
+ PIPE_VIDEO_CHROMA_FORMAT_444
+};
+
+#if 0
+enum pipe_video_surface_format
+{
+ PIPE_VIDEO_SURFACE_FORMAT_NV12, /**< Planar; Y plane, UV plane */
+ PIPE_VIDEO_SURFACE_FORMAT_YV12, /**< Planar; Y plane, U plane, V plane */
+ PIPE_VIDEO_SURFACE_FORMAT_YUYV, /**< Interleaved; Y,U,Y,V,Y,U,Y,V */
+ PIPE_VIDEO_SURFACE_FORMAT_UYVY, /**< Interleaved; U,Y,V,Y,U,Y,V,Y */
+ PIPE_VIDEO_SURFACE_FORMAT_VUYA /**< Packed; A31-24|Y23-16|U15-8|V7-0 */
+};
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/src/gallium/include/pipe/p_inlines.h b/src/gallium/include/pipe/p_inlines.h
index 30a4aaf409..5fbd62a03d 100644
--- a/src/gallium/include/pipe/p_inlines.h
+++ b/src/gallium/include/pipe/p_inlines.h
@@ -176,6 +176,22 @@ pipe_transfer_destroy( struct pipe_transfer *transf )
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
diff --git a/src/gallium/include/pipe/p_refcnt.h b/src/gallium/include/pipe/p_refcnt.h
index 1f9088b3e9..c1c7415e02 100644
--- a/src/gallium/include/pipe/p_refcnt.h
+++ b/src/gallium/include/pipe/p_refcnt.h
@@ -51,7 +51,7 @@ pipe_reference_init(struct pipe_reference *reference, unsigned count)
}
-static INLINE bool
+static INLINE boolean
pipe_is_referenced(struct pipe_reference *reference)
{
return p_atomic_read(&reference->count) != 0;
@@ -59,30 +59,29 @@ pipe_is_referenced(struct pipe_reference *reference)
/**
- * Set 'ptr' to point to 'reference' and update reference counting.
- * The old thing pointed to, if any, will be unreferenced first.
- * 'reference' may be NULL.
+ * 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 bool
-pipe_reference(struct pipe_reference **ptr, struct pipe_reference *reference)
+static INLINE boolean
+pipe_reference(struct pipe_reference *ptr, struct pipe_reference *reference)
{
- bool destroy = FALSE;
+ boolean destroy = FALSE;
- if(*ptr != reference) {
+ 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)) {
+ if (ptr) {
+ assert(pipe_is_referenced(ptr));
+ if (p_atomic_dec_zero(&ptr->count)) {
destroy = TRUE;
}
}
-
- *ptr = reference;
}
return destroy;
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index 3f30c52a16..f0a4de5df3 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -53,7 +53,10 @@ extern "C" {
struct pipe_fence_handle;
struct pipe_winsys;
struct pipe_buffer;
-
+struct pipe_texture;
+struct pipe_surface;
+struct pipe_video_surface;
+struct pipe_transfer;
/**
@@ -252,6 +255,17 @@ struct pipe_screen {
void (*buffer_destroy)( struct pipe_buffer *buf );
+ /**
+ * Create a video surface suitable for use as a decoding target by the
+ * driver's pipe_video_context.
+ */
+ struct pipe_video_surface*
+ (*video_surface_create)( struct pipe_screen *screen,
+ enum pipe_video_chroma_format chroma_format,
+ unsigned width, unsigned height );
+
+ void (*video_surface_destroy)( struct pipe_video_surface *vsfc );
+
/**
* Do any special operations to ensure frontbuffer contents are
diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
index 5fa6c9af30..588ca5e026 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -1,6 +1,7 @@
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2009 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -25,8 +26,8 @@
*
**************************************************************************/
-#ifndef TGSI_TOKEN_H
-#define TGSI_TOKEN_H
+#ifndef P_SHADER_TOKENS_H
+#define P_SHADER_TOKENS_H
#ifdef __cplusplus
extern "C" {
@@ -34,12 +35,6 @@ extern "C" {
#include "p_compiler.h"
-struct tgsi_version
-{
- unsigned MajorVersion : 8;
- unsigned MinorVersion : 8;
- unsigned Padding : 16;
-};
struct tgsi_header
{
@@ -65,8 +60,7 @@ struct tgsi_token
{
unsigned Type : 4; /**< TGSI_TOKEN_TYPE_x */
unsigned NrTokens : 8; /**< UINT */
- unsigned Padding : 19;
- unsigned Extended : 1; /**< BOOL */
+ unsigned Padding : 20;
};
enum tgsi_file_type {
@@ -79,6 +73,7 @@ enum tgsi_file_type {
TGSI_FILE_ADDRESS =6,
TGSI_FILE_IMMEDIATE =7,
TGSI_FILE_LOOP =8,
+ TGSI_FILE_PREDICATE =9,
TGSI_FILE_COUNT /**< how many TGSI_FILE_ types */
};
@@ -115,8 +110,7 @@ struct tgsi_declaration
unsigned Semantic : 1; /**< BOOL, any semantic info? */
unsigned Centroid : 1; /**< centroid sampling? */
unsigned Invariant : 1; /**< invariant optimization? */
- unsigned Padding : 4;
- unsigned Extended : 1; /**< BOOL */
+ unsigned Padding : 5;
};
struct tgsi_declaration_range
@@ -137,8 +131,8 @@ struct tgsi_declaration_range
struct tgsi_declaration_semantic
{
- unsigned SemanticName : 8; /**< one of TGSI_SEMANTIC_x */
- unsigned SemanticIndex : 16; /**< UINT */
+ unsigned Name : 8; /**< one of TGSI_SEMANTIC_x */
+ unsigned Index : 16; /**< UINT */
unsigned Padding : 8;
};
@@ -149,8 +143,7 @@ struct tgsi_immediate
unsigned Type : 4; /**< TGSI_TOKEN_TYPE_IMMEDIATE */
unsigned NrTokens : 8; /**< UINT */
unsigned DataType : 4; /**< one of TGSI_IMM_x */
- unsigned Padding : 15;
- unsigned Extended : 1; /**< BOOL */
+ unsigned Padding : 16;
};
union tgsi_immediate_data
@@ -266,10 +259,7 @@ union tgsi_immediate_data
#define TGSI_OPCODE_BGNSUB 100
#define TGSI_OPCODE_ENDLOOP 101
#define TGSI_OPCODE_ENDSUB 102
-#define TGSI_OPCODE_NOISE1 103
-#define TGSI_OPCODE_NOISE2 104
-#define TGSI_OPCODE_NOISE3 105
-#define TGSI_OPCODE_NOISE4 106
+ /* gap */
#define TGSI_OPCODE_NOP 107
/* gap */
#define TGSI_OPCODE_NRM4 112
@@ -278,7 +268,7 @@ union tgsi_immediate_data
#define TGSI_OPCODE_BREAKC 115
#define TGSI_OPCODE_KIL 116 /* conditional kill */
#define TGSI_OPCODE_END 117 /* aka HALT */
-#define TGSI_OPCODE_SWZ 118
+ /* gap */
#define TGSI_OPCODE_LAST 119
#define TGSI_SAT_NONE 0 /* do not saturate */
@@ -294,7 +284,7 @@ union tgsi_immediate_data
* respectively. For a given operation code, those numbers are fixed and are
* present here only for convenience.
*
- * If Extended is TRUE, it is now executed.
+ * If Predicate is TRUE, tgsi_instruction_predicate token immediately follows.
*
* Saturate controls how are final results in destination registers modified.
*/
@@ -307,12 +297,16 @@ struct tgsi_instruction
unsigned Saturate : 2; /* TGSI_SAT_ */
unsigned NumDstRegs : 2; /* UINT */
unsigned NumSrcRegs : 4; /* UINT */
- unsigned Padding : 3;
- unsigned Extended : 1; /* BOOL */
+ unsigned Predicate : 1; /* BOOL */
+ unsigned Label : 1;
+ unsigned Texture : 1;
+ unsigned Padding : 1;
};
/*
- * If tgsi_instruction::Extended is TRUE, tgsi_instruction_ext follows.
+ * If tgsi_instruction::Label is TRUE, tgsi_instruction_label follows.
+ *
+ * If tgsi_instruction::Texture is TRUE, tgsi_instruction_texture follows.
*
* Then, tgsi_instruction::NumDstRegs of tgsi_dst_register follow.
*
@@ -322,91 +316,15 @@ struct tgsi_instruction
* instruction, including the instruction word.
*/
-#define TGSI_INSTRUCTION_EXT_TYPE_NV 0
-#define TGSI_INSTRUCTION_EXT_TYPE_LABEL 1
-#define TGSI_INSTRUCTION_EXT_TYPE_TEXTURE 2
-#define TGSI_INSTRUCTION_EXT_TYPE_PREDICATE 3
-
-struct tgsi_instruction_ext
-{
- unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_ */
- unsigned Padding : 27;
- unsigned Extended : 1; /* BOOL */
-};
-
-/*
- * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_NV, it should
- * be cast to tgsi_instruction_ext_nv.
- *
- * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_LABEL, it
- * should be cast to tgsi_instruction_ext_label.
- *
- * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_TEXTURE, it
- * should be cast to tgsi_instruction_ext_texture.
- *
- * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_PREDICATE, it
- * should be cast to tgsi_instruction_ext_predicate.
- *
- * If tgsi_instruction_ext::Extended is TRUE, another tgsi_instruction_ext
- * follows.
- */
-
-#define TGSI_PRECISION_DEFAULT 0
-#define TGSI_PRECISION_FLOAT32 1
-#define TGSI_PRECISION_FLOAT16 2
-#define TGSI_PRECISION_FIXED12 3
-
-#define TGSI_CC_GT 0
-#define TGSI_CC_EQ 1
-#define TGSI_CC_LT 2
-#define TGSI_CC_GE 3
-#define TGSI_CC_LE 4
-#define TGSI_CC_NE 5
-#define TGSI_CC_TR 6
-#define TGSI_CC_FL 7
-
#define TGSI_SWIZZLE_X 0
#define TGSI_SWIZZLE_Y 1
#define TGSI_SWIZZLE_Z 2
#define TGSI_SWIZZLE_W 3
-/**
- * Precision controls the precision at which the operation should be executed.
- *
- * CondDstUpdate enables condition code register writes. When this field is
- * TRUE, CondDstIndex specifies the index of the condition code register to
- * update.
- *
- * CondFlowEnable enables conditional execution of the operation. When this
- * field is TRUE, CondFlowIndex specifies the index of the condition code
- * register to test against CondMask with component swizzle controled by
- * CondSwizzleX, CondSwizzleY, CondSwizzleZ and CondSwizzleW. If the test fails,
- * the operation is not executed.
- */
-
-struct tgsi_instruction_ext_nv
-{
- unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_NV */
- unsigned Precision : 4; /* TGSI_PRECISION_ */
- unsigned CondDstIndex : 4; /* UINT */
- unsigned CondFlowIndex : 4; /* UINT */
- unsigned CondMask : 4; /* TGSI_CC_ */
- unsigned CondSwizzleX : 2; /* TGSI_SWIZZLE_ */
- unsigned CondSwizzleY : 2; /* TGSI_SWIZZLE_ */
- unsigned CondSwizzleZ : 2; /* TGSI_SWIZZLE_ */
- unsigned CondSwizzleW : 2; /* TGSI_SWIZZLE_ */
- unsigned CondDstUpdate : 1; /* BOOL */
- unsigned CondFlowEnable : 1; /* BOOL */
- unsigned Padding : 1;
- unsigned Extended : 1; /* BOOL */
-};
-
-struct tgsi_instruction_ext_label
+struct tgsi_instruction_label
{
- unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_LABEL */
unsigned Label : 24; /* UINT */
- unsigned Padding : 3;
- unsigned Extended : 1; /* BOOL */
+ unsigned Padding : 8;
};
#define TGSI_TEXTURE_UNKNOWN 0
@@ -420,21 +338,25 @@ struct tgsi_instruction_ext_label
#define TGSI_TEXTURE_SHADOWRECT 8
#define TGSI_TEXTURE_COUNT 9
-struct tgsi_instruction_ext_texture
+struct tgsi_instruction_texture
{
- unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_TEXTURE */
unsigned Texture : 8; /* TGSI_TEXTURE_ */
- unsigned Padding : 19;
- unsigned Extended : 1; /* BOOL */
+ unsigned Padding : 24;
};
-struct tgsi_instruction_ext_predicate
+/*
+ * For SM3, the following constraint applies.
+ * - Swizzle is either set to identity or replicate.
+ */
+struct tgsi_instruction_predicate
{
- unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_PREDICATE */
- unsigned PredDstIndex : 4; /* UINT */
- unsigned PredWriteMask : 4; /* TGSI_WRITEMASK_ */
- unsigned Padding : 19;
- unsigned Extended : 1; /* BOOL */
+ int Index : 16; /* SINT */
+ unsigned SwizzleX : 2; /* TGSI_SWIZZLE_x */
+ unsigned SwizzleY : 2; /* TGSI_SWIZZLE_x */
+ unsigned SwizzleZ : 2; /* TGSI_SWIZZLE_x */
+ unsigned SwizzleW : 2; /* TGSI_SWIZZLE_x */
+ unsigned Negate : 1; /* BOOL */
+ unsigned Padding : 7;
};
/**
@@ -451,26 +373,24 @@ struct tgsi_instruction_ext_predicate
* The fetched register components are swizzled according to SwizzleX, SwizzleY,
* SwizzleZ and SwizzleW.
*
- * If Extended is TRUE, any further modifications to the source register are
- * made to this temporary storage.
*/
struct tgsi_src_register
{
unsigned File : 4; /* TGSI_FILE_ */
+ unsigned Indirect : 1; /* BOOL */
+ unsigned Dimension : 1; /* BOOL */
+ int Index : 16; /* SINT */
unsigned SwizzleX : 2; /* TGSI_SWIZZLE_ */
unsigned SwizzleY : 2; /* TGSI_SWIZZLE_ */
unsigned SwizzleZ : 2; /* TGSI_SWIZZLE_ */
unsigned SwizzleW : 2; /* TGSI_SWIZZLE_ */
- unsigned Negate : 1; /* BOOL */
- unsigned Indirect : 1; /* BOOL */
- unsigned Dimension : 1; /* BOOL */
- int Index : 16; /* SINT */
- unsigned Extended : 1; /* BOOL */
+ unsigned Absolute : 1; /* BOOL */
+ unsigned Negate : 1; /* BOOL */
};
/**
- * If tgsi_src_register::Extended is TRUE, tgsi_src_register_ext follows.
+ * If tgsi_src_register::Modifier is TRUE, tgsi_src_register_modifier follows.
*
* Then, if tgsi_src_register::Indirect is TRUE, another tgsi_src_register
* follows.
@@ -478,95 +398,13 @@ struct tgsi_src_register
* Then, if tgsi_src_register::Dimension is TRUE, tgsi_dimension follows.
*/
-#define TGSI_SRC_REGISTER_EXT_TYPE_SWZ 0
-#define TGSI_SRC_REGISTER_EXT_TYPE_MOD 1
-
-struct tgsi_src_register_ext
-{
- unsigned Type : 4; /* TGSI_SRC_REGISTER_EXT_TYPE_ */
- unsigned Padding : 27;
- unsigned Extended : 1; /* BOOL */
-};
-
-/**
- * If tgsi_src_register_ext::Type is TGSI_SRC_REGISTER_EXT_TYPE_SWZ,
- * it should be cast to tgsi_src_register_ext_swz.
- *
- * If tgsi_src_register_ext::Type is TGSI_SRC_REGISTER_EXT_TYPE_MOD,
- * it should be cast to tgsi_src_register_ext_mod.
- *
- * If tgsi_dst_register_ext::Extended is TRUE, another tgsi_dst_register_ext
- * follows.
- */
-
-#define TGSI_EXTSWIZZLE_X TGSI_SWIZZLE_X
-#define TGSI_EXTSWIZZLE_Y TGSI_SWIZZLE_Y
-#define TGSI_EXTSWIZZLE_Z TGSI_SWIZZLE_Z
-#define TGSI_EXTSWIZZLE_W TGSI_SWIZZLE_W
-#define TGSI_EXTSWIZZLE_ZERO 4
-#define TGSI_EXTSWIZZLE_ONE 5
-
-/**
- * ExtSwizzleX, ExtSwizzleY, ExtSwizzleZ and ExtSwizzleW swizzle the source
- * register in an extended manner.
- *
- * NegateX, NegateY, NegateZ and NegateW negate individual components of the
- * source register.
- *
- * NOTE: To simplify matter, if this token is present, the corresponding Swizzle
- * and Negate fields in tgsi_src_register should be set to X,Y,Z,W
- * and FALSE, respectively.
- */
-
-struct tgsi_src_register_ext_swz
-{
- unsigned Type : 4; /* TGSI_SRC_REGISTER_EXT_TYPE_SWZ */
- unsigned ExtSwizzleX : 4; /* TGSI_EXTSWIZZLE_ */
- unsigned ExtSwizzleY : 4; /* TGSI_EXTSWIZZLE_ */
- unsigned ExtSwizzleZ : 4; /* TGSI_EXTSWIZZLE_ */
- unsigned ExtSwizzleW : 4; /* TGSI_EXTSWIZZLE_ */
- unsigned NegateX : 1; /* BOOL */
- unsigned NegateY : 1; /* BOOL */
- unsigned NegateZ : 1; /* BOOL */
- unsigned NegateW : 1; /* BOOL */
- unsigned Padding : 7;
- unsigned Extended : 1; /* BOOL */
-};
-
-/**
- * Extra src register modifiers
- *
- * If Complement is TRUE, the source register is modified by subtracting it
- * from 1.0.
- *
- * If Bias is TRUE, the source register is modified by subtracting 0.5 from it.
- *
- * If Scale2X is TRUE, the source register is modified by multiplying it by 2.0.
- *
- * If Absolute is TRUE, the source register is modified by removing the sign.
- *
- * If Negate is TRUE, the source register is modified by negating it.
- */
-
-struct tgsi_src_register_ext_mod
-{
- unsigned Type : 4; /* TGSI_SRC_REGISTER_EXT_TYPE_MOD */
- unsigned Complement : 1; /* BOOL */
- unsigned Bias : 1; /* BOOL */
- unsigned Scale2X : 1; /* BOOL */
- unsigned Absolute : 1; /* BOOL */
- unsigned Negate : 1; /* BOOL */
- unsigned Padding : 22;
- unsigned Extended : 1; /* BOOL */
-};
struct tgsi_dimension
{
unsigned Indirect : 1; /* BOOL */
unsigned Dimension : 1; /* BOOL */
- unsigned Padding : 13;
+ unsigned Padding : 14;
int Index : 16; /* SINT */
- unsigned Extended : 1; /* BOOL */
};
struct tgsi_dst_register
@@ -576,90 +414,7 @@ struct tgsi_dst_register
unsigned Indirect : 1; /* BOOL */
unsigned Dimension : 1; /* BOOL */
int Index : 16; /* SINT */
- unsigned Padding : 5;
- unsigned Extended : 1; /* BOOL */
-};
-
-/*
- * If tgsi_dst_register::Extended is TRUE, tgsi_dst_register_ext follows.
- *
- * Then, if tgsi_dst_register::Indirect is TRUE, tgsi_src_register follows.
- */
-
-#define TGSI_DST_REGISTER_EXT_TYPE_CONDCODE 0
-#define TGSI_DST_REGISTER_EXT_TYPE_MODULATE 1
-#define TGSI_DST_REGISTER_EXT_TYPE_PREDICATE 2
-
-struct tgsi_dst_register_ext
-{
- unsigned Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_ */
- unsigned Padding : 27;
- unsigned Extended : 1; /* BOOL */
-};
-
-/**
- * Extra destination register modifiers
- *
- * If tgsi_dst_register_ext::Type is TGSI_DST_REGISTER_EXT_TYPE_CONDCODE,
- * it should be cast to tgsi_dst_register_ext_condcode.
- *
- * If tgsi_dst_register_ext::Type is TGSI_DST_REGISTER_EXT_TYPE_MODULATE,
- * it should be cast to tgsi_dst_register_ext_modulate.
- *
- * If tgsi_dst_register_ext::Type is TGSI_DST_REGISTER_EXT_TYPE_PREDICATE,
- * it should be cast to tgsi_dst_register_ext_predicate.
- *
- * If tgsi_dst_register_ext::Extended is TRUE, another tgsi_dst_register_ext
- * follows.
- */
-struct tgsi_dst_register_ext_concode
-{
- unsigned Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_CONDCODE */
- unsigned CondMask : 4; /* TGSI_CC_ */
- unsigned CondSwizzleX : 2; /* TGSI_SWIZZLE_ */
- unsigned CondSwizzleY : 2; /* TGSI_SWIZZLE_ */
- unsigned CondSwizzleZ : 2; /* TGSI_SWIZZLE_ */
- unsigned CondSwizzleW : 2; /* TGSI_SWIZZLE_ */
- unsigned CondSrcIndex : 4; /* UINT */
- unsigned Padding : 11;
- unsigned Extended : 1; /* BOOL */
-};
-
-#define TGSI_MODULATE_1X 0
-#define TGSI_MODULATE_2X 1
-#define TGSI_MODULATE_4X 2
-#define TGSI_MODULATE_8X 3
-#define TGSI_MODULATE_HALF 4
-#define TGSI_MODULATE_QUARTER 5
-#define TGSI_MODULATE_EIGHTH 6
-#define TGSI_MODULATE_COUNT 7
-
-struct tgsi_dst_register_ext_modulate
-{
- unsigned Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_MODULATE */
- unsigned Modulate : 4; /* TGSI_MODULATE_ */
- unsigned Padding : 23;
- unsigned Extended : 1; /* BOOL */
-};
-
-/*
- * Currently, the following constraints apply.
- *
- * - PredSwizzleXYZW is either set to identity or replicate.
- * - PredSrcIndex is 0.
- */
-
-struct tgsi_dst_register_ext_predicate
-{
- unsigned Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_PREDICATE */
- unsigned PredSwizzleX : 2; /* TGSI_SWIZZLE_ */
- unsigned PredSwizzleY : 2; /* TGSI_SWIZZLE_ */
- unsigned PredSwizzleZ : 2; /* TGSI_SWIZZLE_ */
- unsigned PredSwizzleW : 2; /* TGSI_SWIZZLE_ */
- unsigned PredSrcIndex : 4; /* UINT */
- unsigned Negate : 1; /* BOOL */
- unsigned Padding : 14;
- unsigned Extended : 1; /* BOOL */
+ unsigned Padding : 6;
};
@@ -667,5 +422,4 @@ struct tgsi_dst_register_ext_predicate
}
#endif
-#endif /* TGSI_TOKEN_H */
-
+#endif /* P_SHADER_TOKENS_H */
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 2187f5b367..60e96b98de 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -60,6 +60,7 @@ extern "C" {
#define PIPE_MAX_COLOR_BUFS 8
#define PIPE_MAX_CONSTANT 32
#define PIPE_MAX_SAMPLERS 16
+#define PIPE_MAX_VERTEX_SAMPLERS 16
#define PIPE_MAX_SHADER_INPUTS 16
#define PIPE_MAX_SHADER_OUTPUTS 16
#define PIPE_MAX_TEXTURE_LEVELS 16
@@ -114,11 +115,29 @@ struct pipe_rasterizer_state
* the vertex shader, clipping and viewport processing. Note that
* a vertex shader is still needed though, to indicate the mapping
* from vertex elements to fragment shader input semantics.
+ *
+ * XXX: considered for removal.
*/
unsigned bypass_vs_clip_and_viewport:1;
- unsigned flatshade_first:1; /**< take color attribute from the first vertex of a primitive */
- unsigned gl_rasterization_rules:1; /**< enable tweaks for GL rasterization? */
+ /**
+ * Use the first vertex of a primitive as the provoking vertex for
+ * flat shading.
+ */
+ unsigned flatshade_first:1;
+
+ /**
+ * When true, triangle rasterization uses (0.5, 0.5) pixel centers
+ * for determining pixel ownership.
+ *
+ * When false, triangle rasterization uses (0,0) pixel centers for
+ * determining pixel ownership.
+ *
+ * Triangle rasterization always uses a 'top,left' rule for pixel
+ * ownership, this just alters which point we consider the pixel
+ * center for that test.
+ */
+ unsigned gl_rasterization_rules:1;
float line_width;
float point_size; /**< used when no per-vertex size */
@@ -179,7 +198,6 @@ struct pipe_depth_state
unsigned enabled:1; /**< depth test enabled? */
unsigned writemask:1; /**< allow depth buffer writes? */
unsigned func:3; /**< depth test func (PIPE_FUNC_x) */
- unsigned occlusion_count:1; /**< do occlusion counting? */
};
@@ -298,14 +316,10 @@ struct pipe_surface
*/
struct pipe_transfer
{
- enum pipe_format format; /**< PIPE_FORMAT_x */
unsigned x; /**< x offset from start of texture image */
unsigned y; /**< y offset from start of texture image */
unsigned width; /**< logical width in pixels */
unsigned height; /**< logical height in pixels */
- struct pipe_format_block block;
- unsigned nblocksx; /**< allocated width in blocks */
- unsigned nblocksy; /**< allocated height in blocks */
unsigned stride; /**< stride in bytes between rows of blocks */
enum pipe_transfer_usage usage; /**< PIPE_TRANSFER_* */
@@ -326,13 +340,9 @@ struct pipe_texture
enum pipe_texture_target target; /**< PIPE_TEXTURE_x */
enum pipe_format format; /**< PIPE_FORMAT_x */
- unsigned width[PIPE_MAX_TEXTURE_LEVELS];
- unsigned height[PIPE_MAX_TEXTURE_LEVELS];
- unsigned depth[PIPE_MAX_TEXTURE_LEVELS];
-
- struct pipe_format_block block;
- unsigned nblocksx[PIPE_MAX_TEXTURE_LEVELS]; /**< allocated width in blocks */
- unsigned nblocksy[PIPE_MAX_TEXTURE_LEVELS]; /**< allocated height in blocks */
+ unsigned width0;
+ unsigned height0;
+ unsigned depth0;
unsigned last_level:8; /**< Index of last mipmap level present/defined */
@@ -382,8 +392,9 @@ pipe_buffer_reference(struct pipe_buffer **ptr, struct pipe_buffer *buf)
{
struct pipe_buffer *old_buf = *ptr;
- if (pipe_reference((struct pipe_reference **)ptr, &buf->reference))
+ if (pipe_reference(&(*ptr)->reference, &buf->reference))
old_buf->screen->buffer_destroy(old_buf);
+ *ptr = buf;
}
static INLINE void
@@ -391,8 +402,9 @@ pipe_surface_reference(struct pipe_surface **ptr, struct pipe_surface *surf)
{
struct pipe_surface *old_surf = *ptr;
- if (pipe_reference((struct pipe_reference **)ptr, &surf->reference))
+ if (pipe_reference(&(*ptr)->reference, &surf->reference))
old_surf->texture->screen->tex_surface_destroy(old_surf);
+ *ptr = surf;
}
static INLINE void
@@ -400,8 +412,9 @@ pipe_texture_reference(struct pipe_texture **ptr, struct pipe_texture *tex)
{
struct pipe_texture *old_tex = *ptr;
- if (pipe_reference((struct pipe_reference **)ptr, &tex->reference))
+ if (pipe_reference(&(*ptr)->reference, &tex->reference))
old_tex->screen->texture_destroy(old_tex);
+ *ptr = tex;
}
diff --git a/src/gallium/include/pipe/p_video_context.h b/src/gallium/include/pipe/p_video_context.h
new file mode 100644
index 0000000000..6ae31418fa
--- /dev/null
+++ b/src/gallium/include/pipe/p_video_context.h
@@ -0,0 +1,121 @@
+/**************************************************************************
+ *
+ * Copyright 2009 Younes Manton.
+ * 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 PIPE_VIDEO_CONTEXT_H
+#define PIPE_VIDEO_CONTEXT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <pipe/p_video_state.h>
+
+struct pipe_screen;
+struct pipe_buffer;
+struct pipe_surface;
+struct pipe_video_surface;
+struct pipe_macroblock;
+struct pipe_picture_desc;
+struct pipe_fence_handle;
+
+/**
+ * Gallium video rendering context
+ */
+struct pipe_video_context
+{
+ struct pipe_screen *screen;
+ enum pipe_video_profile profile;
+ enum pipe_video_chroma_format chroma_format;
+ unsigned width;
+ unsigned height;
+
+ void *priv; /**< context private data (for DRI for example) */
+
+ void (*destroy)(struct pipe_video_context *vpipe);
+
+ /**
+ * Picture decoding and displaying
+ */
+ /*@{*/
+ void (*decode_bitstream)(struct pipe_video_context *vpipe,
+ unsigned num_bufs,
+ struct pipe_buffer **bitstream_buf);
+
+ void (*decode_macroblocks)(struct pipe_video_context *vpipe,
+ struct pipe_video_surface *past,
+ struct pipe_video_surface *future,
+ unsigned num_macroblocks,
+ struct pipe_macroblock *macroblocks,
+ struct pipe_fence_handle **fence);
+
+ void (*clear_surface)(struct pipe_video_context *vpipe,
+ unsigned x, unsigned y,
+ unsigned width, unsigned height,
+ unsigned value,
+ struct pipe_surface *surface);
+
+ void (*render_picture)(struct pipe_video_context *vpipe,
+ /*struct pipe_surface *backround,
+ struct pipe_video_rect *backround_area,*/
+ struct pipe_video_surface *src_surface,
+ enum pipe_mpeg12_picture_type picture_type,
+ /*unsigned num_past_surfaces,
+ struct pipe_video_surface *past_surfaces,
+ unsigned num_future_surfaces,
+ struct pipe_video_surface *future_surfaces,*/
+ struct pipe_video_rect *src_area,
+ struct pipe_surface *dst_surface,
+ struct pipe_video_rect *dst_area,
+ /*unsigned num_layers,
+ struct pipe_texture *layers,
+ struct pipe_video_rect *layer_src_areas,
+ struct pipe_video_rect *layer_dst_areas,*/
+ struct pipe_fence_handle **fence);
+ /*@}*/
+
+ /**
+ * Parameter-like states (or properties)
+ */
+ /*@{*/
+ void (*set_picture_desc)(struct pipe_video_context *vpipe,
+ const struct pipe_picture_desc *desc);
+
+ void (*set_decode_target)(struct pipe_video_context *vpipe,
+ struct pipe_video_surface *dt);
+
+ void (*set_csc_matrix)(struct pipe_video_context *vpipe, const float *mat);
+
+ /* TODO: Interface for scaling modes, post-processing, etc. */
+ /*@}*/
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* PIPE_VIDEO_CONTEXT_H */
diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h
new file mode 100644
index 0000000000..b85f01c2b0
--- /dev/null
+++ b/src/gallium/include/pipe/p_video_state.h
@@ -0,0 +1,185 @@
+/**************************************************************************
+ *
+ * Copyright 2009 Younes Manton.
+ * 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 PIPE_VIDEO_STATE_H
+#define PIPE_VIDEO_STATE_H
+
+/* 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_screen.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct pipe_video_surface
+{
+ struct pipe_reference reference;
+ struct pipe_screen *screen;
+ enum pipe_video_chroma_format chroma_format;
+ /*enum pipe_video_surface_format surface_format;*/
+ unsigned width;
+ unsigned height;
+};
+
+static INLINE void
+pipe_video_surface_reference(struct pipe_video_surface **ptr, struct pipe_video_surface *surf)
+{
+ struct pipe_video_surface *old_surf = *ptr;
+
+ if (pipe_reference(&(*ptr)->reference, &surf->reference))
+ old_surf->screen->video_surface_destroy(old_surf);
+ *ptr = surf;
+}
+
+struct pipe_video_rect
+{
+ unsigned x, y, w, h;
+};
+
+static INLINE enum pipe_video_codec
+u_reduce_video_profile(enum pipe_video_profile profile)
+{
+ switch (profile)
+ {
+ case PIPE_VIDEO_PROFILE_MPEG1:
+ case PIPE_VIDEO_PROFILE_MPEG2_SIMPLE:
+ case PIPE_VIDEO_PROFILE_MPEG2_MAIN:
+ return PIPE_VIDEO_CODEC_MPEG12;
+
+ case PIPE_VIDEO_PROFILE_MPEG4_SIMPLE:
+ case PIPE_VIDEO_PROFILE_MPEG4_ADVANCED_SIMPLE:
+ return PIPE_VIDEO_CODEC_MPEG4;
+
+ case PIPE_VIDEO_PROFILE_VC1_SIMPLE:
+ case PIPE_VIDEO_PROFILE_VC1_MAIN:
+ case PIPE_VIDEO_PROFILE_VC1_ADVANCED:
+ return PIPE_VIDEO_CODEC_VC1;
+
+ case PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE:
+ case PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN:
+ case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH:
+ return PIPE_VIDEO_CODEC_MPEG4_AVC;
+
+ default:
+ assert(0);
+ return PIPE_VIDEO_CODEC_UNKNOWN;
+ }
+}
+
+enum pipe_mpeg12_picture_type
+{
+ PIPE_MPEG12_PICTURE_TYPE_FIELD_TOP,
+ PIPE_MPEG12_PICTURE_TYPE_FIELD_BOTTOM,
+ PIPE_MPEG12_PICTURE_TYPE_FRAME
+};
+
+enum pipe_mpeg12_macroblock_type
+{
+ PIPE_MPEG12_MACROBLOCK_TYPE_INTRA,
+ PIPE_MPEG12_MACROBLOCK_TYPE_FWD,
+ PIPE_MPEG12_MACROBLOCK_TYPE_BKWD,
+ PIPE_MPEG12_MACROBLOCK_TYPE_BI,
+
+ PIPE_MPEG12_MACROBLOCK_NUM_TYPES
+};
+
+enum pipe_mpeg12_motion_type
+{
+ PIPE_MPEG12_MOTION_TYPE_FIELD,
+ PIPE_MPEG12_MOTION_TYPE_FRAME,
+ PIPE_MPEG12_MOTION_TYPE_DUALPRIME,
+ PIPE_MPEG12_MOTION_TYPE_16x8
+};
+
+enum pipe_mpeg12_dct_type
+{
+ PIPE_MPEG12_DCT_TYPE_FIELD,
+ PIPE_MPEG12_DCT_TYPE_FRAME
+};
+
+struct pipe_macroblock
+{
+ enum pipe_video_codec codec;
+};
+
+struct pipe_mpeg12_macroblock
+{
+ struct pipe_macroblock base;
+
+ unsigned mbx;
+ unsigned mby;
+ enum pipe_mpeg12_macroblock_type mb_type;
+ enum pipe_mpeg12_motion_type mo_type;
+ enum pipe_mpeg12_dct_type dct_type;
+ signed pmv[2][2][2];
+ unsigned cbp;
+ void *blocks;
+};
+
+#if 0
+struct pipe_picture_desc
+{
+ enum pipe_video_format format;
+};
+
+struct pipe_mpeg12_picture_desc
+{
+ struct pipe_picture_desc base;
+
+ /* TODO: Use bitfields where possible? */
+ struct pipe_surface *forward_reference;
+ struct pipe_surface *backward_reference;
+ unsigned picture_coding_type;
+ unsigned fcode;
+ unsigned intra_dc_precision;
+ unsigned picture_structure;
+ unsigned top_field_first;
+ unsigned frame_pred_frame_dct;
+ unsigned concealment_motion_vectors;
+ unsigned q_scale_type;
+ unsigned intra_vlc_format;
+ unsigned alternate_scan;
+ unsigned full_pel_forward_vector;
+ unsigned full_pel_backward_vector;
+ struct pipe_buffer *intra_quantizer_matrix;
+ struct pipe_buffer *non_intra_quantizer_matrix;
+ struct pipe_buffer *chroma_intra_quantizer_matrix;
+ struct pipe_buffer *chroma_non_intra_quantizer_matrix;
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* PIPE_VIDEO_STATE_H */