util: move os_time.[ch] to src/util
[mesa.git] / src / gallium / drivers / radeon / radeon_video.h
1 /**************************************************************************
2 *
3 * Copyright 2013 Advanced Micro Devices, Inc.
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 THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 RADEON_VIDEO_H
29 #define RADEON_VIDEO_H
30
31 #include "radeon/radeon_winsys.h"
32 #include "vl/vl_video_buffer.h"
33
34 #define RVID_ERR(fmt, args...) \
35 fprintf(stderr, "EE %s:%d %s UVD - "fmt, __FILE__, __LINE__, __func__, ##args)
36
37 /* video buffer representation */
38 struct rvid_buffer
39 {
40 unsigned usage;
41 struct r600_resource *res;
42 };
43
44 /* generate an stream handle */
45 unsigned si_vid_alloc_stream_handle(void);
46
47 /* create a buffer in the winsys */
48 bool si_vid_create_buffer(struct pipe_screen *screen, struct rvid_buffer *buffer,
49 unsigned size, unsigned usage);
50
51 /* destroy a buffer */
52 void si_vid_destroy_buffer(struct rvid_buffer *buffer);
53
54 /* reallocate a buffer, preserving its content */
55 bool si_vid_resize_buffer(struct pipe_screen *screen, struct radeon_winsys_cs *cs,
56 struct rvid_buffer *new_buf, unsigned new_size);
57
58 /* clear the buffer with zeros */
59 void si_vid_clear_buffer(struct pipe_context *context, struct rvid_buffer* buffer);
60
61 /* join surfaces into the same buffer with identical tiling params
62 sumup their sizes and replace the backend buffers with a single bo */
63 void si_vid_join_surfaces(struct r600_common_context *rctx,
64 struct pb_buffer** buffers[VL_NUM_COMPONENTS],
65 struct radeon_surf *surfaces[VL_NUM_COMPONENTS]);
66
67 /* returns supported codecs and other parameters */
68 int si_vid_get_video_param(struct pipe_screen *screen,
69 enum pipe_video_profile profile,
70 enum pipe_video_entrypoint entrypoint,
71 enum pipe_video_cap param);
72
73 /* the hardware only supports NV12 */
74 boolean si_vid_is_format_supported(struct pipe_screen *screen,
75 enum pipe_format format,
76 enum pipe_video_profile profile,
77 enum pipe_video_entrypoint entrypoint);
78
79 #endif // RADEON_VIDEO_H