From 6fdde4228982ba561306f26062448b1cb6f159e4 Mon Sep 17 00:00:00 2001 From: "Mrozek, Michal" Date: Fri, 18 May 2018 08:42:37 -0700 Subject: [PATCH] Clean not used methods from linear stream. Change-Id: Ib6775e346eb1a971c9ad5bc511c4226f1c53ecaf --- runtime/command_stream/linear_stream.h | 10 ----- .../command_stream/linear_stream_tests.cpp | 45 +------------------ .../gen_commands_common_validation.h | 2 +- 3 files changed, 2 insertions(+), 55 deletions(-) diff --git a/runtime/command_stream/linear_stream.h b/runtime/command_stream/linear_stream.h index 2c69180c5e..556961ad6d 100644 --- a/runtime/command_stream/linear_stream.h +++ b/runtime/command_stream/linear_stream.h @@ -37,8 +37,6 @@ class LinearStream { LinearStream(void *buffer, size_t bufferSize); LinearStream(GraphicsAllocation *buffer); void *getCpuBase() const; - uint64_t getGpuBase() const; - uint64_t getCurrentGpuOffsetFromHeapBase() const; void *getSpace(size_t size); size_t getMaxAvailableSpace() const; size_t getAvailableSpace() const; @@ -65,14 +63,6 @@ inline void *LinearStream::getCpuBase() const { return buffer; } -inline uint64_t LinearStream::getGpuBase() const { - return this->graphicsAllocation->gpuBaseAddress; -} - -inline uint64_t LinearStream::getCurrentGpuOffsetFromHeapBase() const { - return ptrOffset(this->graphicsAllocation->getGpuAddressToPatch(), sizeUsed); -} - inline void *LinearStream::getSpace(size_t size) { UNRECOVERABLE_IF(sizeUsed + size > maxAvailableSpace); auto memory = ptrOffset(buffer, sizeUsed); diff --git a/unit_tests/command_stream/linear_stream_tests.cpp b/unit_tests/command_stream/linear_stream_tests.cpp index d13a9b0df0..ef35df2e33 100644 --- a/unit_tests/command_stream/linear_stream_tests.cpp +++ b/unit_tests/command_stream/linear_stream_tests.cpp @@ -112,47 +112,4 @@ TEST_F(LinearStreamTest, givenNewGraphicsAllocationWhenReplaceIsCalledThenLinear EXPECT_NE(&newGraphicsAllocation, graphicsAllocation); linearStream.replaceGraphicsAllocation(&newGraphicsAllocation); EXPECT_EQ(&newGraphicsAllocation, linearStream.getGraphicsAllocation()); -} - -TEST_F(LinearStreamTest, givenGraphicsAllocationWithGpuBaseAddressWhenItIsUsedInLinearStreamThenGetGpuBaseReturnsGraphicsAllocationBase) { - auto graphicsAllocation = linearStream.getGraphicsAllocation(); - EXPECT_NE(nullptr, graphicsAllocation); - auto address = (void *)0x100000; - uint64_t gpuAddress = 0x1000001; - uint64_t gpuHeapBase = 0x1000000; - - GraphicsAllocation newGraphicsAllocation(address, gpuAddress, gpuHeapBase, 4096); - linearStream.replaceGraphicsAllocation(&newGraphicsAllocation); - - EXPECT_EQ(gpuHeapBase, linearStream.getGpuBase()); -} - -TEST_F(LinearStreamTest, givenGraphicsAllocationWithGpuBaseAddressWhenItIsQueriedForOffsetFromBaseThenProperOffsetIsReturned) { - auto graphicsAllocation = linearStream.getGraphicsAllocation(); - EXPECT_NE(nullptr, graphicsAllocation); - auto address = (void *)0x100000; - uint64_t gpuAddress = 0x1000001; - uint64_t gpuHeapBase = 0x1000000; - - GraphicsAllocation newGraphicsAllocation(address, gpuAddress, gpuHeapBase, 4096); - linearStream.replaceGraphicsAllocation(&newGraphicsAllocation); - - EXPECT_EQ(gpuHeapBase, linearStream.getGpuBase()); -} - -TEST_F(LinearStreamTest, given32BitHeapWhenItIsAskedForGpuoffsetThenOffsetFromBaseIsReturned) { - auto allocationSize = 4096; - std::unique_ptr memoryPtr(new char[allocationSize]); - uint64_t gpuHeapBase = 0x1000000; - uint64_t gpuAddress = 0x1000017; - - auto currentOffset = gpuAddress - gpuHeapBase; - - GraphicsAllocation newGraphicsAllocation(memoryPtr.get(), gpuAddress, gpuHeapBase, allocationSize); - linearStream.replaceGraphicsAllocation(&newGraphicsAllocation); - - EXPECT_EQ(linearStream.getCurrentGpuOffsetFromHeapBase(), currentOffset); - linearStream.getSpace(10); - currentOffset += 10; - EXPECT_EQ(linearStream.getCurrentGpuOffsetFromHeapBase(), currentOffset); -} +} \ No newline at end of file diff --git a/unit_tests/gen_common/gen_commands_common_validation.h b/unit_tests/gen_common/gen_commands_common_validation.h index 32c3508e9a..edcc687fc2 100644 --- a/unit_tests/gen_common/gen_commands_common_validation.h +++ b/unit_tests/gen_common/gen_commands_common_validation.h @@ -56,7 +56,7 @@ void validateStateBaseAddress(uint64_t internalHeapBase, IndirectHeap *pDSH, // Stateless accesses require GSH.base to be 0. EXPECT_EQ(expectedGeneralStateHeapBaseAddress, cmd->getGeneralStateBaseAddress()); EXPECT_EQ(static_cast(reinterpret_cast(pSSH->getCpuBase())), cmd->getSurfaceStateBaseAddress()); - EXPECT_EQ(pIOH->getGpuBase(), cmd->getIndirectObjectBaseAddress()); + EXPECT_EQ(pIOH->getGraphicsAllocation()->gpuBaseAddress, cmd->getIndirectObjectBaseAddress()); EXPECT_EQ(internalHeapBase, cmd->getInstructionBaseAddress()); // Verify all sizes are getting programmed