From 8fe1a460f84b99c6a663e24f3aac7b55a2489fd1 Mon Sep 17 00:00:00 2001 From: Zbigniew Zdanowicz Date: Thu, 14 Mar 2024 10:15:48 +0000 Subject: [PATCH] refactor: simplify isDcFlushAllowed implementation Signed-off-by: Zbigniew Zdanowicz --- shared/source/gen11/hw_cmds_base.h | 2 ++ shared/source/gen12lp/hw_cmds_base.h | 2 ++ shared/source/gen8/hw_cmds_base.h | 2 ++ shared/source/gen9/hw_cmds_base.h | 2 ++ shared/source/os_interface/product_helper.inl | 3 ++- shared/source/xe_hpc_core/hw_cmds_pvc.h | 4 +++- .../os_agnostic_product_helper_xe_hpc_core.inl | 11 ----------- shared/source/xe_hpg_core/hw_cmds_xe_hpg_core_base.h | 2 ++ 8 files changed, 15 insertions(+), 13 deletions(-) diff --git a/shared/source/gen11/hw_cmds_base.h b/shared/source/gen11/hw_cmds_base.h index 9188fe7d90..90d3d8cb8d 100644 --- a/shared/source/gen11/hw_cmds_base.h +++ b/shared/source/gen11/hw_cmds_base.h @@ -86,6 +86,8 @@ struct Gen11 { } }; + static constexpr bool isDcFlushAllowed = true; + static_assert(sizeof(DataPortBindlessSurfaceExtendedMessageDescriptor) == sizeof(DataPortBindlessSurfaceExtendedMessageDescriptor::packed), ""); }; struct Gen11Family : public Gen11 { diff --git a/shared/source/gen12lp/hw_cmds_base.h b/shared/source/gen12lp/hw_cmds_base.h index 02f989e600..159d38b765 100644 --- a/shared/source/gen12lp/hw_cmds_base.h +++ b/shared/source/gen12lp/hw_cmds_base.h @@ -85,6 +85,8 @@ struct Gen12Lp { } }; + static constexpr bool isDcFlushAllowed = true; + static_assert(sizeof(DataPortBindlessSurfaceExtendedMessageDescriptor) == sizeof(DataPortBindlessSurfaceExtendedMessageDescriptor::packed), ""); }; struct Gen12LpFamily : public Gen12Lp { diff --git a/shared/source/gen8/hw_cmds_base.h b/shared/source/gen8/hw_cmds_base.h index 2ebd69d24f..dd31473065 100644 --- a/shared/source/gen8/hw_cmds_base.h +++ b/shared/source/gen8/hw_cmds_base.h @@ -87,6 +87,8 @@ struct Gen8 { } }; + static constexpr bool isDcFlushAllowed = true; + static_assert(sizeof(DataPortBindlessSurfaceExtendedMessageDescriptor) == sizeof(DataPortBindlessSurfaceExtendedMessageDescriptor::packed), ""); }; struct Gen8Family : public Gen8 { diff --git a/shared/source/gen9/hw_cmds_base.h b/shared/source/gen9/hw_cmds_base.h index b847eab8b5..a052a24100 100644 --- a/shared/source/gen9/hw_cmds_base.h +++ b/shared/source/gen9/hw_cmds_base.h @@ -86,6 +86,8 @@ struct Gen9 { } }; + static constexpr bool isDcFlushAllowed = true; + static_assert(sizeof(DataPortBindlessSurfaceExtendedMessageDescriptor) == sizeof(DataPortBindlessSurfaceExtendedMessageDescriptor::packed), ""); }; diff --git a/shared/source/os_interface/product_helper.inl b/shared/source/os_interface/product_helper.inl index b9c474a9ba..3dafb4cb1b 100644 --- a/shared/source/os_interface/product_helper.inl +++ b/shared/source/os_interface/product_helper.inl @@ -393,7 +393,8 @@ bool ProductHelperHw::isKmdMigrationSupported() const { template bool ProductHelperHw::isDcFlushAllowed() const { - auto dcFlushAllowed = true; + using GfxProduct = typename HwMapper::GfxProduct; + bool dcFlushAllowed = GfxProduct::isDcFlushAllowed; if (debugManager.flags.AllowDcFlush.get() != -1) { dcFlushAllowed = debugManager.flags.AllowDcFlush.get(); diff --git a/shared/source/xe_hpc_core/hw_cmds_pvc.h b/shared/source/xe_hpc_core/hw_cmds_pvc.h index 736d7a0f56..b53667e744 100644 --- a/shared/source/xe_hpc_core/hw_cmds_pvc.h +++ b/shared/source/xe_hpc_core/hw_cmds_pvc.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2023 Intel Corporation + * Copyright (C) 2021-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -67,6 +67,8 @@ struct PVC : public XeHpcCoreFamily { return (revId <= 0x3); } static constexpr uint32_t pvcSteppingBits = 0b111; + + static constexpr bool isDcFlushAllowed = false; }; class PvcHwConfig : public PVC { diff --git a/shared/source/xe_hpc_core/os_agnostic_product_helper_xe_hpc_core.inl b/shared/source/xe_hpc_core/os_agnostic_product_helper_xe_hpc_core.inl index 17388e95ee..0a2714755a 100644 --- a/shared/source/xe_hpc_core/os_agnostic_product_helper_xe_hpc_core.inl +++ b/shared/source/xe_hpc_core/os_agnostic_product_helper_xe_hpc_core.inl @@ -16,17 +16,6 @@ bool ProductHelperHw::isDirectSubmissionSupported(ReleaseHelper *rel return true; } -template <> -bool ProductHelperHw::isDcFlushAllowed() const { - auto dcFlushAllowed = false; - - if (debugManager.flags.AllowDcFlush.get() != -1) { - dcFlushAllowed = debugManager.flags.AllowDcFlush.get(); - } - - return dcFlushAllowed; -} - template <> void ProductHelperHw::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) const { using SAMPLER_STATE = typename XeHpcCoreFamily::SAMPLER_STATE; diff --git a/shared/source/xe_hpg_core/hw_cmds_xe_hpg_core_base.h b/shared/source/xe_hpg_core/hw_cmds_xe_hpg_core_base.h index e4e8e16fd7..0bf457e523 100644 --- a/shared/source/xe_hpg_core/hw_cmds_xe_hpg_core_base.h +++ b/shared/source/xe_hpg_core/hw_cmds_xe_hpg_core_base.h @@ -92,6 +92,8 @@ struct XeHpgCore { } }; + static constexpr bool isDcFlushAllowed = true; + static_assert(sizeof(DataPortBindlessSurfaceExtendedMessageDescriptor) == sizeof(DataPortBindlessSurfaceExtendedMessageDescriptor::packed), ""); };