Choose BUFFER_HOST_MEMORY as type in 32 bit applications.

Change-Id: I33addbd37cb4b9192c2dfa88aeee6d6cbdafd714
This commit is contained in:
Mrozek, Michal 2018-12-07 16:12:07 +01:00
parent 481b83b436
commit c865dbbaa1
3 changed files with 37 additions and 9 deletions

2
Jenkinsfile vendored
View File

@ -1,5 +1,5 @@
#!groovy
dependenciesRevision='0069cbdd1559b47c9de98ca934b334b12fa59703-1174'
strategy='EQUAL'
allowedCD=273
allowedCD=274
allowedF=4

View File

@ -319,7 +319,9 @@ void Buffer::checkMemory(cl_mem_flags flags,
GraphicsAllocation::AllocationType Buffer::getGraphicsAllocationType(cl_mem_flags flags, bool sharedContext, bool renderCompressedBuffers) {
GraphicsAllocation::AllocationType type = GraphicsAllocation::AllocationType::BUFFER;
if (flags & CL_MEM_USE_HOST_PTR) {
if (is32bit) {
type = GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
} else if (flags & CL_MEM_USE_HOST_PTR) {
type = GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
} else if (renderCompressedBuffers) {
type = GraphicsAllocation::AllocationType::BUFFER_COMPRESSED;

View File

@ -307,7 +307,11 @@ TEST(Buffer, givenAllocHostPtrFlagPassedToBufferCreateWhenNoSharedContextOrRende
TEST(Buffer, givenRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferCompressedTypeIsReturned) {
cl_mem_flags flags = 0;
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(flags, false, true);
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, type);
if (is32bit) {
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
} else {
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, type);
}
}
TEST(Buffer, givenSharedContextWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) {
@ -343,13 +347,21 @@ TEST(Buffer, givenUseHostPtrFlagAndRenderCompressedBuffersEnabledWhenAllocationT
TEST(Buffer, givenAllocHostPtrFlagAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferCompressedTypeIsReturned) {
cl_mem_flags flags = CL_MEM_ALLOC_HOST_PTR;
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(flags, false, true);
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, type);
if (is32bit) {
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
} else {
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, type);
}
}
TEST(Buffer, givenZeroFlagsNoSharedContextAndRenderCompressedBuffersDisabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) {
cl_mem_flags flags = 0;
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(flags, false, false);
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER, type);
if (is32bit) {
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
} else {
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER, type);
}
}
TEST(Buffer, givenClMemCopyHostPointerPassedToBufferCreateWhenAllocationIsNotInSystemMemoryPoolThenAllocationIsWrittenByEnqueueWriteBuffer) {
@ -441,8 +453,13 @@ TEST_F(RenderCompressedBuffersTests, givenBufferCompressedAllocationAndNoHostPtr
localHwInfo.capabilityTable.ftrRenderCompressedBuffers = true;
buffer.reset(Buffer::create(context.get(), 0, MemoryConstants::cacheLineSize, nullptr, retVal));
EXPECT_FALSE(buffer->isMemObjZeroCopy());
EXPECT_EQ(buffer->getGraphicsAllocation()->getAllocationType(), GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
if (is32bit) {
EXPECT_TRUE(buffer->isMemObjZeroCopy());
EXPECT_EQ(buffer->getGraphicsAllocation()->getAllocationType(), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
} else {
EXPECT_FALSE(buffer->isMemObjZeroCopy());
EXPECT_EQ(buffer->getGraphicsAllocation()->getAllocationType(), GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
}
}
TEST_F(RenderCompressedBuffersTests, givenBufferCompressedAllocationWhenSharedContextIsUsedThenForceDisableCompression) {
@ -452,8 +469,11 @@ TEST_F(RenderCompressedBuffersTests, givenBufferCompressedAllocationWhenSharedCo
uint32_t hostPtr = 0;
buffer.reset(Buffer::create(context.get(), 0, sizeof(uint32_t), &hostPtr, retVal));
EXPECT_EQ(buffer->getGraphicsAllocation()->getAllocationType(), GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
if (is32bit) {
EXPECT_EQ(buffer->getGraphicsAllocation()->getAllocationType(), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
} else {
EXPECT_EQ(buffer->getGraphicsAllocation()->getAllocationType(), GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
}
context->isSharedContext = true;
buffer.reset(Buffer::create(context.get(), 0, sizeof(uint32_t), &hostPtr, retVal));
EXPECT_EQ(buffer->getGraphicsAllocation()->getAllocationType(), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
@ -484,6 +504,9 @@ struct RenderCompressedBuffersCopyHostMemoryTests : public RenderCompressedBuffe
};
TEST_F(RenderCompressedBuffersCopyHostMemoryTests, givenRenderCompressedBufferWhenCopyFromHostPtrIsRequiredThenCallWriteBuffer) {
if (is32bit) {
return;
}
localHwInfo.capabilityTable.ftrRenderCompressedBuffers = true;
buffer.reset(Buffer::create(context.get(), CL_MEM_COPY_HOST_PTR, sizeof(uint32_t), &hostPtr, retVal));
@ -508,6 +531,9 @@ TEST_F(RenderCompressedBuffersCopyHostMemoryTests, givenNonRenderCompressedBuffe
}
TEST_F(RenderCompressedBuffersCopyHostMemoryTests, givenRenderCompressedBufferWhenWriteBufferFailsThenReturnErrorCode) {
if (is32bit) {
return;
}
localHwInfo.capabilityTable.ftrRenderCompressedBuffers = true;
mockCmdQ->writeBufferRetValue = CL_INVALID_VALUE;