/* * Copyright (C) 2019 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "runtime/aub_mem_dump/page_table_entry_bits.h" #include "runtime/command_stream/tbx_command_stream_receiver_hw.h" #include "test.h" #include "unit_tests/fixtures/device_fixture.h" #include "unit_tests/mocks/mock_graphics_allocation.h" using namespace NEO; using Gen12LPTbxCommandStreamReceiverTests = Test; GEN12LPTEST_F(Gen12LPTbxCommandStreamReceiverTests, givenNullPtrGraphicsAlloctionWhenGetPPGTTAdditionalBitsIsCalledThenAppropriateValueIsReturned) { auto tbxCsr = std::make_unique>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); GraphicsAllocation *allocation = nullptr; auto bits = tbxCsr->getPPGTTAdditionalBits(allocation); constexpr uint64_t expectedBits = BIT(PageTableEntry::presentBit) | BIT(PageTableEntry::writableBit); EXPECT_EQ(expectedBits, bits); } GEN12LPTEST_F(Gen12LPTbxCommandStreamReceiverTests, givenGraphicsAlloctionWWhenGetPPGTTAdditionalBitsIsCalledThenAppropriateValueIsReturned) { auto tbxCsr = std::make_unique>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); MockGraphicsAllocation allocation(nullptr, 0); auto bits = tbxCsr->getPPGTTAdditionalBits(&allocation); constexpr uint64_t expectedBits = BIT(PageTableEntry::presentBit) | BIT(PageTableEntry::writableBit); EXPECT_EQ(expectedBits, bits); } GEN12LPTEST_F(Gen12LPTbxCommandStreamReceiverTests, whenAskedForPollForCompletionParametersThenReturnCorrectValues) { class MyMockTbxHw : public TbxCommandStreamReceiverHw { public: MyMockTbxHw(ExecutionEnvironment &executionEnvironment) : TbxCommandStreamReceiverHw(executionEnvironment, 0) {} using TbxCommandStreamReceiverHw::getpollNotEqualValueForPollForCompletion; using TbxCommandStreamReceiverHw::getMaskAndValueForPollForCompletion; }; MyMockTbxHw myMockTbxHw(*pDevice->executionEnvironment); EXPECT_EQ(0x80u, myMockTbxHw.getMaskAndValueForPollForCompletion()); EXPECT_TRUE(myMockTbxHw.getpollNotEqualValueForPollForCompletion()); }