Update DevDriverTools repo to 21c93b7230c4188

This commit is contained in:
baldurk
2018-05-17 00:47:52 +01:00
parent 72eb734964
commit bf09eb59a3
7 changed files with 135 additions and 26 deletions
+11 -4
View File
@@ -146,17 +146,24 @@ bool AMDRGPControl::HasCapture()
bool AMDRGPControl::DriverSupportsInterop()
{
// interop is supported on AMD driver version 18.10 or newer
// interop is supported on AMD driver version 18.10.1 or newer
if(m_RGPContext == NULL)
return false;
unsigned int majorVersion = 0;
unsigned int minorVersion = 0;
unsigned int subminorVersion = 0;
if(m_RGPDispatchTable->GetDriverVersion(m_RGPContext, majorVersion, minorVersion) ==
DEV_DRIVER_STATUS_SUCCESS)
if(m_RGPDispatchTable->GetFullDriverVersion(m_RGPContext, &majorVersion, &minorVersion,
&subminorVersion) == DEV_DRIVER_STATUS_SUCCESS)
{
if(majorVersion > 18 || (majorVersion == 18 && minorVersion >= 10))
if(
// 19.x.x+
majorVersion > 18 ||
// 18.11.x+
(majorVersion == 18 && minorVersion >= 11) ||
// 18.10.2+
(majorVersion == 18 && minorVersion == 10 && subminorVersion > 1))
{
return true;
}
@@ -64,7 +64,7 @@ static bool parseDriverVersionString(char *versionString, unsigned int &major, u
// delimiter not found
return false;
}
strToken = strDriverVersion.substr(0, pos);
ss.str(strToken);
@@ -73,7 +73,7 @@ static bool parseDriverVersionString(char *versionString, unsigned int &major, u
major = 0;
return false;
}
strDriverVersion.erase(0, pos + strDelimiter.length()); // Delete section of string already parsed
// parse the minor driver version
@@ -180,6 +180,53 @@ bool ADLGetDriverVersion(unsigned int& majorVer, unsigned int& minorVer, unsigne
return retStatus;
}
//-----------------------------------------------------------------------------
/// Use ADL on Windows to retrieve the driver version string
/// \param outVersionName Pointer to s string to receive the version number.
/// Presetnly, the string should be at least ADL_MAX_PATH bytes long
/// \return true if successful, or false on error
//-----------------------------------------------------------------------------
bool ADLGetDriverVersionString(char* outVersionString)
{
bool retStatus = false;
HINSTANCE hDLL = LoadLibrary(TEXT("atiadlxx.dll"));
if (NULL == hDLL)
{
// A 32 bit calling application on 64 bit OS will fail to LoadLIbrary.
// Try to load the 32 bit library (atiadlxy.dll) instead
hDLL = LoadLibrary(TEXT("atiadlxy.dll"));
}
if (NULL != hDLL)
{
ADL2_MAIN_CONTROL_CREATE ADL2_Main_Control_Create = (ADL2_MAIN_CONTROL_CREATE)GetProcAddress(hDLL, "ADL2_Main_Control_Create");;
ADL2_MAIN_CONTROL_DESTROY ADL2_Main_Control_Destroy = (ADL2_MAIN_CONTROL_DESTROY)GetProcAddress(hDLL, "ADL2_Main_Control_Destroy");
ADL2_GRAPHICS_VERSION_GET ADL2_Graphics_Versions_Get = (ADL2_GRAPHICS_VERSION_GET)GetProcAddress(hDLL, "ADL2_Graphics_Versions_Get");
if (NULL != ADL2_Main_Control_Create &&
NULL != ADL2_Main_Control_Destroy &&
NULL != ADL2_Graphics_Versions_Get
)
{
ADL_CONTEXT_HANDLE adlContext = NULL;
if (ADL_OK == ADL2_Main_Control_Create(ADL_Main_Memory_Alloc, 1, &adlContext))
{
ADLVersionsInfo versionsInfo;
int ADLResult = ADL2_Graphics_Versions_Get(adlContext, &versionsInfo);
if (ADL_OK == ADLResult || ADL_OK_WARNING == ADLResult)
{
strcpy_s(outVersionString, ADL_MAX_PATH, versionsInfo.strDriverVer);
}
ADL2_Main_Control_Destroy(adlContext);
}
}
FreeLibrary(hDLL);
}
return retStatus;
}
#endif // _WIN32
#ifdef COMMAND_LINE_TEST
@@ -16,6 +16,15 @@
/// \return true if successful, or false on error
//-----------------------------------------------------------------------------
bool ADLGetDriverVersion(unsigned int& majorVer, unsigned int& minorVer, unsigned int& subminorVer);
//-----------------------------------------------------------------------------
/// Use ADL on Windows to retrieve the driver version string
/// \param outVersionName Pointer to s string to receive the version number.
/// Presetnly, the string should be at least ADL_MAX_PATH bytes long
/// \return true if successful, or false on error
//-----------------------------------------------------------------------------
bool ADLGetDriverVersionString(char* outVersionString);
#endif // _WIN32
#endif // ADL_GET_DRIVER_VERSION_H_
@@ -204,16 +204,17 @@ static unsigned int ToInt(const char* &pString)
#endif
//-----------------------------------------------------------------------------
/// Get the video driver version number.
/// indirectly returns the major and minor version numbers in the parameters
/// \param outMajorVersion The major version number returned
/// \param outMinorVersion The minor version number returned
/// Get the video driver version number, including the subminor version.
/// indirectly returns the major, minor and subminor version numbers in the parameters
/// \param pMajorVersion The major version number returned
/// \param pMinorVersion The minor version number returned
/// \param pSubminorVersion The minor version number returned
/// \return DEV_DRIVER_STATUS_SUCCESS if successful, or a DevDriverStatus error
/// code if not. If an error is returned, the version nunbers passed in are
/// unmodified.
//-----------------------------------------------------------------------------
static DevDriverStatus DEV_DRIVER_API_CALL
GetDriverVersion(DevDriverAPIContext handle, unsigned int& outMajorVersion, unsigned int& outMinorVersion)
GetFullDriverVersion(DevDriverAPIContext handle, unsigned int* pMajorVersion, unsigned int* pMinorVersion, unsigned int* pSubminorVersion)
{
if (handle == nullptr)
{
@@ -221,9 +222,11 @@ GetDriverVersion(DevDriverAPIContext handle, unsigned int& outMajorVersion, unsi
}
bool result = false;
unsigned int subMinorVer = 0;
unsigned int majorVersion = 0;
unsigned int minorVersion = 0;
unsigned int subminorVersion = 0;
#ifdef _WIN32
result = ADLGetDriverVersion(outMajorVersion, outMinorVersion, subMinorVer);
result = ADLGetDriverVersion(majorVersion, minorVersion, subminorVersion);
#else
const int sysret = system("modinfo amdgpu | grep version > version.txt");
if (sysret != 0)
@@ -260,11 +263,8 @@ GetDriverVersion(DevDriverAPIContext handle, unsigned int& outMajorVersion, unsi
pVersion++;
}
int majVer = 0;
int minVer = 0;
// get the major version number
majVer = ToInt(pVersion);
majorVersion = ToInt(pVersion);
DD_ASSERT(pVersion[0] == '.');
@@ -272,10 +272,17 @@ GetDriverVersion(DevDriverAPIContext handle, unsigned int& outMajorVersion, unsi
pVersion++;
// get the minor version
minVer = ToInt(pVersion);
minorVersion = ToInt(pVersion);
if (pVersion[0] == '.')
{
// skip the delimiter
pVersion++;
// get the minor version
subminorVersion = ToInt(pVersion);
}
outMajorVersion = majVer;
outMinorVersion = minVer;
result = true;
}
}
@@ -290,6 +297,9 @@ GetDriverVersion(DevDriverAPIContext handle, unsigned int& outMajorVersion, unsi
if (result == true)
{
*pMajorVersion = majorVersion;
*pMinorVersion = minorVersion;
*pSubminorVersion = subminorVersion;
return DEV_DRIVER_STATUS_SUCCESS;
}
else
@@ -298,6 +308,23 @@ GetDriverVersion(DevDriverAPIContext handle, unsigned int& outMajorVersion, unsi
}
}
//-----------------------------------------------------------------------------
/// Get the video driver version number.
/// indirectly returns the major and minor version numbers in the parameters
/// \param outMajorVersion The major version number returned
/// \param outMinorVersion The minor version number returned
/// \return DEV_DRIVER_STATUS_SUCCESS if successful, or a DevDriverStatus error
/// code if not. If an error is returned, the version nunbers passed in are
/// unmodified.
/// \warning This function is deprecated
//-----------------------------------------------------------------------------
static DevDriverStatus DEV_DRIVER_API_CALL
GetDriverVersion(DevDriverAPIContext handle, unsigned int& outMajorVersion, unsigned int& outMinorVersion)
{
unsigned int subminorVersion = 0;
return GetFullDriverVersion(handle, &outMajorVersion, &outMinorVersion, &subminorVersion);
}
//-----------------------------------------------------------------------------
/// Get the function table
/// \param pAprTableOut Pointer to an array to receive the list of function
@@ -338,6 +365,7 @@ DevDriverGetFuncTable(void* pApiTableOut)
apiTable.GetRgpProfileName = GetProfileName;
apiTable.GetDriverVersion = GetDriverVersion;
apiTable.GetFullDriverVersion = GetFullDriverVersion;
// only copy the functions supported by the incoming requested library
memcpy(pApiTable, &apiTable, apiTable.minorVersion);
@@ -141,9 +141,21 @@ typedef DevDriverStatus(DEV_DRIVER_API_CALL*
/// \return DEV_DRIVER_STATUS_SUCCESS if successful, or a DevDriverStatus error
/// code if not. If an error is returned, the version nunbers passed in are
/// unmodified.
/// \warning This function is deprecated
typedef DevDriverStatus(DEV_DRIVER_API_CALL*
DevDriverFnGetDriverVersion)(DevDriverAPIContext context, unsigned int& outMajorVersion, unsigned int& outMinorVersion);
/// Get the video driver version number, including the subminor version.
/// indirectly returns the major, minor and subminor version numbers in the parameters
/// \param pMajorVersion The major version number returned
/// \param pMinorVersion The minor version number returned
/// \param pSubminorVersion The minor version number returned
/// \return DEV_DRIVER_STATUS_SUCCESS if successful, or a DevDriverStatus error
/// code if not. If an error is returned, the version nunbers passed in are
/// unmodified.
typedef DevDriverStatus(DEV_DRIVER_API_CALL*
DevDriverFnGetFullDriverVersion)(DevDriverAPIContext context, unsigned int* pMajorVersion, unsigned int* pMinorVersion, unsigned int* ptSubminorVersion);
// structure containing the list of functions supported by this version of the API.
// Also contains major and minor version numbers
typedef struct DevDriverAPI
@@ -158,6 +170,7 @@ typedef struct DevDriverAPI
DevDriverFnIsRGPProfileCaptured IsRgpProfileCaptured;
DevDriverFnGetRGPProfileName GetRgpProfileName;
DevDriverFnGetDriverVersion GetDriverVersion;
DevDriverFnGetFullDriverVersion GetFullDriverVersion;
} DevDriverAPI;
/// Get the function table
@@ -115,22 +115,27 @@ RGPClientInProcessModel::RGPClientInProcessModel() :
{
m_beginMarker.clear();
m_endMarker.clear();
m_threadContext.m_pContext = nullptr;
m_threadContext.m_pClient = nullptr;
}
RGPClientInProcessModel::~RGPClientInProcessModel()
{
Finish();
if (m_threadContext.m_pContext != nullptr && m_threadContext.m_pClient != nullptr)
{
Finish();
}
}
bool RGPClientInProcessModel::Init(bool rgpEnabled)
{
InitDriverProtocols();
if (rgpEnabled)
bool success = InitDriverProtocols();
if (rgpEnabled == true && success == true)
{
CreateWorkerThreadToResumeDriverAndCollectRgpTrace();
return true;
}
return true;
return false;
}
void RGPClientInProcessModel::Finish()
@@ -1,2 +1,2 @@
This comes from https://github.com/GPUOpen-Tools/DevDriverTools @ 7772fd0f51055b80fe897bbdaae0e7944687a71d
This comes from https://github.com/GPUOpen-Tools/DevDriverTools @ 21c93b7230c4188f493458d976ef2e6f59e051e9