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 }; 25 26 /* video buffer offset info representation */ 27 struct rvid_buf_offset_info { 28 unsigned num_units; 29 unsigned old_offset; 30 unsigned new_offset; 31 }; 32 33 /* generate an stream handle */ 34 unsigned si_vid_alloc_stream_handle(void); 35 36 /* create a buffer in the winsys */ 37 bool si_vid_create_buffer(struct pipe_screen *screen, struct rvid_buffer *buffer, unsigned size, 38 unsigned usage); 39 40 /* create a tmz buffer in the winsys */ 41 bool si_vid_create_tmz_buffer(struct pipe_screen *screen, struct rvid_buffer *buffer, unsigned size, 42 unsigned usage); 43 44 /* destroy a buffer */ 45 void si_vid_destroy_buffer(struct rvid_buffer *buffer); 46 47 /* reallocate a buffer, preserving its content */ 48 bool si_vid_resize_buffer(struct pipe_screen *screen, struct radeon_cmdbuf *cs, 49 struct rvid_buffer *new_buf, unsigned new_size, 50 struct rvid_buf_offset_info *buf_ofst_info); 51 52 /* clear the buffer with zeros */ 53 void si_vid_clear_buffer(struct pipe_context *context, struct rvid_buffer *buffer); 54 55 #endif // RADEON_VIDEO_H 56