mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 17:00:59 +08:00
Related-To: NEO-6510 Check which prelim version is being used. Select proper IoctlHelper based on that version. If no version found, switch to upstream instead. Source of prelim headers: https://github.com/intel-gpu/drm-uapi-helper Signed-off-by: Szymon Morek <szymon.morek@intel.com>
39 lines
1.0 KiB
C++
39 lines
1.0 KiB
C++
/*
|
|
* Copyright (C) 2021 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#include "shared/source/execution_environment/root_device_environment.h"
|
|
#include "shared/source/helpers/hw_info.h"
|
|
#include "shared/source/os_interface/linux/drm_neo.h"
|
|
#include "shared/source/os_interface/linux/ioctl_helper.h"
|
|
|
|
#include <map>
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
namespace NEO {
|
|
|
|
IoctlHelper *ioctlHelperFactory[IGFX_MAX_PRODUCT] = {};
|
|
|
|
std::map<std::string, std::shared_ptr<IoctlHelper>> ioctlHelperImpls{
|
|
{"", std::make_shared<IoctlHelperUpstream>()},
|
|
{"2.0", std::make_shared<IoctlHelperPrelim20>()}};
|
|
|
|
IoctlHelper *IoctlHelper::get(Drm *drm) {
|
|
auto product = drm->getRootDeviceEnvironment().getHardwareInfo()->platform.eProductFamily;
|
|
|
|
auto productSpecificIoctlHelper = ioctlHelperFactory[product];
|
|
if (productSpecificIoctlHelper) {
|
|
return productSpecificIoctlHelper;
|
|
}
|
|
|
|
std::string prelimVersion = "";
|
|
drm->getPrelimVersion(prelimVersion);
|
|
return ioctlHelperImpls[prelimVersion].get();
|
|
}
|
|
|
|
} // namespace NEO
|