From 5250e211eff92aeb90c2a1b89c40e7af6a736c33 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Wed, 1 Jan 2020 10:47:42 +0000 Subject: [PATCH 1/8] is deprecated by POSIX and not required here In file included from Source/GmmLib/ULT/GmmAuxTableULT.cpp:25: In file included from Source/GmmLib/ULT/./GmmAuxTableULT.h:33: /usr/include/malloc.h:3:2: error: " has been replaced by " #error " has been replaced by " ^ --- Source/GmmLib/ULT/GmmAuxTableULT.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/GmmLib/ULT/GmmAuxTableULT.h b/Source/GmmLib/ULT/GmmAuxTableULT.h index 3b8c1a1..e5699b5 100644 --- a/Source/GmmLib/ULT/GmmAuxTableULT.h +++ b/Source/GmmLib/ULT/GmmAuxTableULT.h @@ -30,7 +30,6 @@ OTHER DEALINGS IN THE SOFTWARE. #include "GmmGen10ResourceULT.h" #include -#include #ifndef ALIGN #define ALIGN(v, a) (((v) + ((a)-1)) & ~((a)-1)) From 23df485dac195d98bdd1411e5bd3189b9c2a6fa1 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Wed, 1 Jan 2020 10:44:51 +0000 Subject: [PATCH 2/8] is implicitly included via but not required here Source/GmmLib/Utility/GmmLog/GmmLog.cpp:36:10: fatal error: 'linux/limits.h' file not found #include ^~~~~~~~~~~~~~~~ --- Source/GmmLib/Utility/GmmLog/GmmLog.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/GmmLib/Utility/GmmLog/GmmLog.cpp b/Source/GmmLib/Utility/GmmLog/GmmLog.cpp index 6628c9f..f08d6c7 100644 --- a/Source/GmmLib/Utility/GmmLog/GmmLog.cpp +++ b/Source/GmmLib/Utility/GmmLog/GmmLog.cpp @@ -34,7 +34,6 @@ OTHER DEALINGS IN THE SOFTWARE. #include #include #include -#include #endif /// Logger instance shared by all of GmmLib within a process From c272e0ccd55cf3782175460bbdbd142594b94d41 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Wed, 1 Jan 2020 11:02:37 +0000 Subject: [PATCH 3/8] Avoid -ldl if not required or not supported ld: error: unable to find library -ldl --- Source/GmmLib/ULT/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/GmmLib/ULT/CMakeLists.txt b/Source/GmmLib/ULT/CMakeLists.txt index 52e0944..9e829ff 100644 --- a/Source/GmmLib/ULT/CMakeLists.txt +++ b/Source/GmmLib/ULT/CMakeLists.txt @@ -160,7 +160,7 @@ target_link_libraries(${EXE_NAME} igfx_gmmumd_dll) target_link_libraries(${EXE_NAME} pthread - dl + ${CMAKE_DL_LIBS} ) add_custom_target(Run_ULT ALL DEPENDS GMMULT) From 8ebe65625f719a0ca6024038231510ac22b2b2ce Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Wed, 1 Jan 2020 10:42:29 +0000 Subject: [PATCH 4/8] __sync* are GCC/Clang atomic builtins supported on any platform In file included from Source/GmmLib/Platform/GmmGen11Platform.cpp:23: In file included from Source/GmmLib/inc/Internal/Common/GmmLibInc.h:35: In file included from Source/GmmLib/inc/External/Common/GmmCachePolicy.h:332: Source/GmmLib/inc/External/Common/GmmCachePolicyCommon.h:74:13: error: control reaches end of non-void function [-Werror,-Wreturn-type] } ^ Source/GmmLib/GlobalInfo/GmmInfo.cpp:600:1: error: non-void function does not return a value in all control paths [-Werror,-Wreturn-type] } ^ Source/GmmLib/GlobalInfo/GmmInfo.cpp:635:5: error: expected 'while' in do/while loop else ^ Source/GmmLib/GlobalInfo/GmmInfo.cpp:616:9: note: to match this 'do' do ^ Source/GmmLib/GlobalInfo/GmmInfo.cpp:803:18: error: qualified reference to 'Context' is a constructor name rather than a type in this context GmmLib::Context::Context() ^ Source/GmmLib/GlobalInfo/GmmInfo.cpp:804:5: error: expected ';' after expression : ClientType(), ^ [...] --- Source/GmmLib/GlobalInfo/GmmInfo.cpp | 4 ++-- Source/GmmLib/inc/External/Common/GmmInfo.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/GmmLib/GlobalInfo/GmmInfo.cpp b/Source/GmmLib/GlobalInfo/GmmInfo.cpp index ec2be20..858701f 100644 --- a/Source/GmmLib/GlobalInfo/GmmInfo.cpp +++ b/Source/GmmLib/GlobalInfo/GmmInfo.cpp @@ -937,7 +937,7 @@ int32_t GmmLib::Context::IncrementRefCount() { int32_t *Ref = &RefCount; -#if defined(__linux__) +#if defined(__GNUC__) // returns 0 only when registering the first client return (__sync_fetch_and_add(Ref, 1)); #endif @@ -972,7 +972,7 @@ int32_t GmmLib::Context::DecrementRefCount() { break; } -#if defined(__linux__) +#if defined(__GNUC__) } while(!__sync_bool_compare_and_swap(Ref, CurrentValue, TargetValue)); #endif return TargetValue; diff --git a/Source/GmmLib/inc/External/Common/GmmInfo.h b/Source/GmmLib/inc/External/Common/GmmInfo.h index 95e3aa9..822713c 100644 --- a/Source/GmmLib/inc/External/Common/GmmInfo.h +++ b/Source/GmmLib/inc/External/Common/GmmInfo.h @@ -141,7 +141,7 @@ namespace GmmLib { #if defined(_WIN32) return(InterlockedIncrement((LONG *)&RefCount) - 1); //InterLockedIncrement() returns incremented value -#elif defined(__linux__) +#elif defined(__GNUC__) return(__sync_fetch_and_add(&RefCount, 1)); #endif } @@ -163,7 +163,7 @@ namespace GmmLib } #if defined(_WIN32) } while (!(InterlockedCompareExchange((LONG *)&RefCount, TargetValue, CurrentValue) == CurrentValue)); -#elif defined(__linux__) +#elif defined(__GNUC__) } while (!__sync_bool_compare_and_swap(&RefCount, CurrentValue, TargetValue)); #endif From 6bd46985c4d07c6c9b9212a8216193dbddaf2e94 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Fri, 20 Sep 2019 14:18:56 +0000 Subject: [PATCH 5/8] Relax Linux checks for the code works on any non-Windows platform MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In file included from Source/GmmLib/CachePolicy/GmmCachePolicy.cpp:23: In file included from Source/GmmLib/inc/Internal/Common/GmmLibInc.h:58: In file included from Source/GmmLib/inc/External/Common/GmmResourceInfo.h:91: In file included from Source/GmmLib/inc/External/Common/../Linux/GmmResourceInfoLin.h:26: In file included from Source/GmmLib/inc/External/Common/../Linux/../Common/GmmResourceInfoCommon.h:32: Source/GmmLib/inc/External/Common/GmmClientContext.h:59:5: error: unknown type name 'GMM_DEVICE_CALLBACKS_INT' GMM_DEVICE_CALLBACKS_INT *pDeviceCb; ^ Source/GmmLib/inc/External/Common/GmmClientContext.h:85:9: error: unknown type name 'GMM_DEVICE_CALLBACKS_INT' GMM_DEVICE_CALLBACKS_INT DeviceCB; //OS-specific defn: Will be used by Clients to send as input arguments. ^ Source/GmmLib/inc/External/Common/GmmClientContext.h:139:80: error: unknown type name 'GMM_DEVICE_CALLBACKS_INT' GMM_VIRTUAL GMM_PAGETABLE_MGR* GMM_STDCALL CreatePageTblMgrObject(GMM_DEVICE_CALLBACKS_INT* pDevCb, uint32_t TTFlags); ^ Source/GmmLib/inc/External/Common/GmmClientContext.h:154:57: error: unknown type name 'GMM_DEVICE_CALLBACKS_INT' GMM_DEVICE_CALLBACKS_INT* pDevCb, ^ In file included from Source/GmmLib/CachePolicy/GmmCachePolicy.cpp:23: In file included from Source/GmmLib/inc/Internal/Common/GmmLibInc.h:62: Source/GmmLib/inc/External/Common/GmmPageTableMgr.h:56:5: error: unknown type name 'GMM_UMD_SYNCCONTEXT'; did you mean 'GMM_UMD_CONTEXT'? GMM_UMD_SYNCCONTEXT * UmdContext; // [in] pointer to thread-specific data, specifying BBQHandle/Fence etc ^~~~~~~~~~~~~~~~~~~ GMM_UMD_CONTEXT Source/GmmLib/inc/External/Common/GmmInfo.h:58:3: note: 'GMM_UMD_CONTEXT' declared here } GMM_UMD_CONTEXT; ^ In file included from Source/GmmLib/CachePolicy/GmmCachePolicy.cpp:23: In file included from Source/GmmLib/inc/Internal/Common/GmmLibInc.h:62: Source/GmmLib/inc/External/Common/GmmPageTableMgr.h:72:9: error: unknown type name 'HANDLE' HANDLE BBQueueHandle; ^ Source/GmmLib/inc/External/Common/GmmPageTableMgr.h:75:21: error: unknown type name 'HANDLE' SyncInfoLin(HANDLE Handle, uint64_t Fence) {} ^ Source/GmmLib/inc/External/Common/GmmPageTableMgr.h:115:9: error: unknown type name 'GMM_DEVICE_CALLBACKS' GMM_DEVICE_CALLBACKS DeviceCb; //OS-specific defn: Will be used by Clients to send as input arguments for TR-TT APIs ^ Source/GmmLib/inc/External/Common/GmmPageTableMgr.h:116:9: error: unknown type name 'GMM_DEVICE_CALLBACKS_INT' GMM_DEVICE_CALLBACKS_INT DeviceCbInt; //OS-specific defn: Will be used internally GMM lib ^ Source/GmmLib/inc/External/Common/GmmPageTableMgr.h:117:9: error: unknown type name 'GMM_TRANSLATIONTABLE_CALLBACKS' GMM_TRANSLATIONTABLE_CALLBACKS TTCb; //OS-specific defn ^ Source/GmmLib/inc/External/Common/GmmPageTableMgr.h:118:9: error: unknown type name 'HANDLE' HANDLE hCsr; // OCL per-device command stream receiver handle for aubcapture ^ Source/GmmLib/inc/External/Common/GmmPageTableMgr.h:121:25: error: unknown type name 'GMM_DEVICE_CALLBACKS_INT' GmmPageTableMgr(GMM_DEVICE_CALLBACKS_INT *, uint32_t TTFlags, GmmClientContext *pClientContextIn); // Allocates memory for indicate TT’s root-tables, initializes common node-pool ^ Source/GmmLib/inc/External/Common/GmmPageTableMgr.h:128:60: error: unknown type name 'HANDLE' GMM_VIRTUAL GMM_STATUS InitContextAuxTableRegister(HANDLE initialBBHandle, GMM_ENGINE_TYPE engType); //Clients call it to update Aux-Table pointer in context-image, engType reqd. if @ context level ^ Source/GmmLib/inc/External/Common/GmmPageTableMgr.h:133:46: error: unknown type name 'GMM_UMD_SYNCCONTEXT'; did you mean 'GMM_UMD_CONTEXT'? GMM_VIRTUAL void __ReleaseUnusedPool(GMM_UMD_SYNCCONTEXT *UmdContext); ^~~~~~~~~~~~~~~~~~~ GMM_UMD_CONTEXT Source/GmmLib/inc/External/Common/GmmInfo.h:58:3: note: 'GMM_UMD_CONTEXT' declared here } GMM_UMD_CONTEXT; ^ --- Source/Common/AssertTracer/AssertTracer.cpp | 2 +- Source/Common/AssertTracer/AssertTracer.h | 2 +- Source/GmmLib/CachePolicy/GmmGen8CachePolicy.h | 2 +- Source/GmmLib/Resource/Linux/GmmResourceInfoLinCWrapper.cpp | 4 ++-- Source/GmmLib/Texture/GmmTextureAlloc.cpp | 2 +- Source/GmmLib/TranslationTable/GmmPageTableMgr.cpp | 6 +++--- Source/GmmLib/TranslationTable/GmmUmdTranslationTable.cpp | 2 +- Source/GmmLib/TranslationTable/GmmUmdTranslationTable.h | 4 ++-- Source/GmmLib/ULT/GmmAuxTableULT.cpp | 4 ++-- Source/GmmLib/ULT/GmmAuxTableULT.h | 4 ++-- Source/GmmLib/Utility/GmmLog/GmmLog.cpp | 5 +---- Source/GmmLib/Utility/GmmLog/spdlog/tweakme.h | 2 +- Source/GmmLib/inc/External/Common/GmmCommonExt.h | 2 +- Source/GmmLib/inc/External/Common/GmmPageTableMgr.h | 6 +++--- Source/GmmLib/inc/External/Common/GmmResourceInfoExt.h | 2 +- Source/GmmLib/inc/External/Linux/GmmResourceInfoLinExt.h | 4 ++-- Source/GmmLib/inc/Internal/Linux/GmmResourceInfoLinInt.h | 4 ++-- Source/util/gfxDebug.h | 2 +- 18 files changed, 28 insertions(+), 31 deletions(-) diff --git a/Source/Common/AssertTracer/AssertTracer.cpp b/Source/Common/AssertTracer/AssertTracer.cpp index e9f33a4..cfd9528 100644 --- a/Source/Common/AssertTracer/AssertTracer.cpp +++ b/Source/Common/AssertTracer/AssertTracer.cpp @@ -180,7 +180,7 @@ void __stdcall ReportAssertETW( const unsigned short compId, #endif } -#elif defined( __linux__ ) && defined( _RELEASE_INTERNAL ) && !defined( __ANDROID__ ) +#elif defined( _RELEASE_INTERNAL ) && !defined( _WIN32 ) && !defined( __ANDROID__ ) #include #include #include diff --git a/Source/Common/AssertTracer/AssertTracer.h b/Source/Common/AssertTracer/AssertTracer.h index 5b21afa..6472796 100644 --- a/Source/Common/AssertTracer/AssertTracer.h +++ b/Source/Common/AssertTracer/AssertTracer.h @@ -91,7 +91,7 @@ void __stdcall ReportAssertETW(const unsigned short compId, } #endif -#elif defined( __linux__ ) && defined( _RELEASE_INTERNAL ) && !defined( __ANDROID__ ) +#elif defined( _RELEASE_INTERNAL ) && !defined( _WIN32 ) && !defined( __ANDROID__ ) // do while() is missing ";" at the end and this is intentional // As invoking assert looks like this: assert(expr); So semicolon will // be stuck to do.. while() and that way sorting out possible diff --git a/Source/GmmLib/CachePolicy/GmmGen8CachePolicy.h b/Source/GmmLib/CachePolicy/GmmGen8CachePolicy.h index 112aacf..24dbe57 100755 --- a/Source/GmmLib/CachePolicy/GmmGen8CachePolicy.h +++ b/Source/GmmLib/CachePolicy/GmmGen8CachePolicy.h @@ -145,7 +145,7 @@ DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_REF_ENCODE DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_HME_DOWNSAMPLED_ENCODE , 1 , 1 , 1 , 0 , 1); DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_HME_DOWNSAMPLED_ENCODE_DST , 1 , 1 , 0 , 0 , 1); DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ME_DISTORTION_ENCODE , 1 , 1 , 1 , 0 , 1); -#if defined(__linux__) && !defined(ANDROID) +#if !defined(_WIN32) && !defined(ANDROID) DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MV_DATA_ENCODE , 1 , 1 , 0 , 0 , 1); DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_BRC_ME_DISTORTION_ENCODE , 1 , 1 , 0 , 0 , 1); DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PAK_OBJECT_ENCODE , 1 , 1 , 0 , 0 , 1); diff --git a/Source/GmmLib/Resource/Linux/GmmResourceInfoLinCWrapper.cpp b/Source/GmmLib/Resource/Linux/GmmResourceInfoLinCWrapper.cpp index 546815f..ee41b17 100644 --- a/Source/GmmLib/Resource/Linux/GmmResourceInfoLinCWrapper.cpp +++ b/Source/GmmLib/Resource/Linux/GmmResourceInfoLinCWrapper.cpp @@ -22,7 +22,7 @@ OTHER DEALINGS IN THE SOFTWARE. #include "Internal/Common/GmmLibInc.h" -#if defined(__linux__) && !LHDM +#if !defined(_WIN32) && !LHDM #include "Internal/Linux/GmmResourceInfoLinInt.h" ///////////////////////////////////////////////////////////////////////////////////// @@ -176,4 +176,4 @@ GMM_TRANSLATIONTABLE_CALLBACKS DummyTTCB = { .pfWriteL3Adr = DummyWriteL3Adr, }; -#endif /*__linux__*/ +#endif /*!_WIN32*/ diff --git a/Source/GmmLib/Texture/GmmTextureAlloc.cpp b/Source/GmmLib/Texture/GmmTextureAlloc.cpp index 6184032..9e6da8b 100644 --- a/Source/GmmLib/Texture/GmmTextureAlloc.cpp +++ b/Source/GmmLib/Texture/GmmTextureAlloc.cpp @@ -812,7 +812,7 @@ GMM_STATUS GmmLib::GmmTextureCalc::FillTexPitchAndSize(GMM_TEXTURE_INFO * pTexIn } else { -#if defined(__GMM_KMD__) || defined(__linux__) +#if defined(__GMM_KMD__) || !defined(_WIN32) GMM_ASSERTDPF(0, "Surface too large!"); #endif Status = GMM_ERROR; diff --git a/Source/GmmLib/TranslationTable/GmmPageTableMgr.cpp b/Source/GmmLib/TranslationTable/GmmPageTableMgr.cpp index 041b42e..6f6129e 100644 --- a/Source/GmmLib/TranslationTable/GmmPageTableMgr.cpp +++ b/Source/GmmLib/TranslationTable/GmmPageTableMgr.cpp @@ -28,7 +28,7 @@ Description: UMD-TT manager (manages both TR-TT and AUX-TT in user mode space) #include "../TranslationTable/GmmUmdTranslationTable.h" #include "External/Common/GmmClientContext.h" -#if defined(__linux__) +#if !defined(_WIN32) #include "Internal/Linux/GmmResourceInfoLinInt.h" #endif @@ -44,7 +44,7 @@ Description: UMD-TT manager (manages both TR-TT and AUX-TT in user mode space) LeaveCriticalSection(&PoolLock); \ } extern GMM_MA_LIB_CONTEXT *pGmmMALibContext; -#if defined(__linux__) +#if !defined(_WIN32) GMM_STATUS GmmLib::__GmmDeviceAlloc(GmmClientContext * pClientContext, GMM_DEVICE_CALLBACKS_INT *pDeviceCbInt, GMM_DEVICE_ALLOC * pAlloc) @@ -608,7 +608,7 @@ GMM_STATUS GmmLib::GmmPageTableMgr::UpdateAuxTable(const GMM_DDI_UPDATEAUXTABLE return GMM_SUCCESS; } -#if defined(__linux__) && !_WIN32 +#if !defined(_WIN32) ///////////////////////////////////////////////////////////////////////////////////// /// Gets size of PageTable buffer object (BOs) list /// diff --git a/Source/GmmLib/TranslationTable/GmmUmdTranslationTable.cpp b/Source/GmmLib/TranslationTable/GmmUmdTranslationTable.cpp index 0de4dbd..2117fbd 100644 --- a/Source/GmmLib/TranslationTable/GmmUmdTranslationTable.cpp +++ b/Source/GmmLib/TranslationTable/GmmUmdTranslationTable.cpp @@ -31,7 +31,7 @@ Description: Contains functions of internal classes #if !defined(__GMM_KMD) -#if defined(__linux__) +#if !defined(_WIN32) #include "Internal/Linux/GmmResourceInfoLinInt.h" #define _aligned_free(ptr) free(ptr) diff --git a/Source/GmmLib/TranslationTable/GmmUmdTranslationTable.h b/Source/GmmLib/TranslationTable/GmmUmdTranslationTable.h index 76ee455..85563f6 100644 --- a/Source/GmmLib/TranslationTable/GmmUmdTranslationTable.h +++ b/Source/GmmLib/TranslationTable/GmmUmdTranslationTable.h @@ -27,7 +27,7 @@ Description: This file contains the class definitions for GmmPageTablePool #pragma once #include "External/Common/GmmPageTableMgr.h" -#ifdef __linux__ +#ifndef _WIN32 #include #include @@ -448,7 +448,7 @@ namespace GmmLib public: #ifdef _WIN32 CRITICAL_SECTION TTLock; //synchronized access of PageTable obj -#elif defined __linux__ +#else pthread_mutex_t TTLock; #endif diff --git a/Source/GmmLib/ULT/GmmAuxTableULT.cpp b/Source/GmmLib/ULT/GmmAuxTableULT.cpp index c6a9b53..567f1f3 100644 --- a/Source/GmmLib/ULT/GmmAuxTableULT.cpp +++ b/Source/GmmLib/ULT/GmmAuxTableULT.cpp @@ -20,7 +20,7 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ============================================================================*/ -#if defined (__linux__) && !defined(__i386__) +#if !defined (_WIN32) && !defined(__i386__) #include "GmmAuxTableULT.h" @@ -262,4 +262,4 @@ TEST_F(CTestAuxTable, TestAuxTableContent) pGmmULTClientContext->DestroyPageTblMgrObject(mgr); } -#endif /* __linux__ */ +#endif /* !_WIN32 */ diff --git a/Source/GmmLib/ULT/GmmAuxTableULT.h b/Source/GmmLib/ULT/GmmAuxTableULT.h index e5699b5..ea6ca03 100644 --- a/Source/GmmLib/ULT/GmmAuxTableULT.h +++ b/Source/GmmLib/ULT/GmmAuxTableULT.h @@ -22,7 +22,7 @@ OTHER DEALINGS IN THE SOFTWARE. #pragma once -#if defined (__linux__) && !defined(__i386__) +#if !defined (_WIN32) && !defined(__i386__) #ifndef _ISOC11_SOURCE #define _ISOC11_SOURCE 1 @@ -248,4 +248,4 @@ class CTestAuxTable : public CTestGen10Resource }; }; -#endif /* __linux__ */ +#endif /* !_WIN32 */ diff --git a/Source/GmmLib/Utility/GmmLog/GmmLog.cpp b/Source/GmmLib/Utility/GmmLog/GmmLog.cpp index f08d6c7..4506743 100644 --- a/Source/GmmLib/Utility/GmmLog/GmmLog.cpp +++ b/Source/GmmLib/Utility/GmmLog/GmmLog.cpp @@ -196,12 +196,9 @@ bool GmmLib::Logger::GmmLogInit() #elif defined(__ANDROID__) // Log to logcat SpdLogger = spdlog::android_logger(GMM_LOGGER_NAME, GMM_LOG_TAG); -#elif defined(__linux__) +#else // Log to syslog SpdLogger = spdlog::syslog_logger(GMM_LOGGER_NAME, GMM_LOG_TAG, 1 /*Log Pid*/); -#else - __GMM_ASSERT(0); - return false; #endif } } diff --git a/Source/GmmLib/Utility/GmmLog/spdlog/tweakme.h b/Source/GmmLib/Utility/GmmLog/spdlog/tweakme.h index 5518ce1..cafb783 100644 --- a/Source/GmmLib/Utility/GmmLog/spdlog/tweakme.h +++ b/Source/GmmLib/Utility/GmmLog/spdlog/tweakme.h @@ -97,7 +97,7 @@ /////////////////////////////////////////////////////////////////////////////// // Uncomment to enable syslog (disabled by default) // -#if __linux__ +#ifndef _WIN32 #define SPDLOG_ENABLE_SYSLOG #endif /////////////////////////////////////////////////////////////////////////////// diff --git a/Source/GmmLib/inc/External/Common/GmmCommonExt.h b/Source/GmmLib/inc/External/Common/GmmCommonExt.h index 4626f4f..2924503 100644 --- a/Source/GmmLib/inc/External/Common/GmmCommonExt.h +++ b/Source/GmmLib/inc/External/Common/GmmCommonExt.h @@ -85,7 +85,7 @@ extern const SWIZZLE_DESCRIPTOR INTEL_64KB_UNDEFINED_64_128bpp; #define GMM_NO_FENCE_REG 0xDEADBEEF #define GMM_MAX_DISPLAYS 3 -#if defined __linux__ +#ifndef _WIN32 typedef void* HANDLE; #endif diff --git a/Source/GmmLib/inc/External/Common/GmmPageTableMgr.h b/Source/GmmLib/inc/External/Common/GmmPageTableMgr.h index 55008a0..ddcc420 100644 --- a/Source/GmmLib/inc/External/Common/GmmPageTableMgr.h +++ b/Source/GmmLib/inc/External/Common/GmmPageTableMgr.h @@ -28,7 +28,7 @@ Description: This file contains the class definitions for GmmPageTableMgr #pragma once #include "GmmHw.h" -#ifdef __linux__ +#ifndef _WIN32 #include #endif @@ -108,7 +108,7 @@ namespace GmmLib GmmClientContext *pClientContext; ///< ClientContext of the client creating this Object //OS-specific defn -#if defined __linux__ +#ifndef _WIN32 pthread_mutex_t PoolLock; #endif public: @@ -134,7 +134,7 @@ namespace GmmLib GMM_VIRTUAL GMM_PAGETABLEPool * __GetFreePoolNode(uint32_t * FreePoolNodeIdx, POOL_TYPE PoolType); -#if defined __linux__ +#ifndef _WIN32 //returns number of BOs for indicated TTs = NumNodePoolElements+1 BOs for root table and pools GMM_VIRTUAL int GetNumOfPageTableBOs(uint8_t TTFlags); //returns BO* list for indicated TT in client allocated memory diff --git a/Source/GmmLib/inc/External/Common/GmmResourceInfoExt.h b/Source/GmmLib/inc/External/Common/GmmResourceInfoExt.h index 0ffd558..20f767d 100644 --- a/Source/GmmLib/inc/External/Common/GmmResourceInfoExt.h +++ b/Source/GmmLib/inc/External/Common/GmmResourceInfoExt.h @@ -189,7 +189,7 @@ typedef struct GmmLibContext GMM_LIB_CONTEXT; // Place holder for GMM_RESOURCE_FLAG definition. //--------------------------------------------------------------------------- #include "GmmResourceFlags.h" -#if defined __linux__ +#ifndef _WIN32 #include "External/Linux/GmmResourceInfoLinExt.h" #endif diff --git a/Source/GmmLib/inc/External/Linux/GmmResourceInfoLinExt.h b/Source/GmmLib/inc/External/Linux/GmmResourceInfoLinExt.h index 20d3b95..527e52b 100644 --- a/Source/GmmLib/inc/External/Linux/GmmResourceInfoLinExt.h +++ b/Source/GmmLib/inc/External/Linux/GmmResourceInfoLinExt.h @@ -21,7 +21,7 @@ OTHER DEALINGS IN THE SOFTWARE. ============================================================================*/ #pragma once -#ifdef __linux__ +#ifndef _WIN32 #ifdef __cplusplus extern "C" { @@ -93,4 +93,4 @@ typedef struct GMM_UMD_SYNCCONTEXT_REC } #endif /*__cplusplus*/ -#endif /*__linux__*/ +#endif /*!_WIN32*/ diff --git a/Source/GmmLib/inc/Internal/Linux/GmmResourceInfoLinInt.h b/Source/GmmLib/inc/Internal/Linux/GmmResourceInfoLinInt.h index 750d537..0eedde3 100644 --- a/Source/GmmLib/inc/Internal/Linux/GmmResourceInfoLinInt.h +++ b/Source/GmmLib/inc/Internal/Linux/GmmResourceInfoLinInt.h @@ -22,7 +22,7 @@ OTHER DEALINGS IN THE SOFTWARE. #pragma once -#if defined(__linux__) && !LHDM +#if !defined(_WIN32) && !LHDM // GMM Lib Client Exports #include "External/Common/GmmCommonExt.h" @@ -68,4 +68,4 @@ int GmmCheckForNullDevCbPfn(GMM_CLIENT ClientType, GMM_DEVICE_CALLBACKS_INT *pDe extern GMM_TRANSLATIONTABLE_CALLBACKS DummyTTCB; -#endif /*__linux__*/ +#endif /*!_WIN32*/ diff --git a/Source/util/gfxDebug.h b/Source/util/gfxDebug.h index 69646f6..773c343 100644 --- a/Source/util/gfxDebug.h +++ b/Source/util/gfxDebug.h @@ -124,7 +124,7 @@ OTHER DEALINGS IN THE SOFTWARE. #else -#ifndef __linux__ +#ifdef _WIN32 #include "igdKrnlEtwMacros.h" #endif From f573e35c46bb771c787acafe7ec8de44dbc47059 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Wed, 1 Jan 2020 10:51:17 +0000 Subject: [PATCH 6/8] spdlog: backport support for more Unices https://github.com/gabime/spdlog/commit/53b230801149a35613f33fc4247080bffaf5a289 https://github.com/gabime/spdlog/commit/8d57823e519c05b5cf11672115659c042d83f7c3 --- .../GmmLib/Utility/GmmLog/spdlog/details/os.h | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/Source/GmmLib/Utility/GmmLog/spdlog/details/os.h b/Source/GmmLib/Utility/GmmLog/spdlog/details/os.h index 3f9d386..35223ff 100644 --- a/Source/GmmLib/Utility/GmmLog/spdlog/details/os.h +++ b/Source/GmmLib/Utility/GmmLog/spdlog/details/os.h @@ -39,8 +39,20 @@ #include #include -#elif __FreeBSD__ -#include //Use thr_self() syscall under FreeBSD to get thread id +#elif defined(_AIX) +#include // for pthread_getthreadid_np + +#elif defined(__DragonFly__) || defined(__FreeBSD__) +#include // for pthread_getthreadid_np + +#elif defined(__NetBSD__) +#include // for _lwp_self + +#elif defined(__OpenBSD__) +#include // for getthrid + +#elif defined(__sun) +#include // for thr_self #else #include @@ -213,7 +225,7 @@ inline size_t filesize(FILE *f) #else // unix int fd = fileno(f); //64 bits(but not in osx, where fstat64 is deprecated) -#if !defined(__FreeBSD__) && !defined(__APPLE__) && (defined(__x86_64__) || defined(__ppc64__)) +#if (defined(__linux__) || defined(__sun) || defined(_AIX)) && (defined(__LP64__) || defined(_LP64)) struct stat64 st; if (fstat64(fd, &st) == 0) return static_cast(st.st_size); @@ -302,10 +314,14 @@ inline size_t thread_id() # define SYS_gettid __NR_gettid # endif return static_cast(syscall(SYS_gettid)); -#elif __FreeBSD__ - long tid; - thr_self(&tid); - return static_cast(tid); +#elif defined(_AIX) || defined(__DragonFly__) || defined(__FreeBSD__) + return static_cast(pthread_getthreadid_np()); +#elif defined(__NetBSD__) + return static_cast(_lwp_self()); +#elif defined(__OpenBSD__) + return static_cast(getthrid()); +#elif defined(__sun) + return static_cast(thr_self()); #else //Default to standard C++11 (OSX and other Unix) return static_cast(std::hash()(std::this_thread::get_id())); #endif From 083dae1e31a75dc7fee58055a75ac5b7dcbb8114 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Sat, 11 Jan 2020 22:42:50 +0000 Subject: [PATCH 7/8] Avoid __fastcall conflicting with system definition In file included from media_driver/agnostic/common/cm/cm_hal_hashtable.cpp:36: In file included from media_driver/agnostic/common/cm/cm_hal_hashtable.h:29: In file included from media_driver/agnostic/common/os/mos_os.h:31: In file included from media_driver/linux/common/os/media_skuwa_specific.h:32: In file included from media_driver/linux/common/os/linux_shadow_skuwa.h:31: In file included from /usr/local/include/igdgmm/GmmLib/inc/GmmLib.h:30: /usr/local/include/igdgmm/inc/portable_compiler.h:33:13: error: '__fastcall' macro redefined [-Werror,-Wmacro-redefined] #define __fastcall ^ /usr/include/sys/cdefs.h:372:9: note: previous definition is here #define __fastcall __attribute__((__fastcall__)) ^ --- Source/inc/portable_compiler.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/inc/portable_compiler.h b/Source/inc/portable_compiler.h index db68312..45c18a1 100644 --- a/Source/inc/portable_compiler.h +++ b/Source/inc/portable_compiler.h @@ -30,6 +30,9 @@ OTHER DEALINGS IN THE SOFTWARE. #endif #define __noop + #ifdef __fastcall + #undef __fastcall + #endif #define __fastcall #if defined __x86_64__ #define __stdcall // deprecated for x86-64 From 8f031d57ce598b94210c3d7dc0b8ac1310a53824 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Mon, 13 Jan 2020 21:36:54 +0000 Subject: [PATCH 8/8] Switch to optimized ffsl supported on more platforms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In file included from Source/GmmLib/TranslationTable/GmmAuxTable.cpp:30: Source/GmmLib/TranslationTable/../TranslationTable/GmmUmdTranslationTable.h: In function ‘int _BitScanForward(uint32_t*, uint32_t)’: Source/GmmLib/TranslationTable/../TranslationTable/GmmUmdTranslationTable.h:63:9: error: ‘ffsl’ was not declared in this scope i = ffsl(mask); ^~~~ Source/GmmLib/TranslationTable/../TranslationTable/GmmUmdTranslationTable.h:63:9: note: suggested alternative: ‘ffs’ i = ffsl(mask); ^~~~ ffs --- Source/GmmLib/TranslationTable/GmmUmdTranslationTable.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Source/GmmLib/TranslationTable/GmmUmdTranslationTable.h b/Source/GmmLib/TranslationTable/GmmUmdTranslationTable.h index 85563f6..170ceef 100644 --- a/Source/GmmLib/TranslationTable/GmmUmdTranslationTable.h +++ b/Source/GmmLib/TranslationTable/GmmUmdTranslationTable.h @@ -60,12 +60,7 @@ static inline int _BitScanForward(uint32_t *index, uint32_t mask) { int i; -#ifdef __ANDROID__ - i = ffs(mask); -#else - i = ffsl(mask); -#endif - + i = __builtin_ffsl(mask); if(i > 0) { *index = (uint32_t)(i - 1);