Skip to content

Commit c0d4122

Browse files
Ensure that temporary buffer has zero copy flag set.
Change-Id: Iefa6f281cc61237be21aeff7c26d080c32385a75
1 parent 3a5209c commit c0d4122

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

runtime/mem_obj/buffer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ void Buffer::setSurfaceState(const Device *device,
506506
void *svmPtr,
507507
GraphicsAllocation *gfxAlloc,
508508
cl_mem_flags flags) {
509-
auto buffer = Buffer::createBufferHwFromDevice(device, flags, svmSize, svmPtr, svmPtr, gfxAlloc, false, false, false);
509+
auto buffer = Buffer::createBufferHwFromDevice(device, flags, svmSize, svmPtr, svmPtr, gfxAlloc, true, false, false);
510510
buffer->setArgStateful(surfaceState, false);
511511
buffer->graphicsAllocation = nullptr;
512512
delete buffer;

unit_tests/mem_obj/buffer_tests.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,6 +1368,25 @@ HWTEST_F(BufferSetSurfaceTests, givenMisalignedPointerWhenSurfaceStateIsProgramm
13681368
EXPECT_EQ(alignUp(5u, 4u), length.Length + 1);
13691369
}
13701370

1371+
HWTEST_F(BufferSetSurfaceTests, givenBufferThatIsMisalignedWhenSurfaceStateIsBeingProgrammedThenL3CacheIsOff) {
1372+
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
1373+
1374+
this->device->getExecutionEnvironment()->getGmmHelper()->setSimplifiedMocsTableUsage(true);
1375+
1376+
RENDER_SURFACE_STATE surfaceState = {};
1377+
MockContext context;
1378+
void *svmPtr = reinterpret_cast<void *>(0x1005);
1379+
1380+
Buffer::setSurfaceState(device.get(),
1381+
&surfaceState,
1382+
5,
1383+
svmPtr,
1384+
nullptr,
1385+
0);
1386+
1387+
EXPECT_EQ(0u, surfaceState.getMemoryObjectControlState());
1388+
}
1389+
13711390
struct BufferUnmapTest : public DeviceFixture, public ::testing::Test {
13721391
void SetUp() override {
13731392
DeviceFixture::SetUp();

0 commit comments

Comments
 (0)