summaryrefslogtreecommitdiff
path: root/src/gallium/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/include')
-rw-r--r--src/gallium/include/pipe/p_context.h64
-rw-r--r--src/gallium/include/pipe/p_defines.h225
-rw-r--r--src/gallium/include/pipe/p_format.h18
-rw-r--r--src/gallium/include/pipe/p_screen.h113
-rw-r--r--src/gallium/include/pipe/p_state.h86
-rw-r--r--src/gallium/include/pipe/p_video_context.h121
-rw-r--r--src/gallium/include/pipe/p_video_state.h185
-rw-r--r--src/gallium/include/state_tracker/dri1_api.h2
-rw-r--r--src/gallium/include/state_tracker/drm_api.h2
-rw-r--r--src/gallium/include/state_tracker/st_api.h10
-rw-r--r--src/gallium/include/state_tracker/sw_winsys.h8
11 files changed, 224 insertions, 610 deletions
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index 6aba6ef1ee..1aa0cbe4dc 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -65,7 +65,7 @@ struct pipe_context {
unsigned mode, unsigned start, unsigned count);
void (*draw_elements)( struct pipe_context *pipe,
- struct pipe_buffer *indexBuffer,
+ struct pipe_resource *indexBuffer,
unsigned indexSize,
unsigned mode, unsigned start, unsigned count);
@@ -77,7 +77,7 @@ struct pipe_context {
unsigned instanceCount);
void (*draw_elements_instanced)(struct pipe_context *pipe,
- struct pipe_buffer *indexBuffer,
+ struct pipe_resource *indexBuffer,
unsigned indexSize,
unsigned mode,
unsigned start,
@@ -91,7 +91,7 @@ struct pipe_context {
* module.
*/
void (*draw_range_elements)( struct pipe_context *pipe,
- struct pipe_buffer *indexBuffer,
+ struct pipe_resource *indexBuffer,
unsigned indexSize,
unsigned minIndex,
unsigned maxIndex,
@@ -200,7 +200,7 @@ struct pipe_context {
void (*set_constant_buffer)( struct pipe_context *,
uint shader, uint index,
- struct pipe_buffer *buf );
+ struct pipe_resource *buf );
void (*set_framebuffer_state)( struct pipe_context *,
const struct pipe_framebuffer_state * );
@@ -291,27 +291,15 @@ struct pipe_context {
* \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);
-
- /**
- * Check whether a buffer is referenced by an unflushed hw command.
- * 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 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_resource_referenced)(struct pipe_context *pipe,
+ struct pipe_resource *texture,
+ unsigned face, unsigned level);
/**
* Create a view on a texture to be used by a shader stage.
*/
struct pipe_sampler_view * (*create_sampler_view)(struct pipe_context *ctx,
- struct pipe_texture *texture,
+ struct pipe_resource *texture,
const struct pipe_sampler_view *templat);
void (*sampler_view_destroy)(struct pipe_context *ctx,
@@ -324,24 +312,42 @@ struct pipe_context {
* Transfers are (by default) context-private and allow uploads to be
* interleaved with
*/
- struct pipe_transfer *(*get_tex_transfer)(struct pipe_context *,
- struct pipe_texture *texture,
- unsigned face, unsigned level,
- unsigned zslice,
- enum pipe_transfer_usage usage,
- unsigned x, unsigned y,
- unsigned w, unsigned h);
-
- void (*tex_transfer_destroy)(struct pipe_context *,
+ struct pipe_transfer *(*get_transfer)(struct pipe_context *,
+ struct pipe_resource *resource,
+ struct pipe_subresource,
+ unsigned usage, /* a combination of PIPE_TRANSFER_x */
+ const struct pipe_box *);
+
+ void (*transfer_destroy)(struct pipe_context *,
struct pipe_transfer *);
void *(*transfer_map)( struct pipe_context *,
struct pipe_transfer *transfer );
+ /* If transfer was created with WRITE|FLUSH_EXPLICIT, only the
+ * regions specified with this call are guaranteed to be written to
+ * the resource.
+ */
+ void (*transfer_flush_region)( struct pipe_context *,
+ struct pipe_transfer *transfer,
+ const struct pipe_box *);
+
void (*transfer_unmap)( struct pipe_context *,
struct pipe_transfer *transfer );
+ /* One-shot transfer operation with data supplied in a user
+ * pointer. XXX: strides??
+ */
+ void (*transfer_inline_write)( struct pipe_context *,
+ struct pipe_resource *,
+ struct pipe_subresource,
+ unsigned usage, /* a combination of PIPE_TRANSFER_x */
+ const struct pipe_box *,
+ const void *data,
+ unsigned stride,
+ unsigned slice_stride);
+
};
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index c1e291b9da..0a4bd584ae 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -137,10 +137,11 @@ enum pipe_error {
/** Texture types */
enum pipe_texture_target {
- PIPE_TEXTURE_1D = 0,
- PIPE_TEXTURE_2D = 1,
- PIPE_TEXTURE_3D = 2,
- PIPE_TEXTURE_CUBE = 3,
+ PIPE_BUFFER = 0,
+ PIPE_TEXTURE_1D = 1,
+ PIPE_TEXTURE_2D = 2,
+ PIPE_TEXTURE_3D = 3,
+ PIPE_TEXTURE_CUBE = 4,
PIPE_MAX_TEXTURE_TYPES
};
@@ -175,22 +176,10 @@ enum pipe_texture_target {
#define PIPE_TEX_COMPARE_NONE 0
#define PIPE_TEX_COMPARE_R_TO_TEXTURE 1
-#define PIPE_TEXTURE_USAGE_RENDER_TARGET 0x1
-#define PIPE_TEXTURE_USAGE_DISPLAY_TARGET 0x2 /* windows presentable buffer, ie a backbuffer */
-#define PIPE_TEXTURE_USAGE_SCANOUT 0x4 /* ie a frontbuffer */
-#define PIPE_TEXTURE_USAGE_DEPTH_STENCIL 0x8
-#define PIPE_TEXTURE_USAGE_SAMPLER 0x10
-#define PIPE_TEXTURE_USAGE_DYNAMIC 0x20
-#define PIPE_TEXTURE_USAGE_SHARED 0x40
-/** Pipe driver custom usage flags should be greater or equal to this value */
-#define PIPE_TEXTURE_USAGE_CUSTOM (1 << 16)
-
-#define PIPE_TEXTURE_GEOM_NON_SQUARE 0x1
-#define PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO 0x2
-
/**
- * Surface layout
+ * Surface layout -- a hint? Or some driver-internal poking out into
+ * the interface?
*/
#define PIPE_SURFACE_LAYOUT_LINEAR 0
@@ -208,10 +197,23 @@ enum pipe_texture_target {
* Transfer object usage flags
*/
enum pipe_transfer_usage {
+ /**
+ * Resource contents read back (or accessed directly) at transfer
+ * create time.
+ */
PIPE_TRANSFER_READ = (1 << 0),
+
+ /**
+ * Resource contents will be written back at transfer_destroy
+ * time (or modified as a result of being accessed directly).
+ */
PIPE_TRANSFER_WRITE = (1 << 1),
- /** 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
@@ -221,89 +223,116 @@ enum pipe_transfer_usage {
* 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)
-};
+ PIPE_TRANSFER_MAP_DIRECTLY = (1 << 2),
+
+ /**
+ * Discards the memory within the mapped region.
+ *
+ * It should not be used with PIPE_TRANSFER_CPU_READ.
+ *
+ * See also:
+ * - OpenGL's ARB_map_buffer_range extension, MAP_INVALIDATE_RANGE_BIT flag.
+ * - Direct3D's D3DLOCK_DISCARD flag.
+ */
+ PIPE_TRANSFER_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.
+ */
+ PIPE_TRANSFER_DONTBLOCK = (1 << 9),
-/*
- * Buffer usage flags
- */
+ /**
+ * Do not attempt to synchronize pending operations on the resource when mapping.
+ *
+ * It should not be used with PIPE_TRANSFER_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.
+ */
+ PIPE_TRANSFER_UNSYNCHRONIZED = (1 << 10),
+ PIPE_TRANSFER_NOOVERWRITE = (1 << 10), /* are these really the same?? */
+
+ /**
+ * Written ranges will be notified later with
+ * pipe_context::transfer_flush_region.
+ *
+ * It should not be used with PIPE_TRANSFER_CPU_READ.
+ *
+ * See also:
+ * - pipe_context::transfer_flush_region
+ * - OpenGL's ARB_map_buffer_range extension, MAP_FLUSH_EXPLICIT_BIT flag.
+ */
+ PIPE_TRANSFER_FLUSH_EXPLICIT = (1 << 11),
+
+};
-#define PIPE_BUFFER_USAGE_CPU_READ (1 << 0)
-#define PIPE_BUFFER_USAGE_CPU_WRITE (1 << 1)
-#define PIPE_BUFFER_USAGE_GPU_READ (1 << 2)
-#define PIPE_BUFFER_USAGE_GPU_WRITE (1 << 3)
-#define PIPE_BUFFER_USAGE_PIXEL (1 << 4)
-#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.
+ * Resource binding flags -- state tracker must specify in advance all
+ * the ways a resource might be used.
*/
-
-/**
- * Discards the memory within the mapped region.
+#define PIPE_BIND_DEPTH_STENCIL (1 << 0) /* get_tex_surface */
+#define PIPE_BIND_RENDER_TARGET (1 << 1) /* get_tex_surface */
+#define PIPE_BIND_SAMPLER_VIEW (1 << 2) /* get_sampler_view */
+#define PIPE_BIND_VERTEX_BUFFER (1 << 3) /* set_vertex_buffers */
+#define PIPE_BIND_INDEX_BUFFER (1 << 4) /* draw_elements */
+#define PIPE_BIND_CONSTANT_BUFFER (1 << 5) /* set_constant_buffer */
+#define PIPE_BIND_BLIT_SOURCE (1 << 6) /* surface_copy */
+#define PIPE_BIND_BLIT_DESTINATION (1 << 7) /* surface_copy, fill */
+#define PIPE_BIND_DISPLAY_TARGET (1 << 8) /* flush_front_buffer */
+#define PIPE_BIND_TRANSFER_WRITE (1 << 9) /* get_transfer */
+#define PIPE_BIND_TRANSFER_READ (1 << 10) /* get_transfer */
+#define PIPE_BIND_CUSTOM (1 << 16) /* state-tracker/winsys usages */
+
+/* The first two flags were previously part of the amorphous
+ * TEXTURE_USAGE, most of which are now descriptions of the ways a
+ * particular texture can be bound to the gallium pipeline. These two
+ * do not fit within that and probably need to be migrated to some
+ * other place.
*
- * It should not be used with PIPE_BUFFER_USAGE_CPU_READ.
+ * It seems like scanout is used by the Xorg state tracker to ask for
+ * a texture suitable for actual scanout (hence the name), which
+ * implies extra layout constraints on some hardware. It may also
+ * have some special meaning regarding mouse cursor images.
*
- * See also:
- * - OpenGL's ARB_map_buffer_range extension, MAP_INVALIDATE_RANGE_BIT flag.
- * - Direct3D's D3DLOCK_DISCARD flag.
+ * The shared flag is quite underspecified, but certainly isn't a
+ * binding flag - it seems more like a message to the winsys to create
+ * a shareable allocation. Could it mean that this texture is a valid argument for
*/
-#define PIPE_BUFFER_USAGE_DISCARD (1 << 8)
+#define PIPE_BIND_SCANOUT (1 << 14) /* */
+#define PIPE_BIND_SHARED (1 << 15) /* get_texture_handle ??? */
-/**
- * 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)
-/**
- * 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.
+/* Flags for the driver about resource behaviour:
*/
-#define PIPE_BUFFER_USAGE_UNSYNCHRONIZED (1 << 10)
+#define PIPE_RESOURCE_FLAG_GEN_MIPS (1 << 0) /* Driver performs autogen mips */
+#define PIPE_RESOURCE_FLAG_DRV_PRIV (1 << 16) /* driver/winsys private */
+#define PIPE_RESOURCE_FLAG_ST_PRIV (1 << 24) /* state-tracker/winsys private */
-/**
- * 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.
+/* Hint about the expected lifecycle of a resource.
*/
-#define PIPE_BUFFER_USAGE_FLUSH_EXPLICIT (1 << 11)
+#define PIPE_USAGE_DEFAULT 0 /* many uploads, draws intermixed */
+#define PIPE_USAGE_DYNAMIC 1 /* many uploads, draws intermixed */
+#define PIPE_USAGE_STATIC 2 /* same as immutable?? */
+#define PIPE_USAGE_IMMUTABLE 3 /* no change after first upload */
+#define PIPE_USAGE_STREAM 4 /* upload, draw, upload, draw */
-/** Pipe driver custom usage flags should be greater or equal to this value */
-#define PIPE_BUFFER_USAGE_CUSTOM (1 << 16)
-/* Convenient shortcuts */
-#define PIPE_BUFFER_USAGE_CPU_READ_WRITE \
- ( PIPE_BUFFER_USAGE_CPU_READ | PIPE_BUFFER_USAGE_CPU_WRITE )
-#define PIPE_BUFFER_USAGE_GPU_READ_WRITE \
- ( PIPE_BUFFER_USAGE_GPU_READ | PIPE_BUFFER_USAGE_GPU_WRITE )
-#define PIPE_BUFFER_USAGE_WRITE \
- ( PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_GPU_WRITE )
+/* These are intended to be used in calls to is_format_supported, but
+ * no driver actually uses these flags, and only the glx/xlib state
+ * tracker issues them.
+ *
+ * Deprecate?
+ */
+#define PIPE_TEXTURE_GEOM_NON_SQUARE 0x1
+#define PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO 0x2
/**
@@ -435,30 +464,6 @@ enum pipe_transfer_usage {
#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_format.h b/src/gallium/include/pipe/p_format.h
index d588928982..436c3f627a 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -192,24 +192,6 @@ enum pipe_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_screen.h b/src/gallium/include/pipe/p_screen.h
index b7cb83abbe..dd7c35e12c 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -54,10 +54,9 @@ struct winsys_handle;
/** Opaque type */
struct pipe_fence_handle;
struct pipe_winsys;
-struct pipe_buffer;
struct pipe_texture;
+struct pipe_resource;
struct pipe_surface;
-struct pipe_video_surface;
struct pipe_transfer;
@@ -94,7 +93,7 @@ struct pipe_screen {
/**
* Check if the given pipe_format is supported as a texture or
* drawing surface.
- * \param tex_usage bitmask of PIPE_TEXTURE_USAGE_*
+ * \param tex_usage bitmask of PIPE_BIND_*
* \param geom_flags bitmask of PIPE_TEXTURE_GEOM_*
*/
boolean (*is_format_supported)( struct pipe_screen *,
@@ -106,35 +105,36 @@ struct pipe_screen {
/**
* Create a new texture object, using the given template info.
*/
- struct pipe_texture * (*texture_create)(struct pipe_screen *,
- const struct pipe_texture *templat);
+ struct pipe_resource * (*resource_create)(struct pipe_screen *,
+ const struct pipe_resource *templat);
/**
* Create a texture from a winsys_handle. The handle is often created in
* another process by first creating a pipe texture and then calling
* texture_get_handle.
*/
- struct pipe_texture * (*texture_from_handle)(struct pipe_screen *,
- const struct pipe_texture *templat,
- struct winsys_handle *handle);
+ struct pipe_resource * (*resource_from_handle)(struct pipe_screen *,
+ const struct pipe_resource *templat,
+ struct winsys_handle *handle);
/**
* Get a winsys_handle from a texture. Some platforms/winsys requires
* that the texture is created with a special usage flag like
* DISPLAYTARGET or PRIMARY.
*/
- boolean (*texture_get_handle)(struct pipe_screen *,
- struct pipe_texture *tex,
- struct winsys_handle *handle);
+ boolean (*resource_get_handle)(struct pipe_screen *,
+ struct pipe_resource *tex,
+ struct winsys_handle *handle);
- void (*texture_destroy)(struct pipe_texture *pt);
+ void (*resource_destroy)(struct pipe_screen *,
+ struct pipe_resource *pt);
/** Get a 2D surface which is a "view" into a texture
- * \param usage bitmaks of PIPE_BUFFER_USAGE_* read/write flags
+ * \param usage bitmaks of PIPE_BIND_* flags
*/
struct pipe_surface *(*get_tex_surface)(struct pipe_screen *,
- struct pipe_texture *texture,
+ struct pipe_resource *resource,
unsigned face, unsigned level,
unsigned zslice,
unsigned usage );
@@ -144,17 +144,6 @@ struct pipe_screen {
/**
- * Create a new buffer.
- * \param alignment buffer start address alignment in bytes
- * \param usage bitmask of PIPE_BUFFER_USAGE_x
- * \param size size in bytes
- */
- struct pipe_buffer *(*buffer_create)( struct pipe_screen *screen,
- unsigned alignment,
- unsigned usage,
- unsigned size );
-
- /**
* Create a buffer that wraps user-space data.
*
* Effectively this schedules a delayed call to buffer_create
@@ -175,76 +164,10 @@ struct pipe_screen {
* 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_screen *screen,
- void *ptr,
- unsigned bytes);
-
-
-
- /**
- * 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_screen *screen,
- struct pipe_buffer *buf,
- unsigned usage );
- /**
- * Map a subrange of the buffer data store into the client's address space.
- *
- * The returned pointer is always relative to buffer start, regardless of
- * the specified range. This is different from the ARB_map_buffer_range
- * semantics because we don't forbid multiple mappings of the same buffer
- * (yet).
- */
- void *(*buffer_map_range)( struct pipe_screen *screen,
- struct pipe_buffer *buf,
- unsigned offset,
- unsigned length,
- unsigned usage);
-
- /**
- * Notify a range that was actually written into.
- *
- * Can only be used if the buffer was mapped with the
- * PIPE_BUFFER_USAGE_CPU_WRITE and PIPE_BUFFER_USAGE_FLUSH_EXPLICIT flags
- * set.
- *
- * The range is relative to the buffer start, regardless of the range
- * specified to buffer_map_range. This is different from the
- * ARB_map_buffer_range semantics because we don't forbid multiple mappings
- * of the same buffer (yet).
- *
- */
- void (*buffer_flush_mapped_range)( struct pipe_screen *screen,
- struct pipe_buffer *buf,
- unsigned offset,
- unsigned length);
-
- /**
- * Unmap buffer.
- *
- * If the buffer was mapped with PIPE_BUFFER_USAGE_CPU_WRITE flag but not
- * PIPE_BUFFER_USAGE_FLUSH_EXPLICIT then the pipe driver will
- * assume that the whole buffer was written. This is mostly for backward
- * compatibility purposes and may affect performance -- the state tracker
- * should always specify exactly what got written while the buffer was
- * mapped.
- */
- void (*buffer_unmap)( struct pipe_screen *screen,
- struct pipe_buffer *buf );
-
- 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 );
+ struct pipe_resource *(*user_buffer_create)(struct pipe_screen *screen,
+ void *ptr,
+ unsigned bytes,
+ unsigned bind_flags);
/**
* Do any special operations to ensure buffer size is correct
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 11072407d9..d281d69ff2 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -71,19 +71,6 @@ struct pipe_reference
};
-/**
- * The driver will certainly subclass this to include actual memory
- * management information.
- */
-struct pipe_buffer
-{
- struct pipe_reference reference;
- unsigned size;
- struct pipe_screen *screen;
- unsigned alignment;
- unsigned usage;
-};
-
/**
* Primitive (point/line/tri) rasterization info
@@ -285,20 +272,25 @@ struct pipe_sampler_state
struct pipe_surface
{
struct pipe_reference reference;
+ struct pipe_resource *texture; /**< resource into which this is a view */
enum pipe_format format;
+
unsigned width; /**< logical width in pixels */
unsigned height; /**< logical height in pixels */
+
unsigned layout; /**< PIPE_SURFACE_LAYOUT_x */
unsigned offset; /**< offset from start of buffer, in bytes */
- unsigned usage; /**< bitmask of PIPE_BUFFER_USAGE_x */
+ unsigned usage; /**< bitmask of PIPE_BIND_x */
unsigned zslice;
- struct pipe_texture *texture; /**< texture into which this is a view */
unsigned face;
unsigned level;
};
+
+
+
/**
* A view into a texture that can be bound to a shader stage.
*/
@@ -306,7 +298,7 @@ struct pipe_sampler_view
{
struct pipe_reference reference;
enum pipe_format format; /**< typed PIPE_FORMAT_x */
- struct pipe_texture *texture; /**< texture into which this is a view */
+ struct pipe_resource *texture; /**< texture into which this is a view */
struct pipe_context *context; /**< context this view belongs to */
unsigned first_level:8; /**< first mipmap level */
unsigned last_level:8; /**< last mipmap level */
@@ -317,32 +309,22 @@ struct pipe_sampler_view
};
-/**
- * Transfer object. For data transfer to/from a texture.
- */
-struct pipe_transfer
+struct pipe_box
{
- 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 */
- unsigned stride; /**< stride in bytes between rows of blocks */
- enum pipe_transfer_usage usage; /**< PIPE_TRANSFER_* */
-
- struct pipe_texture *texture; /**< texture to transfer to/from */
- unsigned face;
- unsigned level;
- unsigned zslice;
+ unsigned x;
+ unsigned y;
+ unsigned z;
+ unsigned width;
+ unsigned height;
+ unsigned depth;
};
-/**
- * Texture object.
- */
-struct pipe_texture
-{
- struct pipe_reference reference;
+struct pipe_resource
+{
+ struct pipe_reference reference;
+ struct pipe_screen *screen; /**< screen that this texture belongs to */
enum pipe_texture_target target; /**< PIPE_TEXTURE_x */
enum pipe_format format; /**< PIPE_FORMAT_x */
@@ -351,15 +333,37 @@ struct pipe_texture
unsigned depth0;
unsigned last_level:8; /**< Index of last mipmap level present/defined */
-
unsigned nr_samples:8; /**< for multisampled surfaces, nr of samples */
+ unsigned _usage:8; /* PIPE_USAGE_x (not a bitmask) */
- unsigned tex_usage; /**< bitmask of PIPE_TEXTURE_USAGE_* */
+ unsigned bind; /* PIPE_BIND_x */
+ unsigned flags; /* PIPE_RESOURCE_FLAG_x */
+};
- struct pipe_screen *screen; /**< screen that this texture belongs to */
+
+struct pipe_subresource
+{
+ unsigned face:16;
+ unsigned level:16;
+};
+
+
+/**
+ * Transfer object. For data transfer to/from a texture.
+ */
+struct pipe_transfer
+{
+ struct pipe_resource *resource; /**< resource to transfer to/from */
+ struct pipe_subresource sr;
+ enum pipe_transfer_usage usage;
+ struct pipe_box box;
+ unsigned stride;
+ unsigned slice_stride;
+ void *data;
};
+
/**
* A vertex buffer. Typically, all the vertex data/attributes for
* drawing something will be in one buffer. But it's also possible, for
@@ -370,7 +374,7 @@ struct pipe_vertex_buffer
unsigned stride; /**< stride to same attrib in next vertex, in bytes */
unsigned max_index; /**< number of vertices in this buffer */
unsigned buffer_offset; /**< offset to start of data in buffer, in bytes */
- struct pipe_buffer *buffer; /**< the actual buffer */
+ struct pipe_resource *buffer; /**< the actual buffer */
};
diff --git a/src/gallium/include/pipe/p_video_context.h b/src/gallium/include/pipe/p_video_context.h
deleted file mode 100644
index 6ae31418fa..0000000000
--- a/src/gallium/include/pipe/p_video_context.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/**************************************************************************
- *
- * 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
deleted file mode 100644
index 77e22d0a56..0000000000
--- a/src/gallium/include/pipe/p_video_state.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/**************************************************************************
- *
- * 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 <pipe/p_defines.h>
-#include <pipe/p_format.h>
-#include <pipe/p_state.h>
-#include <pipe/p_screen.h>
-#include <util/u_inlines.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 */
diff --git a/src/gallium/include/state_tracker/dri1_api.h b/src/gallium/include/state_tracker/dri1_api.h
index bb1cd6d1d8..a48c5de5a0 100644
--- a/src/gallium/include/state_tracker/dri1_api.h
+++ b/src/gallium/include/state_tracker/dri1_api.h
@@ -11,7 +11,7 @@ struct pipe_screen;
struct pipe_winsys;
struct pipe_buffer;
struct pipe_context;
-struct pipe_texture;
+struct pipe_resource;
struct drm_clip_rect;
diff --git a/src/gallium/include/state_tracker/drm_api.h b/src/gallium/include/state_tracker/drm_api.h
index 9780cf250b..50c8c1cf19 100644
--- a/src/gallium/include/state_tracker/drm_api.h
+++ b/src/gallium/include/state_tracker/drm_api.h
@@ -8,7 +8,7 @@ struct pipe_screen;
struct pipe_winsys;
struct pipe_buffer;
struct pipe_context;
-struct pipe_texture;
+struct pipe_resource;
enum drm_create_screen_mode {
DRM_CREATE_NORMAL = 0,
diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h
index 70ad215bfc..8897ff7c25 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -119,7 +119,7 @@ enum st_context_resource_type {
typedef void (*st_proc_t)(void);
struct pipe_context;
-struct pipe_texture;
+struct pipe_resource;
struct pipe_fence_handle;
/**
@@ -132,7 +132,7 @@ struct st_context_resource
void *resource;
/* this is owned by the caller */
- struct pipe_texture *texture;
+ struct pipe_resource *texture;
};
/**
@@ -145,7 +145,7 @@ struct st_egl_image
void *egl_image;
/* this is owned by the caller */
- struct pipe_texture *texture;
+ struct pipe_resource *texture;
unsigned face;
unsigned level;
@@ -239,7 +239,7 @@ struct st_framebuffer_iface
boolean (*validate)(struct st_framebuffer_iface *stfbi,
const enum st_attachment_type *statts,
unsigned count,
- struct pipe_texture **out);
+ struct pipe_resource **out);
};
/**
@@ -292,7 +292,7 @@ struct st_context_iface
*/
boolean (*teximage)(struct st_context_iface *stctxi, enum st_texture_type target,
int level, enum pipe_format internal_format,
- struct pipe_texture *tex, boolean mipmap);
+ struct pipe_resource *tex, boolean mipmap);
/**
* Used to implement glXCopyContext.
diff --git a/src/gallium/include/state_tracker/sw_winsys.h b/src/gallium/include/state_tracker/sw_winsys.h
index a87650dc77..d461dedb90 100644
--- a/src/gallium/include/state_tracker/sw_winsys.h
+++ b/src/gallium/include/state_tracker/sw_winsys.h
@@ -47,7 +47,7 @@ extern "C" {
struct winsys_handle;
struct pipe_screen;
struct pipe_context;
-struct pipe_texture;
+struct pipe_resource;
/**
@@ -81,7 +81,7 @@ struct sw_winsys
* pools, or obtained directly from the windowing system.
*
* This callback is invoked by the pipe_screen when creating a texture marked
- * with the PIPE_TEXTURE_USAGE_DISPLAY_TARGET flag to get the underlying
+ * with the PIPE_BIND_DISPLAY_TARGET flag to get the underlying
* storage.
*/
struct sw_displaytarget *
@@ -97,7 +97,7 @@ struct sw_winsys
*/
struct sw_displaytarget *
(*displaytarget_from_handle)( struct sw_winsys *ws,
- const struct pipe_texture *templat,
+ const struct pipe_resource *template,
struct winsys_handle *whandle,
unsigned *stride );
@@ -110,7 +110,7 @@ struct sw_winsys
struct winsys_handle *whandle );
/**
- * \param flags bitmask of PIPE_BUFFER_USAGE_x flags
+ * \param flags bitmask of PIPE_TRANSFER_x flags
*/
void *
(*displaytarget_map)( struct sw_winsys *ws,