1 /**************************************************************************
3 * Copyright 2010 Christian König
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 **************************************************************************/
27 #ifndef vl_vertex_buffers_h
28 #define vl_vertex_buffers_h
30 #include <pipe/p_state.h>
31 #include <pipe/p_video_state.h>
33 #include "vl_defines.h"
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
41 /* inputs to the vertex shaders */
57 PIPE_VIDEO_MV_WEIGHT_MIN
= 0,
58 PIPE_VIDEO_MV_WEIGHT_HALF
= 128,
59 PIPE_VIDEO_MV_WEIGHT_MAX
= 256
65 PIPE_VIDEO_TOP_FIELD
= 1,
66 PIPE_VIDEO_BOTTOM_FIELD
= 3,
74 struct vl_motionvector
78 int16_t field_select
; /**< enum pipe_video_field_select */
79 int16_t weight
; /**< enum pipe_video_mv_weight */
91 struct vl_vertex_buffer
93 unsigned width
, height
;
96 struct pipe_resource
*resource
;
97 struct pipe_transfer
*transfer
;
98 struct vl_ycbcr_block
*vertex_stream
;
99 } ycbcr
[VL_MAX_PLANES
];
102 struct pipe_resource
*resource
;
103 struct pipe_transfer
*transfer
;
104 struct vl_motionvector
*vertex_stream
;
105 } mv
[VL_MAX_REF_FRAMES
];
108 struct pipe_vertex_buffer
vl_vb_upload_quads(struct pipe_context
*pipe
);
110 struct pipe_vertex_buffer
vl_vb_upload_pos(struct pipe_context
*pipe
, unsigned width
, unsigned height
);
112 void *vl_vb_get_ves_ycbcr(struct pipe_context
*pipe
);
114 void *vl_vb_get_ves_mv(struct pipe_context
*pipe
);
116 bool vl_vb_init(struct vl_vertex_buffer
*buffer
,
117 struct pipe_context
*pipe
,
118 unsigned width
, unsigned height
);
120 unsigned vl_vb_attributes_per_plock(struct vl_vertex_buffer
*buffer
);
122 void vl_vb_map(struct vl_vertex_buffer
*buffer
, struct pipe_context
*pipe
);
124 struct pipe_vertex_buffer
vl_vb_get_ycbcr(struct vl_vertex_buffer
*buffer
, int component
);
126 struct vl_ycbcr_block
*vl_vb_get_ycbcr_stream(struct vl_vertex_buffer
*buffer
, int component
);
128 struct pipe_vertex_buffer
vl_vb_get_mv(struct vl_vertex_buffer
*buffer
, int ref_frame
);
130 unsigned vl_vb_get_mv_stream_stride(struct vl_vertex_buffer
*buffer
);
132 struct vl_motionvector
*vl_vb_get_mv_stream(struct vl_vertex_buffer
*buffer
, int ref_frame
);
134 void vl_vb_unmap(struct vl_vertex_buffer
*buffer
, struct pipe_context
*pipe
);
136 void vl_vb_cleanup(struct vl_vertex_buffer
*buffer
);
138 #endif /* vl_vertex_buffers_h */