1 /**************************************************************************
3 * Copyright 2009 Younes Manton.
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:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
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.
26 **************************************************************************/
28 #ifndef PIPE_VIDEO_CONTEXT_H
29 #define PIPE_VIDEO_CONTEXT_H
35 #include <pipe/p_video_state.h>
37 /* XXX: Move to an appropriate place */
38 #define PIPE_CAP_DECODE_TARGET_PREFERRED_FORMAT 256
43 struct pipe_macroblock
;
44 struct pipe_picture_desc
;
45 struct pipe_fence_handle
;
48 * Gallium video rendering context
50 struct pipe_video_context
52 struct pipe_screen
*screen
;
53 enum pipe_video_profile profile
;
54 enum pipe_video_chroma_format chroma_format
;
58 void *priv
; /**< context private data (for DRI for example) */
61 * Query an integer-valued capability/parameter/limit
62 * \param param one of PIPE_CAP_x
64 int (*get_param
)(struct pipe_video_context
*vpipe
, int param
);
67 * Check if the given pipe_format is supported as a texture or
70 boolean (*is_format_supported
)(struct pipe_video_context
*vpipe
,
71 enum pipe_format format
,
75 void (*destroy
)(struct pipe_video_context
*vpipe
);
78 * Picture decoding and displaying
81 void (*decode_bitstream
)(struct pipe_video_context
*vpipe
,
83 struct pipe_buffer
**bitstream_buf
);
85 void (*decode_macroblocks
)(struct pipe_video_context
*vpipe
,
86 struct pipe_surface
*past
,
87 struct pipe_surface
*future
,
88 unsigned num_macroblocks
,
89 struct pipe_macroblock
*macroblocks
,
90 struct pipe_fence_handle
**fence
);
92 void (*render_picture
)(struct pipe_video_context
*vpipe
,
93 struct pipe_surface
*src_surface
,
94 enum pipe_mpeg12_picture_type picture_type
,
95 /*unsigned num_past_surfaces,
96 struct pipe_surface *past_surfaces,
97 unsigned num_future_surfaces,
98 struct pipe_surface *future_surfaces,*/
99 struct pipe_video_rect
*src_area
,
100 struct pipe_surface
*dst_surface
,
101 struct pipe_video_rect
*dst_area
,
102 struct pipe_fence_handle
**fence
);
104 void (*clear_render_target
)(struct pipe_video_context
*vpipe
,
105 struct pipe_surface
*dst
,
106 unsigned dstx
, unsigned dsty
,
108 unsigned width
, unsigned height
);
110 void (*resource_copy_region
)(struct pipe_video_context
*vpipe
,
111 struct pipe_resource
*dst
,
112 struct pipe_subresource subdst
,
113 unsigned dstx
, unsigned dsty
, unsigned dstz
,
114 struct pipe_resource
*src
,
115 struct pipe_subresource subsrc
,
116 unsigned srcx
, unsigned srcy
, unsigned srcz
,
117 unsigned width
, unsigned height
);
119 struct pipe_transfer
*(*get_transfer
)(struct pipe_video_context
*vpipe
,
120 struct pipe_resource
*resource
,
121 struct pipe_subresource subresource
,
122 unsigned usage
, /* a combination of PIPE_TRANSFER_x */
123 const struct pipe_box
*box
);
125 void (*transfer_destroy
)(struct pipe_video_context
*vpipe
,
126 struct pipe_transfer
*transfer
);
128 void* (*transfer_map
)(struct pipe_video_context
*vpipe
,
129 struct pipe_transfer
*transfer
);
131 void (*transfer_flush_region
)(struct pipe_video_context
*vpipe
,
132 struct pipe_transfer
*transfer
,
133 const struct pipe_box
*box
);
135 void (*transfer_unmap
)(struct pipe_video_context
*vpipe
,
136 struct pipe_transfer
*transfer
);
138 void (*transfer_inline_write
)(struct pipe_video_context
*vpipe
,
139 struct pipe_resource
*resource
,
140 struct pipe_subresource subresource
,
141 unsigned usage
, /* a combination of PIPE_TRANSFER_x */
142 const struct pipe_box
*box
,
145 unsigned slice_stride
);
150 * Parameter-like states (or properties)
153 void (*set_picture_background
)(struct pipe_video_context
*vpipe
,
154 struct pipe_surface
*bg
,
155 struct pipe_video_rect
*bg_src_rect
);
157 void (*set_picture_layers
)(struct pipe_video_context
*vpipe
,
158 struct pipe_surface
*layers
[],
159 struct pipe_video_rect
*src_rects
[],
160 struct pipe_video_rect
*dst_rects
[],
161 unsigned num_layers
);
163 void (*set_picture_desc
)(struct pipe_video_context
*vpipe
,
164 const struct pipe_picture_desc
*desc
);
166 void (*set_decode_target
)(struct pipe_video_context
*vpipe
,
167 struct pipe_surface
*dt
);
169 void (*set_csc_matrix
)(struct pipe_video_context
*vpipe
, const float *mat
);
171 /* TODO: Interface for scaling modes, post-processing, etc. */
180 #endif /* PIPE_VIDEO_CONTEXT_H */