mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Create wrapper for GmmClientContext
reduce mock gmm to implementation of OpenGmm function Change-Id: I657412af2d11486c9924cf3ab9a8b4f51e603964
This commit is contained in:

committed by
sys_ocldev

parent
861d001cba
commit
50c31872d8
@ -501,6 +501,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})
|
||||
|
||||
set(HW_SRC_INCLUDE_PATH ${IGDRCL_SOURCE_DIR}/runtime/gen_common)
|
||||
|
||||
|
@ -20,6 +20,10 @@
|
||||
|
||||
set(RUNTIME_SRCS_GMM_HELPER_BASE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${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
|
||||
|
27
runtime/gmm_helper/client_context/gmm_client_context.cpp
Normal file
27
runtime/gmm_helper/client_context/gmm_client_context.cpp
Normal file
@ -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
|
31
runtime/gmm_helper/client_context/gmm_client_context.h
Normal file
31
runtime/gmm_helper/client_context/gmm_client_context.h
Normal file
@ -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 = Gmm::createClientContextFunc(clientType);
|
||||
}
|
||||
GmmClientContextBase::~GmmClientContextBase() {
|
||||
Gmm::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
|
48
runtime/gmm_helper/client_context/gmm_client_context_base.h
Normal file
48
runtime/gmm_helper/client_context/gmm_client_context_base.h
Normal file
@ -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 std::unique_ptr<GmmClientContext> create(GMM_CLIENT clientType) {
|
||||
return std::unique_ptr<GmmClientContext>(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_helper.h"
|
||||
#include "runtime/gmm_helper/resource_info.h"
|
||||
#include "runtime/helpers/get_info.h"
|
||||
@ -54,15 +55,14 @@ bool Gmm::initContext(const PLATFORM *pPlatform,
|
||||
}
|
||||
bool success = GMM_SUCCESS == initGlobalContextFunc(*pPlatform, &gmmFtrTable, &gmmWaTable, pGtSysInfo, GMM_CLIENT::GMM_OCL_VISTA);
|
||||
UNRECOVERABLE_IF(!success);
|
||||
Gmm::gmmClientContext = createClientContextFunc(GMM_CLIENT::GMM_OCL_VISTA);
|
||||
Gmm::gmmClientContext = Gmm::createGmmContextWrapperFunc(GMM_CLIENT::GMM_OCL_VISTA);
|
||||
}
|
||||
return Gmm::gmmClientContext != nullptr;
|
||||
}
|
||||
|
||||
void Gmm::destroyContext() {
|
||||
if (Gmm::gmmClientContext) {
|
||||
deleteClientContextFunc(Gmm::gmmClientContext);
|
||||
Gmm::gmmClientContext = nullptr;
|
||||
Gmm::gmmClientContext.reset(nullptr);
|
||||
destroyGlobalContextFunc();
|
||||
}
|
||||
}
|
||||
@ -76,7 +76,7 @@ uint32_t Gmm::getMOCS(uint32_t type) {
|
||||
}
|
||||
}
|
||||
|
||||
MEMORY_OBJECT_CONTROL_STATE mocs = Gmm::gmmClientContext->CachePolicyGetMemoryObject(nullptr, static_cast<GMM_RESOURCE_USAGE_TYPE>(type));
|
||||
MEMORY_OBJECT_CONTROL_STATE mocs = Gmm::gmmClientContext->cachePolicyGetMemoryObject(nullptr, static_cast<GMM_RESOURCE_USAGE_TYPE>(type));
|
||||
|
||||
return static_cast<uint32_t>(mocs.DwordValue);
|
||||
}
|
||||
@ -392,8 +392,11 @@ bool Gmm::unifiedAuxTranslationCapable() const {
|
||||
return gmmFlags->Gpu.CCS && gmmFlags->Gpu.UnifiedAuxSurface && gmmFlags->Info.RenderCompressed;
|
||||
}
|
||||
|
||||
Gmm::~Gmm() {}
|
||||
|
||||
std::unique_ptr<GmmClientContext> (*Gmm::createGmmContextWrapperFunc)(GMM_CLIENT) = GmmClientContextBase::create<GmmClientContext>;
|
||||
bool Gmm::useSimplifiedMocsTable = false;
|
||||
GMM_CLIENT_CONTEXT *Gmm::gmmClientContext = nullptr;
|
||||
std::unique_ptr<GmmClientContext> Gmm::gmmClientContext = nullptr;
|
||||
bool Gmm::isLoaded = false;
|
||||
|
||||
} // namespace OCLRT
|
||||
|
@ -34,6 +34,7 @@ struct WorkaroundTable;
|
||||
struct ImageInfo;
|
||||
class GraphicsAllocation;
|
||||
class GmmResourceInfo;
|
||||
class GmmClientContext;
|
||||
|
||||
enum OCLPlane {
|
||||
NO_PLANE = 0,
|
||||
@ -50,7 +51,7 @@ class Gmm {
|
||||
public:
|
||||
static const uint32_t maxPossiblePitch = 2147483648;
|
||||
|
||||
virtual ~Gmm() = default;
|
||||
virtual ~Gmm();
|
||||
|
||||
void create();
|
||||
static Gmm *create(const void *alignedPtr, size_t alignedSize, bool uncacheable);
|
||||
@ -96,10 +97,11 @@ class Gmm {
|
||||
static decltype(&GmmDestroyGlobalContext) destroyGlobalContextFunc;
|
||||
static decltype(&GmmCreateClientContext) createClientContextFunc;
|
||||
static decltype(&GmmDeleteClientContext) deleteClientContextFunc;
|
||||
static std::unique_ptr<GmmClientContext> (*createGmmContextWrapperFunc)(GMM_CLIENT);
|
||||
|
||||
bool isRenderCompressed = false;
|
||||
static bool useSimplifiedMocsTable;
|
||||
static GMM_CLIENT_CONTEXT *gmmClientContext;
|
||||
static std::unique_ptr<GmmClientContext> gmmClientContext;
|
||||
static bool isLoaded;
|
||||
};
|
||||
} // namespace OCLRT
|
||||
|
@ -20,6 +20,7 @@
|
||||
* 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"
|
||||
|
||||
@ -33,7 +34,7 @@ bool GmmMemoryBase::configureDeviceAddressSpace(GMM_ESCAPE_HANDLE hAdapter,
|
||||
BOOLEAN BDWL3Coherency,
|
||||
GMM_GFX_SIZE_T SizeOverride,
|
||||
GMM_GFX_SIZE_T SlmGfxSpaceReserve) {
|
||||
return Gmm::gmmClientContext->ConfigureDeviceAddressSpace(
|
||||
return clientContext->ConfigureDeviceAddressSpace(
|
||||
{hAdapter},
|
||||
{hDevice},
|
||||
{pfnEscape},
|
||||
@ -46,7 +47,10 @@ bool GmmMemoryBase::configureDeviceAddressSpace(GMM_ESCAPE_HANDLE hAdapter,
|
||||
}
|
||||
|
||||
uintptr_t GmmMemoryBase::getInternalGpuVaRangeLimit() {
|
||||
return static_cast<uintptr_t>(Gmm::gmmClientContext->GetInternalGpuVaRangeLimit());
|
||||
return static_cast<uintptr_t>(clientContext->GetInternalGpuVaRangeLimit());
|
||||
}
|
||||
GmmMemoryBase::GmmMemoryBase() {
|
||||
clientContext = Gmm::gmmClientContext->getHandle();
|
||||
}
|
||||
|
||||
}; // namespace OCLRT
|
||||
|
@ -42,6 +42,7 @@ class GmmMemoryBase {
|
||||
MOCKABLE_VIRTUAL uintptr_t getInternalGpuVaRangeLimit();
|
||||
|
||||
protected:
|
||||
GmmMemoryBase() = default;
|
||||
GMM_CLIENT_CONTEXT *clientContext = nullptr;
|
||||
GmmMemoryBase();
|
||||
};
|
||||
} // namespace OCLRT
|
||||
|
@ -24,5 +24,7 @@
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
#include "runtime/helpers/surface_formats.h"
|
||||
|
||||
void OCLRT::Gmm::applyAuxFlags(ImageInfo &imgInfo, const HardwareInfo &hwInfo) {
|
||||
namespace OCLRT {
|
||||
void Gmm::applyAuxFlags(ImageInfo &imgInfo, const HardwareInfo &hwInfo) {
|
||||
}
|
||||
} // namespace OCLRT
|
||||
|
@ -28,7 +28,7 @@
|
||||
namespace OCLRT {
|
||||
class GmmPageTableMngr {
|
||||
public:
|
||||
MOCKABLE_VIRTUAL ~GmmPageTableMngr() = default;
|
||||
MOCKABLE_VIRTUAL ~GmmPageTableMngr();
|
||||
|
||||
static GmmPageTableMngr *create(GMM_DEVICE_CALLBACKS_INT *deviceCb, unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb);
|
||||
|
||||
@ -45,13 +45,12 @@ class GmmPageTableMngr {
|
||||
}
|
||||
|
||||
protected:
|
||||
static void customDeleter(GMM_PAGETABLE_MGR *gmmPageTableManager);
|
||||
using UniquePtrType = std::unique_ptr<GMM_PAGETABLE_MGR, std::function<void(GMM_PAGETABLE_MGR *)>>;
|
||||
GMM_CLIENT_CONTEXT *clientContext = nullptr;
|
||||
|
||||
GmmPageTableMngr() = default;
|
||||
|
||||
GmmPageTableMngr(GMM_DEVICE_CALLBACKS_INT *deviceCb, unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb);
|
||||
|
||||
UniquePtrType pageTableManager;
|
||||
GMM_PAGETABLE_MGR *pageTableManager = nullptr;
|
||||
};
|
||||
} // namespace OCLRT
|
||||
|
@ -20,17 +20,20 @@
|
||||
* 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"
|
||||
|
||||
namespace OCLRT {
|
||||
void GmmPageTableMngr::customDeleter(GMM_PAGETABLE_MGR *gmmPageTableManager) {
|
||||
Gmm::gmmClientContext->DestroyPageTblMgrObject(gmmPageTableManager);
|
||||
GmmPageTableMngr::~GmmPageTableMngr() {
|
||||
if (clientContext) {
|
||||
clientContext->DestroyPageTblMgrObject(pageTableManager);
|
||||
}
|
||||
}
|
||||
|
||||
GmmPageTableMngr::GmmPageTableMngr(GMM_DEVICE_CALLBACKS_INT *deviceCb, unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb) {
|
||||
auto pageTableMngrPtr = Gmm::gmmClientContext->CreatePageTblMgrObject(deviceCb, translationTableCb, translationTableFlags);
|
||||
this->pageTableManager = UniquePtrType(pageTableMngrPtr, GmmPageTableMngr::customDeleter);
|
||||
clientContext = Gmm::gmmClientContext->getHandle();
|
||||
pageTableManager = clientContext->CreatePageTblMgrObject(deviceCb, translationTableCb, translationTableFlags);
|
||||
}
|
||||
|
||||
} // namespace OCLRT
|
||||
|
@ -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) {
|
||||
Gmm::gmmClientContext->DestroyResInfoObject(gmmResourceInfo);
|
||||
Gmm::gmmClientContext->destroyResInfoObject(gmmResourceInfo);
|
||||
}
|
||||
|
||||
GmmResourceInfo::GmmResourceInfo(GMM_RESCREATE_PARAMS *resourceCreateParams) {
|
||||
auto resourceInfoPtr = Gmm::gmmClientContext->CreateResInfoObject(resourceCreateParams);
|
||||
auto resourceInfoPtr = Gmm::gmmClientContext->createResInfoObject(resourceCreateParams);
|
||||
this->resourceInfo = UniquePtrType(resourceInfoPtr, GmmResourceInfo::customDeleter);
|
||||
}
|
||||
|
||||
GmmResourceInfo::GmmResourceInfo(GMM_RESOURCE_INFO *inputGmmResourceInfo) {
|
||||
auto resourceInfoPtr = Gmm::gmmClientContext->CopyResInfoObject(inputGmmResourceInfo);
|
||||
auto resourceInfoPtr = Gmm::gmmClientContext->copyResInfoObject(inputGmmResourceInfo);
|
||||
this->resourceInfo = UniquePtrType(resourceInfoPtr, GmmResourceInfo::customDeleter);
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
@ -601,11 +602,13 @@ TEST(GmmTest, givenInvalidFlagsSetWhenAskedForUnifiedAuxTranslationCapabilityThe
|
||||
TEST(GmmTest, whenContextIsInitializedMultipleTimesThenDontOverride) {
|
||||
const HardwareInfo *hwinfo = *platformDevices;
|
||||
EXPECT_TRUE(Gmm::initContext(hwinfo->pPlatform, hwinfo->pSkuTable, hwinfo->pWaTable, hwinfo->pSysInfo));
|
||||
auto currentClientContext = Gmm::gmmClientContext;
|
||||
auto currentClientContext = Gmm::gmmClientContext.get();
|
||||
auto currentClientContextHandle = Gmm::gmmClientContext->getHandle();
|
||||
|
||||
EXPECT_TRUE(Gmm::initContext(hwinfo->pPlatform, hwinfo->pSkuTable, hwinfo->pWaTable, hwinfo->pSysInfo));
|
||||
|
||||
EXPECT_EQ(currentClientContext, Gmm::gmmClientContext);
|
||||
EXPECT_EQ(currentClientContext, Gmm::gmmClientContext.get());
|
||||
EXPECT_EQ(currentClientContextHandle, Gmm::gmmClientContext->getHandle());
|
||||
}
|
||||
|
||||
TEST(GmmTest, whenContextIsDestroyedMultimpleTimesThenDontCrash) {
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "runtime/gmm_helper/resource_info.h"
|
||||
#include "runtime/os_interface/debug_settings_manager.h"
|
||||
#include "lib_names.h"
|
||||
#include "mock_gmm_client_context.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include <algorithm>
|
||||
#include <mutex>
|
||||
@ -420,6 +421,8 @@ int main(int argc, char **argv) {
|
||||
SetUnhandledExceptionFilter(&UltExceptionFilter);
|
||||
if (!useMockGmm) {
|
||||
Os::gmmDllName = GMM_LIBRARY_NAME;
|
||||
} else {
|
||||
Gmm::createGmmContextWrapperFunc = GmmClientContextBase::create<MockGmmClientContext>;
|
||||
}
|
||||
#endif
|
||||
initializeTestHelpers();
|
||||
|
@ -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,26 +20,19 @@
|
||||
* 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) {
|
||||
@ -48,573 +41,4 @@ GMM_STATUS GMM_STDCALL OpenGmm(GmmExportEntries *pm_GmmFuncs) {
|
||||
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;
|
||||
}
|
||||
}
|
23
unit_tests/mock_gmm/mock_gmm.def
Normal file
23
unit_tests/mock_gmm/mock_gmm.def
Normal file
@ -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
|
||||
OpenGmm
|
@ -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);
|
@ -44,10 +44,14 @@ set(IGDRCL_SRCS_tests_mocks
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_device.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_event.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
|
||||
|
28
unit_tests/mocks/mock_gmm_client_context.cpp
Normal file
28
unit_tests/mocks/mock_gmm_client_context.cpp
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.
|
||||
*/
|
||||
|
||||
#include "mock_gmm_client_context.h"
|
||||
|
||||
namespace OCLRT {
|
||||
MockGmmClientContext::MockGmmClientContext(GMM_CLIENT clientType) : MockGmmClientContextBase(clientType) {
|
||||
}
|
||||
} // namespace OCLRT
|
31
unit_tests/mocks/mock_gmm_client_context.h
Normal file
31
unit_tests/mocks/mock_gmm_client_context.h
Normal file
@ -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
|
44
unit_tests/mocks/mock_gmm_client_context_base.cpp
Normal file
44
unit_tests/mocks/mock_gmm_client_context_base.cpp
Normal file
@ -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
|
37
unit_tests/mocks/mock_gmm_client_context_base.h
Normal file
37
unit_tests/mocks/mock_gmm_client_context_base.h
Normal file
@ -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
|
Reference in New Issue
Block a user