xref: /aosp_15_r20/external/intel-media-driver/media_softlet/agnostic/common/vp/hal/feature_manager/hw_filter.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 2019-2020, Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22 
23 //!
24 //! \file     hw_filter.h
25 //! \brief    Defines the common interface for vp features manager
26 //! \details  The vp manager is further sub-divided by vp type
27 //!           this file is for the base interface which is shared by all components.
28 //!
29 #ifndef __HW_FILTER_H__
30 #define __HW_FILTER_H__
31 
32 #include "media_feature_manager.h"
33 #include "vp_utils.h"
34 #include "vp_pipeline_common.h"
35 #include "vp_allocator.h"
36 
37 #include "vp_vebox_cmd_packet.h"
38 #include <queue>
39 #include <vector>
40 #include "vp_filter.h"
41 #include "vp_scaling_filter.h"
42 #include "vp_rot_mir_filter.h"
43 #include "vp_csc_filter.h"
44 #include "vp_dn_filter.h"
45 #include "vp_tcc_filter.h"
46 #include "vp_ste_filter.h"
47 #include "vp_procamp_filter.h"
48 #include "vp_hdr_filter.h"
49 #include "vp_hdr_render_filter.h"
50 #include "vp_di_filter.h"
51 #include "vp_fc_filter.h"
52 #include "vp_l0_fc_filter.h"
53 #include "vp_fc_wrap_filter.h"
54 
55 namespace vp
56 {
57 class VpInterface;
58 class VpSinglePipeContext;
59 
60 enum EngineType
61 {
62     EngineTypeInvalid = 0,
63     EngineTypeVebox,
64     EngineTypeVeboxSfc,
65     EngineTypeRender,
66     // ...
67     NumOfEngineType
68 };
69 
70 struct HW_FILTER_PARAMS
71 {
72     EngineType Type = EngineTypeInvalid;
73     VP_EXECUTE_CAPS vpExecuteCaps = {};
74     SwFilterPipe *executedFilters = nullptr;
75     std::vector<HwFilterParameter *> Params;
76 };
77 
78 struct PACKET_PARAMS
79 {
80     EngineType Type = EngineTypeInvalid;
81     std::vector<VpPacketParameter *> Params;
82 };
83 
84 class HwFilter
85 {
86 public:
87     HwFilter(VpInterface &vpInterface, EngineType type);
88     virtual ~HwFilter();
89     virtual MOS_STATUS Clean();
90     virtual MOS_STATUS Initialize(HW_FILTER_PARAMS &param);
91     virtual MOS_STATUS SetPacketParams(VpCmdPacket &package) = 0;
92 
93     virtual MOS_STATUS ConfigParam(HW_FILTER_PARAM& param);
94 
GetEngineType()95     EngineType GetEngineType()
96     {
97         return m_Params.Type;
98     }
99 
100     RenderTargetType GetRenderTargetType();
101 
IsVeboxFeatureInuse()102     bool IsVeboxFeatureInuse()
103     {
104         return ::IsVeboxFeatureInuse(m_vpExecuteCaps);
105     }
106 
107 protected:
108     VpInterface         &m_vpInterface;
109     PACKET_PARAMS       m_Params = {};
110     SwFilterPipe        *m_swFilterPipe = nullptr;
111     VP_EXECUTE_CAPS     m_vpExecuteCaps = {};
112 
113 MEDIA_CLASS_DEFINE_END(vp__HwFilter)
114 };
115 
116 class HwFilterVebox: public HwFilter
117 {
118 public:
119     HwFilterVebox(VpInterface &vpInterface);
120     virtual ~HwFilterVebox();
Clean()121     virtual MOS_STATUS Clean()
122     {
123         HwFilter::Clean();
124         return MOS_STATUS_SUCCESS;
125     }
126     virtual MOS_STATUS SetPacketParams(VpCmdPacket &package);
127 
128 protected:
129     HwFilterVebox(VpInterface &vpInterface, EngineType type);
130 
131 MEDIA_CLASS_DEFINE_END(vp__HwFilterVebox)
132 };
133 
134 class HwFilterVeboxSfc: public HwFilterVebox  // VEBOX+SFC
135 {
136 public:
137     HwFilterVeboxSfc(VpInterface &vpInterface);
138     virtual ~HwFilterVeboxSfc();
Clean()139     virtual MOS_STATUS Clean()
140     {
141         HwFilter::Clean();
142         return MOS_STATUS_SUCCESS;
143     }
144     virtual MOS_STATUS SetPacketParams(VpCmdPacket &package);
145 
146 MEDIA_CLASS_DEFINE_END(vp__HwFilterVeboxSfc)
147 };
148 
149 class HwFilterRender: public HwFilter
150 {
151 public:
152     HwFilterRender(VpInterface &vpInterface);
153     virtual ~HwFilterRender();
154 
Clean()155     virtual MOS_STATUS Clean()
156     {
157         HwFilter::Clean();
158         return MOS_STATUS_SUCCESS;
159     }
160 
161     virtual MOS_STATUS SetPacketParams(VpCmdPacket &package);
162 
163 MEDIA_CLASS_DEFINE_END(vp__HwFilterRender)
164 };
165 
166 }
167 #endif // !__HW_FILTER_H__
168