• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #define VPE_MAX_GEOMETRIC_DOWNSCALE 4.f
49 
50 /* For Hooking VPE as a decoder instance */
51 struct vpe_video_processor {
52     struct pipe_video_codec base;
53 
54     struct pipe_screen *screen;
55     struct radeon_winsys *ws;
56     struct radeon_cmdbuf cs;
57 
58     uint8_t bufs_num;
59     uint8_t cur_buf;
60     struct rvid_buffer *emb_buffers;
61 
62     /* VPE HW version */
63     uint8_t ver_major;
64     uint8_t ver_minor;
65 
66     struct vpe *vpe_handle;
67     struct vpe_init_data vpe_data;
68     struct vpe_build_bufs *vpe_build_bufs;
69     struct vpe_build_param *vpe_build_param;
70 
71     uint8_t log_level;
72 
73     struct pipe_surface **src_surfaces;
74     struct pipe_surface **dst_surfaces;
75 
76     /* For Geometric scaling */
77     float scaling_ratios[2];
78     float *geometric_scaling_ratios;
79     uint8_t geometric_passes;
80     struct pipe_video_buffer *geometric_buf[2];
81 };
82 
83 struct pipe_video_codec*
84 si_vpe_create_processor(struct pipe_context *context,
85                         const struct pipe_video_codec *templ);
86 
87 #endif
88