2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2018-09-18 15:11:08 +08:00
|
|
|
* Copyright (C) 2018 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
|
2018-01-17 15:37:47 +08:00
|
|
|
#include "igfxfmid.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
#include "stdint.h"
|
2018-01-17 15:37:47 +08:00
|
|
|
#include "runtime/helpers/pipeline_select_helper.h"
|
|
|
|
#include <cstddef>
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-01-17 15:37:47 +08:00
|
|
|
namespace OCLRT {
|
2018-01-16 18:30:53 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
struct HardwareInfo;
|
|
|
|
class Device;
|
2018-01-08 22:58:02 +08:00
|
|
|
class GraphicsAllocation;
|
2017-12-21 07:45:38 +08:00
|
|
|
class LinearStream;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
static constexpr size_t getScratchSpaceOffsetFor64bit() { return 4096; }
|
|
|
|
|
|
|
|
static void programL3(LinearStream *pCommandStream, uint32_t l3Config);
|
2018-01-17 15:37:47 +08:00
|
|
|
static void programPipelineSelect(LinearStream *pCommandStream, bool mediaSamplerRequired);
|
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);
|
2017-12-21 07:45:38 +08:00
|
|
|
static void programVFEState(LinearStream *pCommandStream, const HardwareInfo &hwInfo, int scratchSize, uint64_t scratchAddress);
|
2018-03-29 15:06:33 +08:00
|
|
|
static void programPreamble(LinearStream *pCommandStream, Device &device, uint32_t l3Config,
|
2018-01-08 22:58:02 +08:00
|
|
|
uint32_t requiredThreadArbitrationPolicy, GraphicsAllocation *preemptionCsr);
|
2018-04-13 17:50:57 +08:00
|
|
|
static void programKernelDebugging(LinearStream *pCommandStream);
|
2017-12-21 07:45:38 +08:00
|
|
|
static uint32_t getL3Config(const HardwareInfo &hwInfo, bool useSLM);
|
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();
|
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();
|
2018-06-22 19:04:02 +08:00
|
|
|
static uint32_t getMaxThreadsForVfe(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
|
|
|
|
2018-04-13 17:50:57 +08:00
|
|
|
namespace DebugModeRegisterOffset {
|
|
|
|
static constexpr uint32_t registerOffset = 0x20ec;
|
|
|
|
static constexpr uint32_t debugEnabledValue = (1 << 6) | (1 << 22);
|
|
|
|
}; // namespace DebugModeRegisterOffset
|
|
|
|
|
|
|
|
namespace TdDebugControlRegisterOffset {
|
|
|
|
static constexpr uint32_t registerOffset = 0xe400;
|
|
|
|
static constexpr uint32_t debugEnabledValue = (1 << 4) | (1 << 7);
|
|
|
|
}; // namespace TdDebugControlRegisterOffset
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
} // namespace OCLRT
|