mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Prepare to use gmm as dll on Windows
Since this commit neo on Windows can use static or shared gmm lib Change-Id: I7db70d7f9bc969e8193ac77e8b6d65ecc57d0093
This commit is contained in:

committed by
sys_ocldev

parent
c1782b802a
commit
98b8b4b6a4
@ -240,8 +240,27 @@ if(NOT GMMUMD_LIB_NAME)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
get_target_property(target_type ${GMMUMD_LIB_NAME} TYPE)
|
||||||
|
|
||||||
|
if(target_type STREQUAL "STATIC_LIBRARY")
|
||||||
|
set(USE_STATIC_GMM TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(UMKM_SHAREDDATA_INCLUDE_PATHS $<TARGET_PROPERTY:${GMMUMD_LIB_NAME},INTERFACE_INCLUDE_DIRECTORIES>)
|
set(UMKM_SHAREDDATA_INCLUDE_PATHS $<TARGET_PROPERTY:${GMMUMD_LIB_NAME},INTERFACE_INCLUDE_DIRECTORIES>)
|
||||||
|
|
||||||
|
set(GMM_LIB_FILENAME "igdgmm${NEO_BITS}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||||
|
|
||||||
|
macro(copy_gmm_dll_for target)
|
||||||
|
if(WIN32 AND NOT USE_STATIC_GMM)
|
||||||
|
add_dependencies(${target} ${GMMUMD_LIB_NAME})
|
||||||
|
add_custom_command(
|
||||||
|
TARGET ${target}
|
||||||
|
POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${GMMUMD_LIB_NAME}> $<TARGET_FILE_DIR:${target}>
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
# Instrumentation detection
|
# Instrumentation detection
|
||||||
if(NOT INSTRUMENTATION_LIB_NAME)
|
if(NOT INSTRUMENTATION_LIB_NAME)
|
||||||
if(INSTRUMENTATION_SOURCE_DIR)
|
if(INSTRUMENTATION_SOURCE_DIR)
|
||||||
@ -534,3 +553,4 @@ include(package.cmake)
|
|||||||
configure_file(config.h.in ${IGDRCL_BUILD_DIR}/config.h)
|
configure_file(config.h.in ${IGDRCL_BUILD_DIR}/config.h)
|
||||||
configure_file(compiler.config.h.in ${IGDRCL_BUILD_DIR}/compiler.config.h)
|
configure_file(compiler.config.h.in ${IGDRCL_BUILD_DIR}/compiler.config.h)
|
||||||
configure_file(driver_version.h.in ${IGDRCL_BUILD_DIR}/driver_version.h) # Put Driver version into define
|
configure_file(driver_version.h.in ${IGDRCL_BUILD_DIR}/driver_version.h) # Put Driver version into define
|
||||||
|
configure_file(lib_names.h.in ${IGDRCL_BUILD_DIR}/lib_names.h)
|
||||||
|
28
lib_names.h.in
Normal file
28
lib_names.h.in
Normal file
@ -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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LIB_NAMES_H
|
||||||
|
#define LIB_NAMES_H
|
||||||
|
|
||||||
|
#cmakedefine GMM_LIB_FILENAME "${GMM_LIB_FILENAME}"
|
||||||
|
|
||||||
|
#endif /* LIB_NAMES_H */
|
@ -100,7 +100,11 @@ target_compile_definitions(${NEO_STATIC_LIB_NAME} PUBLIC DEFAULT_PLATFORM=${DEFA
|
|||||||
|
|
||||||
link_directories(${GMM_LIB_PATHS})
|
link_directories(${GMM_LIB_PATHS})
|
||||||
|
|
||||||
target_link_libraries(${NEO_STATIC_LIB_NAME} ${GMMUMD_LIB_NAME})
|
if(UNIX OR USE_STATIC_GMM)
|
||||||
|
target_link_libraries(${NEO_STATIC_LIB_NAME} ${GMMUMD_LIB_NAME})
|
||||||
|
else()
|
||||||
|
target_compile_definitions(${NEO_STATIC_LIB_NAME} PUBLIC GMM_LIB_DLL)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(INSTRUMENTATION_LIB_NAME)
|
if(INSTRUMENTATION_LIB_NAME)
|
||||||
add_dependencies(${NEO_STATIC_LIB_NAME} ${INSTRUMENTATION_LIB_NAME})
|
add_dependencies(${NEO_STATIC_LIB_NAME} ${INSTRUMENTATION_LIB_NAME})
|
||||||
@ -134,6 +138,7 @@ if(${GENERATE_EXECUTABLE})
|
|||||||
add_library(${NEO_DYNAMIC_LIB_NAME} SHARED
|
add_library(${NEO_DYNAMIC_LIB_NAME} SHARED
|
||||||
${NEO_DYNAMIC_LIB__TARGET_OBJECTS}
|
${NEO_DYNAMIC_LIB__TARGET_OBJECTS}
|
||||||
)
|
)
|
||||||
|
add_dependencies(${NEO_DYNAMIC_LIB_NAME} ${GMMUMD_LIB_NAME})
|
||||||
|
|
||||||
if(GTPIN_HEADERS_DIR)
|
if(GTPIN_HEADERS_DIR)
|
||||||
macro(macro_for_each_gen)
|
macro(macro_for_each_gen)
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
* OTHER DEALINGS IN THE SOFTWARE.
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#include "lib_names.h"
|
||||||
|
|
||||||
namespace Os {
|
namespace Os {
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
@ -30,4 +31,5 @@ const char *igcDllName = "igc32.dll";
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *gdiDllName = "gdi32.dll";
|
const char *gdiDllName = "gdi32.dll";
|
||||||
|
const char *gmmDllName = GMM_LIB_FILENAME;
|
||||||
} // namespace Os
|
} // namespace Os
|
||||||
|
@ -31,28 +31,6 @@
|
|||||||
#include "runtime/helpers/hw_info.h"
|
#include "runtime/helpers/hw_info.h"
|
||||||
#include "runtime/sku_info/operations/sku_info_transfer.h"
|
#include "runtime/sku_info/operations/sku_info_transfer.h"
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
|
|
||||||
void GMMDebugBreak(const char *file, const char *function, const int line) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void GMMPrintMessage(uint32_t debugLevel, const char *debugMessageFmt, ...) {
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct GfxDebugControlRec {
|
|
||||||
uint32_t Version;
|
|
||||||
uint32_t Size;
|
|
||||||
uint32_t AssertEnableMask;
|
|
||||||
uint32_t EnableDebugFileDump;
|
|
||||||
uint32_t DebugEnableMask;
|
|
||||||
uint32_t RingBufDbgMask;
|
|
||||||
uint32_t ReportAssertEnable;
|
|
||||||
uint32_t AssertBreakDisable;
|
|
||||||
|
|
||||||
} GFX_DEBUG_CONTROL, *PGFX_DEBUG_CONTROL;
|
|
||||||
PGFX_DEBUG_CONTROL pDebugControl;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
void Gmm::create() {
|
void Gmm::create() {
|
||||||
if (resourceParams.BaseWidth >= maxPossiblePitch) {
|
if (resourceParams.BaseWidth >= maxPossiblePitch) {
|
||||||
@ -71,19 +49,21 @@ bool Gmm::initContext(const PLATFORM *pPlatform,
|
|||||||
_WA_TABLE gmmWaTable = {};
|
_WA_TABLE gmmWaTable = {};
|
||||||
SkuInfoTransfer::transferFtrTableForGmm(&gmmFtrTable, pSkuTable);
|
SkuInfoTransfer::transferFtrTableForGmm(&gmmFtrTable, pSkuTable);
|
||||||
SkuInfoTransfer::transferWaTableForGmm(&gmmWaTable, pWaTable);
|
SkuInfoTransfer::transferWaTableForGmm(&gmmWaTable, pWaTable);
|
||||||
|
if (!isLoaded) {
|
||||||
bool success = GMM_SUCCESS == GmmInitGlobalContext(*pPlatform, &gmmFtrTable, &gmmWaTable, pGtSysInfo, GMM_CLIENT::GMM_OCL_VISTA);
|
loadLib();
|
||||||
|
}
|
||||||
|
bool success = GMM_SUCCESS == initGlobalContextFunc(*pPlatform, &gmmFtrTable, &gmmWaTable, pGtSysInfo, GMM_CLIENT::GMM_OCL_VISTA);
|
||||||
UNRECOVERABLE_IF(!success);
|
UNRECOVERABLE_IF(!success);
|
||||||
Gmm::gmmClientContext = GmmCreateClientContext(GMM_CLIENT::GMM_OCL_VISTA);
|
Gmm::gmmClientContext = createClientContextFunc(GMM_CLIENT::GMM_OCL_VISTA);
|
||||||
}
|
}
|
||||||
return Gmm::gmmClientContext != nullptr;
|
return Gmm::gmmClientContext != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gmm::destroyContext() {
|
void Gmm::destroyContext() {
|
||||||
if (Gmm::gmmClientContext) {
|
if (Gmm::gmmClientContext) {
|
||||||
GmmDeleteClientContext(Gmm::gmmClientContext);
|
deleteClientContextFunc(Gmm::gmmClientContext);
|
||||||
Gmm::gmmClientContext = nullptr;
|
Gmm::gmmClientContext = nullptr;
|
||||||
GmmDestroyGlobalContext();
|
destroyGlobalContextFunc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,5 +394,6 @@ bool Gmm::unifiedAuxTranslationCapable() const {
|
|||||||
|
|
||||||
bool Gmm::useSimplifiedMocsTable = false;
|
bool Gmm::useSimplifiedMocsTable = false;
|
||||||
GMM_CLIENT_CONTEXT *Gmm::gmmClientContext = nullptr;
|
GMM_CLIENT_CONTEXT *Gmm::gmmClientContext = nullptr;
|
||||||
|
bool Gmm::isLoaded = false;
|
||||||
|
|
||||||
} // namespace OCLRT
|
} // namespace OCLRT
|
||||||
|
@ -27,12 +27,6 @@
|
|||||||
#include "runtime/gmm_helper/gmm_lib.h"
|
#include "runtime/gmm_helper/gmm_lib.h"
|
||||||
#include "runtime/api/cl_types.h"
|
#include "runtime/api/cl_types.h"
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
void GMMDebugBreak(const char *file, const char *function, const int line);
|
|
||||||
|
|
||||||
void GMMPrintMessage(uint32_t debugLevel, const char *debugMessageFmt, ...);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
struct HardwareInfo;
|
struct HardwareInfo;
|
||||||
struct FeatureTable;
|
struct FeatureTable;
|
||||||
@ -63,6 +57,7 @@ class Gmm {
|
|||||||
static Gmm *create(GMM_RESOURCE_INFO *inputGmm);
|
static Gmm *create(GMM_RESOURCE_INFO *inputGmm);
|
||||||
|
|
||||||
static bool initContext(const PLATFORM *pPlatform, const FeatureTable *pSkuTable, const WorkaroundTable *pWaTable, const GT_SYSTEM_INFO *pGtSysInfo);
|
static bool initContext(const PLATFORM *pPlatform, const FeatureTable *pSkuTable, const WorkaroundTable *pWaTable, const GT_SYSTEM_INFO *pGtSysInfo);
|
||||||
|
static void loadLib();
|
||||||
static void destroyContext();
|
static void destroyContext();
|
||||||
|
|
||||||
static uint32_t getMOCS(uint32_t type);
|
static uint32_t getMOCS(uint32_t type);
|
||||||
@ -97,8 +92,14 @@ class Gmm {
|
|||||||
GMM_RESCREATE_PARAMS resourceParams = {};
|
GMM_RESCREATE_PARAMS resourceParams = {};
|
||||||
std::unique_ptr<GmmResourceInfo> gmmResourceInfo;
|
std::unique_ptr<GmmResourceInfo> gmmResourceInfo;
|
||||||
|
|
||||||
|
static decltype(&GmmInitGlobalContext) initGlobalContextFunc;
|
||||||
|
static decltype(&GmmDestroyGlobalContext) destroyGlobalContextFunc;
|
||||||
|
static decltype(&GmmCreateClientContext) createClientContextFunc;
|
||||||
|
static decltype(&GmmDeleteClientContext) deleteClientContextFunc;
|
||||||
|
|
||||||
bool isRenderCompressed = false;
|
bool isRenderCompressed = false;
|
||||||
static bool useSimplifiedMocsTable;
|
static bool useSimplifiedMocsTable;
|
||||||
static GMM_CLIENT_CONTEXT *gmmClientContext;
|
static GMM_CLIENT_CONTEXT *gmmClientContext;
|
||||||
|
static bool isLoaded;
|
||||||
};
|
};
|
||||||
} // namespace OCLRT
|
} // namespace OCLRT
|
||||||
|
@ -46,7 +46,7 @@ bool GmmMemoryBase::configureDeviceAddressSpace(GMM_ESCAPE_HANDLE hAdapter,
|
|||||||
}
|
}
|
||||||
|
|
||||||
uintptr_t GmmMemoryBase::getInternalGpuVaRangeLimit() {
|
uintptr_t GmmMemoryBase::getInternalGpuVaRangeLimit() {
|
||||||
return static_cast<uintptr_t>(pGmmGlobalContext->GetInternalGpuVaRangeLimit());
|
return static_cast<uintptr_t>(Gmm::gmmClientContext->GetInternalGpuVaRangeLimit());
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // namespace OCLRT
|
}; // namespace OCLRT
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Intel Corporation
|
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@ -24,7 +24,7 @@
|
|||||||
#include "runtime/gmm_helper/page_table_mngr.h"
|
#include "runtime/gmm_helper/page_table_mngr.h"
|
||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
GmmPageTableMngr *GmmPageTableMngr::create(GMM_DEVICE_CALLBACKS *deviceCb, unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb) {
|
GmmPageTableMngr *GmmPageTableMngr::create(GMM_DEVICE_CALLBACKS_INT *deviceCb, unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb) {
|
||||||
return new GmmPageTableMngr(deviceCb, translationTableFlags, translationTableCb);
|
return new GmmPageTableMngr(deviceCb, translationTableFlags, translationTableCb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class GmmPageTableMngr {
|
|||||||
public:
|
public:
|
||||||
MOCKABLE_VIRTUAL ~GmmPageTableMngr() = default;
|
MOCKABLE_VIRTUAL ~GmmPageTableMngr() = default;
|
||||||
|
|
||||||
static GmmPageTableMngr *create(GMM_DEVICE_CALLBACKS *deviceCb, unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb);
|
static GmmPageTableMngr *create(GMM_DEVICE_CALLBACKS_INT *deviceCb, unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb);
|
||||||
|
|
||||||
MOCKABLE_VIRTUAL GMM_STATUS initContextAuxTableRegister(HANDLE initialBBHandle, GMM_ENGINE_TYPE engineType) {
|
MOCKABLE_VIRTUAL GMM_STATUS initContextAuxTableRegister(HANDLE initialBBHandle, GMM_ENGINE_TYPE engineType) {
|
||||||
return pageTableManager->InitContextAuxTableRegister(initialBBHandle, engineType);
|
return pageTableManager->InitContextAuxTableRegister(initialBBHandle, engineType);
|
||||||
@ -50,7 +50,7 @@ class GmmPageTableMngr {
|
|||||||
|
|
||||||
GmmPageTableMngr() = default;
|
GmmPageTableMngr() = default;
|
||||||
|
|
||||||
GmmPageTableMngr(GMM_DEVICE_CALLBACKS *deviceCb, unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb);
|
GmmPageTableMngr(GMM_DEVICE_CALLBACKS_INT *deviceCb, unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb);
|
||||||
|
|
||||||
UniquePtrType pageTableManager;
|
UniquePtrType pageTableManager;
|
||||||
};
|
};
|
||||||
|
@ -28,7 +28,7 @@ void GmmPageTableMngr::customDeleter(GMM_PAGETABLE_MGR *gmmPageTableManager) {
|
|||||||
Gmm::gmmClientContext->DestroyPageTblMgrObject(gmmPageTableManager);
|
Gmm::gmmClientContext->DestroyPageTblMgrObject(gmmPageTableManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
GmmPageTableMngr::GmmPageTableMngr(GMM_DEVICE_CALLBACKS *deviceCb, unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb) {
|
GmmPageTableMngr::GmmPageTableMngr(GMM_DEVICE_CALLBACKS_INT *deviceCb, unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb) {
|
||||||
auto pageTableMngrPtr = Gmm::gmmClientContext->CreatePageTblMgrObject(deviceCb, translationTableCb, translationTableFlags);
|
auto pageTableMngrPtr = Gmm::gmmClientContext->CreatePageTblMgrObject(deviceCb, translationTableCb, translationTableFlags);
|
||||||
this->pageTableManager = UniquePtrType(pageTableMngrPtr, GmmPageTableMngr::customDeleter);
|
this->pageTableManager = UniquePtrType(pageTableMngrPtr, GmmPageTableMngr::customDeleter);
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ set(RUNTIME_SRCS_OS_INTERFACE_LINUX
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_neo.h
|
${CMAKE_CURRENT_SOURCE_DIR}/drm_neo.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_neo_create.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/drm_neo_create.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_null_device.h
|
${CMAKE_CURRENT_SOURCE_DIR}/drm_null_device.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/gmm_interface_linux.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/linux_inc.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/linux_inc.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/os_thread_linux.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/os_thread_linux.cpp
|
||||||
|
39
runtime/os_interface/linux/gmm_interface_linux.cpp
Normal file
39
runtime/os_interface/linux/gmm_interface_linux.cpp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* 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"
|
||||||
|
|
||||||
|
namespace OCLRT {
|
||||||
|
|
||||||
|
decltype(Gmm::initGlobalContextFunc) Gmm::initGlobalContextFunc = nullptr;
|
||||||
|
decltype(Gmm::destroyGlobalContextFunc) Gmm::destroyGlobalContextFunc = nullptr;
|
||||||
|
decltype(Gmm::createClientContextFunc) Gmm::createClientContextFunc = nullptr;
|
||||||
|
decltype(Gmm::deleteClientContextFunc) Gmm::deleteClientContextFunc = nullptr;
|
||||||
|
|
||||||
|
void Gmm::loadLib() {
|
||||||
|
Gmm::initGlobalContextFunc = GmmInitGlobalContext;
|
||||||
|
Gmm::destroyGlobalContextFunc = GmmDestroyGlobalContext;
|
||||||
|
Gmm::createClientContextFunc = GmmCreateClientContext;
|
||||||
|
Gmm::deleteClientContextFunc = GmmDeleteClientContext;
|
||||||
|
isLoaded = true;
|
||||||
|
}
|
||||||
|
}
|
@ -24,6 +24,13 @@ else()
|
|||||||
set(KMDAF_FILE_SUFFIX "_stub")
|
set(KMDAF_FILE_SUFFIX "_stub")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(USE_STATIC_GMM)
|
||||||
|
set(GMM_INTERFACE_FILE_WINDOWS ${CMAKE_CURRENT_SOURCE_DIR}/gmm_interface_static_win.cpp)
|
||||||
|
else()
|
||||||
|
set(GMM_INTERFACE_FILE_WINDOWS ${CMAKE_CURRENT_SOURCE_DIR}/gmm_interface_dynamic_win.cpp)
|
||||||
|
endif()
|
||||||
|
set_property(GLOBAL PROPERTY GMM_INTERFACE_FILE_WINDOWS ${GMM_INTERFACE_FILE_WINDOWS})
|
||||||
|
|
||||||
set(RUNTIME_SRCS_OS_INTERFACE_WINDOWS
|
set(RUNTIME_SRCS_OS_INTERFACE_WINDOWS
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/api_win.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/api_win.cpp
|
||||||
@ -39,6 +46,7 @@ set(RUNTIME_SRCS_OS_INTERFACE_WINDOWS
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/driver_info.h
|
${CMAKE_CURRENT_SOURCE_DIR}/driver_info.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/gdi_interface.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/gdi_interface.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/gdi_interface.h
|
${CMAKE_CURRENT_SOURCE_DIR}/gdi_interface.h
|
||||||
|
${GMM_INTERFACE_FILE_WINDOWS}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/kmdaf_listener${KMDAF_FILE_SUFFIX}.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/kmdaf_listener${KMDAF_FILE_SUFFIX}.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/kmdaf_listener.h
|
${CMAKE_CURRENT_SOURCE_DIR}/kmdaf_listener.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/os_inc.h
|
${CMAKE_CURRENT_SOURCE_DIR}/os_inc.h
|
||||||
|
@ -99,7 +99,5 @@ class Gdi {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
OCLRT::Windows::OsLibrary gdiDll;
|
OCLRT::Windows::OsLibrary gdiDll;
|
||||||
static const std::string gdiDllName;
|
|
||||||
static const std::string gdiMockDllName;
|
|
||||||
};
|
};
|
||||||
} // namespace OCLRT
|
} // namespace OCLRT
|
||||||
|
61
runtime/os_interface/windows/gmm_interface_dynamic_win.cpp
Normal file
61
runtime/os_interface/windows/gmm_interface_dynamic_win.cpp
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* 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/debug_helpers.h"
|
||||||
|
#include "runtime/os_interface/os_library.h"
|
||||||
|
|
||||||
|
namespace Os {
|
||||||
|
extern const char *gmmDllName;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace OCLRT {
|
||||||
|
GMM_STATUS(GMM_STDCALL *myPfnCreateSingletonContext)
|
||||||
|
(const PLATFORM Platform, const SKU_FEATURE_TABLE *pSkuTable, const WA_TABLE *pWaTable, const GT_SYSTEM_INFO *pGtSysInfo);
|
||||||
|
GMM_STATUS GMM_STDCALL myGmmInitGlobalContext(const PLATFORM Platform, const SKU_FEATURE_TABLE *pSkuTable, const WA_TABLE *pWaTable, const GT_SYSTEM_INFO *pGtSysInfo, GMM_CLIENT ClientType) {
|
||||||
|
return myPfnCreateSingletonContext(Platform, pSkuTable, pWaTable, pGtSysInfo);
|
||||||
|
}
|
||||||
|
decltype(Gmm::initGlobalContextFunc) Gmm::initGlobalContextFunc = &myGmmInitGlobalContext;
|
||||||
|
decltype(Gmm::destroyGlobalContextFunc) Gmm::destroyGlobalContextFunc = nullptr;
|
||||||
|
decltype(Gmm::createClientContextFunc) Gmm::createClientContextFunc = nullptr;
|
||||||
|
decltype(Gmm::deleteClientContextFunc) Gmm::deleteClientContextFunc = nullptr;
|
||||||
|
|
||||||
|
std::unique_ptr<OsLibrary> gmmLib;
|
||||||
|
void Gmm::loadLib() {
|
||||||
|
gmmLib.reset(OsLibrary::load(Os::gmmDllName));
|
||||||
|
|
||||||
|
UNRECOVERABLE_IF(!gmmLib);
|
||||||
|
if (gmmLib->isLoaded()) {
|
||||||
|
auto openGmmFunc = reinterpret_cast<decltype(&OpenGmm)>(gmmLib->getProcAddress(GMM_ENTRY_NAME));
|
||||||
|
GmmExportEntries entries;
|
||||||
|
auto status = openGmmFunc(&entries);
|
||||||
|
if (status == GMM_SUCCESS) {
|
||||||
|
myPfnCreateSingletonContext = entries.pfnCreateSingletonContext;
|
||||||
|
Gmm::destroyGlobalContextFunc = entries.pfnDestroySingletonContext;
|
||||||
|
Gmm::createClientContextFunc = entries.pfnCreateClientContext;
|
||||||
|
Gmm::deleteClientContextFunc = entries.pfnDeleteClientContext;
|
||||||
|
isLoaded = myPfnCreateSingletonContext && Gmm::destroyGlobalContextFunc && Gmm::createClientContextFunc && Gmm::deleteClientContextFunc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
UNRECOVERABLE_IF(!isLoaded);
|
||||||
|
}
|
||||||
|
}
|
58
runtime/os_interface/windows/gmm_interface_static_win.cpp
Normal file
58
runtime/os_interface/windows/gmm_interface_static_win.cpp
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* 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"
|
||||||
|
|
||||||
|
namespace OCLRT {
|
||||||
|
|
||||||
|
decltype(Gmm::initGlobalContextFunc) Gmm::initGlobalContextFunc = nullptr;
|
||||||
|
decltype(Gmm::destroyGlobalContextFunc) Gmm::destroyGlobalContextFunc = nullptr;
|
||||||
|
decltype(Gmm::createClientContextFunc) Gmm::createClientContextFunc = nullptr;
|
||||||
|
decltype(Gmm::deleteClientContextFunc) Gmm::deleteClientContextFunc = nullptr;
|
||||||
|
|
||||||
|
void Gmm::loadLib() {
|
||||||
|
Gmm::initGlobalContextFunc = GmmInitGlobalContext;
|
||||||
|
Gmm::destroyGlobalContextFunc = GmmDestroyGlobalContext;
|
||||||
|
Gmm::createClientContextFunc = GmmCreateClientContext;
|
||||||
|
Gmm::deleteClientContextFunc = GmmDeleteClientContext;
|
||||||
|
isLoaded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
extern "C" {
|
||||||
|
void GMMDebugBreak(const char *file, const char *function, const int line) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void GMMPrintMessage(uint32_t debugLevel, const char *debugMessageFmt, ...) {
|
||||||
|
}
|
||||||
|
typedef struct GfxDebugControlRec {
|
||||||
|
uint32_t Version;
|
||||||
|
uint32_t Size;
|
||||||
|
uint32_t AssertEnableMask;
|
||||||
|
uint32_t EnableDebugFileDump;
|
||||||
|
uint32_t DebugEnableMask;
|
||||||
|
uint32_t RingBufDbgMask;
|
||||||
|
uint32_t ReportAssertEnable;
|
||||||
|
uint32_t AssertBreakDisable;
|
||||||
|
|
||||||
|
} GFX_DEBUG_CONTROL, *PGFX_DEBUG_CONTROL;
|
||||||
|
PGFX_DEBUG_CONTROL pDebugControl;
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Intel Corporation
|
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
@ -176,27 +176,27 @@ bool WddmCommandStreamReceiver<GfxFamily>::waitForFlushStamp(FlushStamp &flushSt
|
|||||||
|
|
||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
GmmPageTableMngr *WddmCommandStreamReceiver<GfxFamily>::createPageTableManager() {
|
GmmPageTableMngr *WddmCommandStreamReceiver<GfxFamily>::createPageTableManager() {
|
||||||
GMM_DEVICE_CALLBACKS deviceCallbacks = {};
|
GMM_DEVICE_CALLBACKS_INT deviceCallbacks = {};
|
||||||
GMM_TRANSLATIONTABLE_CALLBACKS ttCallbacks = {};
|
GMM_TRANSLATIONTABLE_CALLBACKS ttCallbacks = {};
|
||||||
auto gdi = wddm->getGdi();
|
auto gdi = wddm->getGdi();
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
deviceCallbacks.Adapter = wddm->getAdapter();
|
deviceCallbacks.Adapter.KmtHandle = wddm->getAdapter();
|
||||||
deviceCallbacks.hDevice = wddm->getDevice();
|
deviceCallbacks.hDevice.KmtHandle = wddm->getDevice();
|
||||||
deviceCallbacks.PagingQueue = wddm->getPagingQueue();
|
deviceCallbacks.PagingQueue = wddm->getPagingQueue();
|
||||||
deviceCallbacks.PagingFence = wddm->getPagingQueueSyncObject();
|
deviceCallbacks.PagingFence = wddm->getPagingQueueSyncObject();
|
||||||
|
|
||||||
deviceCallbacks.pfnAllocate = gdi->createAllocation;
|
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnAllocate = gdi->createAllocation;
|
||||||
deviceCallbacks.pfnDeallocate = gdi->destroyAllocation;
|
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnDeallocate = gdi->destroyAllocation;
|
||||||
deviceCallbacks.pfnMapGPUVA = gdi->mapGpuVirtualAddress;
|
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnMapGPUVA = gdi->mapGpuVirtualAddress;
|
||||||
deviceCallbacks.pfnMakeResident = gdi->makeResident;
|
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnMakeResident = gdi->makeResident;
|
||||||
deviceCallbacks.pfnEvict = gdi->evict;
|
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnEvict = gdi->evict;
|
||||||
deviceCallbacks.pfnReserveGPUVA = gdi->reserveGpuVirtualAddress;
|
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnReserveGPUVA = gdi->reserveGpuVirtualAddress;
|
||||||
deviceCallbacks.pfnUpdateGPUVA = gdi->updateGpuVirtualAddress;
|
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnUpdateGPUVA = gdi->updateGpuVirtualAddress;
|
||||||
deviceCallbacks.pfnWaitFromCpu = gdi->waitForSynchronizationObjectFromCpu;
|
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnWaitFromCpu = gdi->waitForSynchronizationObjectFromCpu;
|
||||||
deviceCallbacks.pfnLock = gdi->lock2;
|
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnLock = gdi->lock2;
|
||||||
deviceCallbacks.pfnUnLock = gdi->unlock2;
|
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnUnLock = gdi->unlock2;
|
||||||
deviceCallbacks.pfnEscape = gdi->escape;
|
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnEscape = gdi->escape;
|
||||||
|
|
||||||
ttCallbacks.pfWriteL3Adr = TTCallbacks<GfxFamily>::writeL3Address;
|
ttCallbacks.pfWriteL3Adr = TTCallbacks<GfxFamily>::writeL3Address;
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
@ -53,6 +53,7 @@ if(WIN32)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
copy_gmm_dll_for(igdrcl_aub_tests)
|
||||||
add_subdirectories()
|
add_subdirectories()
|
||||||
|
|
||||||
target_link_libraries(igdrcl_aub_tests igdrcl_mocks)
|
target_link_libraries(igdrcl_aub_tests igdrcl_mocks)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Intel Corporation
|
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@ -23,4 +23,5 @@
|
|||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
// max time per single test iteration
|
// max time per single test iteration
|
||||||
unsigned int ultIterationMaxTime = 180;
|
unsigned int ultIterationMaxTime = 180;
|
||||||
|
bool useMockGmm = false;
|
||||||
}
|
}
|
||||||
|
@ -34,12 +34,6 @@ using namespace ::testing;
|
|||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
class GmmTests : public ::testing::Test {
|
class GmmTests : public ::testing::Test {
|
||||||
public:
|
|
||||||
void SetUp() override {
|
|
||||||
// empty calls
|
|
||||||
GMMDebugBreak(nullptr, nullptr, 0);
|
|
||||||
GMMPrintMessage(0, nullptr);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(GmmTests, resourceCreation) {
|
TEST_F(GmmTests, resourceCreation) {
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "unit_tests/mocks/mock_sip.h"
|
#include "unit_tests/mocks/mock_sip.h"
|
||||||
#include "runtime/gmm_helper/resource_info.h"
|
#include "runtime/gmm_helper/resource_info.h"
|
||||||
#include "runtime/os_interface/debug_settings_manager.h"
|
#include "runtime/os_interface/debug_settings_manager.h"
|
||||||
|
#include "lib_names.h"
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
@ -51,9 +52,13 @@ extern const char *hardwarePrefix[];
|
|||||||
extern const HardwareInfo *hardwareInfoTable[IGFX_MAX_PRODUCT];
|
extern const HardwareInfo *hardwareInfoTable[IGFX_MAX_PRODUCT];
|
||||||
|
|
||||||
extern const unsigned int ultIterationMaxTime;
|
extern const unsigned int ultIterationMaxTime;
|
||||||
|
extern bool useMockGmm;
|
||||||
|
|
||||||
std::thread::id tempThreadID;
|
std::thread::id tempThreadID;
|
||||||
} // namespace OCLRT
|
} // namespace OCLRT
|
||||||
|
namespace Os {
|
||||||
|
extern const char *gmmDllName;
|
||||||
|
}
|
||||||
|
|
||||||
using namespace OCLRT;
|
using namespace OCLRT;
|
||||||
TestEnvironment *gEnvironment;
|
TestEnvironment *gEnvironment;
|
||||||
@ -403,6 +408,9 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
SetUnhandledExceptionFilter(&UltExceptionFilter);
|
SetUnhandledExceptionFilter(&UltExceptionFilter);
|
||||||
|
if (!useMockGmm) {
|
||||||
|
Os::gmmDllName = GMM_LIB_FILENAME;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
initializeTestHelpers();
|
initializeTestHelpers();
|
||||||
|
|
||||||
|
51
unit_tests/mock_gmm/CMakeLists.txt
Normal file
51
unit_tests/mock_gmm/CMakeLists.txt
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
set(target_name mock_gmm)
|
||||||
|
project(${target_name})
|
||||||
|
|
||||||
|
# Setting up our local list of test files
|
||||||
|
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
|
||||||
|
)
|
||||||
|
add_library(${target_name} SHARED ${IGDRCL_SRCS_tests_mock_gmm})
|
||||||
|
|
||||||
|
target_include_directories(${target_name} PRIVATE
|
||||||
|
${WDK_INCLUDE_PATHS}
|
||||||
|
${UMKM_SHAREDDATA_INCLUDE_PATHS}
|
||||||
|
)
|
||||||
|
|
||||||
|
set_target_properties(
|
||||||
|
${target_name}
|
||||||
|
PROPERTIES DEBUG_OUTPUT_NAME ${target_name}
|
||||||
|
RELEASE_OUTPUT_NAME ${target_name}
|
||||||
|
RELEASEINTERNAL_OUTPUT_NAME ${target_name}
|
||||||
|
OUTPUT_NAME ${target_name}
|
||||||
|
)
|
||||||
|
|
||||||
|
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)
|
||||||
|
add_dependencies(unit_tests ${target_name})
|
||||||
|
endif()
|
25
unit_tests/mock_gmm/init_platform.cpp
Normal file
25
unit_tests/mock_gmm/init_platform.cpp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* 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) {}
|
620
unit_tests/mock_gmm/mock_gmm.cpp
Normal file
620
unit_tests/mock_gmm/mock_gmm.cpp
Normal file
@ -0,0 +1,620 @@
|
|||||||
|
/*
|
||||||
|
* 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"
|
||||||
|
|
||||||
|
GMM_GLOBAL_CONTEXT *pGmmGlobalContext;
|
||||||
|
GMM_PLATFORM_INFO *pGlobalPlatformInfo = nullptr;
|
||||||
|
|
||||||
|
GMM_CLIENT_CONTEXT *GMM_STDCALL createClientContext(GMM_CLIENT ClientType) {
|
||||||
|
return new GMM_CLIENT_CONTEXT(ClientType);
|
||||||
|
}
|
||||||
|
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) {
|
||||||
|
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() {}
|
||||||
|
}
|
||||||
|
uint8_t GMM_STDCALL GmmIsPlanar(GMM_RESOURCE_FORMAT Format) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
const GMM_PLATFORM_INFO *GMM_STDCALL GmmGetPlatformInfo(GMM_GLOBAL_CONTEXT *pGmmLibContext) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
26
unit_tests/mock_gmm/mock_gmm.h
Normal file
26
unit_tests/mock_gmm/mock_gmm.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* 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);
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Intel Corporation
|
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@ -27,7 +27,7 @@
|
|||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
using namespace ::testing;
|
using namespace ::testing;
|
||||||
|
|
||||||
GmmPageTableMngr *GmmPageTableMngr::create(GMM_DEVICE_CALLBACKS *deviceCb, unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb) {
|
GmmPageTableMngr *GmmPageTableMngr::create(GMM_DEVICE_CALLBACKS_INT *deviceCb, unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb) {
|
||||||
auto pageTableMngr = new ::testing::NiceMock<MockGmmPageTableMngr>(deviceCb, translationTableFlags, translationTableCb);
|
auto pageTableMngr = new ::testing::NiceMock<MockGmmPageTableMngr>(deviceCb, translationTableFlags, translationTableCb);
|
||||||
ON_CALL(*pageTableMngr, initContextAuxTableRegister(_, _)).WillByDefault(Return(GMM_SUCCESS));
|
ON_CALL(*pageTableMngr, initContextAuxTableRegister(_, _)).WillByDefault(Return(GMM_SUCCESS));
|
||||||
ON_CALL(*pageTableMngr, initContextTRTableRegister(_, _)).WillByDefault(Return(GMM_SUCCESS));
|
ON_CALL(*pageTableMngr, initContextTRTableRegister(_, _)).WillByDefault(Return(GMM_SUCCESS));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Intel Corporation
|
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@ -30,7 +30,7 @@ class MockGmmPageTableMngr : public GmmPageTableMngr {
|
|||||||
public:
|
public:
|
||||||
MockGmmPageTableMngr() = default;
|
MockGmmPageTableMngr() = default;
|
||||||
|
|
||||||
MockGmmPageTableMngr(GMM_DEVICE_CALLBACKS *deviceCb, unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb)
|
MockGmmPageTableMngr(GMM_DEVICE_CALLBACKS_INT *deviceCb, unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb)
|
||||||
: deviceCb(*deviceCb), translationTableFlags(translationTableFlags), translationTableCb(*translationTableCb){};
|
: deviceCb(*deviceCb), translationTableFlags(translationTableFlags), translationTableCb(*translationTableCb){};
|
||||||
|
|
||||||
MOCK_METHOD2(initContextAuxTableRegister, GMM_STATUS(HANDLE initialBBHandle, GMM_ENGINE_TYPE engineType));
|
MOCK_METHOD2(initContextAuxTableRegister, GMM_STATUS(HANDLE initialBBHandle, GMM_ENGINE_TYPE engineType));
|
||||||
@ -39,7 +39,7 @@ class MockGmmPageTableMngr : public GmmPageTableMngr {
|
|||||||
|
|
||||||
MOCK_METHOD1(updateAuxTable, GMM_STATUS(const GMM_DDI_UPDATEAUXTABLE *ddiUpdateAuxTable));
|
MOCK_METHOD1(updateAuxTable, GMM_STATUS(const GMM_DDI_UPDATEAUXTABLE *ddiUpdateAuxTable));
|
||||||
|
|
||||||
GMM_DEVICE_CALLBACKS deviceCb = {};
|
GMM_DEVICE_CALLBACKS_INT deviceCb = {};
|
||||||
GMM_TRANSLATIONTABLE_CALLBACKS translationTableCb = {};
|
GMM_TRANSLATIONTABLE_CALLBACKS translationTableCb = {};
|
||||||
unsigned int translationTableFlags = 0;
|
unsigned int translationTableFlags = 0;
|
||||||
};
|
};
|
||||||
|
@ -788,32 +788,35 @@ HWTEST_F(WddmCsrCompressionTests, givenEnabledCompressionWhenInitializedThenCrea
|
|||||||
|
|
||||||
auto mockMngr = reinterpret_cast<MockGmmPageTableMngr *>(myMockWddm->getPageTableManager());
|
auto mockMngr = reinterpret_cast<MockGmmPageTableMngr *>(myMockWddm->getPageTableManager());
|
||||||
|
|
||||||
GMM_DEVICE_CALLBACKS expectedDeviceCb = {};
|
GMM_DEVICE_CALLBACKS_INT expectedDeviceCb = {};
|
||||||
GMM_TRANSLATIONTABLE_CALLBACKS expectedTTCallbacks = {};
|
GMM_TRANSLATIONTABLE_CALLBACKS expectedTTCallbacks = {};
|
||||||
unsigned int expectedFlags = (TT_TYPE::TRTT | TT_TYPE::AUXTT);
|
unsigned int expectedFlags = (TT_TYPE::TRTT | TT_TYPE::AUXTT);
|
||||||
auto myGdi = myMockWddm->getGdi();
|
auto myGdi = myMockWddm->getGdi();
|
||||||
// clang-format off
|
// clang-format off
|
||||||
expectedDeviceCb.Adapter = myMockWddm->getAdapter();
|
expectedDeviceCb.Adapter.KmtHandle = myMockWddm->getAdapter();
|
||||||
expectedDeviceCb.hDevice = myMockWddm->getDevice();
|
expectedDeviceCb.hDevice.KmtHandle = myMockWddm->getDevice();
|
||||||
expectedDeviceCb.PagingQueue = myMockWddm->getPagingQueue();
|
expectedDeviceCb.PagingQueue = myMockWddm->getPagingQueue();
|
||||||
expectedDeviceCb.PagingFence = myMockWddm->getPagingQueueSyncObject();
|
expectedDeviceCb.PagingFence = myMockWddm->getPagingQueueSyncObject();
|
||||||
|
|
||||||
expectedDeviceCb.pfnAllocate = myGdi->createAllocation;
|
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnAllocate = myGdi->createAllocation;
|
||||||
expectedDeviceCb.pfnDeallocate = myGdi->destroyAllocation;
|
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnDeallocate = myGdi->destroyAllocation;
|
||||||
expectedDeviceCb.pfnMapGPUVA = myGdi->mapGpuVirtualAddress;
|
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnMapGPUVA = myGdi->mapGpuVirtualAddress;
|
||||||
expectedDeviceCb.pfnMakeResident = myGdi->makeResident;
|
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnMakeResident = myGdi->makeResident;
|
||||||
expectedDeviceCb.pfnEvict = myGdi->evict;
|
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnEvict = myGdi->evict;
|
||||||
expectedDeviceCb.pfnReserveGPUVA = myGdi->reserveGpuVirtualAddress;
|
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnReserveGPUVA = myGdi->reserveGpuVirtualAddress;
|
||||||
expectedDeviceCb.pfnUpdateGPUVA = myGdi->updateGpuVirtualAddress;
|
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnUpdateGPUVA = myGdi->updateGpuVirtualAddress;
|
||||||
expectedDeviceCb.pfnWaitFromCpu = myGdi->waitForSynchronizationObjectFromCpu;
|
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnWaitFromCpu = myGdi->waitForSynchronizationObjectFromCpu;
|
||||||
expectedDeviceCb.pfnLock = myGdi->lock2;
|
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnLock = myGdi->lock2;
|
||||||
expectedDeviceCb.pfnUnLock = myGdi->unlock2;
|
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnUnLock = myGdi->unlock2;
|
||||||
expectedDeviceCb.pfnEscape = myGdi->escape;
|
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnEscape = myGdi->escape;
|
||||||
|
|
||||||
expectedTTCallbacks.pfWriteL3Adr = TTCallbacks<FamilyType>::writeL3Address;
|
expectedTTCallbacks.pfWriteL3Adr = TTCallbacks<FamilyType>::writeL3Address;
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
EXPECT_TRUE(memcmp(&expectedDeviceCb, &mockMngr->deviceCb, sizeof(GMM_DEVICE_CALLBACKS)) == 0);
|
EXPECT_TRUE(memcmp(&expectedDeviceCb, &mockMngr->deviceCb, sizeof(GMM_DEVICE_CALLBACKS_INT)) == 0);
|
||||||
|
EXPECT_TRUE(memcmp(&expectedDeviceCb.Adapter, &mockMngr->deviceCb.Adapter, sizeof(GMM_HANDLE_EXT)) == 0);
|
||||||
|
EXPECT_TRUE(memcmp(&expectedDeviceCb.hDevice, &mockMngr->deviceCb.hDevice, sizeof(GMM_HANDLE_EXT)) == 0);
|
||||||
|
EXPECT_TRUE(memcmp(&expectedDeviceCb.DevCbPtrs.KmtCbPtrs, &mockMngr->deviceCb.DevCbPtrs.KmtCbPtrs, sizeof(GMM_DEVICE_CB_PTRS::KmtCbPtrs)) == 0);
|
||||||
EXPECT_TRUE(memcmp(&expectedTTCallbacks, &mockMngr->translationTableCb, sizeof(GMM_TRANSLATIONTABLE_CALLBACKS)) == 0);
|
EXPECT_TRUE(memcmp(&expectedTTCallbacks, &mockMngr->translationTableCb, sizeof(GMM_TRANSLATIONTABLE_CALLBACKS)) == 0);
|
||||||
EXPECT_TRUE(memcmp(&expectedFlags, &mockMngr->translationTableFlags, sizeof(unsigned int)) == 0);
|
EXPECT_TRUE(memcmp(&expectedFlags, &mockMngr->translationTableFlags, sizeof(unsigned int)) == 0);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Intel Corporation
|
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@ -32,6 +32,7 @@ namespace Os {
|
|||||||
const char *frontEndDllName = "mock_igdfcl.dll";
|
const char *frontEndDllName = "mock_igdfcl.dll";
|
||||||
const char *igcDllName = "mock_igc.dll";
|
const char *igcDllName = "mock_igc.dll";
|
||||||
const char *gdiDllName = "gdi32_mock.dll";
|
const char *gdiDllName = "gdi32_mock.dll";
|
||||||
|
const char *gmmDllName = "mock_gmm.dll";
|
||||||
const char *testDllName = "test_dynamic_lib.dll";
|
const char *testDllName = "test_dynamic_lib.dll";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ void WddmMemoryManagerFixture::SetUp() {
|
|||||||
wddm = static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20));
|
wddm = static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20));
|
||||||
ASSERT_NE(nullptr, wddm);
|
ASSERT_NE(nullptr, wddm);
|
||||||
if (platformDevices[0]->capabilityTable.ftrCompression) {
|
if (platformDevices[0]->capabilityTable.ftrCompression) {
|
||||||
GMM_DEVICE_CALLBACKS dummyDeviceCallbacks = {};
|
GMM_DEVICE_CALLBACKS_INT dummyDeviceCallbacks = {};
|
||||||
GMM_TRANSLATIONTABLE_CALLBACKS dummyTTCallbacks = {};
|
GMM_TRANSLATIONTABLE_CALLBACKS dummyTTCallbacks = {};
|
||||||
wddm->resetPageTableManager(GmmPageTableMngr::create(&dummyDeviceCallbacks, 0, &dummyTTCallbacks));
|
wddm->resetPageTableManager(GmmPageTableMngr::create(&dummyDeviceCallbacks, 0, &dummyTTCallbacks));
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ else()
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
copy_gmm_dll_for(igdrcl_tbx_tests)
|
||||||
create_project_source_tree(igdrcl_tbx_tests ${IGDRCL_SOURCE_DIR}/runtime ${IGDRCL_SOURCE_DIR}/unit_tests)
|
create_project_source_tree(igdrcl_tbx_tests ${IGDRCL_SOURCE_DIR}/runtime ${IGDRCL_SOURCE_DIR}/unit_tests)
|
||||||
|
|
||||||
add_custom_target(run_tbx_tests ALL DEPENDS unit_tests igdrcl_tbx_tests)
|
add_custom_target(run_tbx_tests ALL DEPENDS unit_tests igdrcl_tbx_tests)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Intel Corporation
|
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@ -22,4 +22,5 @@
|
|||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
unsigned int ultIterationMaxTime = 45;
|
unsigned int ultIterationMaxTime = 45;
|
||||||
|
bool useMockGmm = true;
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ project(igdrcl_windows_dll_tests)
|
|||||||
|
|
||||||
add_executable(igdrcl_windows_dll_tests
|
add_executable(igdrcl_windows_dll_tests
|
||||||
${IGDRCL_SOURCE_DIR}/runtime/os_interface/windows/wddm/wddm_create.cpp
|
${IGDRCL_SOURCE_DIR}/runtime/os_interface/windows/wddm/wddm_create.cpp
|
||||||
|
${IGDRCL_SOURCE_DIR}/unit_tests/ult_configuration.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_create_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/wddm_create_tests.cpp
|
||||||
$<TARGET_OBJECTS:igdrcl_libult>
|
$<TARGET_OBJECTS:igdrcl_libult>
|
||||||
$<TARGET_OBJECTS:igdrcl_libult_cs>
|
$<TARGET_OBJECTS:igdrcl_libult_cs>
|
||||||
|
Reference in New Issue
Block a user