From 684b3e1774a6cdba2abe7537ef245f3cddde4499 Mon Sep 17 00:00:00 2001 From: "Dunajski, Bartosz" Date: Mon, 25 Nov 2019 09:18:26 +0100 Subject: [PATCH] Improve aux translation restrictions check Change-Id: I6e5bd014fef60f89365f536c219ab7d399c51265 Signed-off-by: Dunajski, Bartosz --- core/helpers/hw_helper.h | 2 +- core/helpers/hw_helper_base.inl | 3 ++- runtime/command_queue/enqueue_common.h | 4 ++-- unit_tests/helpers/hw_helper_tests.cpp | 14 ++++++++++---- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/core/helpers/hw_helper.h b/core/helpers/hw_helper.h index 3534c2744e..93455c5903 100644 --- a/core/helpers/hw_helper.h +++ b/core/helpers/hw_helper.h @@ -180,7 +180,7 @@ class HwHelperHw : public HwHelper { static AuxTranslationMode getAuxTranslationMode(); - static bool isBlitAuxTranslationRequired(const MultiDispatchInfo &multiDispatchInfo); + static bool isBlitAuxTranslationRequired(const HardwareInfo &hwInfo, const MultiDispatchInfo &multiDispatchInfo); protected: static const AuxTranslationMode defaultAuxTranslationMode; diff --git a/core/helpers/hw_helper_base.inl b/core/helpers/hw_helper_base.inl index ef1afef0c7..22f8ae2357 100644 --- a/core/helpers/hw_helper_base.inl +++ b/core/helpers/hw_helper_base.inl @@ -167,8 +167,9 @@ AuxTranslationMode HwHelperHw::getAuxTranslationMode() { } template -bool HwHelperHw::isBlitAuxTranslationRequired(const MultiDispatchInfo &multiDispatchInfo) { +bool HwHelperHw::isBlitAuxTranslationRequired(const HardwareInfo &hwInfo, const MultiDispatchInfo &multiDispatchInfo) { return (HwHelperHw::getAuxTranslationMode() == AuxTranslationMode::Blit) && + hwInfo.capabilityTable.blitterOperationsSupported && multiDispatchInfo.getMemObjsForAuxTranslation() && (multiDispatchInfo.getMemObjsForAuxTranslation()->size() > 0); } diff --git a/runtime/command_queue/enqueue_common.h b/runtime/command_queue/enqueue_common.h index c74ad42190..c2da74d899 100644 --- a/runtime/command_queue/enqueue_common.h +++ b/runtime/command_queue/enqueue_common.h @@ -90,7 +90,7 @@ void CommandQueueHw::enqueueHandler(Surface *(&surfaces)[surfaceCount } } - if (HwHelperHw::isBlitAuxTranslationRequired(multiDispatchInfo)) { + if (HwHelperHw::isBlitAuxTranslationRequired(device->getHardwareInfo(), multiDispatchInfo)) { setupBlitAuxTranslation(multiDispatchInfo); } @@ -222,7 +222,7 @@ void CommandQueueHw::enqueueHandler(Surface **surfacesForResidency, blockedCommandsData, surfacesForResidency, numSurfaceForResidency); auto commandStreamStart = commandStream.getUsed(); - if (HwHelperHw::isBlitAuxTranslationRequired(multiDispatchInfo)) { + if (HwHelperHw::isBlitAuxTranslationRequired(device->getHardwareInfo(), multiDispatchInfo)) { processDispatchForBlitAuxTranslation(multiDispatchInfo, blitPropertiesContainer, timestampPacketDependencies, eventsRequest, blockQueue); } diff --git a/unit_tests/helpers/hw_helper_tests.cpp b/unit_tests/helpers/hw_helper_tests.cpp index eb13961670..eb58737f4a 100644 --- a/unit_tests/helpers/hw_helper_tests.cpp +++ b/unit_tests/helpers/hw_helper_tests.cpp @@ -688,19 +688,25 @@ HWTEST_F(HwHelperTest, givenMultiDispatchInfoWhenAskingForAuxTranslationThenChec MockBuffer buffer; MemObjsForAuxTranslation memObjects; MultiDispatchInfo multiDispatchInfo; + HardwareInfo hwInfo = **platformDevices; + hwInfo.capabilityTable.blitterOperationsSupported = true; DebugManager.flags.ForceAuxTranslationMode.set(static_cast(AuxTranslationMode::Blit)); - EXPECT_FALSE(HwHelperHw::isBlitAuxTranslationRequired(multiDispatchInfo)); + EXPECT_FALSE(HwHelperHw::isBlitAuxTranslationRequired(hwInfo, multiDispatchInfo)); multiDispatchInfo.setMemObjsForAuxTranslation(memObjects); - EXPECT_FALSE(HwHelperHw::isBlitAuxTranslationRequired(multiDispatchInfo)); + EXPECT_FALSE(HwHelperHw::isBlitAuxTranslationRequired(hwInfo, multiDispatchInfo)); memObjects.insert(&buffer); - EXPECT_TRUE(HwHelperHw::isBlitAuxTranslationRequired(multiDispatchInfo)); + EXPECT_TRUE(HwHelperHw::isBlitAuxTranslationRequired(hwInfo, multiDispatchInfo)); + hwInfo.capabilityTable.blitterOperationsSupported = false; + EXPECT_FALSE(HwHelperHw::isBlitAuxTranslationRequired(hwInfo, multiDispatchInfo)); + + hwInfo.capabilityTable.blitterOperationsSupported = true; DebugManager.flags.ForceAuxTranslationMode.set(static_cast(AuxTranslationMode::Builtin)); - EXPECT_FALSE(HwHelperHw::isBlitAuxTranslationRequired(multiDispatchInfo)); + EXPECT_FALSE(HwHelperHw::isBlitAuxTranslationRequired(hwInfo, multiDispatchInfo)); } HWTEST_F(HwHelperTest, givenDebugVariableSetWhenAskingForAuxTranslationModeThenReturnCorrectValue) {