From a3745c28a36d30cecf7f4afd2caad87f58523a94 Mon Sep 17 00:00:00 2001 From: Krzysztof Gibala Date: Thu, 28 Apr 2022 09:05:59 +0000 Subject: [PATCH] Create peekGmmHelper function in CSR Related-To: NEO-6523 Signed-off-by: Krzysztof Gibala --- shared/source/command_stream/command_stream_receiver.cpp | 4 ++++ shared/source/command_stream/command_stream_receiver.h | 1 + .../command_stream_receiver_simulated_tests.cpp | 8 ++++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/shared/source/command_stream/command_stream_receiver.cpp b/shared/source/command_stream/command_stream_receiver.cpp index 9dd5e38a35..57b76e2def 100644 --- a/shared/source/command_stream/command_stream_receiver.cpp +++ b/shared/source/command_stream/command_stream_receiver.cpp @@ -236,6 +236,10 @@ OSInterface *CommandStreamReceiver::getOSInterface() const { return executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->osInterface.get(); } +GmmHelper *CommandStreamReceiver::peekGmmHelper() const { + return executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->gmmHelper.get(); +} + uint64_t CommandStreamReceiver::getWorkPartitionAllocationGpuAddress() const { if (isStaticWorkPartitioningEnabled()) { return getWorkPartitionAllocation()->getGpuAddress(); diff --git a/shared/source/command_stream/command_stream_receiver.h b/shared/source/command_stream/command_stream_receiver.h index d0286c9fc3..baa5bc7d0b 100644 --- a/shared/source/command_stream/command_stream_receiver.h +++ b/shared/source/command_stream/command_stream_receiver.h @@ -118,6 +118,7 @@ class CommandStreamReceiver { LinearStream &getCS(size_t minRequiredSize = 1024u); OSInterface *getOSInterface() const; ExecutionEnvironment &peekExecutionEnvironment() const { return executionEnvironment; }; + GmmHelper *peekGmmHelper() const; MOCKABLE_VIRTUAL void setTagAllocation(GraphicsAllocation *allocation); GraphicsAllocation *getTagAllocation() const { diff --git a/shared/test/unit_test/command_stream/command_stream_receiver_simulated_tests.cpp b/shared/test/unit_test/command_stream/command_stream_receiver_simulated_tests.cpp index b7818385a8..9e99e6b8a7 100644 --- a/shared/test/unit_test/command_stream/command_stream_receiver_simulated_tests.cpp +++ b/shared/test/unit_test/command_stream/command_stream_receiver_simulated_tests.cpp @@ -327,7 +327,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenCompressedAllocationWhenCloningPageTa csr->setupContext(osContext); auto mockHardwareContext = static_cast(csr->hardwareContextController->hardwareContexts[0].get()); - MockGmm gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + MockGmm gmm(csr->peekGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); gmm.isCompressionEnabled = true; int dummy = 1; @@ -357,7 +357,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenUncachedAllocationWhenCloningPageTabl csr->setupContext(osContext); auto mockHardwareContext = static_cast(csr->hardwareContextController->hardwareContexts[0].get()); - MockGmm gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED, false, {}, true); + MockGmm gmm(csr->peekGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED, false, {}, true); gmm.isCompressionEnabled = false; int dummy = 1; @@ -417,7 +417,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenCompressedTileInstancedAllocationWhen csr->multiOsContextCapable = true; - MockGmm gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); + MockGmm gmm(csr->peekGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true); gmm.isCompressionEnabled = true; int dummy = 1; @@ -456,7 +456,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenUncachedTileInstancedAllocationWhenWr csr->multiOsContextCapable = true; - MockGmm gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED, false, {}, true); + MockGmm gmm(csr->peekGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED, false, {}, true); gmm.isCompressionEnabled = false; int dummy = 1;