Files
compute-runtime/shared/source/os_interface/linux/ioctl_helper.h
Szymon Morek ce5f9c2214 Rename LocalMemoryHelper to IoctlHelper
Related-To: NEO-6472

This helper class is not used only for local memory.
IoctlHelper is more appropriate.

Signed-off-by: Szymon Morek <szymon.morek@intel.com>
2021-12-01 14:34:21 +01:00

52 lines
1.4 KiB
C++

/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "igfxfmid.h"
#include <cstddef>
#include <cstdint>
#include <memory>
namespace NEO {
class Drm;
class IoctlHelper;
extern IoctlHelper *ioctlHelperFactory[IGFX_MAX_PRODUCT];
class IoctlHelper {
public:
static IoctlHelper *get(PRODUCT_FAMILY product);
static uint32_t ioctl(Drm *drm, unsigned long request, void *arg);
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>
class IoctlHelperImpl : public IoctlHelper {
public:
static IoctlHelper *get() {
static IoctlHelperImpl<gfxProduct> instance;
return &instance;
}
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 IoctlHelperDefault : public IoctlHelper {
public:
static IoctlHelper *get() {
static IoctlHelperDefault instance;
return &instance;
}
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;
};
} // namespace NEO