[g3dvl] make ycbcr stream and block data a public interface
[mesa.git] / src / gallium / auxiliary / vl / vl_vertex_buffers.h
1 /**************************************************************************
2 *
3 * Copyright 2010 Christian König
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 #ifndef vl_vertex_buffers_h
28 #define vl_vertex_buffers_h
29
30 #include <pipe/p_state.h>
31 #include <pipe/p_video_state.h>
32
33 #include "vl_defines.h"
34 #include "vl_types.h"
35
36 /* vertex buffers act as a todo list
37 * uploading all the usefull informations to video ram
38 * so a vertex shader can work with them
39 */
40
41 /* inputs to the vertex shaders */
42 enum VS_INPUT
43 {
44 VS_I_RECT,
45 VS_I_VPOS,
46
47 VS_I_MV_TOP,
48 VS_I_MV_BOTTOM,
49
50 NUM_VS_INPUTS
51 };
52
53 struct vl_vertex_buffer
54 {
55 unsigned width, height;
56
57 struct {
58 struct pipe_resource *resource;
59 struct pipe_transfer *transfer;
60 struct pipe_ycbcr_block *vertex_stream;
61 } ycbcr[VL_MAX_PLANES];
62
63 struct {
64 struct pipe_resource *resource;
65 struct pipe_transfer *transfer;
66 struct pipe_motionvector *vertex_stream;
67 } mv[VL_MAX_REF_FRAMES];
68 };
69
70 struct pipe_vertex_buffer vl_vb_upload_quads(struct pipe_context *pipe);
71
72 struct pipe_vertex_buffer vl_vb_upload_pos(struct pipe_context *pipe, unsigned width, unsigned height);
73
74 void *vl_vb_get_ves_ycbcr(struct pipe_context *pipe);
75
76 void *vl_vb_get_ves_mv(struct pipe_context *pipe);
77
78 void vl_vb_init(struct vl_vertex_buffer *buffer,
79 struct pipe_context *pipe,
80 unsigned width, unsigned height);
81
82 void vl_vb_map(struct vl_vertex_buffer *buffer, struct pipe_context *pipe);
83
84 struct pipe_vertex_buffer vl_vb_get_ycbcr(struct vl_vertex_buffer *buffer, int component);
85
86 struct pipe_ycbcr_block *vl_vb_get_ycbcr_stream(struct vl_vertex_buffer *buffer, int component);
87
88 struct pipe_vertex_buffer vl_vb_get_mv(struct vl_vertex_buffer *buffer, int ref_frame);
89
90 unsigned vl_vb_get_mv_stream_stride(struct vl_vertex_buffer *buffer);
91
92 struct pipe_motionvector *vl_vb_get_mv_stream(struct vl_vertex_buffer *buffer, int ref_frame);
93
94 void vl_vb_unmap(struct vl_vertex_buffer *buffer, struct pipe_context *pipe);
95
96 void vl_vb_cleanup(struct vl_vertex_buffer *buffer);
97
98 #endif /* vl_vertex_buffers_h */