2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2020-02-03 13:19:12 +01:00
|
|
|
* Copyright (C) 2018-2020 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
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2020-02-03 13:19:12 +01:00
|
|
|
#include "unit_tests/libult/create_command_stream.h"
|
|
|
|
|
|
2019-12-09 15:29:30 +01:00
|
|
|
#include "core/helpers/options.h"
|
2020-02-03 13:19:12 +01:00
|
|
|
#include "core/unit_tests/helpers/ult_hw_config.h"
|
2017-12-21 00:45:38 +01:00
|
|
|
#include "runtime/command_stream/aub_command_stream_receiver.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
#include "runtime/command_stream/command_stream_receiver.h"
|
|
|
|
|
#include "runtime/command_stream/create_command_stream_impl.h"
|
2017-12-21 00:45:38 +01:00
|
|
|
#include "runtime/command_stream/tbx_command_stream_receiver.h"
|
|
|
|
|
#include "unit_tests/libult/ult_command_stream_receiver.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
#include <cassert>
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[2 * IGFX_MAX_CORE];
|
2018-02-14 13:48:31 +01:00
|
|
|
|
2019-10-29 08:01:53 +01:00
|
|
|
CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex) {
|
2019-02-27 10:06:14 +01:00
|
|
|
auto hwInfo = executionEnvironment.getHardwareInfo();
|
2019-08-06 18:01:26 +02:00
|
|
|
|
2020-02-03 13:19:12 +01:00
|
|
|
if (ultHwConfig.useHwCsr) {
|
2019-10-29 08:01:53 +01:00
|
|
|
return createCommandStreamImpl(executionEnvironment, rootDeviceIndex);
|
2019-08-06 18:01:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto funcCreate = commandStreamReceiverFactory[IGFX_MAX_CORE + hwInfo->platform.eRenderCoreFamily];
|
|
|
|
|
if (funcCreate) {
|
2019-10-29 08:01:53 +01:00
|
|
|
return funcCreate(false, executionEnvironment, rootDeviceIndex);
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
2019-08-06 18:01:26 +02:00
|
|
|
return nullptr;
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
|
2019-05-06 12:33:44 +02:00
|
|
|
bool getDevices(size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment) {
|
2020-02-03 13:19:12 +01:00
|
|
|
if (ultHwConfig.useMockedGetDevicesFunc) {
|
2018-06-20 18:25:40 +02:00
|
|
|
numDevicesReturned = numPlatformDevices;
|
2019-11-15 09:59:48 +01:00
|
|
|
executionEnvironment.prepareRootDeviceEnvironments(static_cast<uint32_t>(numDevicesReturned));
|
2019-12-24 09:59:49 +01:00
|
|
|
executionEnvironment.calculateMaxOsContextCount();
|
2020-02-03 13:19:12 +01:00
|
|
|
return ultHwConfig.mockedGetDevicesFuncResult;
|
2018-02-14 13:48:31 +01:00
|
|
|
}
|
2018-06-20 18:25:40 +02:00
|
|
|
|
2019-05-06 12:33:44 +02:00
|
|
|
return getDevicesImpl(numDevicesReturned, executionEnvironment);
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|