mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-01 04:23:00 +08:00
Refactor passing GlobalFenceAllocation to DirectSubmission
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
6f0f15a0b8
commit
fc4eaa1894
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace NEO {
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
inline std::unique_ptr<DirectSubmissionHw<GfxFamily, Dispatcher>> DirectSubmissionHw<GfxFamily, Dispatcher>::create(Device &device, OsContext &osContext) {
|
||||
return std::make_unique<DrmDirectSubmission<GfxFamily, Dispatcher>>(device, osContext);
|
||||
inline std::unique_ptr<DirectSubmissionHw<GfxFamily, Dispatcher>> DirectSubmissionHw<GfxFamily, Dispatcher>::create(Device &device, OsContext &osContext, const GraphicsAllocation *globalFenceAllocation) {
|
||||
return std::make_unique<DrmDirectSubmission<GfxFamily, Dispatcher>>(device, osContext, globalFenceAllocation);
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -10,11 +10,11 @@
|
||||
|
||||
namespace NEO {
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
inline std::unique_ptr<DirectSubmissionHw<GfxFamily, Dispatcher>> DirectSubmissionHw<GfxFamily, Dispatcher>::create(Device &device, OsContext &osContext) {
|
||||
inline std::unique_ptr<DirectSubmissionHw<GfxFamily, Dispatcher>> DirectSubmissionHw<GfxFamily, Dispatcher>::create(Device &device, OsContext &osContext, const GraphicsAllocation *globalFenceAllocation) {
|
||||
if (device.getRootDeviceEnvironment().osInterface->getDriverModel()->getDriverModelType() == DriverModelType::DRM) {
|
||||
return std::make_unique<DrmDirectSubmission<GfxFamily, Dispatcher>>(device, osContext);
|
||||
return std::make_unique<DrmDirectSubmission<GfxFamily, Dispatcher>>(device, osContext, globalFenceAllocation);
|
||||
} else {
|
||||
return std::make_unique<WddmDirectSubmission<GfxFamily, Dispatcher>>(device, osContext);
|
||||
return std::make_unique<WddmDirectSubmission<GfxFamily, Dispatcher>>(device, osContext, globalFenceAllocation);
|
||||
}
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace NEO {
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
inline std::unique_ptr<DirectSubmissionHw<GfxFamily, Dispatcher>> DirectSubmissionHw<GfxFamily, Dispatcher>::create(Device &device, OsContext &osContext) {
|
||||
return std::make_unique<WddmDirectSubmission<GfxFamily, Dispatcher>>(device, osContext);
|
||||
inline std::unique_ptr<DirectSubmissionHw<GfxFamily, Dispatcher>> DirectSubmissionHw<GfxFamily, Dispatcher>::create(Device &device, OsContext &osContext, const GraphicsAllocation *globalFenceAllocation) {
|
||||
return std::make_unique<WddmDirectSubmission<GfxFamily, Dispatcher>>(device, osContext, globalFenceAllocation);
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -60,8 +60,7 @@ class OsContext;
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
class DirectSubmissionHw {
|
||||
public:
|
||||
DirectSubmissionHw(Device &device,
|
||||
OsContext &osContext);
|
||||
DirectSubmissionHw(Device &device, OsContext &osContext, const GraphicsAllocation *globalFenceAllocation);
|
||||
|
||||
virtual ~DirectSubmissionHw();
|
||||
|
||||
@@ -73,7 +72,7 @@ class DirectSubmissionHw {
|
||||
|
||||
MOCKABLE_VIRTUAL bool dispatchCommandBuffer(BatchBuffer &batchBuffer, FlushStampTracker &flushStamp);
|
||||
|
||||
static std::unique_ptr<DirectSubmissionHw<GfxFamily, Dispatcher>> create(Device &device, OsContext &osContext);
|
||||
static std::unique_ptr<DirectSubmissionHw<GfxFamily, Dispatcher>> create(Device &device, OsContext &osContext, const GraphicsAllocation *globalFenceAllocation);
|
||||
|
||||
protected:
|
||||
static constexpr size_t prefetchSize = 8 * MemoryConstants::cacheLineSize;
|
||||
@@ -148,6 +147,7 @@ class DirectSubmissionHw {
|
||||
Device &device;
|
||||
OsContext &osContext;
|
||||
const HardwareInfo *hwInfo = nullptr;
|
||||
const GraphicsAllocation *globalFenceAllocation = nullptr;
|
||||
GraphicsAllocation *ringBuffer = nullptr;
|
||||
GraphicsAllocation *ringBuffer2 = nullptr;
|
||||
GraphicsAllocation *semaphores = nullptr;
|
||||
|
||||
@@ -30,9 +30,8 @@
|
||||
namespace NEO {
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
DirectSubmissionHw<GfxFamily, Dispatcher>::DirectSubmissionHw(Device &device,
|
||||
OsContext &osContext)
|
||||
: device(device), osContext(osContext) {
|
||||
DirectSubmissionHw<GfxFamily, Dispatcher>::DirectSubmissionHw(Device &device, OsContext &osContext, const GraphicsAllocation *globalFenceAllocation)
|
||||
: device(device), osContext(osContext), globalFenceAllocation(globalFenceAllocation) {
|
||||
hwInfo = &device.getHardwareInfo();
|
||||
|
||||
auto hwInfoConfig = HwInfoConfig::get(hwInfo->platform.eProductFamily);
|
||||
@@ -618,11 +617,8 @@ size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getDiagnosticModeSection() {
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
void DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchSystemMemoryFenceAddress() {
|
||||
auto &engineControl = device.getEngine(this->osContext.getEngineType(), this->osContext.getEngineUsage());
|
||||
|
||||
UNRECOVERABLE_IF(engineControl.osContext->getContextId() != engineControl.osContext->getContextId());
|
||||
|
||||
EncodeMemoryFence<GfxFamily>::encodeSystemMemoryFence(ringCommandStream, engineControl.commandStreamReceiver->getGlobalFenceAllocation());
|
||||
UNRECOVERABLE_IF(!this->globalFenceAllocation);
|
||||
EncodeMemoryFence<GfxFamily>::encodeSystemMemoryFence(ringCommandStream, this->globalFenceAllocation);
|
||||
}
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -16,8 +16,7 @@ class DrmDirectSubmission : public DirectSubmissionHw<GfxFamily, Dispatcher> {
|
||||
using DirectSubmissionHw<GfxFamily, Dispatcher>::ringCommandStream;
|
||||
using DirectSubmissionHw<GfxFamily, Dispatcher>::switchRingBuffersAllocations;
|
||||
|
||||
DrmDirectSubmission(Device &device,
|
||||
OsContext &osContext);
|
||||
DrmDirectSubmission(Device &device, OsContext &osContext, const GraphicsAllocation *globalFenceAllocation);
|
||||
|
||||
~DrmDirectSubmission();
|
||||
|
||||
|
||||
@@ -20,9 +20,8 @@
|
||||
namespace NEO {
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
DrmDirectSubmission<GfxFamily, Dispatcher>::DrmDirectSubmission(Device &device,
|
||||
OsContext &osContext)
|
||||
: DirectSubmissionHw<GfxFamily, Dispatcher>(device, osContext) {
|
||||
DrmDirectSubmission<GfxFamily, Dispatcher>::DrmDirectSubmission(Device &device, OsContext &osContext, const GraphicsAllocation *globalFenceAllocation)
|
||||
: DirectSubmissionHw<GfxFamily, Dispatcher>(device, osContext, globalFenceAllocation) {
|
||||
|
||||
this->disableMonitorFence = true;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -19,8 +19,7 @@ class Wddm;
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
class WddmDirectSubmission : public DirectSubmissionHw<GfxFamily, Dispatcher> {
|
||||
public:
|
||||
WddmDirectSubmission(Device &device,
|
||||
OsContext &osContext);
|
||||
WddmDirectSubmission(Device &device, OsContext &osContext, const GraphicsAllocation *globalFenceAllocation);
|
||||
|
||||
~WddmDirectSubmission();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -23,9 +23,8 @@ namespace NEO {
|
||||
DECLARE_COMMAND_BUFFER(CommandBufferHeader, UMD_OCL, FALSE, FALSE, PERFTAG_OCL);
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
WddmDirectSubmission<GfxFamily, Dispatcher>::WddmDirectSubmission(Device &device,
|
||||
OsContext &osContext)
|
||||
: DirectSubmissionHw<GfxFamily, Dispatcher>(device, osContext) {
|
||||
WddmDirectSubmission<GfxFamily, Dispatcher>::WddmDirectSubmission(Device &device, OsContext &osContext, const GraphicsAllocation *globalFenceAllocation)
|
||||
: DirectSubmissionHw<GfxFamily, Dispatcher>(device, osContext, globalFenceAllocation) {
|
||||
osContextWin = reinterpret_cast<OsContextWin *>(&osContext);
|
||||
wddm = osContextWin->getWddm();
|
||||
commandBufferHeader = std::make_unique<COMMAND_BUFFER_HEADER_REC>();
|
||||
|
||||
Reference in New Issue
Block a user