diff options
author | Christian König <[email protected]> | 2011-04-06 00:06:20 +0200 |
---|---|---|
committer | Christian König <[email protected]> | 2011-04-06 00:06:20 +0200 |
commit | d9ad3aa3b9647f1ede2568600978af956ff32fff (patch) | |
tree | 91eb6e083acdaa6f368a607ad558df27d6d2ede1 /src/gallium/include | |
parent | 3a2b906805985e0a4258bcbaed4cdff758875514 (diff) |
[g3dvl] and finally split the decoder part out of the context
This should give a good basis to implement vdpau ontop of it.
Diffstat (limited to 'src/gallium/include')
-rw-r--r-- | src/gallium/include/pipe/p_screen.h | 18 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_video_context.h | 150 |
2 files changed, 115 insertions, 53 deletions
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index 0d1b1094550..4f95fa1b2e1 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -1,8 +1,8 @@ /************************************************************************** - * + * * 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 @@ -10,11 +10,11 @@ * 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. @@ -22,12 +22,12 @@ * 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 - * + * * Screen, Adapter or GPU * * These are driver functions/facilities that are context independent. @@ -94,11 +94,7 @@ struct pipe_screen { struct pipe_context * (*context_create)( struct pipe_screen *, void *priv ); - struct pipe_video_context * (*video_context_create)( struct pipe_screen *screen, - enum pipe_video_profile profile, - enum pipe_video_chroma_format chroma_format, - unsigned width, unsigned height, void *priv ); - + struct pipe_video_context * (*video_context_create)( struct pipe_screen *screen, void *priv ); /** * Check if the given pipe_format is supported as a texture or diff --git a/src/gallium/include/pipe/p_video_context.h b/src/gallium/include/pipe/p_video_context.h index dec524d5290..33c64baf7c4 100644 --- a/src/gallium/include/pipe/p_video_context.h +++ b/src/gallium/include/pipe/p_video_context.h @@ -35,12 +35,10 @@ extern "C" { #include <pipe/p_video_state.h> struct pipe_screen; -struct pipe_buffer; struct pipe_surface; struct pipe_macroblock; struct pipe_picture_desc; struct pipe_fence_handle; -struct pipe_video_buffer; /** * Gallium video rendering context @@ -48,36 +46,33 @@ struct pipe_video_buffer; 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) */ /** + * destroy context, all objects created from this context + * (buffers, decoders, compositors etc...) must be freed before calling this + */ + void (*destroy)(struct pipe_video_context *context); + + /** * Query an integer-valued capability/parameter/limit * \param param one of PIPE_CAP_x */ - int (*get_param)(struct pipe_video_context *vpipe, int param); + int (*get_param)(struct pipe_video_context *context, int param); /** * Check if the given pipe_format is supported as a texture or * drawing surface. */ - boolean (*is_format_supported)(struct pipe_video_context *vpipe, + boolean (*is_format_supported)(struct pipe_video_context *context, enum pipe_format format, unsigned usage); /** - * destroy context, all buffers must be freed before calling this - */ - void (*destroy)(struct pipe_video_context *vpipe); - - /** * create a surface of a texture */ - struct pipe_surface *(*create_surface)(struct pipe_video_context *vpipe, + struct pipe_surface *(*create_surface)(struct pipe_video_context *context, struct pipe_resource *resource, const struct pipe_surface *templ); @@ -89,14 +84,14 @@ struct pipe_video_context /** * create a sampler view of a texture, for subpictures for example */ - struct pipe_sampler_view *(*create_sampler_view)(struct pipe_video_context *vpipe, + struct pipe_sampler_view *(*create_sampler_view)(struct pipe_video_context *context, struct pipe_resource *resource, const struct pipe_sampler_view *templ); /** * upload image data to a sampler */ - void (*upload_sampler)(struct pipe_video_context *vpipe, + void (*upload_sampler)(struct pipe_video_context *context, struct pipe_sampler_view *dst, const struct pipe_box *dst_box, const void *src, unsigned src_stride, @@ -105,74 +100,145 @@ struct pipe_video_context /** * clear a sampler with a specific rgba color */ - void (*clear_sampler)(struct pipe_video_context *vpipe, + void (*clear_sampler)(struct pipe_video_context *context, struct pipe_sampler_view *dst, const struct pipe_box *dst_box, const float *rgba); + /*}@*/ + + /** + * create a decoder for a specific video profile + */ + struct pipe_video_decoder *(*create_decoder)(struct pipe_video_context *context, + enum pipe_video_profile profile, + enum pipe_video_chroma_format chroma_format, + unsigned width, unsigned height); + /** * Creates a buffer as decoding target */ - struct pipe_video_buffer *(*create_buffer)(struct pipe_video_context *vpipe); + struct pipe_video_buffer *(*create_buffer)(struct pipe_video_context *context, + enum pipe_format buffer_format, + enum pipe_video_chroma_format chroma_format, + unsigned width, unsigned height); /** * Creates a video compositor */ - struct pipe_video_compositor *(*create_compositor)(struct pipe_video_context *vpipe); + struct pipe_video_compositor *(*create_compositor)(struct pipe_video_context *context); +}; + +/** + * decoder for a specific video codec + */ +struct pipe_video_decoder +{ + struct pipe_video_context *context; + + enum pipe_video_profile profile; + enum pipe_video_chroma_format chroma_format; + unsigned width; + unsigned height; /** - * Picture decoding and displaying + * destroy this video decoder */ + void (*destroy)(struct pipe_video_decoder *decoder); -#if 0 - void (*decode_bitstream)(struct pipe_video_context *vpipe, - unsigned num_bufs, - struct pipe_buffer **bitstream_buf); -#endif + /** + * Creates a buffer as decoding input + */ + struct pipe_video_decode_buffer *(*create_buffer)(struct pipe_video_decoder *decoder); + + /** + * flush decoder buffer to video hardware + */ + void (*flush_buffer)(struct pipe_video_decode_buffer *decbuf, + struct pipe_video_buffer *ref_frames[2], + struct pipe_video_buffer *dst, + struct pipe_fence_handle **fence); + + /** + * clear decoder buffers todo list + */ + void (*clear_buffer)(struct pipe_video_decode_buffer *decbuf); }; -struct pipe_video_buffer +/** + * input buffer for a decoder + */ +struct pipe_video_decode_buffer { - struct pipe_video_context* context; + struct pipe_video_decoder *decoder; /** - * destroy this video buffer + * destroy this decode buffer */ - void (*destroy)(struct pipe_video_buffer *buffer); + void (*destroy)(struct pipe_video_decode_buffer *decbuf); /** - * map the buffer into memory before calling add_macroblocks + * map the input buffer into memory before starting decoding */ - void (*map)(struct pipe_video_buffer *buffer); + void (*map)(struct pipe_video_decode_buffer *decbuf); +#if 0 /** - * add macroblocks to buffer for decoding + * decode a bitstream */ - void (*add_macroblocks)(struct pipe_video_buffer *buffer, + void (*decode_bitstream)(struct pipe_video_decode_buffer *decbuf, + unsigned num_bufs, + struct pipe_buffer **bitstream_buf); +#endif + + /** + * add macroblocks to decoder buffer + */ + void (*add_macroblocks)(struct pipe_video_decode_buffer *decbuf, unsigned num_macroblocks, struct pipe_macroblock *macroblocks); /** - * unmap buffer before flushing + * unmap decoder buffer before flushing */ - void (*unmap)(struct pipe_video_buffer *buffer); + void (*unmap)(struct pipe_video_decode_buffer *decbuf); +}; + +/** + * output for decoding / input for displaying + */ +struct pipe_video_buffer +{ + struct pipe_video_context *context; + + enum pipe_format buffer_format; + enum pipe_video_chroma_format chroma_format; + unsigned width; + unsigned height; /** - * flush buffer to video hardware + * destroy this video buffer */ - void (*flush)(struct pipe_video_buffer *buffer, - struct pipe_video_buffer *ref_frames[2], - struct pipe_fence_handle **fence); + void (*destroy)(struct pipe_video_buffer *buffer); + /** + * get a individual sampler view for each plane + */ + struct pipe_sampler_view **(*get_sampler_views)(struct pipe_video_buffer *buffer); - void (*get_sampler_views)(struct pipe_video_buffer *buffer, - struct pipe_sampler_view *sampler_views[3]); + /** + * get a individual surfaces for each plane + */ + struct pipe_surface **(*get_surfaces)(struct pipe_video_buffer *buffer); }; +/** + * composing and displaying of image data + */ struct pipe_video_compositor { - struct pipe_video_context* context; + struct pipe_video_context *context; /** * destroy this compositor |