From 288193c6b4a2f22203146429116969e348e109d1 Mon Sep 17 00:00:00 2001 From: "Mrozek, Michal" Date: Tue, 3 Sep 2019 09:26:49 +0200 Subject: [PATCH] Simplify fillExecObject code. - remove defines - always go for 64 bit addresses, ( all our GPU VA addressees are 64 bit ) Change-Id: Ic650feddc964e7dad45bad4248c0ba4dcf23e886 Signed-off-by: Mrozek, Michal --- runtime/os_interface/linux/drm_buffer_object.cpp | 6 +----- unit_tests/os_interface/linux/drm_buffer_object_tests.cpp | 4 ++-- unit_tests/os_interface/linux/drm_command_stream_tests.cpp | 6 +----- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/runtime/os_interface/linux/drm_buffer_object.cpp b/runtime/os_interface/linux/drm_buffer_object.cpp index bee57f0db2..da0f57f849 100644 --- a/runtime/os_interface/linux/drm_buffer_object.cpp +++ b/runtime/os_interface/linux/drm_buffer_object.cpp @@ -96,11 +96,7 @@ void BufferObject::fillExecObject(drm_i915_gem_exec_object2 &execObject, uint32_ execObject.relocs_ptr = 0ul; execObject.alignment = 0; execObject.offset = this->gpuAddress; - execObject.flags = EXEC_OBJECT_PINNED; -#ifdef __x86_64__ - // set EXEC_OBJECT_SUPPORTS_48B_ADDRESS flag if whole object resides in 32BIT address space boundary - execObject.flags |= (this->gpuAddress + this->size) & MemoryConstants::zoneHigh ? EXEC_OBJECT_SUPPORTS_48B_ADDRESS : 0; -#endif + execObject.flags = EXEC_OBJECT_PINNED | EXEC_OBJECT_SUPPORTS_48B_ADDRESS; execObject.rsvd1 = drmContextId; execObject.rsvd2 = 0; } diff --git a/unit_tests/os_interface/linux/drm_buffer_object_tests.cpp b/unit_tests/os_interface/linux/drm_buffer_object_tests.cpp index 0b1f674972..52f9e2ead5 100644 --- a/unit_tests/os_interface/linux/drm_buffer_object_tests.cpp +++ b/unit_tests/os_interface/linux/drm_buffer_object_tests.cpp @@ -111,7 +111,7 @@ TEST_F(DrmBufferObjectTest, givenAddressThatWhenSizeIsAddedCrosses32BitBoundaryW EXPECT_TRUE(execObject.flags & EXEC_OBJECT_SUPPORTS_48B_ADDRESS); } -TEST_F(DrmBufferObjectTest, givenAddressThatWhenSizeIsAddedWithin32BitBoundaryWhenExecIsCalledThen48BitFlagIsNotSet) { +TEST_F(DrmBufferObjectTest, givenAddressThatWhenSizeIsAddedWithin32BitBoundaryWhenExecIsCalledThen48BitFlagSet) { drm_i915_gem_exec_object2 execObject; memset(&execObject, 0, sizeof(execObject)); @@ -119,7 +119,7 @@ TEST_F(DrmBufferObjectTest, givenAddressThatWhenSizeIsAddedWithin32BitBoundaryWh bo->setSize(0xFFF); bo->fillExecObject(execObject, 1); //base address + size < size of 32bit address space - EXPECT_FALSE(execObject.flags & EXEC_OBJECT_SUPPORTS_48B_ADDRESS); + EXPECT_TRUE(execObject.flags & EXEC_OBJECT_SUPPORTS_48B_ADDRESS); } TEST_F(DrmBufferObjectTest, onPinIoctlFailed) { diff --git a/unit_tests/os_interface/linux/drm_command_stream_tests.cpp b/unit_tests/os_interface/linux/drm_command_stream_tests.cpp index a331451c83..875b88a537 100644 --- a/unit_tests/os_interface/linux/drm_command_stream_tests.cpp +++ b/unit_tests/os_interface/linux/drm_command_stream_tests.cpp @@ -444,11 +444,7 @@ MATCHER(BoExecFlushCheckFlags, "") { drm_i915_gem_exec_object2 *exec_objects = (drm_i915_gem_exec_object2 *)exec2->buffers_ptr; for (unsigned int i = 0; i < exec2->buffer_count; i++) { - if (exec_objects[i].offset > 0xFFFFFFFF) { - EXPECT_TRUE(exec_objects[i].flags == (EXEC_OBJECT_PINNED | EXEC_OBJECT_SUPPORTS_48B_ADDRESS)); - } else { - EXPECT_TRUE(exec_objects[i].flags == (EXEC_OBJECT_PINNED)); - } + EXPECT_TRUE(exec_objects[i].flags == (EXEC_OBJECT_PINNED | EXEC_OBJECT_SUPPORTS_48B_ADDRESS)); } return true;