Linux: setup correct FileDescriptor when initializing GmmClientContext.

Related-To: NEO-3691

Change-Id: I192e53ba97b36decb197fa3aaa009b1c60787db5
Signed-off-by: Jablonski, Mateusz <mateusz.jablonski@intel.com>
This commit is contained in:
Jablonski, Mateusz
2020-03-02 14:11:08 +01:00
committed by sys_ocldev
parent 073e015000
commit 6df36e5667
2 changed files with 22 additions and 1 deletions

View File

@@ -6,10 +6,12 @@
*/
#include "shared/source/command_stream/preemption.h"
#include "shared/source/gmm_helper/gmm_lib.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/os_interface/linux/os_context_linux.h"
#include "shared/source/os_interface/linux/os_interface.h"
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
#include "opencl/test/unit_test/os_interface/linux/drm_mock.h"
#include "gtest/gtest.h"
@@ -24,4 +26,20 @@ TEST(OsInterfaceTest, GivenLinuxOsInterfaceWhenDeviceHandleQueriedthenZeroIsRetu
OSInterface osInterface;
EXPECT_EQ(0u, osInterface.getDeviceHandle());
}
TEST(OsInterfaceTest, whenOsInterfaceSetupsGmmInputArgsThenProperFileDescriptorIsSet) {
MockExecutionEnvironment executionEnvironment;
auto rootDeviceEnvironment = executionEnvironment.rootDeviceEnvironments[0].get();
auto osInterface = new OSInterface();
rootDeviceEnvironment->osInterface.reset(osInterface);
auto drm = Drm::create(nullptr, *rootDeviceEnvironment);
osInterface->get()->setDrm(drm);
GMM_INIT_IN_ARGS gmmInputArgs = {};
EXPECT_EQ(0u, gmmInputArgs.FileDescriptor);
osInterface->setGmmInputArgs(&gmmInputArgs);
EXPECT_NE(0u, gmmInputArgs.FileDescriptor);
uint32_t expectedFileDescriptor = drm->getFileDescriptor();
EXPECT_EQ(expectedFileDescriptor, gmmInputArgs.FileDescriptor);
}
} // namespace NEO