Skip to content

Commit

Permalink
Update xgl from commit: e13d188
Browse files Browse the repository at this point in the history
* Add VKI_EXT_HOST_MAPPED_FOREIGN_MEMORY support
* Fix build error when LTO is disabled
* Update SPIR-V headers
* Remove static asserts for ABI shader types
* VertBufBindingMgr::GraphicsPipelineChanged should use device mask
* Fix numSlices in Pal::ImageScaledCopyRegion
* Memset driver name and info strings
* Preserve the default values for runtime settings that are not overwritten with an app profile
* Update PAL Interface in Vulkan to 543
  • Loading branch information
JaxLinAMD committed Oct 18, 2019
1 parent 68e79ff commit 19a031d
Show file tree
Hide file tree
Showing 24 changed files with 305 additions and 213 deletions.
4 changes: 2 additions & 2 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2017 Advanced Micro Devices, Inc.
Copyright (c) 2018 Advanced Micro Devices, Inc. All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ 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.
SOFTWARE.
65 changes: 21 additions & 44 deletions icd/api/app_profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -818,9 +818,8 @@ void ProcessProfileEntry(
const char* entryName,
uint32_t dataSize,
const void* data,
RuntimeSettings* pRuntimeSettings,
ChillSettings* pChillSettings,
TurboSyncSettings* pTurboSyncSettings,
ProfileSettings* pProfileSettings,
uint32_t appGpuID,
bool isUser3DAreaFormat)
{
// Skip if the data is empty
Expand All @@ -829,25 +828,25 @@ void ProcessProfileEntry(
const wchar_t* wcharData = reinterpret_cast<const wchar_t *>(data);
bool* pBoolSetting = nullptr;
uint32_t* pUint32Setting = nullptr;
float* pFloatSetting = nullptr;
bool assertOnZero = false;
bool doNotSetOnZero = false;
uint32_t appGpuID = 0u;

if (pRuntimeSettings != nullptr)
if (strcmp(entryName, "TFQ") == 0)
{
appGpuID = pRuntimeSettings->appGpuID;

if (strcmp(entryName, "TFQ") == 0 && (pRuntimeSettings != nullptr))
{
pUint32Setting = reinterpret_cast<uint32_t*>(&(pRuntimeSettings->vulkanTexFilterQuality));
}
pUint32Setting = &(pProfileSettings->texFilterQuality);
}

if (pBoolSetting != nullptr)
{
uint32_t dataValue = ParseProfileDataToUint32(wcharData, isUser3DAreaFormat, appGpuID);
*pBoolSetting = dataValue ? true : false;
}
else if (pFloatSetting != nullptr)
{
uint32_t dataValue = ParseProfileDataToUint32(wcharData, isUser3DAreaFormat, appGpuID);
*pFloatSetting = static_cast<float>(dataValue);
}
else if (pUint32Setting != nullptr)
{
uint32_t dataValue = ParseProfileDataToUint32(wcharData, isUser3DAreaFormat, appGpuID);
Expand All @@ -863,7 +862,6 @@ void ProcessProfileEntry(
*pUint32Setting = dataValue;
}
}

}
}

