xref: /aosp_15_r20/external/mesa3d/src/gallium/drivers/radeonsi/radeon_video.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /**************************************************************************
2  *
3  * Copyright 2013 Advanced Micro Devices, Inc.
4  *
5  * SPDX-License-Identifier: MIT
6  *
7  **************************************************************************/
8 
9 #ifndef RADEON_VIDEO_H
10 #define RADEON_VIDEO_H
11 
12 #include "winsys/radeon_winsys.h"
13 #include "vl/vl_video_buffer.h"
14 
15 #define RVID_ERR(fmt, args...)                                                                     \
16    fprintf(stderr, "EE %s:%d %s UVD - " fmt, __FILE__, __LINE__, __func__, ##args)
17 
18 #define UVD_FW_1_66_16 ((1 << 24) | (66 << 16) | (16 << 8))
19 
20 /* video buffer representation */
21 struct rvid_buffer {
22    unsigned usage;
23    struct si_resource *res;
24    void *user_data;
25 };
26 
27 /* video buffer offset info representation */
28 struct rvid_buf_offset_info {
29    unsigned num_units;
30    unsigned old_offset;
31    unsigned new_offset;
32 };
33 
34 /* generate an stream handle */
35 unsigned si_vid_alloc_stream_handle(void);
36 
37 /* create a buffer in the winsys */
38 bool si_vid_create_buffer(struct pipe_screen *screen, struct rvid_buffer *buffer, unsigned size,
39                           unsigned usage);
40 
41 /* create a tmz buffer in the winsys */
42 bool si_vid_create_tmz_buffer(struct pipe_screen *screen, struct rvid_buffer *buffer, unsigned size,
43                               unsigned usage);
44 
45 /* destroy a buffer */
46 void si_vid_destroy_buffer(struct rvid_buffer *buffer);
47 
48 /* reallocate a buffer, preserving its content */
49 bool si_vid_resize_buffer(struct pipe_context *context, struct radeon_cmdbuf *cs,
50                           struct rvid_buffer *new_buf, unsigned new_size,
51                           struct rvid_buf_offset_info *buf_ofst_info);
52 
53 /* clear the buffer with zeros */
54 void si_vid_clear_buffer(struct pipe_context *context, struct rvid_buffer *buffer);
55 
56 #endif // RADEON_VIDEO_H
57