Merge branch 'mesa_7_6_branch'
[profile/ivi/mesa.git] / src / gallium / include / pipe / p_video_context.h
1 /**************************************************************************
2  * 
3  * Copyright 2009 Younes Manton.
4  * All Rights Reserved.
5  * 
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sub license, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  * 
14  * The above copyright notice and this permission notice (including the
15  * next paragraph) shall be included in all copies or substantial portions
16  * of the Software.
17  * 
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21  * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25  * 
26  **************************************************************************/
27
28 #ifndef PIPE_VIDEO_CONTEXT_H
29 #define PIPE_VIDEO_CONTEXT_H
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #include <pipe/p_video_state.h>
36
37 struct pipe_screen;
38 struct pipe_buffer;
39 struct pipe_surface;
40 struct pipe_video_surface;
41 struct pipe_macroblock;
42 struct pipe_picture_desc;
43 struct pipe_fence_handle;
44
45 /**
46  * Gallium video rendering context
47  */
48 struct pipe_video_context
49 {
50    struct pipe_screen *screen;
51    enum pipe_video_profile profile;
52    enum pipe_video_chroma_format chroma_format;
53    unsigned width;
54    unsigned height;
55
56    void *priv; /**< context private data (for DRI for example) */
57
58    void (*destroy)(struct pipe_video_context *vpipe);
59
60    /**
61     * Picture decoding and displaying
62     */
63    /*@{*/
64    void (*decode_bitstream)(struct pipe_video_context *vpipe,
65                             unsigned num_bufs,
66                             struct pipe_buffer **bitstream_buf);
67
68    void (*decode_macroblocks)(struct pipe_video_context *vpipe,
69                               struct pipe_video_surface *past,
70                               struct pipe_video_surface *future,
71                               unsigned num_macroblocks,
72                               struct pipe_macroblock *macroblocks,
73                               struct pipe_fence_handle **fence);
74
75    void (*clear_surface)(struct pipe_video_context *vpipe,
76                          unsigned x, unsigned y,
77                          unsigned width, unsigned height,
78                          unsigned value,
79                          struct pipe_surface *surface);
80
81    void (*render_picture)(struct pipe_video_context     *vpipe,
82                           /*struct pipe_surface         *backround,
83                           struct pipe_video_rect        *backround_area,*/
84                           struct pipe_video_surface     *src_surface,
85                           enum pipe_mpeg12_picture_type picture_type,
86                           /*unsigned                    num_past_surfaces,
87                           struct pipe_video_surface     *past_surfaces,
88                           unsigned                      num_future_surfaces,
89                           struct pipe_video_surface     *future_surfaces,*/
90                           struct pipe_video_rect        *src_area,
91                           struct pipe_surface           *dst_surface,
92                           struct pipe_video_rect        *dst_area,
93                           /*unsigned                      num_layers,
94                           struct pipe_texture           *layers,
95                           struct pipe_video_rect        *layer_src_areas,
96                           struct pipe_video_rect        *layer_dst_areas,*/
97                           struct pipe_fence_handle      **fence);
98    /*@}*/
99
100    /**
101     * Parameter-like states (or properties)
102     */
103    /*@{*/
104    void (*set_picture_desc)(struct pipe_video_context *vpipe,
105                             const struct pipe_picture_desc *desc);
106
107    void (*set_decode_target)(struct pipe_video_context *vpipe,
108                              struct pipe_video_surface *dt);
109
110    void (*set_csc_matrix)(struct pipe_video_context *vpipe, const float *mat);
111
112    /* TODO: Interface for scaling modes, post-processing, etc. */
113    /*@}*/
114 };
115
116
117 #ifdef __cplusplus
118 }
119 #endif
120
121 #endif /* PIPE_VIDEO_CONTEXT_H */