2021-10-13 13:30:46 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2021 Intel Corporation
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
#include "igfxfmid.h"
|
|
|
|
|
|
|
|
|
|
#include <cstddef>
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
namespace NEO {
|
|
|
|
|
class Drm;
|
2021-12-01 11:45:29 +00:00
|
|
|
class IoctlHelper;
|
2021-10-13 13:30:46 +00:00
|
|
|
|
2021-12-01 11:45:29 +00:00
|
|
|
extern IoctlHelper *ioctlHelperFactory[IGFX_MAX_PRODUCT];
|
2021-10-13 13:30:46 +00:00
|
|
|
|
2021-12-01 11:45:29 +00:00
|
|
|
class IoctlHelper {
|
2021-10-13 13:30:46 +00:00
|
|
|
public:
|
2021-12-08 10:10:27 +00:00
|
|
|
virtual ~IoctlHelper() {}
|
|
|
|
|
static IoctlHelper *get(Drm *product);
|
2021-10-13 13:30:46 +00:00
|
|
|
static uint32_t ioctl(Drm *drm, unsigned long request, void *arg);
|
2021-11-02 15:59:57 +00:00
|
|
|
|
2021-10-13 13:30:46 +00:00
|
|
|
virtual uint32_t createGemExt(Drm *drm, void *data, uint32_t dataSize, size_t allocSize, uint32_t &handle) = 0;
|
|
|
|
|
virtual std::unique_ptr<uint8_t[]> translateIfRequired(uint8_t *dataQuery, int32_t length) = 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <PRODUCT_FAMILY gfxProduct>
|
2021-12-01 11:45:29 +00:00
|
|
|
class IoctlHelperImpl : public IoctlHelper {
|
2021-10-13 13:30:46 +00:00
|
|
|
public:
|
2021-12-01 11:45:29 +00:00
|
|
|
static IoctlHelper *get() {
|
|
|
|
|
static IoctlHelperImpl<gfxProduct> instance;
|
2021-10-13 13:30:46 +00:00
|
|
|
return &instance;
|
|
|
|
|
}
|
|
|
|
|
uint32_t createGemExt(Drm *drm, void *data, uint32_t dataSize, size_t allocSize, uint32_t &handle) override;
|
2021-10-27 12:23:13 +00:00
|
|
|
std::unique_ptr<uint8_t[]> translateIfRequired(uint8_t *dataQuery, int32_t length) override;
|
2021-10-13 13:30:46 +00:00
|
|
|
};
|
|
|
|
|
|
2021-12-08 10:10:27 +00:00
|
|
|
class IoctlHelperUpstream : public IoctlHelper {
|
|
|
|
|
public:
|
|
|
|
|
uint32_t createGemExt(Drm *drm, void *data, uint32_t dataSize, size_t allocSize, uint32_t &handle) override;
|
|
|
|
|
std::unique_ptr<uint8_t[]> translateIfRequired(uint8_t *dataQuery, int32_t length) override;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class IoctlHelperPrelim20 : public IoctlHelper {
|
2021-11-02 15:59:57 +00:00
|
|
|
public:
|
|
|
|
|
uint32_t createGemExt(Drm *drm, void *data, uint32_t dataSize, size_t allocSize, uint32_t &handle) override;
|
|
|
|
|
std::unique_ptr<uint8_t[]> translateIfRequired(uint8_t *dataQuery, int32_t length) override;
|
2021-10-13 13:30:46 +00:00
|
|
|
};
|
2021-11-02 15:59:57 +00:00
|
|
|
|
2021-10-13 13:30:46 +00:00
|
|
|
} // namespace NEO
|