From 6618a351268d8bbfd4b62760eee10d36eb83af41 Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Tue, 24 Jul 2018 10:02:03 +0200 Subject: [PATCH] Remove static gmmlib support on Windows Change-Id: I9e52f11b196ef9364b710766d9dd302e4dc0cc64 --- runtime/gmm_helper/CMakeLists.txt | 7 +++ .../gmm_interface_dynamic.cpp} | 0 .../gmm_interface_static.cpp} | 0 runtime/os_interface/linux/CMakeLists.txt | 8 --- .../linux/gmm_interface_dynamic_linux.cpp | 55 ----------------- runtime/os_interface/windows/CMakeLists.txt | 8 --- .../windows/gmm_interface_static_win.cpp | 60 ------------------- 7 files changed, 7 insertions(+), 131 deletions(-) rename runtime/{os_interface/windows/gmm_interface_dynamic_win.cpp => gmm_helper/gmm_interface_dynamic.cpp} (100%) rename runtime/{os_interface/linux/gmm_interface_static_linux.cpp => gmm_helper/gmm_interface_static.cpp} (100%) delete mode 100644 runtime/os_interface/linux/gmm_interface_dynamic_linux.cpp delete mode 100644 runtime/os_interface/windows/gmm_interface_static_win.cpp diff --git a/runtime/gmm_helper/CMakeLists.txt b/runtime/gmm_helper/CMakeLists.txt index 8e0bb693c9..684cfb6d5d 100644 --- a/runtime/gmm_helper/CMakeLists.txt +++ b/runtime/gmm_helper/CMakeLists.txt @@ -18,6 +18,12 @@ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. +if(UNIX AND USE_STATIC_GMM) + set(GMM_INTERFACE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/gmm_interface_static.cpp) +else() + set(GMM_INTERFACE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/gmm_interface_dynamic.cpp) +endif() + set(RUNTIME_SRCS_GMM_HELPER_BASE ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/gmm.cpp @@ -26,6 +32,7 @@ set(RUNTIME_SRCS_GMM_HELPER_BASE ${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 + ${GMM_INTERFACE_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/gmm_helper.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gmm_helper.h ${CMAKE_CURRENT_SOURCE_DIR}/gmm_lib.h diff --git a/runtime/os_interface/windows/gmm_interface_dynamic_win.cpp b/runtime/gmm_helper/gmm_interface_dynamic.cpp similarity index 100% rename from runtime/os_interface/windows/gmm_interface_dynamic_win.cpp rename to runtime/gmm_helper/gmm_interface_dynamic.cpp diff --git a/runtime/os_interface/linux/gmm_interface_static_linux.cpp b/runtime/gmm_helper/gmm_interface_static.cpp similarity index 100% rename from runtime/os_interface/linux/gmm_interface_static_linux.cpp rename to runtime/gmm_helper/gmm_interface_static.cpp diff --git a/runtime/os_interface/linux/CMakeLists.txt b/runtime/os_interface/linux/CMakeLists.txt index 6ea4f2068b..343a2c96eb 100644 --- a/runtime/os_interface/linux/CMakeLists.txt +++ b/runtime/os_interface/linux/CMakeLists.txt @@ -18,13 +18,6 @@ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. -if(USE_STATIC_GMM) - set(GMM_INTERFACE_FILE_LINUX ${CMAKE_CURRENT_SOURCE_DIR}/gmm_interface_static_linux.cpp) -else() - set(GMM_INTERFACE_FILE_LINUX ${CMAKE_CURRENT_SOURCE_DIR}/gmm_interface_dynamic_linux.cpp) -endif() -set_property(GLOBAL PROPERTY GMM_INTERFACE_FILE_LINUX ${GMM_INTERFACE_FILE_LINUX}) - set(RUNTIME_SRCS_OS_INTERFACE_LINUX ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/allocator_helper.h @@ -50,7 +43,6 @@ set(RUNTIME_SRCS_OS_INTERFACE_LINUX ${CMAKE_CURRENT_SOURCE_DIR}/drm_neo.h ${CMAKE_CURRENT_SOURCE_DIR}/drm_neo_create.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drm_null_device.h - ${GMM_INTERFACE_FILE_LINUX} ${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config.cpp ${CMAKE_CURRENT_SOURCE_DIR}/linux_inc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/os_thread_linux.cpp diff --git a/runtime/os_interface/linux/gmm_interface_dynamic_linux.cpp b/runtime/os_interface/linux/gmm_interface_dynamic_linux.cpp deleted file mode 100644 index 011ce04c4c..0000000000 --- a/runtime/os_interface/linux/gmm_interface_dynamic_linux.cpp +++ /dev/null @@ -1,55 +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 "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; -extern const char *gmmEntryName; -} // namespace Os - -namespace OCLRT { -decltype(GmmHelper::initGlobalContextFunc) GmmHelper::initGlobalContextFunc = nullptr; -decltype(GmmHelper::destroyGlobalContextFunc) GmmHelper::destroyGlobalContextFunc = nullptr; -decltype(GmmHelper::createClientContextFunc) GmmHelper::createClientContextFunc = nullptr; -decltype(GmmHelper::deleteClientContextFunc) GmmHelper::deleteClientContextFunc = nullptr; - -void GmmHelper::loadLib() { - gmmLib = OsLibrary::load(Os::gmmDllName); - - UNRECOVERABLE_IF(!gmmLib); - if (gmmLib->isLoaded()) { - auto openGmmFunc = reinterpret_cast(gmmLib->getProcAddress(Os::gmmEntryName)); - GmmExportEntries entries; - auto status = openGmmFunc(&entries); - if (status == GMM_SUCCESS) { - GmmHelper::initGlobalContextFunc = entries.pfnCreateSingletonContext; - GmmHelper::destroyGlobalContextFunc = entries.pfnDestroySingletonContext; - GmmHelper::createClientContextFunc = entries.pfnCreateClientContext; - GmmHelper::deleteClientContextFunc = entries.pfnDeleteClientContext; - isLoaded = GmmHelper::initGlobalContextFunc && GmmHelper::destroyGlobalContextFunc && GmmHelper::createClientContextFunc && GmmHelper::deleteClientContextFunc; - } - } - UNRECOVERABLE_IF(!isLoaded); -} -} // namespace OCLRT diff --git a/runtime/os_interface/windows/CMakeLists.txt b/runtime/os_interface/windows/CMakeLists.txt index 6e9c8cb7cd..8e1d7f1add 100644 --- a/runtime/os_interface/windows/CMakeLists.txt +++ b/runtime/os_interface/windows/CMakeLists.txt @@ -24,13 +24,6 @@ else() set(KMDAF_FILE_SUFFIX "_stub") 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 ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/api_win.cpp @@ -46,7 +39,6 @@ set(RUNTIME_SRCS_OS_INTERFACE_WINDOWS ${CMAKE_CURRENT_SOURCE_DIR}/driver_info.h ${CMAKE_CURRENT_SOURCE_DIR}/gdi_interface.cpp ${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.h ${CMAKE_CURRENT_SOURCE_DIR}/os_inc.h diff --git a/runtime/os_interface/windows/gmm_interface_static_win.cpp b/runtime/os_interface/windows/gmm_interface_static_win.cpp deleted file mode 100644 index 14857a1299..0000000000 --- a/runtime/os_interface/windows/gmm_interface_static_win.cpp +++ /dev/null @@ -1,60 +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 "runtime/gmm_helper/gmm_helper.h" - -namespace OCLRT { -GMM_STATUS GMM_STDCALL myPfnCreateSingletonContext(const PLATFORM platform, const SKU_FEATURE_TABLE *pSkuTable, const WA_TABLE *pWaTable, const GT_SYSTEM_INFO *pGtSysInfo) { - return GmmInitGlobalContext(platform, pSkuTable, pWaTable, pGtSysInfo, GMM_CLIENT::GMM_OCL_VISTA); -} -decltype(GmmHelper::initGlobalContextFunc) GmmHelper::initGlobalContextFunc = nullptr; -decltype(GmmHelper::destroyGlobalContextFunc) GmmHelper::destroyGlobalContextFunc = nullptr; -decltype(GmmHelper::createClientContextFunc) GmmHelper::createClientContextFunc = nullptr; -decltype(GmmHelper::deleteClientContextFunc) GmmHelper::deleteClientContextFunc = nullptr; - -void GmmHelper::loadLib() { - GmmHelper::initGlobalContextFunc = myPfnCreateSingletonContext; - GmmHelper::destroyGlobalContextFunc = GmmDestroyGlobalContext; - GmmHelper::createClientContextFunc = GmmCreateClientContext; - GmmHelper::deleteClientContextFunc = GmmDeleteClientContext; - isLoaded = true; -} -} // namespace OCLRT -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; -}