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