Create gmm client context wrapper, reduce mock_gmm
Change-Id: I4eec4366afeb175fea4bf7934e3046b50fe30fe9
This commit is contained in:
parent
f59c191915
commit
36db75da28
|
@ -542,6 +542,7 @@ include_directories(${IGDRCL_BUILD_DIR})
|
|||
include_directories(${IGDRCL_SOURCE_DIR}/runtime/sku_info/definitions${BRANCH_DIR_SUFFIX})
|
||||
include_directories(${IGDRCL_SOURCE_DIR}/runtime/gen_common/reg_configs${BRANCH_DIR_SUFFIX})
|
||||
include_directories(${IGDRCL_SOURCE_DIR}/runtime/gmm_helper/${BRANCH_DIR_SUFFIX})
|
||||
include_directories(${IGDRCL_SOURCE_DIR}/runtime/gmm_helper/client_context${BRANCH_DIR_SUFFIX})
|
||||
include_directories(${IGDRCL_SOURCE_DIR}/runtime/gmm_helper/gmm_memory${BRANCH_DIR_SUFFIX})
|
||||
|
||||
set(HW_SRC_INCLUDE_PATH ${IGDRCL_SOURCE_DIR}/runtime/gen_common)
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "runtime/device/device_vector.h"
|
||||
#include "runtime/device/driver_info.h"
|
||||
#include "runtime/execution_environment/execution_environment.h"
|
||||
#include "runtime/gmm_helper/gmm_helper.h"
|
||||
#include "runtime/helpers/built_ins_helper.h"
|
||||
#include "runtime/helpers/debug_helpers.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
|
@ -85,7 +84,6 @@ Device::Device(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnviro
|
|||
memset(&deviceInfo, 0, sizeof(deviceInfo));
|
||||
deviceExtensions.reserve(1000);
|
||||
name.reserve(100);
|
||||
GmmHelper::hwInfo = &hwInfo;
|
||||
preemptionMode = PreemptionHelper::getDefaultPreemptionMode(hwInfo);
|
||||
engineType = DebugManager.flags.NodeOrdinal.get() == -1
|
||||
? hwInfo.capabilityTable.defaultEngineType
|
||||
|
|
|
@ -19,12 +19,15 @@
|
|||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "lib_names.h"
|
||||
#include "External/Common/GmmLibDllName.h"
|
||||
|
||||
namespace Os {
|
||||
|
||||
const char *frontEndDllName = FCL_LIBRARY_NAME;
|
||||
const char *igcDllName = IGC_LIBRARY_NAME;
|
||||
const char *gdiDllName = "gdi32.dll";
|
||||
const char *gmmDllName = GMM_LIBRARY_NAME;
|
||||
const char *gmmDllName = GMM_UMD_DLL;
|
||||
const char *gmmEntryName = GMM_ENTRY_NAME;
|
||||
} // namespace Os
|
||||
|
|
|
@ -22,6 +22,10 @@ set(RUNTIME_SRCS_GMM_HELPER_BASE
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/client_context/gmm_client_context_base.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/client_context/gmm_client_context_base.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/client_context${BRANCH_DIR_SUFFIX}/gmm_client_context.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/client_context${BRANCH_DIR_SUFFIX}/gmm_client_context.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_helper.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_lib.h
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "gmm_client_context.h"
|
||||
|
||||
namespace OCLRT {
|
||||
GmmClientContext::GmmClientContext(GMM_CLIENT clientType) : GmmClientContextBase(clientType){};
|
||||
} // namespace OCLRT
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "runtime/gmm_helper/client_context/gmm_client_context_base.h"
|
||||
|
||||
namespace OCLRT {
|
||||
class GmmClientContext : public GmmClientContextBase {
|
||||
public:
|
||||
GmmClientContext(GMM_CLIENT clientType);
|
||||
};
|
||||
} // namespace OCLRT
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/gmm_helper/client_context/gmm_client_context_base.h"
|
||||
|
||||
namespace OCLRT {
|
||||
GmmClientContextBase::GmmClientContextBase(GMM_CLIENT clientType) {
|
||||
clientContext = GmmHelper::createClientContextFunc(clientType);
|
||||
}
|
||||
GmmClientContextBase::~GmmClientContextBase() {
|
||||
GmmHelper::deleteClientContextFunc(clientContext);
|
||||
};
|
||||
|
||||
MEMORY_OBJECT_CONTROL_STATE GmmClientContextBase::cachePolicyGetMemoryObject(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE usage) {
|
||||
return clientContext->CachePolicyGetMemoryObject(pResInfo, usage);
|
||||
}
|
||||
|
||||
GMM_RESOURCE_INFO *GmmClientContextBase::createResInfoObject(GMM_RESCREATE_PARAMS *pCreateParams) {
|
||||
return clientContext->CreateResInfoObject(pCreateParams);
|
||||
}
|
||||
|
||||
GMM_RESOURCE_INFO *GmmClientContextBase::copyResInfoObject(GMM_RESOURCE_INFO *pSrcRes) {
|
||||
return clientContext->CopyResInfoObject(pSrcRes);
|
||||
}
|
||||
|
||||
void GmmClientContextBase::destroyResInfoObject(GMM_RESOURCE_INFO *pResInfo) {
|
||||
return clientContext->DestroyResInfoObject(pResInfo);
|
||||
}
|
||||
|
||||
GMM_CLIENT_CONTEXT *GmmClientContextBase::getHandle() const {
|
||||
return clientContext;
|
||||
}
|
||||
} // namespace OCLRT
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "runtime/gmm_helper/gmm_helper.h"
|
||||
#include "runtime/gmm_helper/gmm_lib.h"
|
||||
#include <memory>
|
||||
|
||||
namespace OCLRT {
|
||||
class GmmClientContext;
|
||||
class GmmClientContextBase {
|
||||
public:
|
||||
virtual ~GmmClientContextBase();
|
||||
|
||||
MOCKABLE_VIRTUAL MEMORY_OBJECT_CONTROL_STATE cachePolicyGetMemoryObject(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE usage);
|
||||
MOCKABLE_VIRTUAL GMM_RESOURCE_INFO *createResInfoObject(GMM_RESCREATE_PARAMS *pCreateParams);
|
||||
MOCKABLE_VIRTUAL GMM_RESOURCE_INFO *copyResInfoObject(GMM_RESOURCE_INFO *pSrcRes);
|
||||
MOCKABLE_VIRTUAL void destroyResInfoObject(GMM_RESOURCE_INFO *pResInfo);
|
||||
GMM_CLIENT_CONTEXT *getHandle() const;
|
||||
template <typename T>
|
||||
static GmmClientContext *create(GMM_CLIENT clientType) {
|
||||
return new T(clientType);
|
||||
}
|
||||
|
||||
protected:
|
||||
GMM_CLIENT_CONTEXT *clientContext;
|
||||
GmmClientContextBase(GMM_CLIENT clientType);
|
||||
};
|
||||
} // namespace OCLRT
|
|
@ -20,6 +20,7 @@
|
|||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "gmm_client_context.h"
|
||||
#include "runtime/gmm_helper/gmm.h"
|
||||
#include "runtime/gmm_helper/gmm_helper.h"
|
||||
#include "runtime/gmm_helper/resource_info.h"
|
||||
|
@ -45,16 +46,15 @@ void GmmHelper::initContext(const PLATFORM *pPlatform,
|
|||
loadLib();
|
||||
bool success = GMM_SUCCESS == initGlobalContextFunc(*pPlatform, &gmmFtrTable, &gmmWaTable, pGtSysInfo, GMM_CLIENT::GMM_OCL_VISTA);
|
||||
UNRECOVERABLE_IF(!success);
|
||||
GmmHelper::gmmClientContext = GmmHelper::createClientContextFunc(GMM_CLIENT::GMM_OCL_VISTA);
|
||||
GmmHelper::gmmClientContext = GmmHelper::createGmmContextWrapperFunc(GMM_CLIENT::GMM_OCL_VISTA);
|
||||
}
|
||||
UNRECOVERABLE_IF(!GmmHelper::gmmClientContext);
|
||||
}
|
||||
|
||||
void GmmHelper::destroyContext() {
|
||||
if (GmmHelper::gmmClientContext) {
|
||||
deleteClientContextFunc(GmmHelper::gmmClientContext);
|
||||
delete GmmHelper::gmmClientContext;
|
||||
GmmHelper::gmmClientContext = nullptr;
|
||||
destroyGlobalContextFunc();
|
||||
if (gmmLib) {
|
||||
delete gmmLib;
|
||||
gmmLib = nullptr;
|
||||
|
@ -70,7 +70,7 @@ uint32_t GmmHelper::getMOCS(uint32_t type) {
|
|||
return cacheEnabledIndex;
|
||||
}
|
||||
}
|
||||
MEMORY_OBJECT_CONTROL_STATE mocs = GmmHelper::gmmClientContext->CachePolicyGetMemoryObject(nullptr, static_cast<GMM_RESOURCE_USAGE_TYPE>(type));
|
||||
MEMORY_OBJECT_CONTROL_STATE mocs = GmmHelper::gmmClientContext->cachePolicyGetMemoryObject(nullptr, static_cast<GMM_RESOURCE_USAGE_TYPE>(type));
|
||||
|
||||
return static_cast<uint32_t>(mocs.DwordValue);
|
||||
}
|
||||
|
@ -171,7 +171,9 @@ GmmHelper::~GmmHelper() {
|
|||
}
|
||||
}
|
||||
bool GmmHelper::useSimplifiedMocsTable = false;
|
||||
GMM_CLIENT_CONTEXT *GmmHelper::gmmClientContext = nullptr;
|
||||
GmmClientContext *GmmHelper::gmmClientContext = nullptr;
|
||||
GmmClientContext *(*GmmHelper::createGmmContextWrapperFunc)(GMM_CLIENT) = GmmClientContextBase::create<GmmClientContext>;
|
||||
|
||||
const HardwareInfo *GmmHelper::hwInfo = nullptr;
|
||||
OsLibrary *GmmHelper::gmmLib = nullptr;
|
||||
} // namespace OCLRT
|
||||
|
|
|
@ -36,6 +36,7 @@ struct ImageInfo;
|
|||
class GraphicsAllocation;
|
||||
class Gmm;
|
||||
class OsLibrary;
|
||||
class GmmClientContext;
|
||||
|
||||
class GmmHelper {
|
||||
public:
|
||||
|
@ -62,11 +63,12 @@ class GmmHelper {
|
|||
static decltype(&GmmDestroyGlobalContext) destroyGlobalContextFunc;
|
||||
static decltype(&GmmCreateClientContext) createClientContextFunc;
|
||||
static decltype(&GmmDeleteClientContext) deleteClientContextFunc;
|
||||
static GmmClientContext *(*createGmmContextWrapperFunc)(GMM_CLIENT);
|
||||
|
||||
static bool useSimplifiedMocsTable;
|
||||
static GMM_CLIENT_CONTEXT *gmmClientContext;
|
||||
static const HardwareInfo *hwInfo;
|
||||
static OsLibrary *gmmLib;
|
||||
static GmmClientContext *gmmClientContext;
|
||||
|
||||
protected:
|
||||
void loadLib();
|
||||
|
|
|
@ -20,12 +20,15 @@
|
|||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "gmm_client_context.h"
|
||||
#include "runtime/gmm_helper/gmm_memory_base.h"
|
||||
#include "runtime/gmm_helper/gmm_helper.h"
|
||||
|
||||
namespace OCLRT {
|
||||
GmmMemoryBase::GmmMemoryBase() {
|
||||
clientContext = GmmHelper::gmmClientContext;
|
||||
void GmmMemoryBase::ensureClientContext() {
|
||||
if (!clientContext) {
|
||||
clientContext = GmmHelper::gmmClientContext->getHandle();
|
||||
}
|
||||
}
|
||||
bool GmmMemoryBase::configureDeviceAddressSpace(GMM_ESCAPE_HANDLE hAdapter,
|
||||
GMM_ESCAPE_HANDLE hDevice,
|
||||
|
@ -36,6 +39,7 @@ bool GmmMemoryBase::configureDeviceAddressSpace(GMM_ESCAPE_HANDLE hAdapter,
|
|||
BOOLEAN BDWL3Coherency,
|
||||
GMM_GFX_SIZE_T SizeOverride,
|
||||
GMM_GFX_SIZE_T SlmGfxSpaceReserve) {
|
||||
ensureClientContext();
|
||||
return clientContext->ConfigureDeviceAddressSpace(
|
||||
{hAdapter},
|
||||
{hDevice},
|
||||
|
@ -49,7 +53,7 @@ bool GmmMemoryBase::configureDeviceAddressSpace(GMM_ESCAPE_HANDLE hAdapter,
|
|||
}
|
||||
|
||||
uintptr_t GmmMemoryBase::getInternalGpuVaRangeLimit() {
|
||||
ensureClientContext();
|
||||
return static_cast<uintptr_t>(clientContext->GetInternalGpuVaRangeLimit());
|
||||
}
|
||||
|
||||
}; // namespace OCLRT
|
||||
|
|
|
@ -42,7 +42,8 @@ class GmmMemoryBase {
|
|||
MOCKABLE_VIRTUAL uintptr_t getInternalGpuVaRangeLimit();
|
||||
|
||||
protected:
|
||||
GmmMemoryBase();
|
||||
GMM_CLIENT_CONTEXT *clientContext;
|
||||
GmmMemoryBase() = default;
|
||||
void ensureClientContext();
|
||||
GMM_CLIENT_CONTEXT *clientContext = nullptr;
|
||||
};
|
||||
} // namespace OCLRT
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "gmm_client_context.h"
|
||||
#include "runtime/gmm_helper/gmm_helper.h"
|
||||
#include "runtime/gmm_helper/page_table_mngr.h"
|
||||
|
||||
|
@ -31,7 +32,7 @@ GmmPageTableMngr::~GmmPageTableMngr() {
|
|||
}
|
||||
|
||||
GmmPageTableMngr::GmmPageTableMngr(GMM_DEVICE_CALLBACKS_INT *deviceCb, unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb) {
|
||||
this->clientContext = GmmHelper::gmmClientContext;
|
||||
clientContext = GmmHelper::gmmClientContext->getHandle();
|
||||
pageTableManager = clientContext->CreatePageTblMgrObject(deviceCb, translationTableCb, translationTableFlags);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,21 +20,22 @@
|
|||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "gmm_client_context.h"
|
||||
#include "runtime/gmm_helper/resource_info.h"
|
||||
#include "runtime/gmm_helper/gmm_helper.h"
|
||||
|
||||
namespace OCLRT {
|
||||
void GmmResourceInfo::customDeleter(GMM_RESOURCE_INFO *gmmResourceInfo) {
|
||||
GmmHelper::gmmClientContext->DestroyResInfoObject(gmmResourceInfo);
|
||||
GmmHelper::gmmClientContext->destroyResInfoObject(gmmResourceInfo);
|
||||
}
|
||||
|
||||
GmmResourceInfo::GmmResourceInfo(GMM_RESCREATE_PARAMS *resourceCreateParams) {
|
||||
auto resourceInfoPtr = GmmHelper::gmmClientContext->CreateResInfoObject(resourceCreateParams);
|
||||
auto resourceInfoPtr = GmmHelper::gmmClientContext->createResInfoObject(resourceCreateParams);
|
||||
this->resourceInfo = UniquePtrType(resourceInfoPtr, GmmResourceInfo::customDeleter);
|
||||
}
|
||||
|
||||
GmmResourceInfo::GmmResourceInfo(GMM_RESOURCE_INFO *inputGmmResourceInfo) {
|
||||
auto resourceInfoPtr = GmmHelper::gmmClientContext->CopyResInfoObject(inputGmmResourceInfo);
|
||||
auto resourceInfoPtr = GmmHelper::gmmClientContext->copyResInfoObject(inputGmmResourceInfo);
|
||||
this->resourceInfo = UniquePtrType(resourceInfoPtr, GmmResourceInfo::customDeleter);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
|
||||
namespace Os {
|
||||
extern const char *gmmDllName;
|
||||
}
|
||||
extern const char *gmmEntryName;
|
||||
} // namespace Os
|
||||
|
||||
namespace OCLRT {
|
||||
GMM_STATUS(GMM_STDCALL *myPfnCreateSingletonContext)
|
||||
|
@ -44,7 +45,7 @@ void GmmHelper::loadLib() {
|
|||
|
||||
UNRECOVERABLE_IF(!gmmLib);
|
||||
if (gmmLib->isLoaded()) {
|
||||
auto openGmmFunc = reinterpret_cast<decltype(&OpenGmm)>(gmmLib->getProcAddress(GMM_ENTRY_NAME));
|
||||
auto openGmmFunc = reinterpret_cast<decltype(&OpenGmm)>(gmmLib->getProcAddress(Os::gmmEntryName));
|
||||
GmmExportEntries entries;
|
||||
auto status = openGmmFunc(&entries);
|
||||
if (status == GMM_SUCCESS) {
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "CL/cl_ext.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/execution_environment/execution_environment.h"
|
||||
#include "runtime/gmm_helper/gmm_helper.h"
|
||||
#include "runtime/gtpin/gtpin_notify.h"
|
||||
#include "runtime/helpers/debug_helpers.h"
|
||||
#include "runtime/helpers/get_info.h"
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "gmm_client_context.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "igfxfmid.h"
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
|
@ -614,8 +615,11 @@ TEST(GmmTest, whenContextIsInitializedMultipleTimesThenDontOverride) {
|
|||
const HardwareInfo *hwinfo = *platformDevices;
|
||||
auto gmmHelper = MockGmmHelper(hwinfo);
|
||||
auto currentClientContext = GmmHelper::gmmClientContext;
|
||||
auto currentClientContextHandle = GmmHelper::gmmClientContext->getHandle();
|
||||
gmmHelper.initContext(hwinfo->pPlatform, hwinfo->pSkuTable, hwinfo->pWaTable, hwinfo->pSysInfo);
|
||||
|
||||
EXPECT_EQ(currentClientContext, GmmHelper::gmmClientContext);
|
||||
EXPECT_EQ(currentClientContextHandle, GmmHelper::gmmClientContext->getHandle());
|
||||
}
|
||||
|
||||
TEST(GmmTest, whenContextIsDestroyedMultimpleTimesThenDontCrash) {
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
#include "unit_tests/mocks/mock_sip.h"
|
||||
#include "runtime/gmm_helper/resource_info.h"
|
||||
#include "runtime/os_interface/debug_settings_manager.h"
|
||||
#include "lib_names.h"
|
||||
#include "External/Common/GmmLibDllName.h"
|
||||
#include "mock_gmm_client_context.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include <algorithm>
|
||||
#include <mutex>
|
||||
|
@ -59,7 +60,8 @@ std::thread::id tempThreadID;
|
|||
} // namespace OCLRT
|
||||
namespace Os {
|
||||
extern const char *gmmDllName;
|
||||
}
|
||||
extern const char *gmmEntryName;
|
||||
} // namespace Os
|
||||
|
||||
using namespace OCLRT;
|
||||
TestEnvironment *gEnvironment;
|
||||
|
@ -416,7 +418,10 @@ int main(int argc, char **argv) {
|
|||
#else
|
||||
SetUnhandledExceptionFilter(&UltExceptionFilter);
|
||||
if (!useMockGmm) {
|
||||
Os::gmmDllName = GMM_LIBRARY_NAME;
|
||||
Os::gmmDllName = GMM_UMD_DLL;
|
||||
Os::gmmEntryName = GMM_ENTRY_NAME;
|
||||
} else {
|
||||
GmmHelper::createGmmContextWrapperFunc = GmmClientContextBase::create<MockGmmClientContext>;
|
||||
}
|
||||
std::unique_ptr<OsLibrary> gmmLib(OsLibrary::load(Os::gmmDllName));
|
||||
#endif
|
||||
|
|
|
@ -26,8 +26,7 @@ if(NOT USE_STATIC_GMM)
|
|||
set(IGDRCL_SRCS_tests_mock_gmm
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/init_platform.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm.def
|
||||
)
|
||||
add_library(${target_name} EXCLUDE_FROM_ALL SHARED ${IGDRCL_SRCS_tests_mock_gmm})
|
||||
|
||||
|
@ -46,7 +45,7 @@ if(NOT USE_STATIC_GMM)
|
|||
|
||||
create_project_source_tree(${target_name})
|
||||
set_target_properties(${target_name} PROPERTIES FOLDER "test mocks")
|
||||
target_compile_definitions(${target_name} PUBLIC GMM_LIB_DLL GMM_LIB_DLL_EXPORTS)
|
||||
target_compile_definitions(${target_name} PUBLIC)
|
||||
if(NOT USE_STATIC_GMM)
|
||||
add_dependencies(unit_tests ${target_name})
|
||||
endif()
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "mock_gmm.h"
|
||||
|
||||
void initPlatform(GMM_PLATFORM_INFO *platform) {}
|
|
@ -20,601 +20,31 @@
|
|||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "mock_gmm.h"
|
||||
|
||||
GMM_GLOBAL_CONTEXT *pGmmGlobalContext;
|
||||
GMM_PLATFORM_INFO *pGlobalPlatformInfo = nullptr;
|
||||
#include "GmmLib.h"
|
||||
|
||||
GMM_CLIENT_CONTEXT *GMM_STDCALL createClientContext(GMM_CLIENT ClientType) {
|
||||
return new GMM_CLIENT_CONTEXT(ClientType);
|
||||
return reinterpret_cast<GMM_CLIENT_CONTEXT *>(0x1);
|
||||
}
|
||||
void GMM_STDCALL deleteClientContext(GMM_CLIENT_CONTEXT *pGmmClientContext) {
|
||||
delete pGmmClientContext;
|
||||
}
|
||||
void GMM_STDCALL destroySingletonContext(void) {
|
||||
delete pGlobalPlatformInfo;
|
||||
}
|
||||
GMM_STATUS GMM_STDCALL createSingletonContext(const PLATFORM Platform,
|
||||
const SKU_FEATURE_TABLE *pSkuTable,
|
||||
const WA_TABLE *pWaTable,
|
||||
const GT_SYSTEM_INFO *pGtSysInfo) {
|
||||
pGlobalPlatformInfo = new GMM_PLATFORM_INFO;
|
||||
initPlatform(pGlobalPlatformInfo);
|
||||
return GMM_SUCCESS;
|
||||
}
|
||||
GMM_STATUS GMM_STDCALL OpenGmm(GmmExportEntries *pm_GmmFuncs) {
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
GMM_STATUS GMM_STDCALL openMockGmm(GmmExportEntries *pm_GmmFuncs) {
|
||||
pm_GmmFuncs->pfnCreateClientContext = &createClientContext;
|
||||
pm_GmmFuncs->pfnCreateSingletonContext = &createSingletonContext;
|
||||
pm_GmmFuncs->pfnDeleteClientContext = &deleteClientContext;
|
||||
pm_GmmFuncs->pfnDestroySingletonContext = &destroySingletonContext;
|
||||
return GMM_SUCCESS;
|
||||
}
|
||||
|
||||
namespace GmmLib {
|
||||
MEMORY_OBJECT_CONTROL_STATE GmmClientContext::CachePolicyGetMemoryObject(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE Usage) {
|
||||
return {};
|
||||
}
|
||||
GmmClientContext::GmmClientContext(GMM_CLIENT ClientType) {
|
||||
}
|
||||
GmmClientContext::~GmmClientContext() {
|
||||
}
|
||||
|
||||
GMM_PTE_CACHE_CONTROL_BITS GMM_STDCALL GmmClientContext::CachePolicyGetPteType(GMM_RESOURCE_USAGE_TYPE Usage) {
|
||||
return {};
|
||||
}
|
||||
|
||||
MEMORY_OBJECT_CONTROL_STATE GMM_STDCALL GmmClientContext::CachePolicyGetOriginalMemoryObject(GMM_RESOURCE_INFO *pResInfo) {
|
||||
return {};
|
||||
}
|
||||
|
||||
uint8_t GMM_STDCALL GmmClientContext::CachePolicyIsUsagePTECached(GMM_RESOURCE_USAGE_TYPE Usage) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t GMM_STDCALL GmmClientContext::CachePolicyGetMaxMocsIndex() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t GMM_STDCALL GmmClientContext::CachePolicyGetMaxL1HdcMocsIndex() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t GMM_STDCALL GmmClientContext::CachePolicyGetMaxSpecialMocsIndex(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const GMM_CACHE_POLICY_ELEMENT *GMM_STDCALL GmmClientContext::GetCachePolicyUsage() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void GMM_STDCALL GmmClientContext::GetCacheSizes(GMM_CACHE_SIZES *pCacheSizes) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t GMM_STDCALL GmmClientContext::GetUseGlobalGtt(GMM_HW_COMMAND_STREAMER cs,
|
||||
GMM_HW_COMMAND Command,
|
||||
D3DDDI_PATCHLOCATIONLIST_DRIVERID *pDriverId) {
|
||||
return 0;
|
||||
}
|
||||
GMM_CACHE_POLICY_ELEMENT GMM_STDCALL GmmClientContext::GetCachePolicyElement(GMM_RESOURCE_USAGE_TYPE Usage) {
|
||||
return {};
|
||||
}
|
||||
|
||||
GMM_CACHE_POLICY_TBL_ELEMENT GMM_STDCALL GmmClientContext::GetCachePolicyTlbElement(uint32_t MocsIdx) {
|
||||
return {};
|
||||
}
|
||||
|
||||
GMM_PLATFORM_INFO &GMM_STDCALL GmmClientContext::GetPlatformInfo() {
|
||||
return *pGlobalPlatformInfo;
|
||||
}
|
||||
|
||||
uint8_t GMM_STDCALL GmmClientContext::IsPlanar(GMM_RESOURCE_FORMAT Format) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t GMM_STDCALL GmmClientContext::IsP0xx(GMM_RESOURCE_FORMAT Format) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t GMM_STDCALL GmmClientContext::IsUVPacked(GMM_RESOURCE_FORMAT Format) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t GMM_STDCALL GmmClientContext::IsCompressed(GMM_RESOURCE_FORMAT Format) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t GMM_STDCALL GmmClientContext::IsYUVPacked(GMM_RESOURCE_FORMAT Format) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
GMM_STATUS GMM_STDCALL GmmClientContext::GetLogicalTileShape(uint32_t TileMode,
|
||||
uint32_t *pWidthInBytes,
|
||||
uint32_t *pHeight,
|
||||
uint32_t *pDepth) {
|
||||
return GMM_SUCCESS;
|
||||
}
|
||||
|
||||
GMM_RESOURCE_INFO *GMM_STDCALL GmmClientContext::CreateResInfoObject(GMM_RESCREATE_PARAMS *pCreateParams) {
|
||||
return new GMM_RESOURCE_INFO;
|
||||
}
|
||||
|
||||
GMM_RESOURCE_INFO *GMM_STDCALL GmmClientContext::CopyResInfoObject(GMM_RESOURCE_INFO *pSrcRes) {
|
||||
return new GMM_RESOURCE_INFO;
|
||||
}
|
||||
|
||||
void GMM_STDCALL GmmClientContext::ResMemcpy(void *pDst, void *pSrc) {
|
||||
}
|
||||
|
||||
void GMM_STDCALL GmmClientContext::DestroyResInfoObject(GMM_RESOURCE_INFO *pResInfo) {
|
||||
delete pResInfo;
|
||||
}
|
||||
|
||||
GMM_PAGETABLE_MGR *GMM_STDCALL GmmClientContext::CreatePageTblMgrObject(
|
||||
GMM_DEVICE_CALLBACKS *pDevCb,
|
||||
GMM_TRANSLATIONTABLE_CALLBACKS *pTTCB,
|
||||
uint32_t TTFlags) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GMM_PAGETABLE_MGR *GMM_STDCALL GmmClientContext::CreatePageTblMgrObject(
|
||||
GMM_DEVICE_CALLBACKS_INT *pDevCb,
|
||||
GMM_TRANSLATIONTABLE_CALLBACKS *pTTCB,
|
||||
uint32_t TTFlags) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void GMM_STDCALL GmmClientContext::DestroyPageTblMgrObject(GMM_PAGETABLE_MGR *pPageTableMgr) {
|
||||
}
|
||||
GMM_RESOURCE_INFO *GMM_STDCALL GmmClientContext::CreateResInfoObject(GMM_RESCREATE_PARAMS *pCreateParams,
|
||||
GmmClientAllocationCallbacks *pAllocCbs) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void GMM_STDCALL GmmClientContext::DestroyResInfoObject(GMM_RESOURCE_INFO *pResInfo,
|
||||
GmmClientAllocationCallbacks *pAllocCbs) {
|
||||
}
|
||||
|
||||
GMM_PAGETABLE_MGR *GMM_STDCALL GmmClientContext::CreatePageTblMgrObject(
|
||||
GMM_DEVICE_CALLBACKS_INT *pDevCb,
|
||||
GMM_TRANSLATIONTABLE_CALLBACKS *pTTCB,
|
||||
uint32_t TTFlags,
|
||||
GmmClientAllocationCallbacks *pAllocCbs) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void GMM_STDCALL GmmClientContext::DestroyPageTblMgrObject(GMM_PAGETABLE_MGR *pPageTableMgr,
|
||||
GmmClientAllocationCallbacks *pAllocCbs) {
|
||||
}
|
||||
|
||||
extern "C" GMM_CLIENT_CONTEXT *GMM_STDCALL GmmCreateClientContext(GMM_CLIENT ClientType) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
extern "C" void GMM_STDCALL GmmDeleteClientContext(GMM_CLIENT_CONTEXT *pGmmClientContext) {
|
||||
}
|
||||
|
||||
uint8_t GMM_STDCALL GmmClientContext::ConfigureDeviceAddressSpace(GMM_ESCAPE_HANDLE_EXT hAdapter,
|
||||
GMM_ESCAPE_HANDLE_EXT hDevice,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape,
|
||||
GMM_GFX_SIZE_T SvmSize,
|
||||
uint8_t FaultableSvm,
|
||||
uint8_t SparseReady,
|
||||
uint8_t BDWL3Coherency,
|
||||
GMM_GFX_SIZE_T SizeOverride,
|
||||
GMM_GFX_SIZE_T SlmGfxSpaceReserve) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t GmmClientContext::GetSetProcessGfxPartition(GMM_ESCAPE_HANDLE_EXT hAdapter,
|
||||
GMM_ESCAPE_HANDLE_EXT hDevice,
|
||||
GMM_GFX_PARTITIONING *pProcessGfxPart,
|
||||
uint8_t Get,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
GMM_GFX_PARTITIONING GMM_STDCALL GmmClientContext::OverrideGfxPartition(GMM_GFX_PARTITIONING *GfxPartition,
|
||||
GMM_ESCAPE_HANDLE_EXT hAdapter,
|
||||
GMM_ESCAPE_HANDLE_EXT hDevice,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape) {
|
||||
return {};
|
||||
}
|
||||
|
||||
uint8_t GMM_STDCALL GmmClientContext::EnhancedBufferMap(GMM_ESCAPE_HANDLE_EXT hAdapter,
|
||||
GMM_ESCAPE_HANDLE_EXT hDevice,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape,
|
||||
D3DKMT_HANDLE hOriginalAllocation,
|
||||
GMM_ENHANCED_BUFFER_INFO *pEnhancedBufferInfo[GMM_MAX_DISPLAYS]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
GMM_GFX_ADDRESS GMM_STDCALL GmmClientContext::GetHeap32Base(GMM_ESCAPE_HANDLE_EXT hAdapter,
|
||||
GMM_ESCAPE_HANDLE_EXT hDevice,
|
||||
uint32_t *pHeapSize,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape) {
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
GMM_GFX_ADDRESS GMM_STDCALL GmmClientContext::GetTrashPageGfxAddress(GMM_ESCAPE_HANDLE_EXT hAdapter,
|
||||
GMM_ESCAPE_HANDLE_EXT hDevice,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape) {
|
||||
return {};
|
||||
}
|
||||
|
||||
GMM_HEAP *GMM_STDCALL GmmClientContext::UmSetupHeap(GMM_ESCAPE_HANDLE_EXT hAdapter,
|
||||
GMM_ESCAPE_HANDLE_EXT hDevice,
|
||||
GMM_GFX_ADDRESS GfxAddress,
|
||||
GMM_GFX_SIZE_T Size,
|
||||
uint32_t Flags,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape) {
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GMM_STATUS GMM_STDCALL GmmClientContext::UmDestroypHeap(GMM_ESCAPE_HANDLE_EXT hAdapter,
|
||||
GMM_ESCAPE_HANDLE_EXT hDevice,
|
||||
GMM_HEAP **pHeapObj,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape) {
|
||||
return GMM_SUCCESS;
|
||||
}
|
||||
|
||||
GMM_GFX_ADDRESS GMM_STDCALL GmmClientContext::AllocateHeapVA(GMM_HEAP *pHeapObj,
|
||||
GMM_GFX_SIZE_T AllocSize) {
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
GMM_STATUS GMM_STDCALL GmmClientContext::FreeHeapVA(GMM_HEAP *pHeapObj,
|
||||
GMM_GFX_ADDRESS AllocVA,
|
||||
GMM_GFX_SIZE_T AllocSize) {
|
||||
return GMM_SUCCESS;
|
||||
}
|
||||
|
||||
void *GmmClientContext::__GetSharedHeapObject(GMM_ESCAPE_HANDLE_EXT hAdapter,
|
||||
GMM_ESCAPE_HANDLE_EXT hDevice,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint32_t GmmClientContext::__SetSharedHeapObject(GMM_ESCAPE_HANDLE_EXT hAdapter,
|
||||
GMM_ESCAPE_HANDLE_EXT hDevice,
|
||||
void **pHeapObj,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
GMM_GFX_ADDRESS GMM_STDCALL GmmClientContext::GetSLMaddressRange(GMM_ESCAPE_HANDLE_EXT hAdapter,
|
||||
GMM_ESCAPE_HANDLE_EXT hDevice,
|
||||
GMM_GFX_SIZE_T Size,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape) {
|
||||
return {};
|
||||
}
|
||||
|
||||
uint8_t GMM_STDCALL GmmClientContext::ResDestroySvmAllocation(GMM_ESCAPE_HANDLE_EXT hAdapter,
|
||||
GMM_ESCAPE_HANDLE_EXT hDevice,
|
||||
D3DKMT_HANDLE hAllocation,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GMM_STDCALL GmmClientContext::GetD3dSwizzlePattern(const SWIZZLE_DESCRIPTOR *pGmmSwizzle,
|
||||
uint8_t MSAA,
|
||||
D3DWDDM2_0DDI_SWIZZLE_PATTERN_DESC *pD3dSwizzle) {
|
||||
}
|
||||
|
||||
void GMM_STDCALL GmmClientContext::GetD3dSwizzlePattern(const SWIZZLE_DESCRIPTOR *pGmmSwizzle,
|
||||
uint8_t MSAA,
|
||||
D3DWDDM2_2DDI_SWIZZLE_PATTERN_DESC *pD3dSwizzle) {
|
||||
}
|
||||
|
||||
void GMM_STDCALL GmmClientContext::GetD3dSwizzlePattern(const SWIZZLE_DESCRIPTOR *pGmmSwizzle,
|
||||
uint8_t MSAA,
|
||||
D3D12DDI_SWIZZLE_PATTERN_DESC_0022 *pD3dSwizzle) {
|
||||
}
|
||||
|
||||
void GMM_STDCALL GmmClientContext::GetD3dSwizzlePattern(const SWIZZLE_DESCRIPTOR *pGmmSwizzle,
|
||||
uint8_t MSAA,
|
||||
D3D12DDI_SWIZZLE_PATTERN_DESC_0004 *pD3dSwizzle) {
|
||||
}
|
||||
|
||||
GMM_GFX_ADDRESS GMM_STDCALL GmmClientContext::PigmsReserveGpuVA(GMM_ESCAPE_HANDLE_EXT hAdapter,
|
||||
GMM_ESCAPE_HANDLE_EXT hDevice,
|
||||
GMM_GFX_SIZE_T Size,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t GMM_STDCALL GmmClientContext::PigmsMapGpuVA(GMM_ESCAPE_HANDLE_EXT hAdapter,
|
||||
GMM_ESCAPE_HANDLE_EXT hDevice,
|
||||
GMM_GFX_ADDRESS GfxAddress,
|
||||
D3DKMT_HANDLE hAllocation,
|
||||
GMM_RESOURCE_INFO *pGmmResInfo,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t GMM_STDCALL GmmClientContext::PigmsFreeGpuVa(GMM_ESCAPE_HANDLE_EXT hAdapter,
|
||||
GMM_ESCAPE_HANDLE_EXT hDevice,
|
||||
GMM_GFX_ADDRESS GfxAddress,
|
||||
GMM_GFX_SIZE_T Size,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
GMM_STATUS GMM_STDCALL GmmClientContext::ResUpdateAfterSharedOpen(HANDLE hAdapter,
|
||||
HANDLE hDevice,
|
||||
D3DKMT_HANDLE hAllocation,
|
||||
GMM_RESOURCE_INFO *pGmmResInfo,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape) {
|
||||
return GMM_SUCCESS;
|
||||
}
|
||||
|
||||
uint8_t GMM_STDCALL GmmClientContext::CreateTiledResource(GMM_HANDLE_EXT hAdapter,
|
||||
GMM_HANDLE_EXT hDevice,
|
||||
GMM_UMD_SYNCCONTEXT *pUmdContext,
|
||||
GMM_TRANSLATIONTABLE_CALLBACKS *pTrTtCallbacks,
|
||||
GMM_RESOURCE_INFO *pGmmResource,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape,
|
||||
uint32_t NullHw) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t GMM_STDCALL GmmClientContext::DestroyTiledResource(GMM_HANDLE_EXT hAdapter,
|
||||
GMM_HANDLE_EXT hDevice,
|
||||
GMM_UMD_SYNCCONTEXT *pUmdContext,
|
||||
GMM_TRANSLATIONTABLE_CALLBACKS *pTrTtCallbacks,
|
||||
GMM_RESOURCE_INFO *pGmmResource,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape,
|
||||
uint32_t NullHw) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
GMM_STATUS GMM_STDCALL GmmClientContext::UpdateTiledResourceMapping(GMM_HANDLE_EXT hAdapter,
|
||||
GMM_HANDLE_EXT hDevice,
|
||||
GMM_UPDATE_TILE_MAPPINGS_INT Mappings,
|
||||
uint8_t UseWDDM20,
|
||||
GMM_UMD_SYNCCONTEXT *pUmdContext,
|
||||
GMM_TRANSLATIONTABLE_CALLBACKS *CmdBufCallbacks,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape,
|
||||
GMM_DEVICE_CALLBACKS_INT *DeviceCallbacks,
|
||||
uint32_t NullHw,
|
||||
uint8_t NewPool) {
|
||||
return GMM_SUCCESS;
|
||||
}
|
||||
|
||||
GMM_STATUS GMM_STDCALL GmmClientContext::UpdateSparseResourceOpaqueMapping(GMM_HANDLE_EXT hAdapter,
|
||||
GMM_HANDLE_EXT hDevice,
|
||||
GMM_UMD_SYNCCONTEXT *pUmdContext,
|
||||
GMM_TRANSLATIONTABLE_CALLBACKS *CmdBufCallbacks,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape,
|
||||
uint8_t UseWDDM20,
|
||||
uint32_t NumMappings,
|
||||
GMM_UPDATE_SPARSE_RESOURCE_OPAQUE_MAPPINGS *pMappings) {
|
||||
return GMM_SUCCESS;
|
||||
}
|
||||
|
||||
GMM_STATUS GMM_STDCALL GmmClientContext::CopyTileMappings(GMM_HANDLE_EXT hAdapter,
|
||||
GMM_HANDLE_EXT hDevice,
|
||||
GMM_COPY_TILE_MAPPINGS_INT Mappings,
|
||||
uint8_t UseWDDM20,
|
||||
GMM_UMD_SYNCCONTEXT *pUmdContext,
|
||||
GMM_TRANSLATIONTABLE_CALLBACKS *CmdBufCallbacks,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape,
|
||||
GMM_DEVICE_CALLBACKS_INT *DeviceCallbacks,
|
||||
uint32_t NullHw,
|
||||
uint8_t CheckTilePoolAllocs) {
|
||||
return GMM_SUCCESS;
|
||||
}
|
||||
|
||||
uint64_t GMM_STDCALL GmmClientContext::GetInternalGpuVaRangeLimit() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool GmmResourceInfoCommon::IsPresentableformat() {
|
||||
return false;
|
||||
}
|
||||
void GmmResourceInfoCommon::GetGenericRestrictions(__GMM_BUFFER_TYPE *pBuff) {
|
||||
}
|
||||
__GMM_BUFFER_TYPE *GmmResourceInfoCommon::GetBestRestrictions(__GMM_BUFFER_TYPE *pFirstBuffer, const __GMM_BUFFER_TYPE *pSecondBuffer) {
|
||||
return nullptr;
|
||||
}
|
||||
bool GmmResourceInfoCommon::CopyClientParams(GMM_RESCREATE_PARAMS &CreateParams) {
|
||||
return false;
|
||||
}
|
||||
bool GmmResourceInfoCommon::RedescribePlanes() {
|
||||
return false;
|
||||
}
|
||||
bool GmmResourceInfoCommon::ReAdjustPlaneProperties(bool IsAuxSurf) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const GMM_PLATFORM_INFO &GmmResourceInfoCommon::GetPlatformInfo() {
|
||||
return *pGlobalPlatformInfo;
|
||||
}
|
||||
GMM_STATUS GMM_STDCALL GmmResourceInfoCommon::Create(Context &GmmLibContext, GMM_RESCREATE_PARAMS &CreateParams) {
|
||||
return GMM_SUCCESS;
|
||||
}
|
||||
uint8_t GMM_STDCALL GmmResourceInfoCommon::ValidateParams() {
|
||||
return 0;
|
||||
}
|
||||
GMM_STATUS GMM_STDCALL GmmResourceInfoCommon::Create(GMM_RESCREATE_PARAMS &CreateParams) {
|
||||
|
||||
return GMM_SUCCESS;
|
||||
}
|
||||
void GMM_STDCALL GmmResourceInfoCommon::GetRestrictions(__GMM_BUFFER_TYPE &Restrictions) {
|
||||
}
|
||||
uint32_t GMM_STDCALL GmmResourceInfoCommon::GetPaddedWidth(uint32_t MipLevel) {
|
||||
return 0;
|
||||
}
|
||||
uint32_t GMM_STDCALL GmmResourceInfoCommon::GetPaddedHeight(uint32_t MipLevel) {
|
||||
return 0;
|
||||
}
|
||||
uint32_t GMM_STDCALL GmmResourceInfoCommon::GetPaddedPitch(uint32_t MipLevel) {
|
||||
return 0;
|
||||
}
|
||||
uint32_t GMM_STDCALL GmmResourceInfoCommon::GetQPitch() {
|
||||
return 0;
|
||||
}
|
||||
GMM_STATUS GMM_STDCALL GmmResourceInfoCommon::GetOffset(GMM_REQ_OFFSET_INFO &ReqInfo) {
|
||||
|
||||
return GMM_SUCCESS;
|
||||
}
|
||||
uint8_t GMM_STDCALL GmmResourceInfoCommon::CpuBlt(GMM_RES_COPY_BLT *pBlt) {
|
||||
return 0;
|
||||
}
|
||||
uint8_t GMM_STDCALL GmmResourceInfoCommon::GetMappingSpanDesc(GMM_GET_MAPPING *pMapping) {
|
||||
return 0;
|
||||
}
|
||||
uint8_t GMM_STDCALL GmmResourceInfoCommon::Is64KBPageSuitable() {
|
||||
return 0;
|
||||
}
|
||||
void GMM_STDCALL GmmResourceInfoCommon::GetTiledResourceMipPacking(uint32_t *pNumPackedMips,
|
||||
uint32_t *pNumTilesForPackedMips) {}
|
||||
uint32_t GMM_STDCALL GmmResourceInfoCommon::GetPackedMipTailStartLod() {
|
||||
return 0;
|
||||
}
|
||||
bool GMM_STDCALL GmmResourceInfoCommon::IsMipRCCAligned(uint8_t &MisAlignedLod) {
|
||||
return false;
|
||||
}
|
||||
uint8_t GMM_STDCALL GmmResourceInfoCommon::GetDisplayFastClearSupport() {
|
||||
return 0;
|
||||
}
|
||||
uint8_t GMM_STDCALL GmmResourceInfoCommon::GetDisplayCompressionSupport() {
|
||||
return 0;
|
||||
}
|
||||
uint32_t GMM_STDCALL GmmResourceInfoCommon::GetCompressionBlockWidth() {
|
||||
return 0;
|
||||
}
|
||||
uint32_t GMM_STDCALL GmmResourceInfoCommon::GetCompressionBlockHeight() {
|
||||
return 0;
|
||||
}
|
||||
uint32_t GMM_STDCALL GmmResourceInfoCommon::GetCompressionBlockDepth() {
|
||||
return 0;
|
||||
}
|
||||
uint8_t GMM_STDCALL GmmResourceInfoCommon::IsArraySpacingSingleLod() {
|
||||
return 0;
|
||||
}
|
||||
uint8_t GMM_STDCALL GmmResourceInfoCommon::IsASTC() {
|
||||
return 0;
|
||||
}
|
||||
MEMORY_OBJECT_CONTROL_STATE GMM_STDCALL GmmResourceInfoCommon::GetMOCS() {
|
||||
return {};
|
||||
}
|
||||
uint32_t GMM_STDCALL GmmResourceInfoCommon::GetStdTilingModeExtSurfaceState() {
|
||||
return 0;
|
||||
}
|
||||
GMM_SURFACESTATE_FORMAT GMM_STDCALL GmmResourceInfoCommon::GetResourceFormatSurfaceState() {
|
||||
return {};
|
||||
}
|
||||
GMM_GFX_SIZE_T GMM_STDCALL GmmResourceInfoCommon::GetMipWidth(uint32_t MipLevel) {
|
||||
return {};
|
||||
}
|
||||
uint32_t GMM_STDCALL GmmResourceInfoCommon::GetMipHeight(uint32_t MipLevel) {
|
||||
return 0;
|
||||
}
|
||||
uint32_t GMM_STDCALL GmmResourceInfoCommon::GetMipDepth(uint32_t MipLevel) {
|
||||
return 0;
|
||||
}
|
||||
GMM_STATUS GMM_STDCALL GmmResourceInfoWin::GetOffsetFor64KBTiles(GMM_REQ_OFFSET_INFO &ReqInfo) {
|
||||
return GMM_SUCCESS;
|
||||
}
|
||||
uint8_t GMM_STDCALL GmmResourceInfoWin::ApplyExistingSysMem(void *pExistingSysMem, GMM_GFX_SIZE_T ExistingSysMemSize) {
|
||||
return 0;
|
||||
}
|
||||
uint8_t GMM_STDCALL GmmResourceInfoWin::IsPredictedGlobalAliasingParticipant() {
|
||||
return 0;
|
||||
}
|
||||
uint8_t GMM_STDCALL GmmResourceInfoWin::IsSurfaceFaultable() {
|
||||
return 0;
|
||||
}
|
||||
uint32_t GMM_STDCALL GmmResourceInfoWin::GetRenderPitchIn64KBTiles() {
|
||||
return 0;
|
||||
}
|
||||
uint8_t GMM_STDCALL GmmResourceInfoWin::UpdateCacheability(GMM_ESCAPE_HANDLE_EXT hAdapter,
|
||||
GMM_ESCAPE_HANDLE_EXT hDevice,
|
||||
D3DKMT_HANDLE hAllocation,
|
||||
GMM_GPU_CACHE_SETTINGS &CacheSettings,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape) {
|
||||
return 0;
|
||||
}
|
||||
uint8_t GMM_STDCALL GmmResourceInfoWin::Alias32bit(GMM_ESCAPE_HANDLE_EXT hAdapter,
|
||||
GMM_ESCAPE_HANDLE_EXT hDevice,
|
||||
D3DKMT_HANDLE hAllocation,
|
||||
uint32_t Size,
|
||||
uint32_t *pAliasAddress,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape) {
|
||||
return 0;
|
||||
}
|
||||
uint8_t GMM_STDCALL GmmResourceInfoWin::KmdGetSetHardwareProtection(GMM_ESCAPE_HANDLE_EXT hAdapter,
|
||||
GMM_ESCAPE_HANDLE_EXT hDevice,
|
||||
D3DKMT_HANDLE hAllocation,
|
||||
uint8_t SetIsEncrypted,
|
||||
uint8_t *pGetIsEncrypted,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t GMM_STDCALL GmmResourceInfoWin::KmdSetPavpStoutOrIsolatedEncryptionForDisplay(GMM_ESCAPE_HANDLE_EXT hAdapter,
|
||||
GMM_ESCAPE_HANDLE_EXT hDevice,
|
||||
D3DKMT_HANDLE hAllocation,
|
||||
uint8_t bPavpModeIsStoutOrIsolatedDecode,
|
||||
uint32_t uiPavpSessionId,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t GMM_STDCALL GmmResourceInfoWin::KmdGetSetCpSurfTag(GMM_ESCAPE_HANDLE_EXT hAdapter,
|
||||
GMM_ESCAPE_HANDLE_EXT hDevice,
|
||||
D3DKMT_HANDLE hAllocation,
|
||||
uint8_t IsSet,
|
||||
uint32_t CpTag,
|
||||
GMM_ESCAPE_FUNC_TYPE_EXT pfnEscape) {
|
||||
return 0;
|
||||
}
|
||||
bool GmmResourceInfoWin::CopyClientParams(GMM_RESCREATE_PARAMS &CreateParams) {
|
||||
return false;
|
||||
}
|
||||
GMM_GFX_ADDRESS GmmPageTableMgr::GetTRL3TableAddr() {
|
||||
return {};
|
||||
}
|
||||
GMM_GFX_ADDRESS GmmPageTableMgr::GetAuxL3TableAddr() {
|
||||
return {};
|
||||
}
|
||||
GMM_STATUS GmmPageTableMgr::InitContextAuxTableRegister(HANDLE initialBBHandle, GMM_ENGINE_TYPE engType) {
|
||||
return GMM_SUCCESS;
|
||||
}
|
||||
GMM_STATUS GmmPageTableMgr::InitContextTRTableRegister(HANDLE initialBBHandle, GMM_ENGINE_TYPE engType) {
|
||||
return GMM_SUCCESS;
|
||||
}
|
||||
void GmmPageTableMgr::InitGpuBBQueueCallbacks(GMM_TRANSLATIONTABLE_CALLBACKS *TTCB) {}
|
||||
|
||||
HRESULT GmmPageTableMgr::ReserveTRGpuVirtualAddress(GMM_UMD_SYNCCONTEXT *, D3DDDI_RESERVEGPUVIRTUALADDRESS *, uint8_t DoNotWait) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
HRESULT GmmPageTableMgr::MapTRGpuVirtualAddress(GMM_MAPTRGPUVIRTUALADDRESS *ReserveGpuVa, uint8_t DoNotWait) {
|
||||
return 0;
|
||||
}
|
||||
HRESULT GmmPageTableMgr::UpdateTRGpuVirtualAddress(GMM_UMD_SYNCCONTEXT **, const GMM_UPDATETRGPUVIRTUALADDRESS_INT *, uint8_t DoNotWait) {
|
||||
return 0;
|
||||
}
|
||||
HRESULT GmmPageTableMgr::FreeTRGpuVirtualAddress(GMM_UMD_SYNCCONTEXT *, const GMM_DDI_FREEGPUVIRTUALADDRSS_INT *, uint8_t DoNotWait) {
|
||||
return 0;
|
||||
}
|
||||
GMM_STATUS GmmPageTableMgr::UpdateAuxTable(const GMM_DDI_UPDATEAUXTABLE *) {
|
||||
return GMM_SUCCESS;
|
||||
}
|
||||
void GmmPageTableMgr::EvictPageTablePool(D3DKMT_HANDLE *BBQHandles, int NumBBFenceObj) {}
|
||||
void GmmPageTableMgr::__ReleaseUnusedPool(GMM_UMD_SYNCCONTEXT *UmdContext) {}
|
||||
GMM_PAGETABLEPool *GmmPageTableMgr::__GetFreePoolNode(uint32_t *FreePoolNodeIdx, POOL_TYPE PoolType) { return nullptr; }
|
||||
GmmPageTableMgr::~GmmPageTableMgr() {}
|
||||
} // namespace GmmLib
|
||||
uint8_t GMM_STDCALL GmmIsPlanar(GMM_RESOURCE_FORMAT Format) {
|
||||
return 0;
|
||||
}
|
||||
const GMM_PLATFORM_INFO *GMM_STDCALL GmmGetPlatformInfo(GMM_GLOBAL_CONTEXT *pGmmLibContext) {
|
||||
return nullptr;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
; Copyright (c) 2018, Intel Corporation
|
||||
;
|
||||
; Permission is hereby granted, free of charge, to any person obtaining a
|
||||
; copy of this software and associated documentation files (the "Software"),
|
||||
; to deal in the Software without restriction, including without limitation
|
||||
; the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
; and/or sell copies of the Software, and to permit persons to whom the
|
||||
; Software is furnished to do so, subject to the following conditions:
|
||||
;
|
||||
; The above copyright notice and this permission notice shall be included
|
||||
; in all copies or substantial portions of the Software.
|
||||
;
|
||||
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
; OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
; THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
; OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
; ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
; OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
LIBRARY "mock_gmm"
|
||||
EXPORTS
|
||||
openMockGmm
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "GmmLib.h"
|
||||
|
||||
void initPlatform(GMM_PLATFORM_INFO *platform);
|
|
@ -46,10 +46,14 @@ set(IGDRCL_SRCS_tests_mocks
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/mock_event.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_experimental_command_buffer.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_client_context_base.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_client_context_base.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_resource_info.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_resource_info.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_graphics_allocation.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${IGDRCL__INSTRUMENTATION_DIR_SUFFIX}/mock_instrumentation.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/mock_gmm_client_context.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/mock_gmm_client_context.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_image.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_kernel.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_kernel.h
|
||||
|
@ -65,13 +69,14 @@ set(IGDRCL_SRCS_tests_mocks
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/mock_submissions_aggregator.h
|
||||
)
|
||||
|
||||
if (WIN32)
|
||||
if(WIN32)
|
||||
file(GLOB IGDRCL_SRC_tests_mock_wddm "${CMAKE_CURRENT_SOURCE_DIR}/mock_wddm2[0-9]\.*")
|
||||
list (APPEND IGDRCL_SRCS_tests_mocks
|
||||
list(APPEND IGDRCL_SRCS_tests_mocks
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_d3d_objects.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_ostime_win.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/mock_gmm_memory.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/mock_gmm_memory.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_memory_base.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_memory_base.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_memory${BRANCH_DIR_SUFFIX}/mock_gmm_memory.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_page_table_mngr.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_page_table_mngr.cpp
|
||||
${IGDRCL_SRC_tests_mock_wddm}
|
||||
|
@ -82,6 +87,12 @@ add_subdirectories()
|
|||
|
||||
add_library(igdrcl_mocks STATIC ${IGDRCL_SRCS_tests_mocks})
|
||||
|
||||
if(WIN32)
|
||||
target_include_directories(igdrcl_mocks PUBLIC
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/mocks/gmm_memory${BRANCH_DIR_SUFFIX}
|
||||
)
|
||||
endif()
|
||||
|
||||
# add_dependencies(igdrcl_mocks gmock-gtest)
|
||||
|
||||
target_include_directories(igdrcl_mocks PRIVATE
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "unit_tests/mocks/mock_gmm_memory_base.h"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
class MockGmmMemory : public MockGmmMemoryBase {
|
||||
};
|
||||
|
||||
class GmockGmmMemory : public GmockGmmMemoryBase {
|
||||
};
|
||||
} // namespace OCLRT
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "mock_gmm_client_context.h"
|
||||
|
||||
namespace OCLRT {
|
||||
MockGmmClientContext::MockGmmClientContext(GMM_CLIENT clientType) : MockGmmClientContextBase(clientType) {
|
||||
}
|
||||
} // namespace OCLRT
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "unit_tests/mocks/mock_gmm_client_context_base.h"
|
||||
|
||||
namespace OCLRT {
|
||||
class MockGmmClientContext : public MockGmmClientContextBase {
|
||||
public:
|
||||
MockGmmClientContext(GMM_CLIENT clientType);
|
||||
};
|
||||
} // namespace OCLRT
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "unit_tests/mocks/mock_gmm_client_context.h"
|
||||
|
||||
namespace OCLRT {
|
||||
MockGmmClientContextBase::MockGmmClientContextBase(GMM_CLIENT clientType) : GmmClientContext(clientType) {
|
||||
}
|
||||
|
||||
MEMORY_OBJECT_CONTROL_STATE MockGmmClientContextBase::cachePolicyGetMemoryObject(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE usage) {
|
||||
return {};
|
||||
}
|
||||
|
||||
GMM_RESOURCE_INFO *MockGmmClientContextBase::createResInfoObject(GMM_RESCREATE_PARAMS *pCreateParams) {
|
||||
return reinterpret_cast<GMM_RESOURCE_INFO *>(new char[1]);
|
||||
}
|
||||
|
||||
GMM_RESOURCE_INFO *MockGmmClientContextBase::copyResInfoObject(GMM_RESOURCE_INFO *pSrcRes) {
|
||||
return reinterpret_cast<GMM_RESOURCE_INFO *>(new char[1]);
|
||||
}
|
||||
|
||||
void MockGmmClientContextBase::destroyResInfoObject(GMM_RESOURCE_INFO *pResInfo) {
|
||||
delete[] reinterpret_cast<char *>(pResInfo);
|
||||
}
|
||||
} // namespace OCLRT
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "gmm_client_context.h"
|
||||
|
||||
namespace OCLRT {
|
||||
class MockGmmClientContextBase : public GmmClientContext {
|
||||
public:
|
||||
MEMORY_OBJECT_CONTROL_STATE cachePolicyGetMemoryObject(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE usage) override;
|
||||
GMM_RESOURCE_INFO *createResInfoObject(GMM_RESCREATE_PARAMS *pCreateParams) override;
|
||||
GMM_RESOURCE_INFO *copyResInfoObject(GMM_RESOURCE_INFO *pSrcRes) override;
|
||||
void destroyResInfoObject(GMM_RESOURCE_INFO *pResInfo) override;
|
||||
|
||||
protected:
|
||||
MockGmmClientContextBase(GMM_CLIENT clientType);
|
||||
};
|
||||
} // namespace OCLRT
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
@ -21,9 +21,6 @@
|
|||
*/
|
||||
|
||||
#include "mock_gmm_memory.h"
|
||||
#include "runtime/os_interface/windows/windows_defs.h"
|
||||
|
||||
using namespace ::testing;
|
||||
|
||||
namespace OCLRT {
|
||||
GmmMemory *GmmMemory::create() {
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
@ -27,11 +27,11 @@
|
|||
|
||||
namespace OCLRT {
|
||||
|
||||
class MockGmmMemory : public GmmMemory {
|
||||
class MockGmmMemoryBase : public GmmMemory {
|
||||
public:
|
||||
~MockGmmMemory() = default;
|
||||
~MockGmmMemoryBase() = default;
|
||||
|
||||
MockGmmMemory() = default;
|
||||
MockGmmMemoryBase() = default;
|
||||
|
||||
bool configureDeviceAddressSpace(GMM_ESCAPE_HANDLE hAdapter,
|
||||
GMM_ESCAPE_HANDLE hDevice,
|
||||
|
@ -50,11 +50,11 @@ class MockGmmMemory : public GmmMemory {
|
|||
}
|
||||
};
|
||||
|
||||
class GmockGmmMemory : public GmmMemory {
|
||||
class GmockGmmMemoryBase : public GmmMemory {
|
||||
public:
|
||||
~GmockGmmMemory() = default;
|
||||
~GmockGmmMemoryBase() = default;
|
||||
|
||||
GmockGmmMemory() = default;
|
||||
GmockGmmMemoryBase() = default;
|
||||
|
||||
MOCK_METHOD9(configureDeviceAddressSpace,
|
||||
bool(GMM_ESCAPE_HANDLE hAdapter,
|
|
@ -26,6 +26,7 @@ set(IGDRCL_SRCS_tests_os_interface_windows
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/driver_info_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gdi_dll_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gdi_interface_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_memory_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_win_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_win_tests.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gdi_interface.h
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/gmm_helper/gmm_helper.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "gmm_memory.h"
|
||||
#include "gmm_client_context.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
class PublicGmmMemory : public GmmMemory {
|
||||
public:
|
||||
using GmmMemory::clientContext;
|
||||
using GmmMemory::ensureClientContext;
|
||||
};
|
||||
|
||||
TEST(GmmMemoryTest, givenGmmMemoryWithoutSetClientContextWhenEnsureClientContextThenSetClientContext) {
|
||||
PublicGmmMemory gmmMemory;
|
||||
GmmHelper gmmHelper(*platformDevices);
|
||||
EXPECT_EQ(nullptr, gmmMemory.clientContext);
|
||||
gmmMemory.ensureClientContext();
|
||||
EXPECT_NE(nullptr, gmmMemory.clientContext);
|
||||
EXPECT_EQ(gmmMemory.clientContext, GmmHelper::gmmClientContext->getHandle());
|
||||
}
|
||||
|
||||
TEST(GmmMemoryTest, givenGmmMemoryWithSetClientContextWhenEnsureClientContextThenDontOverrideClientContext) {
|
||||
PublicGmmMemory gmmMemory;
|
||||
GmmHelper gmmHelper(*platformDevices);
|
||||
auto dummyPtr = reinterpret_cast<GMM_CLIENT_CONTEXT *>(0x123);
|
||||
gmmMemory.clientContext = dummyPtr;
|
||||
EXPECT_EQ(dummyPtr, gmmMemory.clientContext);
|
||||
EXPECT_NE(dummyPtr, GmmHelper::gmmClientContext->getHandle());
|
||||
gmmMemory.ensureClientContext();
|
||||
EXPECT_EQ(dummyPtr, gmmMemory.clientContext);
|
||||
}
|
|
@ -33,6 +33,7 @@ const char *frontEndDllName = "mock_igdfcl.dll";
|
|||
const char *igcDllName = "mock_igc.dll";
|
||||
const char *gdiDllName = "gdi32_mock.dll";
|
||||
const char *gmmDllName = "mock_gmm.dll";
|
||||
const char *gmmEntryName = "openMockGmm";
|
||||
const char *testDllName = "test_dynamic_lib.dll";
|
||||
} // namespace Os
|
||||
|
||||
|
|
Loading…
Reference in New Issue