vdpau: add vdpau-r600 target
[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 /* XXX: Move to an appropriate place */
38 #define PIPE_CAP_DECODE_TARGET_PREFERRED_FORMAT 256
39
40 struct pipe_screen;
41 struct pipe_buffer;
42 struct pipe_surface;
43 struct pipe_macroblock;
44 struct pipe_picture_desc;
45 struct pipe_fence_handle;
46
47 /**
48 * Gallium video rendering context
49 */
50 struct pipe_video_context
51 {
52 struct pipe_screen *screen;
53 enum pipe_video_profile profile;
54 enum pipe_video_chroma_format chroma_format;
55 unsigned width;
56 unsigned height;
57
58 void *priv; /**< context private data (for DRI for example) */
59
60 /**
61 * Query an integer-valued capability/parameter/limit
62 * \param param one of PIPE_CAP_x
63 */
64 int (*get_param)(struct pipe_video_context *vpipe, int param);
65
66 /**
67 * Check if the given pipe_format is supported as a texture or
68 * drawing surface.
69 */
70 boolean (*is_format_supported)(struct pipe_video_context *vpipe,
71 enum pipe_format format,
72 unsigned usage,
73 unsigned geom);
74
75 void (*destroy)(struct pipe_video_context *vpipe);
76
77 struct pipe_surface *(*create_surface)(struct pipe_video_context *vpipe,
78 struct pipe_resource *resource,
79 const struct pipe_surface *templat);
80
81 /**
82 * Picture decoding and displaying
83 */
84 /*@{*/
85 void (*decode_bitstream)(struct pipe_video_context *vpipe,
86 unsigned num_bufs,
87 struct pipe_buffer **bitstream_buf);
88
89 void (*decode_macroblocks)(struct pipe_video_context *vpipe,
90 struct pipe_surface *past,
91 struct pipe_surface *future,
92 unsigned num_macroblocks,
93 struct pipe_macroblock *macroblocks,
94 struct pipe_fence_handle **fence);
95
96 void (*render_picture)(struct pipe_video_context *vpipe,
97 struct pipe_surface *src_surface,
98 enum pipe_mpeg12_picture_type picture_type,
99 /*unsigned num_past_surfaces,
100 struct pipe_surface *past_surfaces,
101 unsigned num_future_surfaces,
102 struct pipe_surface *future_surfaces,*/
103 struct pipe_video_rect *src_area,
104 struct pipe_surface *dst_surface,
105 struct pipe_video_rect *dst_area,
106 struct pipe_fence_handle **fence);
107
108 void (*clear_render_target)(struct pipe_video_context *vpipe,
109 struct pipe_surface *dst,
110 unsigned dstx, unsigned dsty,
111 const float *rgba,
112 unsigned width, unsigned height);
113
114 void (*resource_copy_region)(struct pipe_video_context *vpipe,
115 struct pipe_resource *dst,
116 unsigned dstx, unsigned dsty, unsigned dstz,
117 struct pipe_resource *src,
118 unsigned srcx, unsigned srcy, unsigned srcz,
119 unsigned width, unsigned height);
120
121 struct pipe_transfer *(*get_transfer)(struct pipe_video_context *vpipe,
122 struct pipe_resource *resource,
123 unsigned level,
124 unsigned usage, /* a combination of PIPE_TRANSFER_x */
125 const struct pipe_box *box);
126
127 void (*transfer_destroy)(struct pipe_video_context *vpipe,
128 struct pipe_transfer *transfer);
129
130 void* (*transfer_map)(struct pipe_video_context *vpipe,
131 struct pipe_transfer *transfer);
132
133 void (*transfer_flush_region)(struct pipe_video_context *vpipe,
134 struct pipe_transfer *transfer,
135 const struct pipe_box *box);
136
137 void (*transfer_unmap)(struct pipe_video_context *vpipe,
138 struct pipe_transfer *transfer);
139
140 void (*transfer_inline_write)(struct pipe_video_context *vpipe,
141 struct pipe_resource *resource,
142 unsigned level,
143 unsigned usage, /* a combination of PIPE_TRANSFER_x */
144 const struct pipe_box *box,
145 const void *data,
146 unsigned stride,
147 unsigned slice_stride);
148
149 /*@}*/
150
151 /**
152 * Parameter-like states (or properties)
153 */
154 /*@{*/
155 void (*set_picture_background)(struct pipe_video_context *vpipe,
156 struct pipe_surface *bg,
157 struct pipe_video_rect *bg_src_rect);
158
159 void (*set_picture_layers)(struct pipe_video_context *vpipe,
160 struct pipe_surface *layers[],
161 struct pipe_video_rect *src_rects[],
162 struct pipe_video_rect *dst_rects[],
163 unsigned num_layers);
164
165 void (*set_picture_desc)(struct pipe_video_context *vpipe,
166 const struct pipe_picture_desc *desc);
167
168 void (*set_decode_target)(struct pipe_video_context *vpipe,
169 struct pipe_surface *dt);
170
171 void (*set_csc_matrix)(struct pipe_video_context *vpipe, const float *mat);
172
173 /* TODO: Interface for scaling modes, post-processing, etc. */
174 /*@}*/
175 };
176
177
178 #ifdef __cplusplus
179 }
180 #endif
181
182 #endif /* PIPE_VIDEO_CONTEXT_H */