| 1 | /* |
| 2 | * Copyright (c) 2021-2022, 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_user_feature_control.cpp |
| 24 | //! \brief vp user feature control. |
| 25 | //! \details vp user feature control. |
| 26 | //! |
| 27 | #include "vp_user_feature_control.h" |
| 28 | #include "vp_utils.h" |
| 29 | |
| 30 | using namespace vp; |
| 31 | |
| 32 | VpUserFeatureControl::VpUserFeatureControl(MOS_INTERFACE &osInterface, VpPlatformInterface *vpPlatformInterface, void *owner) : |
| 33 | m_owner(owner), m_osInterface(&osInterface), m_vpPlatformInterface(vpPlatformInterface) |
| 34 | { |
| 35 | MOS_STATUS status = MOS_STATUS_SUCCESS; |
| 36 | uint32_t compBypassMode = VPHAL_COMP_BYPASS_ENABLED; // Vebox Comp Bypass is on by default |
| 37 | MEDIA_FEATURE_TABLE* skuTable = nullptr; |
| 38 | |
| 39 | if (m_osInterface->pfnGetSkuTable) |
| 40 | { |
| 41 | skuTable = m_osInterface->pfnGetSkuTable(m_osInterface); |
| 42 | } |
| 43 | |
| 44 | |
| 45 | m_userSettingPtr = m_osInterface->pfnGetUserSettingInstance(m_osInterface); |
| 46 | // Read user feature key to get the Composition Bypass mode |
| 47 | if (skuTable && (!MEDIA_IS_SKU(skuTable, FtrVERing))) |
| 48 | { |
| 49 | m_ctrlValDefault.disableVeboxOutput = true; |
| 50 | m_ctrlValDefault.disableSfc = true; |
| 51 | |
| 52 | VP_PUBLIC_NORMALMESSAGE("No VeRing, disableVeboxOutput %d, disableSfc %d", m_ctrlValDefault.disableVeboxOutput, m_ctrlValDefault.disableSfc); |
| 53 | } |
| 54 | else |
| 55 | { |
| 56 | status = ReadUserSetting( |
| 57 | m_userSettingPtr, |
| 58 | compBypassMode, |
| 59 | __VPHAL_BYPASS_COMPOSITION, |
| 60 | MediaUserSetting::Group::Sequence, |
| 61 | compBypassMode, |
| 62 | true); |
| 63 | |
| 64 | if (MOS_SUCCEEDED(status)) |
| 65 | { |
| 66 | m_ctrlValDefault.disableVeboxOutput = VPHAL_COMP_BYPASS_DISABLED == compBypassMode; |
| 67 | } |
| 68 | else |
| 69 | { |
| 70 | // Default value |
| 71 | m_ctrlValDefault.disableVeboxOutput = false; |
| 72 | } |
| 73 | |
| 74 | VP_PUBLIC_NORMALMESSAGE("disableVeboxOutput %d", m_ctrlValDefault.disableVeboxOutput); |
| 75 | |
| 76 | if (skuTable && MEDIA_IS_SKU(skuTable, FtrSFCPipe)) |
| 77 | { |
| 78 | // Read user feature key to Disable SFC |
| 79 | bool disableSFC = false; |
| 80 | status = ReadUserSetting( |
| 81 | m_userSettingPtr, |
| 82 | disableSFC, |
| 83 | __VPHAL_VEBOX_DISABLE_SFC, |
| 84 | MediaUserSetting::Group::Sequence); |
| 85 | |
| 86 | if (MOS_SUCCEEDED(status)) |
| 87 | { |
| 88 | m_ctrlValDefault.disableSfc = disableSFC; |
| 89 | } |
| 90 | else |
| 91 | { |
| 92 | // Default value |
| 93 | m_ctrlValDefault.disableSfc = false; |
| 94 | } |
| 95 | } |
| 96 | else |
| 97 | { |
| 98 | m_ctrlValDefault.disableSfc = true; |
| 99 | VP_PUBLIC_NORMALMESSAGE("No FtrSFCPipe, disableSfc %d", m_ctrlValDefault.disableSfc); |
| 100 | } |
| 101 | VP_PUBLIC_NORMALMESSAGE("disableSfc %d", m_ctrlValDefault.disableSfc); |
| 102 | } |
| 103 | |
| 104 | // If disable dn |
| 105 | bool disableDn = false; |
| 106 | status = ReadUserSetting( |
| 107 | m_userSettingPtr, |
| 108 | disableDn, |
| 109 | __MEDIA_USER_FEATURE_VALUE_DISABLE_DN, |
| 110 | MediaUserSetting::Group::Sequence); |
| 111 | if (MOS_SUCCEEDED(status)) |
| 112 | { |
| 113 | m_ctrlValDefault.disableDn = disableDn; |
| 114 | } |
| 115 | else |
| 116 | { |
| 117 | // Default value |
| 118 | m_ctrlValDefault.disableDn = false; |
| 119 | } |
| 120 | VP_PUBLIC_NORMALMESSAGE("disableDn %d", m_ctrlValDefault.disableDn); |
| 121 | |
| 122 | // Force enable vebox ouptut surface. |
| 123 | bool forceEnableVeboxOutputSurf = false; |
| 124 | status = ReadUserSetting( |
| 125 | m_userSettingPtr, |
| 126 | forceEnableVeboxOutputSurf, |
| 127 | __MEDIA_USER_FEATURE_VALUE_FORCE_ENABLE_VEBOX_OUTPUT_SURF, |
| 128 | MediaUserSetting::Group::Sequence); |
| 129 | if (MOS_SUCCEEDED(status)) |
| 130 | { |
| 131 | m_ctrlValDefault.ForceEnableVeboxOutputSurf = forceEnableVeboxOutputSurf; |
| 132 | } |
| 133 | else |
| 134 | { |
| 135 | // Default value |
| 136 | m_ctrlValDefault.ForceEnableVeboxOutputSurf = false; |
| 137 | } |
| 138 | VP_PUBLIC_NORMALMESSAGE("ForceEnableVeboxOutputSurf %d", m_ctrlValDefault.ForceEnableVeboxOutputSurf); |
| 139 | |
| 140 | // __MEDIA_USER_FEATURE_VALUE_CSC_COEFF_PATCH_MODE_DISABLE |
| 141 | bool cscCoeffPatchModeDisabled = false; |
| 142 | status = ReadUserSetting( |
| 143 | m_userSettingPtr, |
| 144 | cscCoeffPatchModeDisabled, |
| 145 | __MEDIA_USER_FEATURE_VALUE_CSC_COEFF_PATCH_MODE_DISABLE, |
| 146 | MediaUserSetting::Group::Sequence); |
| 147 | if (MOS_SUCCEEDED(status)) |
| 148 | { |
| 149 | m_ctrlValDefault.cscCosffPatchModeDisabled = cscCoeffPatchModeDisabled; |
| 150 | } |
| 151 | else |
| 152 | { |
| 153 | // Default value |
| 154 | m_ctrlValDefault.cscCosffPatchModeDisabled = false; |
| 155 | } |
| 156 | VP_PUBLIC_NORMALMESSAGE("cscCosffPatchModeDisabled %d", m_ctrlValDefault.cscCosffPatchModeDisabled); |
| 157 | |
| 158 | bool disablePacketReuse = false; |
| 159 | status = ReadUserSetting( |
| 160 | m_userSettingPtr, |
| 161 | disablePacketReuse, |
| 162 | __MEDIA_USER_FEATURE_VALUE_DISABLE_PACKET_REUSE, |
| 163 | MediaUserSetting::Group::Sequence); |
| 164 | if (MOS_SUCCEEDED(status)) |
| 165 | { |
| 166 | m_ctrlValDefault.disablePacketReuse = disablePacketReuse; |
| 167 | } |
| 168 | else |
| 169 | { |
| 170 | // Default value |
| 171 | m_ctrlValDefault.disablePacketReuse = false; |
| 172 | } |
| 173 | VP_PUBLIC_NORMALMESSAGE("disablePacketReuse %d", m_ctrlValDefault.disablePacketReuse); |
| 174 | |
| 175 | bool enablePacketReuseTeamsAlways = false; |
| 176 | status = ReadUserSetting( |
| 177 | m_userSettingPtr, |
| 178 | enablePacketReuseTeamsAlways, |
| 179 | __MEDIA_USER_FEATURE_VALUE_ENABLE_PACKET_REUSE_TEAMS_ALWAYS, |
| 180 | MediaUserSetting::Group::Sequence); |
| 181 | if (MOS_SUCCEEDED(status)) |
| 182 | { |
| 183 | m_ctrlValDefault.enablePacketReuseTeamsAlways = enablePacketReuseTeamsAlways; |
| 184 | } |
| 185 | else |
| 186 | { |
| 187 | // Default value |
| 188 | m_ctrlValDefault.enablePacketReuseTeamsAlways = false; |
| 189 | } |
| 190 | VP_PUBLIC_NORMALMESSAGE("enablePacketReuseTeamsAlways %d", m_ctrlValDefault.enablePacketReuseTeamsAlways); |
| 191 | |
| 192 | // bComputeContextEnabled is true only if Gen12+. |
| 193 | // Gen12+, compute context(MOS_GPU_NODE_COMPUTE, MOS_GPU_CONTEXT_COMPUTE) can be used for render engine. |
| 194 | // Before Gen12, we only use MOS_GPU_NODE_3D and MOS_GPU_CONTEXT_RENDER. |
| 195 | if (skuTable && MEDIA_IS_SKU(skuTable, FtrCCSNode)) |
| 196 | { |
| 197 | #if (_DEBUG || _RELEASE_INTERNAL) |
| 198 | bool computeContextEnabled = false; |
| 199 | status = ReadUserSettingForDebug( |
| 200 | m_userSettingPtr, |
| 201 | computeContextEnabled, |
| 202 | __VPHAL_ENABLE_COMPUTE_CONTEXT, |
| 203 | MediaUserSetting::Group::Sequence); |
| 204 | |
| 205 | if (MOS_SUCCEEDED(status)) |
| 206 | { |
| 207 | m_ctrlValDefault.computeContextEnabled = computeContextEnabled ? true : false; |
| 208 | } |
| 209 | else |
| 210 | #endif |
| 211 | { |
| 212 | // Default value |
| 213 | m_ctrlValDefault.computeContextEnabled = true; |
| 214 | } |
| 215 | } |
| 216 | else |
| 217 | { |
| 218 | m_ctrlValDefault.computeContextEnabled = false; |
| 219 | } |
| 220 | VP_PUBLIC_NORMALMESSAGE("computeContextEnabled %d", m_ctrlValDefault.computeContextEnabled); |
| 221 | |
| 222 | // Read userSettingForDebug |
| 223 | CreateUserSettingForDebug(); |
| 224 | |
| 225 | if (m_vpPlatformInterface) |
| 226 | { |
| 227 | m_ctrlValDefault.eufusionBypassWaEnabled = m_vpPlatformInterface->IsEufusionBypassWaEnabled(); |
| 228 | m_ctrlValDefault.decompForInterlacedSurfWaEnabled = m_vpPlatformInterface->IsDecompForInterlacedSurfWaEnabled(); |
| 229 | } |
| 230 | else |
| 231 | { |
| 232 | // Should never come to here. |
| 233 | VP_PUBLIC_ASSERTMESSAGE("m_vpPlatformInterface == nullptr"); |
| 234 | } |
| 235 | VP_PUBLIC_NORMALMESSAGE("eufusionBypassWaEnabled %d", m_ctrlValDefault.eufusionBypassWaEnabled); |
| 236 | VP_PUBLIC_NORMALMESSAGE("decompForInterlacedSurfWaEnabled %d", m_ctrlValDefault.decompForInterlacedSurfWaEnabled); |
| 237 | |
| 238 | MT_LOG3(MT_VP_USERFEATURE_CTRL, MT_NORMAL, MT_VP_UF_CTRL_DISABLE_VEOUT, m_ctrlValDefault.disableVeboxOutput, |
| 239 | MT_VP_UF_CTRL_DISABLE_SFC, m_ctrlValDefault.disableSfc, MT_VP_UF_CTRL_CCS, m_ctrlValDefault.computeContextEnabled); |
| 240 | |
| 241 | #if (_DEBUG || _RELEASE_INTERNAL) |
| 242 | uint32_t globalLutMode = VPHAL_HDR_LUT_MODE_NONE; |
| 243 | status = ReadUserSetting( |
| 244 | m_userSettingPtr, |
| 245 | globalLutMode, |
| 246 | __VPHAL_HDR_LUT_MODE, |
| 247 | MediaUserSetting::Group::Sequence, |
| 248 | VPHAL_HDR_LUT_MODE_NONE, |
| 249 | true); |
| 250 | if (MOS_SUCCEEDED(status)) |
| 251 | { |
| 252 | m_ctrlValDefault.globalLutMode = (VPHAL_HDR_LUT_MODE)globalLutMode; |
| 253 | } |
| 254 | |
| 255 | bool gpuGenerate3DLUT = false; |
| 256 | status = ReadUserSetting( |
| 257 | m_userSettingPtr, |
| 258 | gpuGenerate3DLUT, |
| 259 | __VPHAL_HDR_GPU_GENERTATE_3DLUT, |
| 260 | MediaUserSetting::Group::Sequence, |
| 261 | false, |
| 262 | true); |
| 263 | if (MOS_SUCCEEDED(status)) |
| 264 | { |
| 265 | m_ctrlValDefault.gpuGenerate3DLUT = gpuGenerate3DLUT; |
| 266 | } |
| 267 | |
| 268 | bool disableAutoMode = false; |
| 269 | status = ReadUserSetting( |
| 270 | m_userSettingPtr, |
| 271 | disableAutoMode, |
| 272 | __VPHAL_HDR_DISABLE_AUTO_MODE, |
| 273 | MediaUserSetting::Group::Sequence, |
| 274 | false, |
| 275 | true); |
| 276 | if (MOS_SUCCEEDED(status)) |
| 277 | { |
| 278 | m_ctrlValDefault.disableAutoMode = disableAutoMode; |
| 279 | } |
| 280 | #endif |
| 281 | |
| 282 | uint32_t splitFramePortions = 1; |
| 283 | status = ReadUserSetting( |
| 284 | m_userSettingPtr, |
| 285 | splitFramePortions, |
| 286 | __VPHAL_HDR_SPLIT_FRAME_PORTIONS, |
| 287 | MediaUserSetting::Group::Sequence, |
| 288 | splitFramePortions, |
| 289 | true); |
| 290 | if (MOS_SUCCEEDED(status)) |
| 291 | { |
| 292 | m_ctrlValDefault.splitFramePortions = splitFramePortions; |
| 293 | } |
| 294 | |
| 295 | #if (_DEBUG || _RELEASE_INTERNAL) |
| 296 | std::string lut3DFilePath = ""; |
| 297 | status = ReadUserSetting( |
| 298 | m_userSettingPtr, |
| 299 | lut3DFilePath, |
| 300 | __VPHAL_3DLUT_FILE_PATH, |
| 301 | MediaUserSetting::Group::Sequence, |
| 302 | std::string(""), // Default empty string |
| 303 | true); // Use custom value |
| 304 | if (MOS_SUCCEEDED(status) && !lut3DFilePath.empty()) |
| 305 | { |
| 306 | m_ctrlValDefault.lut3DFilePath = lut3DFilePath; |
| 307 | m_ctrlValDefault.enable3DLutNewLayout = true; |
| 308 | VP_PUBLIC_NORMALMESSAGE("3DLUT new layout enabled with file: %s", lut3DFilePath.c_str()); |
| 309 | } |
| 310 | else |
| 311 | { |
| 312 | m_ctrlValDefault.enable3DLutNewLayout = false; |
| 313 | m_ctrlValDefault.lut3DFilePath = ""; |
| 314 | } |
| 315 | #endif |
| 316 | |
| 317 | //check vebox type |
| 318 | if (skuTable && (MEDIA_IS_SKU(skuTable, FtrVeboxTypeH))) |
| 319 | { |
| 320 | m_ctrlValDefault.veboxTypeH = true; |
| 321 | } |
| 322 | VP_PUBLIC_NORMALMESSAGE("veboxTypeH %d", m_ctrlValDefault.veboxTypeH); |
| 323 | |
| 324 | m_ctrlVal = m_ctrlValDefault; |
| 325 | } |
| 326 | |
| 327 | VpUserFeatureControl::~VpUserFeatureControl() |
| 328 | { |
| 329 | if (m_pOcaFeatureControlInfo) |
| 330 | { |
| 331 | MOS_FreeMemAndSetNull(m_pOcaFeatureControlInfo); |
| 332 | } |
| 333 | } |
| 334 | |
| 335 | MOS_STATUS VpUserFeatureControl::CreateUserSettingForDebug() |
| 336 | { |
| 337 | MOS_STATUS eRegKeyReadStatus = MOS_STATUS_SUCCESS; |
| 338 | #if ((_DEBUG || _RELEASE_INTERNAL) && !EMUL) |
| 339 | bool forceDecompressedOutput = false; |
| 340 | eRegKeyReadStatus = ReadUserSettingForDebug( |
| 341 | m_userSettingPtr, |
| 342 | forceDecompressedOutput, |
| 343 | __VPHAL_RNDR_FORCE_VP_DECOMPRESSED_OUTPUT, |
| 344 | MediaUserSetting::Group::Sequence); |
| 345 | if (MOS_SUCCEEDED(eRegKeyReadStatus)) |
| 346 | { |
| 347 | m_ctrlValDefault.forceDecompressedOutput = forceDecompressedOutput; |
| 348 | } |
| 349 | else |
| 350 | { |
| 351 | // Default value |
| 352 | m_ctrlValDefault.forceDecompressedOutput = false; |
| 353 | } |
| 354 | #endif |
| 355 | |
| 356 | #if (_DEBUG || _RELEASE_INTERNAL) |
| 357 | uint32_t force3DLutInterpolation = 0; |
| 358 | eRegKeyReadStatus = ReadUserSettingForDebug( |
| 359 | m_userSettingPtr, |
| 360 | force3DLutInterpolation, |
| 361 | __VPHAL_FORCE_3DLUT_INTERPOLATION, |
| 362 | MediaUserSetting::Group::Sequence); |
| 363 | if (MOS_SUCCEEDED(eRegKeyReadStatus)) |
| 364 | { |
| 365 | m_ctrlValDefault.force3DLutInterpolation = force3DLutInterpolation; |
| 366 | } |
| 367 | else |
| 368 | { |
| 369 | // Default value |
| 370 | m_ctrlValDefault.force3DLutInterpolation = 0; |
| 371 | } |
| 372 | |
| 373 | uint32_t is3DLutKernelOnly = 0; |
| 374 | eRegKeyReadStatus = ReadUserSettingForDebug( |
| 375 | m_userSettingPtr, |
| 376 | is3DLutKernelOnly, |
| 377 | __VPHAL_FORCE_VP_3DLUT_KERNEL_ONLY, |
| 378 | MediaUserSetting::Group::Sequence); |
| 379 | if (MOS_SUCCEEDED(eRegKeyReadStatus)) |
| 380 | { |
| 381 | m_ctrlValDefault.is3DLutKernelOnly = is3DLutKernelOnly; |
| 382 | } |
| 383 | else |
| 384 | { |
| 385 | // Default value |
| 386 | m_ctrlValDefault.is3DLutKernelOnly = 0; |
| 387 | } |
| 388 | |
| 389 | //SFC NV12/P010 Linear Output. |
| 390 | uint32_t enabledSFCNv12P010LinearOutput = 0; |
| 391 | eRegKeyReadStatus = ReadUserSettingForDebug( |
| 392 | m_userSettingPtr, |
| 393 | enabledSFCNv12P010LinearOutput, |
| 394 | __VPHAL_ENABLE_SFC_NV12_P010_LINEAR_OUTPUT, |
| 395 | MediaUserSetting::Group::Sequence); |
| 396 | if (MOS_SUCCEEDED(eRegKeyReadStatus)) |
| 397 | { |
| 398 | m_ctrlValDefault.enabledSFCNv12P010LinearOutput = enabledSFCNv12P010LinearOutput; |
| 399 | } |
| 400 | else |
| 401 | { |
| 402 | // Default value |
| 403 | m_ctrlValDefault.enabledSFCNv12P010LinearOutput = 0; |
| 404 | } |
| 405 | |
| 406 | //SFC RGBP Linear/Tile RGB24 Linear Output. |
| 407 | uint32_t enabledSFCRGBPRGB24Output = 0; |
| 408 | eRegKeyReadStatus =ReadUserSettingForDebug( |
| 409 | m_userSettingPtr, |
| 410 | enabledSFCRGBPRGB24Output, |
| 411 | __VPHAL_ENABLE_SFC_RGBP_RGB24_OUTPUT, |
| 412 | MediaUserSetting::Group::Sequence); |
| 413 | if (MOS_SUCCEEDED(eRegKeyReadStatus)) |
| 414 | { |
| 415 | m_ctrlValDefault.enabledSFCRGBPRGB24Output = enabledSFCRGBPRGB24Output; |
| 416 | } |
| 417 | else |
| 418 | { |
| 419 | // Default value |
| 420 | m_ctrlValDefault.enabledSFCRGBPRGB24Output = 0; |
| 421 | } |
| 422 | |
| 423 | //Enable IFNCC report |
| 424 | bool enableIFNCC = false; |
| 425 | eRegKeyReadStatus = ReadUserSettingForDebug( |
| 426 | m_userSettingPtr, |
| 427 | enableIFNCC, |
| 428 | __MEDIA_USER_FEATURE_VALUE_ENABLE_IFNCC, |
| 429 | MediaUserSetting::Group::Sequence); |
| 430 | if (MOS_SUCCEEDED(eRegKeyReadStatus)) |
| 431 | { |
| 432 | m_ctrlValDefault.enableIFNCC = enableIFNCC; |
| 433 | VP_PUBLIC_NORMALMESSAGE("Report IFNCC Reg Key Enabled. Will Report IFNCC Reg key at the end of VP pipeline."); |
| 434 | } |
| 435 | else |
| 436 | { |
| 437 | // Default value |
| 438 | m_ctrlValDefault.enableIFNCC = false; |
| 439 | } |
| 440 | |
| 441 | bool bEnableOCL3DLut = false; |
| 442 | eRegKeyReadStatus = ReadUserSettingForDebug( |
| 443 | m_userSettingPtr, |
| 444 | bEnableOCL3DLut, |
| 445 | __MEDIA_USER_FEATURE_VALUE_ENABLE_VP_OCL_3DLUT, |
| 446 | MediaUserSetting::Group::Sequence); |
| 447 | if (MOS_SUCCEEDED(eRegKeyReadStatus)) |
| 448 | { |
| 449 | m_ctrlValDefault.enableOcl3DLut = bEnableOCL3DLut ? VP_CTRL_ENABLE : VP_CTRL_DISABLE; |
| 450 | } |
| 451 | else |
| 452 | { |
| 453 | // Default value |
| 454 | m_ctrlValDefault.enableOcl3DLut = VP_CTRL_DEFAULT; |
| 455 | } |
| 456 | |
| 457 | bool bForceOclFC = false; |
| 458 | eRegKeyReadStatus = ReadUserSettingForDebug( |
| 459 | m_userSettingPtr, |
| 460 | bForceOclFC, |
| 461 | __MEDIA_USER_FEATURE_VALUE_ENABLE_VP_OCL_FC, |
| 462 | MediaUserSetting::Group::Sequence); |
| 463 | if (MOS_SUCCEEDED(eRegKeyReadStatus)) |
| 464 | { |
| 465 | m_ctrlValDefault.forceOclFC = bForceOclFC ? VP_CTRL_ENABLE : VP_CTRL_DISABLE; |
| 466 | } |
| 467 | else |
| 468 | { |
| 469 | // Default value |
| 470 | m_ctrlValDefault.forceOclFC = VP_CTRL_DEFAULT; |
| 471 | } |
| 472 | |
| 473 | bool bDisableOclFcFp = false; |
| 474 | eRegKeyReadStatus = ReadUserSettingForDebug( |
| 475 | m_userSettingPtr, |
| 476 | bDisableOclFcFp, |
| 477 | __MEDIA_USER_FEATURE_VALUE_DISABLE_VP_OCL_FC_FP, |
| 478 | MediaUserSetting::Group::Sequence); |
| 479 | if (MOS_SUCCEEDED(eRegKeyReadStatus)) |
| 480 | { |
| 481 | m_ctrlValDefault.bDisableOclFcFp = bDisableOclFcFp; |
| 482 | } |
| 483 | else |
| 484 | { |
| 485 | // Default value |
| 486 | m_ctrlValDefault.bDisableOclFcFp = false; |
| 487 | } |
| 488 | #endif |
| 489 | #if (_DEBUG || _RELEASE_INTERNAL) |
| 490 | bool enableSFCLinearOutputByTileConvert = 0; |
| 491 | eRegKeyReadStatus = ReadUserSettingForDebug( |
| 492 | m_userSettingPtr, |
| 493 | enableSFCLinearOutputByTileConvert, |
| 494 | __MEDIA_USER_FEATURE_VALUE_ENABLE_VESFC_LINEAR_OUTPUT_BY_TILECONVERT, |
| 495 | MediaUserSetting::Group::Device); |
| 496 | if (MOS_SUCCEEDED(eRegKeyReadStatus)) |
| 497 | { |
| 498 | m_ctrlValDefault.enableSFCLinearOutputByTileConvert = enableSFCLinearOutputByTileConvert; |
| 499 | } |
| 500 | else |
| 501 | #endif |
| 502 | { |
| 503 | if (m_osInterface->pfnGetWaTable) |
| 504 | { |
| 505 | auto waTable = m_osInterface->pfnGetWaTable(m_osInterface); |
| 506 | VP_PUBLIC_CHK_NULL_RETURN(waTable); |
| 507 | // Default value |
| 508 | m_ctrlValDefault.enableSFCLinearOutputByTileConvert = MEDIA_IS_WA(waTable, Wa_15016458807); |
| 509 | } |
| 510 | } |
| 511 | VP_PUBLIC_NORMALMESSAGE("enableSFCLinearOutputByTileConvert value is set as %d.", m_ctrlValDefault.enableSFCLinearOutputByTileConvert); |
| 512 | |
| 513 | #if (_DEBUG || _RELEASE_INTERNAL) |
| 514 | uint32_t fallbackScalingToRender8K = 0; |
| 515 | eRegKeyReadStatus = ReadUserSettingForDebug( |
| 516 | m_userSettingPtr, |
| 517 | fallbackScalingToRender8K, |
| 518 | __MEDIA_USER_FEATURE_VALUE_FALLBACK_SCALING_TO_RENDER_8K, |
| 519 | MediaUserSetting::Group::Sequence, |
| 520 | true, |
| 521 | true); |
| 522 | if (MOS_SUCCEEDED(eRegKeyReadStatus)) |
| 523 | { |
| 524 | m_ctrlValDefault.fallbackScalingToRender8K = fallbackScalingToRender8K; |
| 525 | } |
| 526 | else |
| 527 | #endif |
| 528 | { |
| 529 | // Do not set fallbackScalingToRender8K if render is disabled. This is for internal vesfc usage (e.g., 8k preenc) that should not fallback to render. |
| 530 | if (m_vpPlatformInterface && !m_vpPlatformInterface->IsRenderDisabled()) |
| 531 | { |
| 532 | if (m_osInterface->pfnGetWaTable) |
| 533 | { |
| 534 | auto *waTable = m_osInterface->pfnGetWaTable(m_osInterface); |
| 535 | VP_PUBLIC_CHK_NULL_RETURN(waTable); |
| 536 | m_ctrlValDefault.fallbackScalingToRender8K = MEDIA_IS_WA(waTable, Wa_16025683853); |
| 537 | } |
| 538 | } |
| 539 | } |
| 540 | VP_PUBLIC_NORMALMESSAGE("fallbackScalingToRender8K %d", m_ctrlValDefault.fallbackScalingToRender8K); |
| 541 | |
| 542 | return MOS_STATUS_SUCCESS; |
| 543 | } |
| 544 | |
| 545 | MOS_STATUS VpUserFeatureControl::UpdateOnNewPipe(SwFilterPipe *swFilterPipe, uint32_t pipeCnt) |
| 546 | { |
| 547 | VP_PUBLIC_CHK_NULL_RETURN(swFilterPipe); |
| 548 | |
| 549 | // if more than one swFilterPipe, then update the swFilterPipe config |
| 550 | if (pipeCnt > 1) |
| 551 | { |
| 552 | if (swFilterPipe->IsForceToRender()) |
| 553 | { |
| 554 | m_ctrlVal.disableSfc = true; |
| 555 | m_ctrlVal.disableVeboxOutput = true; |
| 556 | VP_PUBLIC_NORMALMESSAGE("Disable SFC and vebox output as task is forced to render."); |
| 557 | } |
| 558 | else |
| 559 | { |
| 560 | m_ctrlVal.disableSfc = false; |
| 561 | m_ctrlVal.disableVeboxOutput = false; |
| 562 | } |
| 563 | } |
| 564 | |
| 565 | return MOS_STATUS_SUCCESS; |
| 566 | } |
| 567 | |
| 568 | MOS_STATUS VpUserFeatureControl::Update(PVP_PIPELINE_PARAMS params) |
| 569 | { |
| 570 | VP_PUBLIC_CHK_NULL_RETURN(params); |
| 571 | |
| 572 | m_ctrlVal = m_ctrlValDefault; |
| 573 | |
| 574 | if (params->bForceToRender) |
| 575 | { |
| 576 | m_ctrlVal.disableSfc = true; |
| 577 | m_ctrlVal.disableVeboxOutput = true; |
| 578 | VP_PUBLIC_NORMALMESSAGE("Disable SFC and vebox output as task is forced to render."); |
| 579 | } |
| 580 | if (params->renderCommandStreamType == VPHAL_RENDER_COMMAND_STREAM_RCS) |
| 581 | { |
| 582 | m_ctrlVal.computeContextEnabled = false; |
| 583 | } |
| 584 | |
| 585 | return MOS_STATUS_SUCCESS; |
| 586 | } |
| 587 | |
| 588 | PMOS_OCA_LOG_USER_FEATURE_CONTROL_INFO VpUserFeatureControl::GetOcaFeautreControlInfo() |
| 589 | { |
| 590 | if (nullptr == m_pOcaFeatureControlInfo) |
| 591 | { |
| 592 | m_pOcaFeatureControlInfo = (PMOS_OCA_LOG_USER_FEATURE_CONTROL_INFO)MOS_AllocAndZeroMemory(sizeof(MOS_OCA_LOG_USER_FEATURE_CONTROL_INFO)); |
| 593 | } |
| 594 | return m_pOcaFeatureControlInfo; |
| 595 | } |
| 596 | |
| 597 | |
| 598 | bool VpUserFeatureControl::EnableOclFC() |
| 599 | { |
| 600 | bool bEnableOclFC = false; |
| 601 | if (m_ctrlVal.forceOclFC == VP_CTRL_ENABLE) |
| 602 | { |
| 603 | bEnableOclFC = true; |
| 604 | } |
| 605 | else if (m_ctrlVal.forceOclFC == VP_CTRL_DISABLE) |
| 606 | { |
| 607 | bEnableOclFC = false; |
| 608 | } |
| 609 | else // if (m_ctrlVal.forceOclFC == VP_CTRL_DEFAULT) |
| 610 | { |
| 611 | bEnableOclFC = (m_vpPlatformInterface && m_vpPlatformInterface->IsOclKernelEnabled()); |
| 612 | } |
| 613 | VP_PUBLIC_NORMALMESSAGE("EnableOclFC set as %d", bEnableOclFC); |
| 614 | return bEnableOclFC; |
| 615 | } |
| 616 | |
| 617 | bool VpUserFeatureControl::EnableOcl3DLut() |
| 618 | { |
| 619 | bool bEnableOcl3DLut = false; |
| 620 | if (m_ctrlVal.enableOcl3DLut == VP_CTRL_ENABLE) |
| 621 | { |
| 622 | bEnableOcl3DLut = true; |
| 623 | } |
| 624 | else if (m_ctrlVal.enableOcl3DLut == VP_CTRL_DISABLE) |
| 625 | { |
| 626 | bEnableOcl3DLut = false; |
| 627 | } |
| 628 | else // if (m_ctrlVal.enableOcl3DLut == VP_CTRL_DEFAULT) |
| 629 | { |
| 630 | bEnableOcl3DLut = (m_vpPlatformInterface && m_vpPlatformInterface->IsOclKernelEnabled()); |
| 631 | } |
| 632 | VP_PUBLIC_NORMALMESSAGE("EnableOcl3DLut set as %d", bEnableOcl3DLut); |
| 633 | return bEnableOcl3DLut; |
| 634 | } |