2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2022-03-17 00:08:37 +08:00
|
|
|
* Copyright (C) 2018-2022 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
|
2022-08-29 07:20:29 +08:00
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/built_ins/sip_kernel_type.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2022-08-29 07:20:29 +08:00
|
|
|
#include <cstddef>
|
|
|
|
#include <string>
|
2020-12-02 18:22:27 +08:00
|
|
|
#include <vector>
|
2022-08-29 07:20:29 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
class Device;
|
2018-03-09 18:52:14 +08:00
|
|
|
class GraphicsAllocation;
|
2021-04-16 20:52:30 +08:00
|
|
|
class MemoryManager;
|
2022-08-29 07:20:29 +08:00
|
|
|
|
|
|
|
struct HardwareInfo;
|
2021-04-16 20:52:30 +08:00
|
|
|
struct RootDeviceEnvironment;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
class SipKernel {
|
|
|
|
public:
|
2021-03-31 10:31:58 +08:00
|
|
|
SipKernel(SipKernelType type, GraphicsAllocation *sipAlloc, std::vector<char> ssah);
|
2017-12-21 07:45:38 +08:00
|
|
|
SipKernel(const SipKernel &) = delete;
|
|
|
|
SipKernel &operator=(const SipKernel &) = delete;
|
2020-10-13 17:41:48 +08:00
|
|
|
SipKernel(SipKernel &&) = delete;
|
|
|
|
SipKernel &operator=(SipKernel &&) = delete;
|
2019-12-03 22:57:45 +08:00
|
|
|
virtual ~SipKernel();
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-01-08 10:25:27 +08:00
|
|
|
SipKernelType getType() const {
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
2019-12-03 22:57:45 +08:00
|
|
|
MOCKABLE_VIRTUAL GraphicsAllocation *getSipAllocation() const;
|
2021-03-31 10:31:58 +08:00
|
|
|
MOCKABLE_VIRTUAL const std::vector<char> &getStateSaveAreaHeader() const;
|
2022-03-17 00:08:37 +08:00
|
|
|
MOCKABLE_VIRTUAL size_t getStateSaveAreaSize(Device *device) const;
|
2021-04-16 20:52:30 +08:00
|
|
|
|
|
|
|
static bool initSipKernel(SipKernelType type, Device &device);
|
|
|
|
static void freeSipKernels(RootDeviceEnvironment *rootDeviceEnvironment, MemoryManager *memoryManager);
|
|
|
|
|
|
|
|
static const SipKernel &getSipKernel(Device &device);
|
2021-08-18 19:05:17 +08:00
|
|
|
static const SipKernel &getBindlessDebugSipKernel(Device &device);
|
2021-04-16 20:52:30 +08:00
|
|
|
static SipKernelType getSipKernelType(Device &device);
|
2021-08-18 19:05:17 +08:00
|
|
|
static SipKernelType getSipKernelType(Device &device, bool debuggingEnable);
|
2021-04-16 20:52:30 +08:00
|
|
|
static SipClassType classType;
|
2018-03-09 18:52:14 +08:00
|
|
|
|
2021-10-29 23:06:11 +08:00
|
|
|
enum class COMMAND : uint32_t {
|
|
|
|
RESUME,
|
|
|
|
READY,
|
|
|
|
SLM_READ,
|
|
|
|
SLM_WRITE
|
|
|
|
};
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
protected:
|
2021-04-16 20:52:30 +08:00
|
|
|
static bool initSipKernelImpl(SipKernelType type, Device &device);
|
|
|
|
static const SipKernel &getSipKernelImpl(Device &device);
|
|
|
|
|
|
|
|
static bool initBuiltinsSipKernel(SipKernelType type, Device &device);
|
|
|
|
static bool initRawBinaryFromFileKernel(SipKernelType type, Device &device, std::string &fileName);
|
2021-09-22 23:45:29 +08:00
|
|
|
static std::vector<char> readStateSaveAreaHeaderFromFile(const std::string &fileName);
|
|
|
|
static std::string createHeaderFilename(const std::string &filename);
|
|
|
|
|
2021-08-30 07:41:42 +08:00
|
|
|
static bool initHexadecimalArraySipKernel(SipKernelType type, Device &device);
|
|
|
|
static void selectSipClassType(std::string &fileName, const HardwareInfo &hwInfo);
|
2021-04-16 20:52:30 +08:00
|
|
|
|
2021-03-31 10:31:58 +08:00
|
|
|
const std::vector<char> stateSaveAreaHeader;
|
2021-04-16 20:52:30 +08:00
|
|
|
GraphicsAllocation *sipAllocation = nullptr;
|
|
|
|
SipKernelType type = SipKernelType::COUNT;
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
2022-08-29 07:20:29 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|