Reuse mapAllocation for memory transfer during buffer creation

Change-Id: Idcdabb4a9c61b5cbf69164c51ca1690a64665a26
Signed-off-by: Pawel Wilma <pawel.wilma@intel.com>
This commit is contained in:
Pawel Wilma
2020-04-02 10:52:36 +02:00
committed by sys_ocldev
parent a2e58ed707
commit 4d80f21dac
5 changed files with 15 additions and 2 deletions

View File

@@ -655,6 +655,16 @@ TEST_F(RenderCompressedBuffersCopyHostMemoryTests, givenRenderCompressedBufferWh
EXPECT_EQ(CL_SUCCESS, retVal);
}
TEST_F(RenderCompressedBuffersCopyHostMemoryTests, givenBufferCreateWhenMemoryTransferWithEnqueueWriteBufferThenMapAllocationIsReused) {
cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR;
auto &capabilityTable = device->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable;
capabilityTable.blitterOperationsSupported = false;
static_cast<MockMemoryManager *>(context->memoryManager)->forceRenderCompressed = true;
std::unique_ptr<Buffer> buffer(Buffer::create(context.get(), flags, bufferSize, hostPtr, retVal));
EXPECT_NE(nullptr, mockCmdQ->writeMapAllocation);
EXPECT_EQ(buffer->getMapAllocation(), mockCmdQ->writeMapAllocation);
}
struct BcsBufferTests : public ::testing::Test {
class BcsMockContext : public MockContext {
public: