mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-22 01:48:50 +08:00
store them in one struct expect that global state is restored on test end Related-To: NEO-4207 Change-Id: Icd1db59598f464a34608290d6023405cf7f246f0 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
49 lines
1.6 KiB
C++
49 lines
1.6 KiB
C++
/*
|
|
* Copyright (C) 2018-2020 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#include "unit_tests/libult/create_command_stream.h"
|
|
|
|
#include "core/helpers/options.h"
|
|
#include "core/unit_tests/helpers/ult_hw_config.h"
|
|
#include "runtime/command_stream/aub_command_stream_receiver.h"
|
|
#include "runtime/command_stream/command_stream_receiver.h"
|
|
#include "runtime/command_stream/create_command_stream_impl.h"
|
|
#include "runtime/command_stream/tbx_command_stream_receiver.h"
|
|
#include "unit_tests/libult/ult_command_stream_receiver.h"
|
|
|
|
#include <cassert>
|
|
|
|
namespace NEO {
|
|
|
|
extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[2 * IGFX_MAX_CORE];
|
|
|
|
CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex) {
|
|
auto hwInfo = executionEnvironment.getHardwareInfo();
|
|
|
|
if (ultHwConfig.useHwCsr) {
|
|
return createCommandStreamImpl(executionEnvironment, rootDeviceIndex);
|
|
}
|
|
|
|
auto funcCreate = commandStreamReceiverFactory[IGFX_MAX_CORE + hwInfo->platform.eRenderCoreFamily];
|
|
if (funcCreate) {
|
|
return funcCreate(false, executionEnvironment, rootDeviceIndex);
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
bool getDevices(size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment) {
|
|
if (ultHwConfig.useMockedGetDevicesFunc) {
|
|
numDevicesReturned = numPlatformDevices;
|
|
executionEnvironment.prepareRootDeviceEnvironments(static_cast<uint32_t>(numDevicesReturned));
|
|
executionEnvironment.calculateMaxOsContextCount();
|
|
return ultHwConfig.mockedGetDevicesFuncResult;
|
|
}
|
|
|
|
return getDevicesImpl(numDevicesReturned, executionEnvironment);
|
|
}
|
|
} // namespace NEO
|