vl: Subpicture/compositing fixes.
[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 (*render_picture)(struct pipe_video_context *vpipe,
76 /*struct pipe_surface *backround,
77 struct pipe_video_rect *backround_area,*/
78 struct pipe_video_surface *src_surface,
79 enum pipe_mpeg12_picture_type picture_type,
80 /*unsigned num_past_surfaces,
81 struct pipe_video_surface *past_surfaces,
82 unsigned num_future_surfaces,
83 struct pipe_video_surface *future_surfaces,*/
84 struct pipe_video_rect *src_area,
85 struct pipe_surface *dst_surface,
86 struct pipe_video_rect *dst_area,
87 /*unsigned num_layers,
88 struct pipe_texture *layers,
89 struct pipe_video_rect *layer_src_areas,
90 struct pipe_video_rect *layer_dst_areas,*/
91 struct pipe_fence_handle **fence);
92
93 void (*surface_fill)(struct pipe_video_context *vpipe,
94 struct pipe_surface *dst,
95 unsigned dstx, unsigned dsty,
96 unsigned width, unsigned height,
97 unsigned value);
98
99 void (*surface_copy)(struct pipe_video_context *vpipe,
100 struct pipe_surface *dst,
101 unsigned dstx, unsigned dsty,
102 struct pipe_surface *src,
103 unsigned srcx, unsigned srcy,
104 unsigned width, unsigned height);
105
106 /*@}*/
107
108 /**
109 * Parameter-like states (or properties)
110 */
111 /*@{*/
112 void (*set_picture_background)(struct pipe_video_context *vpipe,
113 struct pipe_texture *bg,
114 struct pipe_video_rect *bg_src_rect);
115
116 void (*set_picture_layers)(struct pipe_video_context *vpipe,
117 struct pipe_texture *layers[],
118 struct pipe_video_rect *src_rects[],
119 struct pipe_video_rect *dst_rects[],
120 unsigned num_layers);
121
122 void (*set_picture_desc)(struct pipe_video_context *vpipe,
123 const struct pipe_picture_desc *desc);
124
125 void (*set_decode_target)(struct pipe_video_context *vpipe,
126 struct pipe_video_surface *dt);
127
128 void (*set_csc_matrix)(struct pipe_video_context *vpipe, const float *mat);
129
130 /* TODO: Interface for scaling modes, post-processing, etc. */
131 /*@}*/
132 };
133
134
135 #ifdef __cplusplus
136 }
137 #endif
138
139 #endif /* PIPE_VIDEO_CONTEXT_H */