Pass ClientType to Gmm

Change-Id: I25ba11d2fd1523fd5cf35157d6a2381991709ad2
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski 2020-07-22 12:51:48 +02:00 committed by sys_ocldev
parent 2bf23742f1
commit d51e3bb9ce
5 changed files with 15 additions and 3 deletions

View File

@ -15,7 +15,10 @@ namespace NEO {
bool OSInterface::osEnableLocalMemory = true; bool OSInterface::osEnableLocalMemory = true;
void OSInterface::setGmmInputArgs(void *args) { void OSInterface::setGmmInputArgs(void *args) {
reinterpret_cast<GMM_INIT_IN_ARGS *>(args)->FileDescriptor = this->get()->getDrm()->getFileDescriptor(); auto gmmInArgs = reinterpret_cast<GMM_INIT_IN_ARGS *>(args);
gmmInArgs->FileDescriptor = this->get()->getDrm()->getFileDescriptor();
gmmInArgs->ClientType = GMM_CLIENT::GMM_OCL_VISTA;
} }
} // namespace NEO } // namespace NEO

View File

@ -34,6 +34,7 @@ TEST(OsInterfaceTest, whenOsInterfaceSetupsGmmInputArgsThenProperFileDescriptorI
auto expectedFileDescriptor = drm->getFileDescriptor(); auto expectedFileDescriptor = drm->getFileDescriptor();
EXPECT_EQ(static_cast<uint32_t>(expectedFileDescriptor), gmmInputArgs.FileDescriptor); EXPECT_EQ(static_cast<uint32_t>(expectedFileDescriptor), gmmInputArgs.FileDescriptor);
EXPECT_EQ(GMM_CLIENT::GMM_OCL_VISTA, gmmInputArgs.ClientType);
} }
TEST(GmmHelperTest, whenCreateGmmHelperWithoutOsInterfaceThenPassedFileDescriptorIsZeroed) { TEST(GmmHelperTest, whenCreateGmmHelperWithoutOsInterfaceThenPassedFileDescriptorIsZeroed) {
@ -45,5 +46,6 @@ TEST(GmmHelperTest, whenCreateGmmHelperWithoutOsInterfaceThenPassedFileDescripto
gmmHelper.reset(new GmmHelper(nullptr, defaultHwInfo.get())); gmmHelper.reset(new GmmHelper(nullptr, defaultHwInfo.get()));
EXPECT_EQ(expectedFileDescriptor, passedInputArgs.FileDescriptor); EXPECT_EQ(expectedFileDescriptor, passedInputArgs.FileDescriptor);
EXPECT_EQ(GMM_CLIENT::GMM_OCL_VISTA, passedInputArgs.ClientType);
} }
} // namespace NEO } // namespace NEO

View File

@ -18,7 +18,7 @@ TEST(osInterfaceTests, osInterfaceLocalMemoryEnabledByDefault) {
EXPECT_TRUE(OSInterface::osEnableLocalMemory); EXPECT_TRUE(OSInterface::osEnableLocalMemory);
} }
TEST(osInterfaceTests, whenOsInterfaceSetupGmmInputArgsThenProperAdapterBDFIsSet) { TEST(osInterfaceTests, whenOsInterfaceSetupGmmInputArgsThenArgsAreSet) {
MockExecutionEnvironment executionEnvironment; MockExecutionEnvironment executionEnvironment;
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment); RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
auto wddm = new WddmMock(rootDeviceEnvironment); auto wddm = new WddmMock(rootDeviceEnvironment);
@ -33,6 +33,9 @@ TEST(osInterfaceTests, whenOsInterfaceSetupGmmInputArgsThenProperAdapterBDFIsSet
GMM_INIT_IN_ARGS gmmInputArgs = {}; GMM_INIT_IN_ARGS gmmInputArgs = {};
EXPECT_NE(0, memcmp(&adapterBDF, &gmmInputArgs.stAdapterBDF, sizeof(ADAPTER_BDF))); EXPECT_NE(0, memcmp(&adapterBDF, &gmmInputArgs.stAdapterBDF, sizeof(ADAPTER_BDF)));
rootDeviceEnvironment.osInterface->setGmmInputArgs(&gmmInputArgs); rootDeviceEnvironment.osInterface->setGmmInputArgs(&gmmInputArgs);
EXPECT_EQ(0, memcmp(&adapterBDF, &gmmInputArgs.stAdapterBDF, sizeof(ADAPTER_BDF))); EXPECT_EQ(0, memcmp(&adapterBDF, &gmmInputArgs.stAdapterBDF, sizeof(ADAPTER_BDF)));
EXPECT_EQ(GMM_CLIENT::GMM_OCL_VISTA, gmmInputArgs.ClientType);
} }

View File

@ -1013,7 +1013,10 @@ void Wddm::waitOnPagingFenceFromCpu() {
} }
void Wddm::setGmmInputArg(void *args) { void Wddm::setGmmInputArg(void *args) {
reinterpret_cast<GMM_INIT_IN_ARGS *>(args)->stAdapterBDF = this->adapterBDF; auto gmmInArgs = reinterpret_cast<GMM_INIT_IN_ARGS *>(args);
gmmInArgs->stAdapterBDF = this->adapterBDF;
gmmInArgs->ClientType = GMM_CLIENT::GMM_OCL_VISTA;
} }
void Wddm::updatePagingFenceValue(uint64_t newPagingFenceValue) { void Wddm::updatePagingFenceValue(uint64_t newPagingFenceValue) {

View File

@ -25,6 +25,7 @@ TEST(GmmHelperTest, whenCreateGmmHelperWithoutOsInterfaceThenPassedAdapterBDFIsZ
gmmHelper.reset(new GmmHelper(nullptr, defaultHwInfo.get())); gmmHelper.reset(new GmmHelper(nullptr, defaultHwInfo.get()));
EXPECT_EQ(0, memcmp(&expectedAdapterBDF, &passedInputArgs.stAdapterBDF, sizeof(ADAPTER_BDF))); EXPECT_EQ(0, memcmp(&expectedAdapterBDF, &passedInputArgs.stAdapterBDF, sizeof(ADAPTER_BDF)));
EXPECT_EQ(GMM_CLIENT::GMM_OCL_VISTA, passedInputArgs.ClientType);
} }
} // namespace NEO } // namespace NEO