1 /*
2 * Copyright (c) 2024, 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 //! \file     vp_fc_wrap_filter.h
24 //! \brief    Defines the common interface for legacy fc and L0 fc wrapper
25 //!           this file is for the base interface which is shared by all wrap fc in driver.
26 #ifndef __VP_FC_WRAP_FILTER_H__
27 #define __VP_FC_WRAP_FILTER_H__
28 
29 #include "vp_l0_fc_filter.h"
30 #include "vp_fc_filter.h"
31 
32 namespace vp
33 {
34 
35 class PolicyFcFeatureWrapHandler : public PolicyFeatureHandler
36 {
37 public:
38     PolicyFcFeatureWrapHandler(VP_HW_CAPS &hwCaps, bool enableL0FC);
39 
40     virtual ~PolicyFcFeatureWrapHandler();
41 
42     virtual bool IsFeatureEnabled(VP_EXECUTE_CAPS vpExecuteCaps);
43 
44     virtual HwFilterParameter *CreateHwFilterParam(VP_EXECUTE_CAPS vpExecuteCaps, SwFilterPipe &swFilterPipe, PVP_MHWINTERFACE pHwInterface);
45 
46     virtual MOS_STATUS UpdateFeaturePipe(VP_EXECUTE_CAPS caps, SwFilter &feature, SwFilterPipe &featurePipe, SwFilterPipe &executePipe, bool isInputPipe, int index);
47 
48     virtual MOS_STATUS UpdateUnusedFeature(VP_EXECUTE_CAPS caps, SwFilter &feature, SwFilterPipe &featurePipe, SwFilterPipe &executePipe, bool isInputPipe, int index);
49 
50     virtual MOS_STATUS ReleaseHwFeatureParameter(HwFilterParameter *&pParam) override;
51 
52 private:
53     bool                      m_enableL0FC         = false;
54     PolicyL0FcFeatureHandler *m_l0fcFeatureHandler = nullptr;
55     PolicyFcFeatureHandler   *m_fcFeatureHandler   = nullptr;
56 
57 MEDIA_CLASS_DEFINE_END(vp__PolicyFcFeatureWrapHandler)
58 };
59 
60 class PolicyFcWrapHandler : public PolicyFeatureHandler
61 {
62 public:
63     PolicyFcWrapHandler(VP_HW_CAPS &hwCaps, bool enableL0FC);
64 
65     virtual ~PolicyFcWrapHandler();
66 
67     virtual HwFilterParameter *CreateHwFilterParam(VP_EXECUTE_CAPS vpExecuteCaps, SwFilterPipe &swFilterPipe, PVP_MHWINTERFACE pHwInterface) override;
68 
69     virtual bool IsFeatureEnabled(VP_EXECUTE_CAPS vpExecuteCaps);
70 
71     virtual MOS_STATUS UpdateFeaturePipe(VP_EXECUTE_CAPS caps, SwFilter &feature, SwFilterPipe &featurePipe, SwFilterPipe &executePipe, bool isInputPipe, int index);
72 
73     virtual MOS_STATUS UpdateUnusedFeature(VP_EXECUTE_CAPS caps, SwFilter &feature, SwFilterPipe &featurePipe, SwFilterPipe &executePipe, bool isInputPipe, int index);
74 
75     virtual MOS_STATUS LayerSelectForProcess(std::vector<int> &layerIndexes, SwFilterPipe &featurePipe, VP_EXECUTE_CAPS &caps);
76 
77     virtual MOS_STATUS ReleaseHwFeatureParameter(HwFilterParameter *&pParam) override;
78 
79 private:
80     bool               m_enableL0FC  = false;
81     PolicyL0FcHandler *m_l0fcHandler = nullptr;
82     PolicyFcHandler   *m_fcHandler   = nullptr;
83 
84 MEDIA_CLASS_DEFINE_END(vp__PolicyFcWrapHandler)
85 };
86 
87 }
88 
89 #endif