2018-01-19 10:00:51 +01:00
|
|
|
/*
|
2019-02-05 17:38:57 +01:00
|
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
2018-01-19 10:00:51 +01:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-01-19 10:00:51 +01:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "runtime/command_stream/aub_command_stream_receiver.h"
|
|
|
|
|
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
#include "runtime/command_stream/tbx_command_stream_receiver.h"
|
2019-02-27 10:06:14 +01:00
|
|
|
#include "runtime/execution_environment/execution_environment.h"
|
2018-01-19 10:00:51 +01:00
|
|
|
#include "runtime/gmm_helper/gmm_helper.h"
|
|
|
|
|
#include "runtime/helpers/options.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
#include "runtime/os_interface/device_factory.h"
|
2018-01-19 10:00:51 +01:00
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2018-01-19 10:00:51 +01:00
|
|
|
|
2019-08-06 18:01:26 +02:00
|
|
|
extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[IGFX_MAX_CORE];
|
2018-01-19 10:00:51 +01:00
|
|
|
|
2019-10-29 08:01:53 +01:00
|
|
|
CommandStreamReceiver *createCommandStreamImpl(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex) {
|
2019-05-08 16:00:24 +02:00
|
|
|
auto funcCreate = commandStreamReceiverFactory[executionEnvironment.getHardwareInfo()->platform.eRenderCoreFamily];
|
2018-01-19 10:00:51 +01:00
|
|
|
if (funcCreate == nullptr) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
CommandStreamReceiver *commandStreamReceiver = nullptr;
|
2019-04-10 11:51:45 +02:00
|
|
|
int32_t csr = DebugManager.flags.SetCommandStreamReceiver.get();
|
|
|
|
|
if (csr < 0) {
|
|
|
|
|
csr = CommandStreamReceiverType::CSR_HW;
|
2019-02-19 08:55:11 +01:00
|
|
|
}
|
2019-04-10 11:51:45 +02:00
|
|
|
switch (csr) {
|
|
|
|
|
case CSR_HW:
|
2019-10-29 08:01:53 +01:00
|
|
|
commandStreamReceiver = funcCreate(false, executionEnvironment, rootDeviceIndex);
|
2019-04-10 11:51:45 +02:00
|
|
|
break;
|
|
|
|
|
case CSR_AUB:
|
2019-10-29 08:01:53 +01:00
|
|
|
commandStreamReceiver = AUBCommandStreamReceiver::create("aubfile", true, executionEnvironment, rootDeviceIndex);
|
2019-04-10 11:51:45 +02:00
|
|
|
break;
|
|
|
|
|
case CSR_TBX:
|
2019-10-29 08:01:53 +01:00
|
|
|
commandStreamReceiver = TbxCommandStreamReceiver::create("", false, executionEnvironment, rootDeviceIndex);
|
2019-04-10 11:51:45 +02:00
|
|
|
break;
|
|
|
|
|
case CSR_HW_WITH_AUB:
|
2019-10-29 08:01:53 +01:00
|
|
|
commandStreamReceiver = funcCreate(true, executionEnvironment, rootDeviceIndex);
|
2019-04-10 11:51:45 +02:00
|
|
|
break;
|
|
|
|
|
case CSR_TBX_WITH_AUB:
|
2019-10-29 08:01:53 +01:00
|
|
|
commandStreamReceiver = TbxCommandStreamReceiver::create("aubfile", true, executionEnvironment, rootDeviceIndex);
|
2019-04-10 11:51:45 +02:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2018-01-19 10:00:51 +01:00
|
|
|
}
|
|
|
|
|
return commandStreamReceiver;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-06 12:33:44 +02:00
|
|
|
bool getDevicesImpl(size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment) {
|
2018-02-14 13:48:31 +01:00
|
|
|
bool result;
|
2019-04-10 11:51:45 +02:00
|
|
|
int32_t csr = DebugManager.flags.SetCommandStreamReceiver.get();
|
|
|
|
|
if (csr < 0) {
|
|
|
|
|
csr = CommandStreamReceiverType::CSR_HW;
|
2019-02-19 08:55:11 +01:00
|
|
|
}
|
2019-04-10 11:51:45 +02:00
|
|
|
switch (csr) {
|
|
|
|
|
case CSR_HW:
|
2019-05-06 12:33:44 +02:00
|
|
|
result = DeviceFactory::getDevices(numDevicesReturned, executionEnvironment);
|
|
|
|
|
DEBUG_BREAK_IF(!result);
|
2019-04-10 11:51:45 +02:00
|
|
|
return result;
|
|
|
|
|
case CSR_AUB:
|
|
|
|
|
case CSR_TBX:
|
|
|
|
|
case CSR_TBX_WITH_AUB:
|
2019-05-06 12:33:44 +02:00
|
|
|
return DeviceFactory::getDevicesForProductFamilyOverride(numDevicesReturned, executionEnvironment);
|
2019-04-10 11:51:45 +02:00
|
|
|
case CSR_HW_WITH_AUB:
|
2019-05-06 12:33:44 +02:00
|
|
|
return DeviceFactory::getDevices(numDevicesReturned, executionEnvironment);
|
2019-04-10 11:51:45 +02:00
|
|
|
default:
|
|
|
|
|
return false;
|
2018-02-14 13:48:31 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|