2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2019-02-27 18:39:32 +08:00
|
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2019-12-30 23:41:41 +08:00
|
|
|
#include "core/helpers/pipeline_select_helper.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
|
|
|
#include "igfxfmid.h"
|
|
|
|
|
2018-01-17 15:37:47 +08:00
|
|
|
#include <cstddef>
|
2018-11-14 15:40:37 +08:00
|
|
|
#include <cstdint>
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2018-01-16 18:30:53 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
struct HardwareInfo;
|
|
|
|
class Device;
|
2018-11-14 15:40:37 +08:00
|
|
|
struct DispatchFlags;
|
2018-01-08 22:58:02 +08:00
|
|
|
class GraphicsAllocation;
|
2017-12-21 07:45:38 +08:00
|
|
|
class LinearStream;
|
2019-09-10 22:13:11 +08:00
|
|
|
struct PipelineSelectArgs;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
struct PreambleHelper {
|
2018-02-20 15:11:24 +08:00
|
|
|
using MI_LOAD_REGISTER_IMM = typename GfxFamily::MI_LOAD_REGISTER_IMM;
|
|
|
|
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
|
2019-10-01 17:51:31 +08:00
|
|
|
using VFE_STATE_TYPE = typename GfxFamily::VFE_STATE_TYPE;
|
2018-02-20 15:11:24 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
static void programL3(LinearStream *pCommandStream, uint32_t l3Config);
|
2019-08-19 21:01:00 +08:00
|
|
|
static void programPipelineSelect(LinearStream *pCommandStream,
|
2019-09-10 22:13:11 +08:00
|
|
|
const PipelineSelectArgs &pipelineSelectArgs,
|
2019-08-19 21:01:00 +08:00
|
|
|
const HardwareInfo &hwInfo);
|
2018-02-20 15:11:24 +08:00
|
|
|
static uint32_t getDefaultThreadArbitrationPolicy();
|
2017-12-21 07:45:38 +08:00
|
|
|
static void programThreadArbitration(LinearStream *pCommandStream, uint32_t requiredThreadArbitrationPolicy);
|
2018-03-29 15:06:33 +08:00
|
|
|
static void programPreemption(LinearStream *pCommandStream, Device &device, GraphicsAllocation *preemptionCsr);
|
2018-02-23 21:01:12 +08:00
|
|
|
static void addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo);
|
2019-08-13 17:34:56 +08:00
|
|
|
static uint64_t programVFEState(LinearStream *pCommandStream,
|
|
|
|
const HardwareInfo &hwInfo,
|
|
|
|
int scratchSize,
|
|
|
|
uint64_t scratchAddress,
|
|
|
|
uint32_t maxFrontEndThreads);
|
2019-10-07 19:11:12 +08:00
|
|
|
static void programAdditionalFieldsInVfeState(VFE_STATE_TYPE *mediaVfeState, const HardwareInfo &hwInfo);
|
2018-03-29 15:06:33 +08:00
|
|
|
static void programPreamble(LinearStream *pCommandStream, Device &device, uint32_t l3Config,
|
2019-09-04 22:44:27 +08:00
|
|
|
uint32_t requiredThreadArbitrationPolicy, GraphicsAllocation *preemptionCsr, GraphicsAllocation *perDssBackedBuffer);
|
2018-04-13 17:50:57 +08:00
|
|
|
static void programKernelDebugging(LinearStream *pCommandStream);
|
2019-09-04 22:44:27 +08:00
|
|
|
static void programPerDssBackedBuffer(LinearStream *pCommandStream, const HardwareInfo &hwInfo, GraphicsAllocation *perDssBackBufferOffset);
|
2017-12-21 07:45:38 +08:00
|
|
|
static uint32_t getL3Config(const HardwareInfo &hwInfo, bool useSLM);
|
2019-08-06 05:57:15 +08:00
|
|
|
static bool isL3Configurable(const HardwareInfo &hwInfo);
|
2018-02-20 15:11:24 +08:00
|
|
|
static size_t getAdditionalCommandsSize(const Device &device);
|
2018-04-20 19:55:54 +08:00
|
|
|
static size_t getThreadArbitrationCommandsSize();
|
2019-05-16 23:17:53 +08:00
|
|
|
static size_t getVFECommandsSize();
|
2018-04-13 17:50:57 +08:00
|
|
|
static size_t getKernelDebuggingCommandsSize(bool debuggingActive);
|
2017-12-21 07:45:38 +08:00
|
|
|
static void programGenSpecificPreambleWorkArounds(LinearStream *pCommandStream, const HardwareInfo &hwInfo);
|
|
|
|
static uint32_t getUrbEntryAllocationSize();
|
2019-09-04 22:44:27 +08:00
|
|
|
static size_t getPerDssBackedBufferCommandsSize(const HardwareInfo &hwInfo);
|
2019-09-10 22:13:11 +08:00
|
|
|
static size_t getCmdSizeForPipelineSelect(const HardwareInfo &hwInfo);
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
template <PRODUCT_FAMILY ProductFamily>
|
|
|
|
static uint32_t getL3ConfigHelper(bool useSLM);
|
|
|
|
|
|
|
|
template <PRODUCT_FAMILY ProductFamily>
|
|
|
|
struct L3CNTLREGConfig {
|
|
|
|
static const uint32_t valueForSLM;
|
|
|
|
static const uint32_t valueForNoSLM;
|
|
|
|
};
|
|
|
|
|
|
|
|
template <PRODUCT_FAMILY ProductFamily>
|
|
|
|
uint32_t getL3ConfigHelper(bool useSLM) {
|
|
|
|
if (!useSLM) {
|
|
|
|
return L3CNTLREGConfig<ProductFamily>::valueForNoSLM;
|
|
|
|
}
|
|
|
|
return L3CNTLREGConfig<ProductFamily>::valueForSLM;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
struct L3CNTLRegisterOffset {
|
|
|
|
static const uint32_t registerOffset;
|
|
|
|
};
|
2018-02-20 15:11:24 +08:00
|
|
|
|
2019-10-01 19:28:37 +08:00
|
|
|
template <typename GfxFamily>
|
2019-12-11 22:30:14 +08:00
|
|
|
struct DebugModeRegisterOffset {
|
|
|
|
enum {
|
|
|
|
registerOffset = 0x20ec,
|
|
|
|
debugEnabledValue = (1 << 6) | (1 << 22)
|
|
|
|
};
|
|
|
|
};
|
2018-04-13 17:50:57 +08:00
|
|
|
|
|
|
|
namespace TdDebugControlRegisterOffset {
|
|
|
|
static constexpr uint32_t registerOffset = 0xe400;
|
|
|
|
static constexpr uint32_t debugEnabledValue = (1 << 4) | (1 << 7);
|
|
|
|
}; // namespace TdDebugControlRegisterOffset
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|