mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-22 10:17:01 +08:00
When linear stream created for command container has not enough space for command and BB_END it will program BB_END and allocate new command buffer allocation. Pointer returned from getSpace in this case will return storage from new command buffer allocation. Related-To: NEO-5707 Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
46 lines
2.2 KiB
C++
46 lines
2.2 KiB
C++
/*
|
|
* Copyright (C) 2021-2022 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#include "shared/source/command_container/command_encoder.h"
|
|
#include "shared/source/helpers/preamble.h"
|
|
#include "shared/test/common/mocks/mock_command_stream_receiver.h"
|
|
#include "shared/test/common/mocks/mock_device.h"
|
|
#include "shared/test/common/test_macros/test.h"
|
|
|
|
using namespace NEO;
|
|
|
|
using Gen12LpCommandEncodeTest = testing::Test;
|
|
GEN12LPTEST_F(Gen12LpCommandEncodeTest, givenGen12LpPlatformWhenDoBindingTablePrefetchIsCalledThenReturnsTrue) {
|
|
EXPECT_FALSE(EncodeSurfaceState<FamilyType>::doBindingTablePrefetch());
|
|
}
|
|
|
|
template <bool rcs>
|
|
class MyCommandStreamReceiverMock : public MockCommandStreamReceiver {
|
|
public:
|
|
MyCommandStreamReceiverMock(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex, const DeviceBitfield deviceBitfield) : MockCommandStreamReceiver(executionEnvironment, rootDeviceIndex, deviceBitfield) {}
|
|
bool isRcs() const override {
|
|
return rcs;
|
|
}
|
|
};
|
|
|
|
GEN12LPTEST_F(Gen12LpCommandEncodeTest, givenGen12LpPlatformWhenDefaultEngineIsRcsThenAdditionalPipelineSelectSizeEqualTwoPipelineSelectSize) {
|
|
MockDevice device;
|
|
auto csr = std::make_unique<MyCommandStreamReceiverMock<true>>(*device.getExecutionEnvironment(), 0, device.getDeviceBitfield());
|
|
auto oldCsr = device.getDefaultEngine().commandStreamReceiver;
|
|
device.getDefaultEngine().commandStreamReceiver = csr.get();
|
|
EXPECT_EQ(2 * PreambleHelper<FamilyType>::getCmdSizeForPipelineSelect(device.getHardwareInfo()), EncodeWA<FamilyType>::getAdditionalPipelineSelectSize(device));
|
|
device.getDefaultEngine().commandStreamReceiver = oldCsr;
|
|
}
|
|
|
|
GEN12LPTEST_F(Gen12LpCommandEncodeTest, givenGen12LpPlatformWhenDefaultEngineIsNotRcsThenAdditionalPipelineSelectSizeEqualZero) {
|
|
MockDevice device;
|
|
auto csr = std::make_unique<MyCommandStreamReceiverMock<false>>(*device.getExecutionEnvironment(), 0, device.getDeviceBitfield());
|
|
auto oldCsr = device.getDefaultEngine().commandStreamReceiver;
|
|
device.getDefaultEngine().commandStreamReceiver = csr.get();
|
|
EXPECT_EQ(0u, EncodeWA<FamilyType>::getAdditionalPipelineSelectSize(device));
|
|
device.getDefaultEngine().commandStreamReceiver = oldCsr;
|
|
} |