diff --git a/projects/clr/rocclr/device/pal/paldevice.cpp b/projects/clr/rocclr/device/pal/paldevice.cpp index aae6aa419f..8112af92eb 100644 --- a/projects/clr/rocclr/device/pal/paldevice.cpp +++ b/projects/clr/rocclr/device/pal/paldevice.cpp @@ -885,6 +885,13 @@ bool Device::create(Pal::IDevice* device) { // Make sure CP DMA can be used for all possible transfers palSettings->cpDmaCmdCopyMemoryMaxBytes = 0xFFFFFFFF; + // Create RGP capture manager + // Note: RGP initialization in PAL must be performed before CommitSettingsAndInit() + rgpCaptureMgr_ = RgpCaptureMgr::Create(platform_, *this); + if (nullptr != rgpCaptureMgr_) { + Pal::IPlatform::InstallDeveloperCb(iPlat(), &Device::PalDeveloperCallback, this); + } + // Commit the new settings for the device result = iDev()->CommitSettingsAndInit(); if (result != Pal::Result::Success) { @@ -1121,10 +1128,12 @@ bool Device::initializeHeapResources() { } xferQueue_->enableSyncedBlit(); - // Create RGP capture manager - rgpCaptureMgr_ = RgpCaptureMgr::Create(platform_, *this); - if (nullptr != rgpCaptureMgr_) { - Pal::IPlatform::InstallDeveloperCb(iPlat(), &Device::PalDeveloperCallback, this); + // Update RGP capture manager + if (rgpCaptureMgr_ != nullptr) { + if (!rgpCaptureMgr_->Update(platform_)) { + delete rgpCaptureMgr_; + rgpCaptureMgr_ = nullptr; + } } } return true; diff --git a/projects/clr/rocclr/device/pal/palgpuopen.cpp b/projects/clr/rocclr/device/pal/palgpuopen.cpp index f175ed1c6b..981fee249a 100644 --- a/projects/clr/rocclr/device/pal/palgpuopen.cpp +++ b/projects/clr/rocclr/device/pal/palgpuopen.cpp @@ -81,7 +81,6 @@ bool RgpCaptureMgr::Init(Pal::IPlatform* platform) { if (dev_driver_server_ == nullptr) { return false; } - const Settings& settings = device_.settings(); // Tell RGP that the server (i.e. the driver) supports tracing if requested. rgp_server_ = dev_driver_server_->GetRGPServer(); if (rgp_server_ == nullptr) { @@ -91,8 +90,14 @@ bool RgpCaptureMgr::Init(Pal::IPlatform* platform) { // Finalize RGP settings Finalize(); + return true; +} + +// ================================================================================================ +bool RgpCaptureMgr::Update(Pal::IPlatform* platform) { bool result = true; + const Settings& settings = device_.settings(); // Fail initialization of trace resources if SQTT tracing has been force-disabled from // the panel (this will consequently fail the trace), or if the chosen device's gfxip // does not support SQTT. diff --git a/projects/clr/rocclr/device/pal/palgpuopen.hpp b/projects/clr/rocclr/device/pal/palgpuopen.hpp index a95c38c18e..035e14fbe2 100644 --- a/projects/clr/rocclr/device/pal/palgpuopen.hpp +++ b/projects/clr/rocclr/device/pal/palgpuopen.hpp @@ -311,6 +311,7 @@ class RgpCaptureMgr { bool RegisterTimedQueue(uint32_t queue_id, Pal::IQueue* iQueue, bool* debug_vmid) const; Pal::Result TimedQueueSubmit(Pal::IQueue* queue, uint64_t cmdId, const Pal::SubmitInfo& submitInfo) const; + bool Update(Pal::IPlatform* platform); private: // Steps that an RGP trace goes through