2020-02-10 15:57:49 +01:00
|
|
|
/*
|
2023-02-01 16:23:01 +00:00
|
|
|
* Copyright (C) 2020-2023 Intel Corporation
|
2020-02-10 15:57:49 +01:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/debugger/debugger.h"
|
2020-02-10 15:57:49 +01:00
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/built_ins/sip_kernel_type.h"
|
2022-11-14 16:34:34 +00:00
|
|
|
#include "shared/source/execution_environment/root_device_environment.h"
|
2023-02-01 16:23:01 +00:00
|
|
|
#include "shared/source/helpers/gfx_core_helper.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/helpers/hw_info.h"
|
2020-07-23 10:56:08 +02:00
|
|
|
#include "shared/source/indirect_heap/indirect_heap.h"
|
2020-03-06 10:11:44 +01:00
|
|
|
#include "shared/source/source_level_debugger/source_level_debugger.h"
|
2021-04-16 12:52:30 +00:00
|
|
|
|
2020-02-10 15:57:49 +01:00
|
|
|
namespace NEO {
|
2022-11-14 16:34:34 +00:00
|
|
|
std::unique_ptr<Debugger> Debugger::create(const RootDeviceEnvironment &rootDeviceEnvironment) {
|
2020-02-10 15:57:49 +01:00
|
|
|
std::unique_ptr<SourceLevelDebugger> sourceLevelDebugger;
|
2022-11-14 16:34:34 +00:00
|
|
|
auto &hwInfo = *rootDeviceEnvironment.getMutableHardwareInfo();
|
|
|
|
|
if (hwInfo.capabilityTable.debuggerSupported || DebugManager.flags.ExperimentalEnableSourceLevelDebugger.get()) {
|
2020-02-10 15:57:49 +01:00
|
|
|
sourceLevelDebugger.reset(SourceLevelDebugger::create());
|
|
|
|
|
}
|
|
|
|
|
if (sourceLevelDebugger) {
|
2022-12-08 12:22:35 +00:00
|
|
|
auto &gfxCoreHelper = rootDeviceEnvironment.getHelper<GfxCoreHelper>();
|
2022-11-14 16:34:34 +00:00
|
|
|
|
2022-12-08 12:22:35 +00:00
|
|
|
bool localMemorySipAvailable = (SipKernelType::DbgCsrLocal == gfxCoreHelper.getSipKernelType(true));
|
2020-02-10 15:57:49 +01:00
|
|
|
sourceLevelDebugger->initialize(localMemorySipAvailable);
|
2021-06-18 15:23:10 +00:00
|
|
|
|
|
|
|
|
if (sourceLevelDebugger->isDebuggerActive()) {
|
2022-11-14 16:34:34 +00:00
|
|
|
hwInfo.capabilityTable.fusedEuEnabled = false;
|
2021-06-18 15:23:10 +00:00
|
|
|
}
|
2020-02-10 15:57:49 +01:00
|
|
|
}
|
|
|
|
|
return sourceLevelDebugger;
|
|
|
|
|
}
|
2020-07-23 10:56:08 +02:00
|
|
|
|
|
|
|
|
void *Debugger::getDebugSurfaceReservedSurfaceState(IndirectHeap &ssh) {
|
|
|
|
|
return ssh.getCpuBase();
|
|
|
|
|
}
|
2020-02-10 15:57:49 +01:00
|
|
|
} // namespace NEO
|