From 20e0d8c7abac2f3473dd2c6ac0572fd0246b1f25 Mon Sep 17 00:00:00 2001 From: "Milczarek, Slawomir" Date: Fri, 26 Apr 2019 17:04:03 +0200 Subject: [PATCH] Add flag to control Binding Table Base Address programming Related-To: NEO-2747 Change-Id: I30b52875f37b4f75a0b63eb199fc388d1e495dec Signed-off-by: Milczarek, Slawomir --- .../command_stream_receiver.cpp | 1 + .../command_stream/command_stream_receiver.h | 1 + .../command_stream_receiver_hw.inl | 5 +++++ ...and_stream_receiver_flush_task_1_tests.cpp | 19 +++++++++++++++++++ .../libult/ult_command_stream_receiver.h | 1 + 5 files changed, 27 insertions(+) diff --git a/runtime/command_stream/command_stream_receiver.cpp b/runtime/command_stream/command_stream_receiver.cpp index 9013f3d2dd..89333f86db 100644 --- a/runtime/command_stream/command_stream_receiver.cpp +++ b/runtime/command_stream/command_stream_receiver.cpp @@ -223,6 +223,7 @@ GraphicsAllocation *CommandStreamReceiver::getScratchAllocation() { void CommandStreamReceiver::initProgrammingFlags() { isPreambleSent = false; GSBAFor32BitProgrammed = false; + bindingTableBaseAddressRequired = true; mediaVfeStateDirty = true; lastVmeSubslicesConfig = false; diff --git a/runtime/command_stream/command_stream_receiver.h b/runtime/command_stream/command_stream_receiver.h index 2951a07bd6..a6dddaa31e 100644 --- a/runtime/command_stream/command_stream_receiver.h +++ b/runtime/command_stream/command_stream_receiver.h @@ -238,6 +238,7 @@ class CommandStreamReceiver { bool isPreambleSent = false; bool isStateSipSent = false; bool GSBAFor32BitProgrammed = false; + bool bindingTableBaseAddressRequired = false; bool mediaVfeStateDirty = true; bool lastVmeSubslicesConfig = false; bool disableL3Cache = false; diff --git a/runtime/command_stream/command_stream_receiver_hw.inl b/runtime/command_stream/command_stream_receiver_hw.inl index b12fdfe886..573c91cbb5 100644 --- a/runtime/command_stream/command_stream_receiver_hw.inl +++ b/runtime/command_stream/command_stream_receiver_hw.inl @@ -328,8 +328,13 @@ CompletionStamp CommandStreamReceiverHw::flushTask( dispatchFlags); if (sshDirty) { + bindingTableBaseAddressRequired = true; + } + + if (bindingTableBaseAddressRequired) { StateBaseAddressHelper::programBindingTableBaseAddress(commandStreamCSR, ssh, stateBaseAddressCmdOffset, device.getGmmHelper()); + bindingTableBaseAddressRequired = false; } programStateSip(commandStreamCSR, device); diff --git a/unit_tests/command_stream/command_stream_receiver_flush_task_1_tests.cpp b/unit_tests/command_stream/command_stream_receiver_flush_task_1_tests.cpp index 1df7db5509..02f3d71b68 100644 --- a/unit_tests/command_stream/command_stream_receiver_flush_task_1_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_flush_task_1_tests.cpp @@ -472,6 +472,25 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, preambleShouldBeSentIfNeverSent) { EXPECT_GT(commandStreamReceiver.commandStream.getUsed(), 0u); } +HWTEST_F(CommandStreamReceiverFlushTaskTests, givenFlushTaskWhenInitProgrammingFlagsIsCalledThenBindingTableBaseAddressRequiredIsSetCorrecty) { + auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); + + commandStreamReceiver.initProgrammingFlags(); + EXPECT_TRUE(commandStreamReceiver.bindingTableBaseAddressRequired); + + flushTask(commandStreamReceiver); + EXPECT_FALSE(commandStreamReceiver.bindingTableBaseAddressRequired); +} + +HWTEST_F(CommandStreamReceiverFlushTaskTests, givenFlushTaskWhenInitProgrammingFlagsIsNotCalledThenBindingTableBaseAddressRequiredIsSetCorrectly) { + auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); + + EXPECT_FALSE(commandStreamReceiver.bindingTableBaseAddressRequired); + + flushTask(commandStreamReceiver); + EXPECT_FALSE(commandStreamReceiver.bindingTableBaseAddressRequired); +} + HWTEST_F(CommandStreamReceiverFlushTaskTests, pipelineSelectShouldBeSentIfNeverSentPreambleAndMediaSamplerRequirementChanged) { auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); commandStreamReceiver.isPreambleSent = false; diff --git a/unit_tests/libult/ult_command_stream_receiver.h b/unit_tests/libult/ult_command_stream_receiver.h index 7bbc848096..74e3a6319c 100644 --- a/unit_tests/libult/ult_command_stream_receiver.h +++ b/unit_tests/libult/ult_command_stream_receiver.h @@ -31,6 +31,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw, publ using BaseClass::programPreamble; using BaseClass::programStateSip; using BaseClass::sshState; + using BaseClass::CommandStreamReceiver::bindingTableBaseAddressRequired; using BaseClass::CommandStreamReceiver::cleanupResources; using BaseClass::CommandStreamReceiver::commandStream; using BaseClass::CommandStreamReceiver::disableL3Cache;