Expand All @@ -873,9 +871,8 @@ void ProcessProfileEntry(
// Return true if a profile is present.
static bool QueryPalProfile(
Instance* pInstance,
RuntimeSettings* pRuntimeSettings,
ChillSettings* pChillSettings,
TurboSyncSettings* pTurboSyncSettings,
ProfileSettings* pProfileSettings,
uint32_t appGpuID,
Pal::ApplicationProfileClient client,
char* exeOrCdnName) // This is the game EXE name or Content Distribution Network name.
{
Expand All @@ -895,9 +892,8 @@ static bool QueryPalProfile(
ProcessProfileEntry(iterator.GetName(),
iterator.GetDataSize(),
iterator.GetData(),
pRuntimeSettings,
pChillSettings,
pTurboSyncSettings,
pProfileSettings,
appGpuID,
isUser3DAreaFormat);
iterator.Next();
}
Expand All @@ -909,15 +905,13 @@ static bool QueryPalProfile(
// =====================================================================================================================
// Queries PAL for app profile settings
void ReloadAppProfileSettings(
Instance* pInstance,
VulkanSettingsLoader* pSettingsLoader,
ChillSettings* pChillSettings,
TurboSyncSettings* pTurboSyncSettings)
Instance* pInstance,
ProfileSettings* pProfileSettings,
uint32_t appGpuID)
{
size_t exeNameLength = 0;
char* pExeName = GetExecutableName(&exeNameLength, true);
char* pExeNameLower = nullptr;
RuntimeSettings* pRuntimeSettings = nullptr;

if (pExeName != nullptr)
{
Expand All @@ -927,19 +921,13 @@ void ReloadAppProfileSettings(
free(pExeName);
}

if (pSettingsLoader != nullptr)
{
pRuntimeSettings = pSettingsLoader->GetSettingsPtr();
}

if (pExeNameLower != nullptr)
{
bool foundProfile = false;
// User 3D has highest priority, so query it first
foundProfile = QueryPalProfile(pInstance,
pRuntimeSettings,
pChillSettings,
pTurboSyncSettings,
pProfileSettings,
appGpuID,
Pal::ApplicationProfileClient::User3D,
pExeNameLower);

Expand All @@ -955,24 +943,13 @@ void ReloadAppProfileSettings(
if (hasValidCdnName == true)
{
foundProfile = QueryPalProfile(pInstance,
pRuntimeSettings,
pChillSettings,
pTurboSyncSettings,
pProfileSettings,
appGpuID,
Pal::ApplicationProfileClient::User3D,
cdnApplicationId);
}
}

if (foundProfile == false)
{
QueryPalProfile(pInstance,
pRuntimeSettings,
pChillSettings,
pTurboSyncSettings,
Pal::ApplicationProfileClient::Chill, //CHILL area
pExeNameLower);
}

free(pExeNameLower);
}
}
Expand Down
66 changes: 13 additions & 53 deletions icd/api/devmode/devmode_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,6 @@ DevModeMgr::DevModeMgr(Instance* pInstance)
#if VKI_GPUOPEN_PROTOCOL_ETW_CLIENT
m_pEtwClient(nullptr),
#endif
m_hardwareSupportsTracing(false),
m_rgpServerSupportsTracing(false),
m_finalized(false),
m_numPrepFrames(0),
m_traceGpuMemLimit(0),
Expand Down Expand Up @@ -388,15 +386,6 @@ Pal::Result DevModeMgr::Init()
m_pRGPServer = m_pDevDriverServer->GetRGPServer();
}

// Tell RGP that the server (i.e. the driver) supports tracing if requested.
if (result == Pal::Result::Success)
{
if (m_pRGPServer != nullptr)
{
m_rgpServerSupportsTracing = (m_pRGPServer->EnableTraces() == DevDriver::Result::Success);
}
}

if (result == Pal::Result::Success)
{
m_pipelineReinjectionLock.Init();
Expand All @@ -411,41 +400,27 @@ Pal::Result DevModeMgr::Init()
// This finalizes the developer driver manager.
void DevModeMgr::Finalize(
uint32_t deviceCount,
Pal::IDevice** ppDevices,
VulkanSettingsLoader* settingsLoaders[])
{
// Figure out if the gfxip supports tracing. We decide tracing if there is at least one enumerated GPU
// that can support tracing. Since we don't yet know if that GPU will be picked as the target of an eventual
// VkDevice, this check is imperfect. In mixed-GPU situations where an unsupported GPU is picked for tracing,
// trace capture will fail with an error.
m_hardwareSupportsTracing = false;

if (m_rgpServerSupportsTracing)
if (m_pRGPServer != nullptr)
{
bool tracingForceDisabledForAllGpus = true;

for (uint32_t gpu = 0; gpu < deviceCount; ++gpu)
{
// This is technically a violation of the PAL interface: we are not allowed to query PAL device properties
// prior to calling CommitSettingsAndInit(). However, doing so is (a) safe for some properties and (b)
// the only way to do this currently as we need to know this information prior to calling Finalize() on
// the device and devdriver manager and (c) it also matches DXCP behavior for the same reasons.
Pal::DeviceProperties props = {};

if (ppDevices[gpu]->GetProperties(&props) == Pal::Result::Success)
if (settingsLoaders[gpu]->GetSettings().devModeSqttForceDisable == false)
{
if (GpuSupportsTracing(props, settingsLoaders[gpu]->GetSettings()))
{
m_hardwareSupportsTracing = true;
tracingForceDisabledForAllGpus = false;

break;
}
break;
}
}
}

// If no GPU supports tracing, inform the RGP server to disable tracing
if ((m_pRGPServer != nullptr) && (m_hardwareSupportsTracing == false))
{
m_pRGPServer->DisableTraces();
// If tracing is force disabled for all GPUs, inform the RGP server to disable tracing
if (tracingForceDisabledForAllGpus)
{
m_pRGPServer->DisableTraces();
}
}

// Finalize the devmode manager
Expand All @@ -470,8 +445,7 @@ void DevModeMgr::WaitForDriverResume()
auto* pDriverControlServer = m_pDevDriverServer->GetDriverControlServer();

VK_ASSERT(pDriverControlServer != nullptr);

pDriverControlServer->WaitForDriverResume();
pDriverControlServer->DriverTick();
}

// =====================================================================================================================
Expand Down Expand Up @@ -1970,16 +1944,6 @@ Pal::Result DevModeMgr::InitTraceQueueFamilyResources(
return result;
}

// =====================================================================================================================
// Returns true if the given device properties/settings support tracing.
bool DevModeMgr::GpuSupportsTracing(
const Pal::DeviceProperties& props,
const RuntimeSettings& settings)
{
return props.gfxipProperties.flags.supportRgpTraces &&
(settings.devModeSqttForceDisable == false);
}

// =====================================================================================================================
// Initializes device-persistent RGP resources
Pal::Result DevModeMgr::InitRGPTracing(
Expand All @@ -2002,7 +1966,7 @@ Pal::Result DevModeMgr::InitRGPTracing(
//
// It's necessary to check this during RGP tracing init in addition to devmode init because during the earlier
// devmode init we may be in a situation where some enumerated physical devices support tracing and others do not.
if (GpuSupportsTracing(pDevice->VkPhysicalDevice(DefaultDeviceIndex)->PalProperties(), pDevice->GetRuntimeSettings()) == false)
if (pDevice->GetRuntimeSettings().devModeSqttForceDisable)
{
result = Pal::Result::ErrorInitializationFailed;
}
Expand Down Expand Up @@ -2212,11 +2176,7 @@ void DevModeMgr::PostDeviceCreate(Device* pDevice)
// information to decide when it's reasonable to make certain requests of the driver through protocol functions.
if (pDriverControlServer->IsDriverInitialized() == false)
{
#if GPUOPEN_CLIENT_INTERFACE_MAJOR_VERSION < GPUOPEN_DRIVER_CONTROL_CLEANUP_VERSION
pDriverControlServer->FinishDriverInitialization();
#else
pDriverControlServer->FinishDeviceInit();
#endif
}
}

Expand Down
5 changes: 0 additions & 5 deletions icd/api/devmode/devmode_mgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ class DevModeMgr

void Finalize(
uint32_t deviceCount,
Pal::IDevice** ppDevices,
VulkanSettingsLoader* settingsLoaders[]);

void Destroy();
Expand Down Expand Up @@ -301,7 +300,6 @@ class DevModeMgr
void DestroyTraceQueueFamilyResources(TraceQueueFamilyState* pState);
TraceQueueState* FindTraceQueueState(TraceState* pState, const Queue* pQueue);
bool QueueSupportsTiming(uint32_t deviceIdx, const Queue* pQueue);
static bool GpuSupportsTracing(const Pal::DeviceProperties& props, const RuntimeSettings& settings);

#if VKI_GPUOPEN_PROTOCOL_ETW_CLIENT
Pal::Result InitEtwClient();
Expand All @@ -318,9 +316,6 @@ class DevModeMgr
#endif
Util::Mutex m_traceMutex;
TraceState m_trace;
bool m_hardwareSupportsTracing; // True if gfxip supports tracing
bool m_rgpServerSupportsTracing; // True if gpuopen protocol successfully enabled
// tracing
bool m_finalized;
uint32_t m_numPrepFrames;
uint32_t m_traceGpuMemLimit;
Expand Down
27 changes: 6 additions & 21 deletions icd/api/include/app_profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ namespace Pal
namespace vk
{
class Instance;
class VulkanSettingsLoader;
struct RuntimeSettings;
};

namespace vk
Expand Down Expand Up @@ -84,31 +82,18 @@ enum class AppProfile : uint32_t
NitrousEngine, // Nitrous Engine by Oxide (Default)
};

// Struct describing dynamic CHILL settings
struct ChillSettings
struct ProfileSettings
{
bool chillProfileEnable; // If per-app chill profile settings is enabled
uint32_t chillLevel; // Chill level and flags
uint32_t chillMinFrameRate; // Min chill frame rate; valid range is 30-300fps.
uint32_t chillMaxFrameRate; // Max chill frame rate; valid range is 30-300fps.
uint32_t chillLoadingScreenDrawsThresh; // The threshold number of draw calls per frame used to distinguish
// between loading screens and gameplay.
};
uint32_t texFilterQuality; // TextureFilterOptimizationSettings

// Struct describing dynamic TurboSync settings
struct TurboSyncSettings
{
bool turboSyncEnable; // If per-app TurboSync profile settings is enabled
};

extern AppProfile ScanApplicationProfile(const VkInstanceCreateInfo& instanceInfo);

void ReloadAppProfileSettings(
Instance* pInstance,
VulkanSettingsLoader* pSettingsLoader,
ChillSettings* pChillSettings,
TurboSyncSettings* pTurboSyncSettings);
void ReloadAppProfileSettings(Instance* pInstance,
ProfileSettings* pProfileSettings,
uint32_t appGpuID = 0u);

};

#endif /* __GPU_EVENT_MGR_H__ */
#endif /* __APP_PROFILE_H__ */
Loading

0 comments on commit 19a031d

Please sign in to comment.