1 /************************************************************************** 2 * 3 * Copyright 2022 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 SI_VPE_H 29 #define SI_VPE_H 30 31 #include "pipe/p_screen.h" 32 #include "pipe/p_video_codec.h" 33 #include "vpelib/inc/vpelib.h" 34 #include "radeon_video.h" 35 36 /* The buffer size of cmd_buf and emb_buf in bytes 37 * 38 * TODO: vpe-utils also use this value. Need to be reviewed further. 39 */ 40 #define VPE_FENCE_TIMEOUT_NS 1000000000 41 42 /* VPE 1st generation only support 1 input stram */ 43 #define VPE_STREAM_MAX_NUM 1 44 45 #define VPE_BUFFERS_NUM 6 46 #define VPE_EMBBUF_SIZE 20000 47 48 /* For Hooking VPE as a decoder instance */ 49 struct vpe_video_processor { 50 struct pipe_video_codec base; 51 52 struct pipe_screen *screen; 53 struct radeon_winsys *ws; 54 struct radeon_cmdbuf cs; 55 56 uint8_t bufs_num; 57 uint8_t cur_buf; 58 struct rvid_buffer *emb_buffers; 59 void **mapped_cpu_va; 60 61 struct pipe_fence_handle *process_fence; 62 63 /* VPE HW version */ 64 uint8_t ver_major; 65 uint8_t ver_minor; 66 67 struct vpe *vpe_handle; 68 struct vpe_init_data vpe_data; 69 struct vpe_build_bufs *vpe_build_bufs; 70 struct vpe_build_param *vpe_build_param; 71 72 uint8_t log_level; 73 74 struct pipe_surface **src_surfaces; 75 struct pipe_surface **dst_surfaces; 76 }; 77 78 struct pipe_video_codec* 79 si_vpe_create_processor(struct pipe_context *context, 80 const struct pipe_video_codec *templ); 81 82 #endif 83