1 /*===================== begin_copyright_notice ==================================
2 
3 # Copyright (c) 2022, Intel Corporation
4 
5 # Permission is hereby granted, free of charge, to any person obtaining a
6 # copy of this software and associated documentation files (the "Software"),
7 # to deal in the Software without restriction, including without limitation
8 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 # and/or sell copies of the Software, and to permit persons to whom the
10 # Software is furnished to do so, subject to the following conditions:
11 
12 # The above copyright notice and this permission notice shall be included
13 # in all copies or substantial portions of the Software.
14 
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 # OTHER DEALINGS IN THE SOFTWARE.
22 
23 ======================= end_copyright_notice ==================================*/
24 //!
25 //! \file     mhw_vdbox_avp_impl_xe_lpm_plus.h
26 //! \brief    MHW VDBOX AVP interface common base for Xe_XPM_plus
27 //! \details
28 //!
29 
30 #ifndef __MHW_VDBOX_AVP_IMPL_XE_LPM_PLUS_H__
31 #define __MHW_VDBOX_AVP_IMPL_XE_LPM_PLUS_H__
32 
33 #include "mhw_vdbox_avp_impl_xe_lpm_plus_base.h"
34 #include "mhw_vdbox_avp_hwcmd_xe_lpm_plus.h"
35 
36 namespace mhw
37 {
38 namespace vdbox
39 {
40 namespace avp
41 {
42 namespace xe_lpm_plus_base
43 {
44 namespace v0
45 {
46 class Impl : public BaseImpl<Cmd>
47 {
48 protected:
49     using cmd_t  = Cmd;
50     using base_t = BaseImpl<cmd_t>;
51 
52 public:
Impl(PMOS_INTERFACE osItf)53     Impl(PMOS_INTERFACE osItf) : base_t(osItf){};
54 
_MHW_SETCMD_OVERRIDE_DECL(AVP_SURFACE_STATE)55     _MHW_SETCMD_OVERRIDE_DECL(AVP_SURFACE_STATE)
56     {
57         _MHW_SETCMD_CALLBASE(AVP_SURFACE_STATE);
58 
59         //Add compression setting for each ref
60 #define DO_FIELDS()                                                             \
61     DO_FIELD(DW4, MemoryCompressionEnableForAv1IntraFrame, MmcEnabled(params.mmcState[intraFrame]) ? 1 : 0);   \
62     DO_FIELD(DW4, MemoryCompressionEnableForAv1LastFrame, MmcEnabled(params.mmcState[lastFrame]) ? 1 : 0);    \
63     DO_FIELD(DW4, MemoryCompressionEnableForAv1Last2Frame, MmcEnabled(params.mmcState[last2Frame]) ? 1 : 0);   \
64     DO_FIELD(DW4, MemoryCompressionEnableForAv1Last3Frame, MmcEnabled(params.mmcState[last3Frame]) ? 1 : 0);   \
65     DO_FIELD(DW4, MemoryCompressionEnableForAv1GoldenFrame, MmcEnabled(params.mmcState[goldenFrame]) ? 1 : 0);  \
66     DO_FIELD(DW4, MemoryCompressionEnableForAv1BwdrefFrame, MmcEnabled(params.mmcState[bwdRefFrame]) ? 1 : 0);  \
67     DO_FIELD(DW4, MemoryCompressionEnableForAv1Altref2Frame, MmcEnabled(params.mmcState[altRef2Frame]) ? 1 : 0); \
68     DO_FIELD(DW4, MemoryCompressionEnableForAv1AltrefFrame, MmcEnabled(params.mmcState[altRefFrame]) ? 1 : 0);  \
69     DO_FIELD(DW4, CompressionTypeForIntraFrame, MmcRcEnabled(params.mmcState[intraFrame]) ? 1 : 0);            \
70     DO_FIELD(DW4, CompressionTypeForLastFrame, MmcRcEnabled(params.mmcState[lastFrame]) ? 1 : 0);             \
71     DO_FIELD(DW4, CompressionTypeForLast2Frame, MmcRcEnabled(params.mmcState[last2Frame]) ? 1 : 0);            \
72     DO_FIELD(DW4, CompressionTypeForLast3Frame, MmcRcEnabled(params.mmcState[last3Frame]) ? 1 : 0);            \
73     DO_FIELD(DW4, CompressionTypeForGoldenFrame, MmcRcEnabled(params.mmcState[goldenFrame]) ? 1 : 0);           \
74     DO_FIELD(DW4, CompressionTypeForBwdrefFrame, MmcRcEnabled(params.mmcState[bwdRefFrame]) ? 1 : 0);           \
75     DO_FIELD(DW4, CompressionTypeForAltref2Frame, MmcRcEnabled(params.mmcState[altRef2Frame]) ? 1 : 0);          \
76     DO_FIELD(DW4, CompressionTypeForAltrefFrame, MmcRcEnabled(params.mmcState[altRefFrame]) ? 1 : 0)
77 
78 #include "mhw_hwcmd_process_cmdfields.h"
79     }
80 
_MHW_SETCMD_OVERRIDE_DECL(AVP_PIC_STATE)81     _MHW_SETCMD_OVERRIDE_DECL(AVP_PIC_STATE)
82     {
83         _MHW_SETCMD_CALLBASE(AVP_PIC_STATE);
84 
85 #define DO_FIELDS()                                                                             \
86     DO_FIELD(DW75, SbMaxBitsizeallowed, params.sbMaxBitSizeAllowed);                            \
87     DO_FIELD(DW75, SbmaxbitstatusenSbmaxsizereportmask, params.sbMaxSizeReportMask ? 1 : 0);
88 
89 #include "mhw_hwcmd_process_cmdfields.h"
90     }
91 
92 MEDIA_CLASS_DEFINE_END(mhw__vdbox__avp__xe_lpm_plus_base__v0__Impl)
93 };
94 }  // namespace v0
95 }  // namespace xe_lpm_plus_base
96 }  // namespace avp
97 }  // namespace vdbox
98 }  // namespace mhw
99 
100 #endif  // __MHW_VDBOX_AVP_IMPL_XE_LPM_PLUS_H__
101