xref: /aosp_15_r20/external/mesa3d/src/gallium/drivers/r600/radeon_video.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright 2013 Advanced Micro Devices, Inc.
3  * Authors:
4  *      Christian König <[email protected]>
5  * SPDX-License-Identifier: MIT
6  */
7 
8 #ifndef RADEON_VIDEO_H
9 #define RADEON_VIDEO_H
10 
11 #include "winsys/radeon_winsys.h"
12 #include "vl/vl_video_buffer.h"
13 
14 #define RVID_ERR(fmt, args...) \
15 	fprintf(stderr, "EE %s:%d %s UVD - "fmt, __FILE__, __LINE__, __func__, ##args)
16 
17 /* video buffer representation */
18 struct rvid_buffer
19 {
20 	unsigned		usage;
21 	struct r600_resource	*res;
22 };
23 
24 /* generate an stream handle */
25 unsigned rvid_alloc_stream_handle(void);
26 
27 /* create a buffer in the winsys */
28 bool rvid_create_buffer(struct pipe_screen *screen, struct rvid_buffer *buffer,
29 			unsigned size, unsigned usage);
30 
31 /* destroy a buffer */
32 void rvid_destroy_buffer(struct rvid_buffer *buffer);
33 
34 /* reallocate a buffer, preserving its content */
35 bool rvid_resize_buffer(struct pipe_screen *screen, struct radeon_cmdbuf *cs,
36 			struct rvid_buffer *new_buf, unsigned new_size);
37 
38 /* clear the buffer with zeros */
39 void rvid_clear_buffer(struct pipe_context *context, struct rvid_buffer* buffer);
40 
41 /* join surfaces into the same buffer with identical tiling params
42    sum up their sizes and replace the backend buffers with a single bo */
43 void rvid_join_surfaces(struct r600_common_context *rctx,
44                         struct pb_buffer_lean** buffers[VL_NUM_COMPONENTS],
45                         struct radeon_surf *surfaces[VL_NUM_COMPONENTS]);
46 
47 /* returns supported codecs and other parameters */
48 int rvid_get_video_param(struct pipe_screen *screen,
49                          enum pipe_video_profile profile,
50                          enum pipe_video_entrypoint entrypoint,
51                          enum pipe_video_cap param);
52 
53 /* the hardware only supports NV12 */
54 bool rvid_is_format_supported(struct pipe_screen *screen,
55 			      enum pipe_format format,
56 			      enum pipe_video_profile profile,
57 			      enum pipe_video_entrypoint entrypoint);
58 
59 #endif // RADEON_VIDEO_H
60