2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2019-01-08 13:11:09 +01:00
|
|
|
* Copyright (C) 2018-2019 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
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#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"
|
2019-02-27 11:39:32 +01:00
|
|
|
#include "runtime/helpers/options.h"
|
2017-12-21 00:45:38 +01:00
|
|
|
#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-16 14:26:48 +01:00
|
|
|
bool getDevicesResult = true;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-02-14 13:48:31 +01:00
|
|
|
bool overrideCommandStreamReceiverCreation = false;
|
2018-06-20 18:25:40 +02:00
|
|
|
bool overrideDeviceWithDefaultHardwareInfo = true;
|
2018-02-14 13:48:31 +01:00
|
|
|
|
2019-02-27 10:06:14 +01:00
|
|
|
CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executionEnvironment) {
|
|
|
|
|
auto hwInfo = executionEnvironment.getHardwareInfo();
|
2019-08-06 18:01:26 +02:00
|
|
|
|
|
|
|
|
if (overrideCommandStreamReceiverCreation) {
|
|
|
|
|
return createCommandStreamImpl(executionEnvironment);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto funcCreate = commandStreamReceiverFactory[IGFX_MAX_CORE + hwInfo->platform.eRenderCoreFamily];
|
|
|
|
|
if (funcCreate) {
|
|
|
|
|
return funcCreate(false, executionEnvironment);
|
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) {
|
2018-06-20 18:25:40 +02:00
|
|
|
if (overrideDeviceWithDefaultHardwareInfo) {
|
|
|
|
|
numDevicesReturned = numPlatformDevices;
|
2019-10-24 13:34:25 +02:00
|
|
|
executionEnvironment.rootDeviceEnvironments.resize(numDevicesReturned);
|
2018-02-14 13:48:31 +01:00
|
|
|
return getDevicesResult;
|
|
|
|
|
}
|
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
|