diff --git a/Android.bp b/Android.bp new file mode 100644 index 0000000..0b5f652 --- /dev/null +++ b/Android.bp @@ -0,0 +1,113 @@ +// 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. + +cc_library_static { + + name: "libgmm_umd", + proprietary: true, + srcs: [ + "Source/GmmLib/CachePolicy/GmmCachePolicy.cpp", + "Source/GmmLib/CachePolicy/GmmCachePolicyCommon.cpp", + "Source/GmmLib/CachePolicy/GmmGen10CachePolicy.cpp", + "Source/GmmLib/CachePolicy/GmmGen11CachePolicy.cpp", + "Source/GmmLib/CachePolicy/GmmGen12CachePolicy.cpp", + "Source/GmmLib/CachePolicy/GmmGen12dGPUCachePolicy.cpp", + "Source/GmmLib/CachePolicy/GmmGen8CachePolicy.cpp", + "Source/GmmLib/CachePolicy/GmmGen9CachePolicy.cpp", + "Source/GmmLib/CachePolicy/GmmXe_LPGCachePolicy.cpp", + "Source/GmmLib/GlobalInfo/GmmClientContext.cpp", + "Source/GmmLib/GlobalInfo/GmmInfo.cpp", + "Source/GmmLib/GlobalInfo/GmmLibDllMain.cpp", + "Source/GmmLib/Platform/GmmGen10Platform.cpp", + "Source/GmmLib/Platform/GmmGen11Platform.cpp", + "Source/GmmLib/Platform/GmmGen12Platform.cpp", + "Source/GmmLib/Platform/GmmGen8Platform.cpp", + "Source/GmmLib/Platform/GmmGen9Platform.cpp", + "Source/GmmLib/Platform/GmmPlatform.cpp", + "Source/GmmLib/Resource/GmmResourceInfo.cpp", + "Source/GmmLib/Resource/GmmResourceInfoCommon.cpp", + "Source/GmmLib/Resource/GmmResourceInfoCommonEx.cpp", + "Source/GmmLib/Resource/GmmRestrictions.cpp", + "Source/GmmLib/Resource/Linux/GmmResourceInfoLinCWrapper.cpp", + "Source/GmmLib/Texture/GmmGen10Texture.cpp", + "Source/GmmLib/Texture/GmmGen11Texture.cpp", + "Source/GmmLib/Texture/GmmGen12Texture.cpp", + "Source/GmmLib/Texture/GmmGen7Texture.cpp", + "Source/GmmLib/Texture/GmmGen8Texture.cpp", + "Source/GmmLib/Texture/GmmGen9Texture.cpp", + "Source/GmmLib/Texture/GmmTexture.cpp", + "Source/GmmLib/Texture/GmmTextureAlloc.cpp", + "Source/GmmLib/Texture/GmmTextureOffset.cpp", + "Source/GmmLib/Texture/GmmTextureSpecialCases.cpp", + "Source/GmmLib/Texture/GmmXe_LPGTexture.cpp", + "Source/GmmLib/TranslationTable/GmmAuxTable.cpp", + "Source/GmmLib/TranslationTable/GmmPageTableMgr.cpp", + "Source/GmmLib/TranslationTable/GmmUmdTranslationTable.cpp", + "Source/GmmLib/Utility/CpuSwizzleBlt/CpuSwizzleBlt.c", + "Source/GmmLib/Utility/GmmLog/GmmLog.cpp", + "Source/GmmLib/Utility/GmmUtility.cpp", + "Source/Common/AssertTracer/AssertTracer.cpp", + ], + + cflags: [ + "-Wno-error", + "-Wno-unused-parameter", + "-DGMM_LIB_DLL", + "-DGMM_LIB_DLL_EXPORTS", + "-DGMM_UNIFIED_LIB", + "-DGMM_UNIFY_DAF_API", + "-DISTDLIB_UMD", + "-DSMALL_POOL_ALLOC", + "-DUNUSED_ISTDLIB_MT", + "-D_ATL_NO_WIN_SUPPORT", + "-D_X64", + "-D__GFX_MACRO_C__", + "-D__GMM", + "-D__STDC_CONSTANT_MACROS", + "-D__STDC_LIMIT_MACROS", + "-D__UMD", + "-Digfx_gmmumd_dll_EXPORTS", + ], + + cppflags: [ + "-fexceptions", + "-std=c++11", + ], + + local_include_dirs: [ + "Source/GmmLib", + "Source/GmmLib/Utility/GmmLog", + "Source/GmmLib/Utility", + "Source/GmmLib/GlobalInfo", + "Source/GmmLib/Texture", + "Source/GmmLib/Resource", + "Source/GmmLib/Platform", + "Source/util", + "Source/inc/umKmInc", + "Source/install", + ], + + export_include_dirs: [ + "Source/GmmLib/inc", + "Source/inc", + "Source/inc/common", + ], + +} diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000..70f5b13 --- /dev/null +++ b/Android.mk @@ -0,0 +1,112 @@ +# 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. + +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE := libgmm_umd +LOCAL_PROPRIETARY_MODULE := true +LOCAL_SRC_FILES = \ + Source/GmmLib/CachePolicy/GmmCachePolicy.cpp \ + Source/GmmLib/CachePolicy/GmmCachePolicyCommon.cpp \ + Source/GmmLib/CachePolicy/GmmGen10CachePolicy.cpp \ + Source/GmmLib/CachePolicy/GmmGen11CachePolicy.cpp \ + Source/GmmLib/CachePolicy/GmmGen12CachePolicy.cpp \ + Source/GmmLib/CachePolicy/GmmGen12dGPUCachePolicy.cpp \ + Source/GmmLib/CachePolicy/GmmGen8CachePolicy.cpp \ + Source/GmmLib/CachePolicy/GmmGen9CachePolicy.cpp \ + Source/GmmLib/CachePolicy/GmmXe_LPGCachePolicy.cpp \ + Source/GmmLib/GlobalInfo/GmmClientContext.cpp \ + Source/GmmLib/GlobalInfo/GmmInfo.cpp \ + Source/GmmLib/GlobalInfo/GmmLibDllMain.cpp \ + Source/GmmLib/Platform/GmmGen10Platform.cpp \ + Source/GmmLib/Platform/GmmGen11Platform.cpp \ + Source/GmmLib/Platform/GmmGen12Platform.cpp \ + Source/GmmLib/Platform/GmmGen8Platform.cpp \ + Source/GmmLib/Platform/GmmGen9Platform.cpp \ + Source/GmmLib/Platform/GmmPlatform.cpp \ + Source/GmmLib/Resource/GmmResourceInfo.cpp \ + Source/GmmLib/Resource/GmmResourceInfoCommon.cpp \ + Source/GmmLib/Resource/GmmResourceInfoCommonEx.cpp \ + Source/GmmLib/Resource/GmmRestrictions.cpp \ + Source/GmmLib/Resource/Linux/GmmResourceInfoLinCWrapper.cpp \ + Source/GmmLib/Texture/GmmGen10Texture.cpp \ + Source/GmmLib/Texture/GmmGen11Texture.cpp \ + Source/GmmLib/Texture/GmmGen12Texture.cpp \ + Source/GmmLib/Texture/GmmGen7Texture.cpp \ + Source/GmmLib/Texture/GmmGen8Texture.cpp \ + Source/GmmLib/Texture/GmmGen9Texture.cpp \ + Source/GmmLib/Texture/GmmTexture.cpp \ + Source/GmmLib/Texture/GmmTextureAlloc.cpp \ + Source/GmmLib/Texture/GmmTextureOffset.cpp \ + Source/GmmLib/Texture/GmmTextureSpecialCases.cpp \ + Source/GmmLib/Texture/GmmXe_LPGTexture.cpp \ + Source/GmmLib/TranslationTable/GmmAuxTable.cpp \ + Source/GmmLib/TranslationTable/GmmPageTableMgr.cpp \ + Source/GmmLib/TranslationTable/GmmUmdTranslationTable.cpp \ + Source/GmmLib/Utility/CpuSwizzleBlt/CpuSwizzleBlt.c \ + Source/GmmLib/Utility/GmmLog/GmmLog.cpp \ + Source/GmmLib/Utility/GmmUtility.cpp \ + Source/Common/AssertTracer/AssertTracer.cpp \ + +LOCAL_CFLAGS := \ + -Wno-error \ + -Wno-unused-parameter \ + -DGMM_LIB_DLL \ + -DGMM_LIB_DLL_EXPORTS \ + -DGMM_UNIFIED_LIB \ + -DGMM_UNIFY_DAF_API \ + -DISTDLIB_UMD \ + -DSMALL_POOL_ALLOC \ + -DUNUSED_ISTDLIB_MT \ + -D_ATL_NO_WIN_SUPPORT \ + -D_X64 \ + -D__GFX_MACRO_C__ \ + -D__GMM \ + -D__STDC_CONSTANT_MACROS \ + -D__STDC_LIMIT_MACROS \ + -D__UMD \ + -Digfx_gmmumd_dll_EXPORTS + +LOCAL_CPPFLAGS := \ + -fexceptions \ + -std=c++11 + +LOCAL_C_INCLUDES = \ + $(LOCAL_PATH)/Source/GmmLib \ + $(LOCAL_PATH)/Source/GmmLib/Utility/GmmLog \ + $(LOCAL_PATH)/Source/GmmLib/inc \ + $(LOCAL_PATH)/Source/GmmLib/Utility \ + $(LOCAL_PATH)/Source/GmmLib/GlobalInfo \ + $(LOCAL_PATH)/Source/GmmLib/Texture \ + $(LOCAL_PATH)/Source/GmmLib/Resource \ + $(LOCAL_PATH)/Source/GmmLib/Platform \ + $(LOCAL_PATH)/Source/util \ + $(LOCAL_PATH)/Source/inc \ + $(LOCAL_PATH)/Source/inc/common \ + $(LOCAL_PATH)/Source/inc/umKmInc \ + $(LOCAL_PATH)/Source/install + +LOCAL_EXPORT_C_INCLUDE_DIRS = \ + $(LOCAL_PATH)/Source/GmmLib/inc \ + $(LOCAL_PATH)/Source/inc \ + $(LOCAL_PATH)/Source/inc/common \ + +include $(BUILD_STATIC_LIBRARY) diff --git a/Source/GmmLib/GlobalInfo/GmmLibDllMain.cpp b/Source/GmmLib/GlobalInfo/GmmLibDllMain.cpp index 117a5d8..0fa6a7a 100755 --- a/Source/GmmLib/GlobalInfo/GmmLibDllMain.cpp +++ b/Source/GmmLib/GlobalInfo/GmmLibDllMain.cpp @@ -34,6 +34,25 @@ OTHER DEALINGS IN THE SOFTWARE. #include "External/Common/GmmClientContext.h" #include "External/Common/GmmLibDll.h" +///////////////////////////////////////////////////////////////////////////////////// +/// First Call to GMM Lib DLL/so to get the DLL/so exported fucntion pointers +/// +///////////////////////////////////////////////////////////////////////////////////// +extern "C" GMM_LIB_API GMM_STATUS GMM_STDCALL OpenGmm(GmmExportEntries *pm_GmmFuncs) +{ + GMM_STATUS Status = GMM_SUCCESS; + if(pm_GmmFuncs) + { + //TODO + } + else + { + Status = GMM_INVALIDPARAM; + } + + return Status; +} + ///////////////////////////////////////////////////////////////////////////////////// // First Call to GMM Lib DLL/so to initialize singleton global context // and create client context diff --git a/Source/GmmLib/inc/External/Common/GmmLibDll.h b/Source/GmmLib/inc/External/Common/GmmLibDll.h index 6bdb31d..eca2805 100755 --- a/Source/GmmLib/inc/External/Common/GmmLibDll.h +++ b/Source/GmmLib/inc/External/Common/GmmLibDll.h @@ -68,6 +68,7 @@ extern "C" { ///////////////////////////////////////////////////////////////////////////////////// /// Only function exported from GMM lib DLL. ///////////////////////////////////////////////////////////////////////////////////// + GMM_LIB_API GMM_STATUS GMM_STDCALL OpenGmm(GmmExportEntries *pm_GmmFuncs); GMM_LIB_API GMM_STATUS GMM_STDCALL InitializeGmm(GMM_INIT_IN_ARGS *pInArgs, GMM_INIT_OUT_ARGS *pOutArgs); GMM_LIB_API void GMM_STDCALL GmmAdapterDestroy(GMM_INIT_OUT_ARGS *pInArgs); diff --git a/Source/GmmLib/inc/External/Common/GmmLibDllName.h b/Source/GmmLib/inc/External/Common/GmmLibDllName.h index 9fc05ed..854716e 100755 --- a/Source/GmmLib/inc/External/Common/GmmLibDllName.h +++ b/Source/GmmLib/inc/External/Common/GmmLibDllName.h @@ -22,7 +22,10 @@ OTHER DEALINGS IN THE SOFTWARE. #pragma once #if defined(_WIN64 ) || defined(__x86_64__) || defined(__LP64__) + #define GMM_ENTRY_NAME "OpenGmm" + #define GMM_INIT_NAME "GmmInit" #define GMM_ADAPTER_INIT_NAME "InitializeGmm" + #define GMM_DESTROY_NAME "GmmDestroy" #define GMM_ADAPTER_DESTROY_NAME "GmmAdapterDestroy" #if defined(_WIN64) @@ -33,7 +36,10 @@ OTHER DEALINGS IN THE SOFTWARE. #define GMM_UMD_DLL "libigdgmm.so.12" #endif #else + #define GMM_ENTRY_NAME "_OpenGmm@4" + #define GMM_INIT_NAME "_GmmInit@48" #define GMM_ADAPTER_INIT_NAME "_InitializeGmm@8" + #define GMM_DESTROY_NAME "_GmmDestroy@4" #define GMM_ADAPTER_DESTROY_NAME "_GmmAdapterDestroy@4" #if defined(_WIN32)