1 /*
2 * Copyright (c) 2021-2023, 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_feature_report.cpp
24 //! \brief    vp feature report
25 //! \details  vp feature report class inlcuding:
26 //!           features, functions
27 //!
28 #include "vp_feature_report.h"
29 #include "vp_utils.h"
30 #include "vp_pipeline_adapter_base.h"
31 
InitReportValue()32 void VpFeatureReport::InitReportValue()
33 {
34     VP_FUNC_CALL();
35 
36     m_features.iecp                = false;
37     m_features.ief                 = false;
38     m_features.denoise             = false;
39     m_features.chromaDenoise       = false;
40     m_features.deinterlaceMode     = VPHAL_DI_REPORT_PROGRESSIVE;
41     m_features.scalingMode         = VPHAL_SCALING_NEAREST;
42     m_features.outputPipeMode      = VPHAL_OUTPUT_PIPE_MODE_COMP;
43     m_features.vpMMCInUse          = false;
44     m_features.rtCompressible      = false;
45     m_features.rtCompressMode      = 0;
46     m_features.rtCacheSetting      = 0;
47 #if (_DEBUG || _RELEASE_INTERNAL)
48     m_features.rtOldCacheSetting   = 0;
49 #endif
50     m_features.ffdiCompressible    = false;
51     m_features.ffdiCompressMode    = 0;
52     m_features.ffdnCompressible    = false;
53     m_features.ffdnCompressMode    = 0;
54     m_features.stmmCompressible    = false;
55     m_features.stmmCompressMode    = 0;
56     m_features.scalerCompressible  = false;
57     m_features.scalerCompressMode  = 0;
58     m_features.primaryCompressible = false;
59     m_features.primaryCompressMode = 0;
60     m_features.compositionMode     = VPHAL_NO_COMPOSITION;
61     m_features.diScdMode           = false;
62     m_features.veFeatureInUse      = false;
63     m_features.hdrMode             = VPHAL_HDR_MODE_NONE;
64 
65     return;
66 }
67 
SetConfigValues(PVP_CONFIG configValues,bool traceEvent)68 void VpFeatureReport::SetConfigValues(
69     PVP_CONFIG configValues,
70     bool       traceEvent)
71 {
72     VP_FUNC_CALL();
73 
74     // Report DI mode
75     switch (m_features.deinterlaceMode)
76     {
77         case VPHAL_DI_REPORT_BOB:
78         case VPHAL_DI_REPORT_ADI_BOB:
79             configValues->dwCurrentDeinterlaceMode = VPDDI_BOB;
80             break;
81         case VPHAL_DI_REPORT_ADI:
82         case VPHAL_DI_REPORT_FMD:
83             configValues->dwCurrentDeinterlaceMode = VPDDI_ADI;
84             break;
85         case VPHAL_DI_REPORT_PROGRESSIVE:
86         default:
87             configValues->dwCurrentDeinterlaceMode = VPDDI_PROGRESSIVE;
88             break;
89     }
90 
91     // Report Scaling mode
92     configValues->dwCurrentScalingMode = (m_features.scalingMode == VPHAL_SCALING_AVS) ? VPDDI_ADVANCEDSCALING : (m_features.scalingMode > VPHAL_SCALING_AVS) ? VPDDI_SUPERRESOLUTIONSCALING : VPDDI_SCALING;
93 
94     // Report HDR Mode
95     configValues->dwCurrentHdrMode = m_features.hdrMode;
96 
97     // Report Output Pipe
98     configValues->dwCurrentOutputPipeMode = m_features.outputPipeMode;
99 
100     // Report VE Feature In Use
101     configValues->dwCurrentVEFeatureInUse = m_features.veFeatureInUse;
102 
103     // Report vp packet reused flag.
104     configValues->isPacketReused = m_features.packetReused;
105 
106     // Report vp Dn enabled flag.
107     configValues->isDnEnabled = m_features.denoise;
108 
109     // Report MMC status
110     configValues->dwVPMMCInUse          = m_features.vpMMCInUse;
111     configValues->dwRTCompressible      = m_features.rtCompressible;
112     configValues->dwRTCompressMode      = m_features.rtCompressMode;
113     configValues->dwFFDICompressible    = m_features.ffdiCompressible;
114     configValues->dwFFDICompressMode    = m_features.ffdiCompressMode;
115     configValues->dwFFDNCompressible    = m_features.ffdnCompressible;
116     configValues->dwFFDNCompressMode    = m_features.ffdnCompressMode;
117     configValues->dwSTMMCompressible    = m_features.stmmCompressible;
118     configValues->dwSTMMCompressMode    = m_features.stmmCompressMode;
119     configValues->dwScalerCompressible  = m_features.scalerCompressible;
120     configValues->dwScalerCompressMode  = m_features.scalerCompressMode;
121     configValues->dwPrimaryCompressible = m_features.primaryCompressible;
122     configValues->dwPrimaryCompressMode = m_features.primaryCompressMode;
123 
124     // Report Render Target cache usage
125     configValues->dwRTCacheSetting     = m_features.rtCacheSetting;
126 #if (_DEBUG || _RELEASE_INTERNAL)
127     configValues->dwRTOldCacheSetting = m_features.rtOldCacheSetting;
128 #endif
129 
130     // Report In Place Compositon status
131     configValues->dwCurrentCompositionMode = m_features.compositionMode;
132     configValues->dwCurrentScdMode         = m_features.diScdMode;
133 
134     // Report Vebox Scalability
135     configValues->dwCurrentVeboxScalability = m_features.VeboxScalability;
136 
137     configValues->dwCurrentSFCLinearOutputByTileConvert = m_features.sfcLinearOutputByTileConvert;
138 
139     // Report VP Apogeios
140     configValues->dwCurrentVPApogeios       = m_features.VPApogeios;
141 
142     VP_PUBLIC_NORMALMESSAGE(
143         "VP Feature Report: \
144         OutputPipeMode %d, \
145         HDRMode %d, \
146         VEFeatureInUse %d, \
147         ScalingMode %d, \
148         DeinterlaceMode %d, \
149         VPMMCInUse %d, \
150         RTCompressible %d, \
151         RTCompressMode %d, \
152         PrimaryCompressible %d, \
153         PrimaryCompressMode %d, \
154         CompositionMode %d, \
155         sfcLinearOutputByTileConvert %d",
156         m_features.outputPipeMode,
157         m_features.hdrMode,
158         m_features.veFeatureInUse,
159         m_features.scalingMode,
160         m_features.deinterlaceMode,
161         m_features.vpMMCInUse,
162         m_features.rtCompressible,
163         m_features.rtCompressMode,
164         m_features.primaryCompressible,
165         m_features.primaryCompressMode,
166         m_features.compositionMode,
167         m_features.sfcLinearOutputByTileConvert);
168 
169     if (traceEvent)
170     {
171         MT_LOG5(MT_VP_FTR_REPORT, MT_NORMAL, MT_VP_RENDERDATA_OUTPUT_PIPE, m_features.outputPipeMode, MT_VP_RENDER_VE_HDRMODE, m_features.hdrMode,
172         MT_VP_RENDER_VE_FTRINUSE, m_features.veFeatureInUse, MT_VP_HAL_SCALING_MODE, m_features.scalingMode, MT_VP_HAL_MMCINUSE, m_features.vpMMCInUse);
173     }
174     return;
175 }
176