Refactor memory object control state methods in generated commands

remove setters/getters for Index To Mocs Tables fields
all information contained in MOCS from gmm client context is now handled
by dedicated method set/get MemoryObjectControlState

Related-To: NEO-6466


Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2021-12-13 12:34:09 +00:00
committed by Compute-Runtime-Automation
parent 601271c92e
commit 03e617d14f
35 changed files with 582 additions and 327 deletions

View File

@@ -0,0 +1,56 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/gen9/hw_cmds_base.h"
#include "test.h"
using namespace NEO;
using Gen9HwCmdTest = ::testing::Test;
GEN9TEST_F(Gen9HwCmdTest, givenRenderSurfaceStateWhenProgrammingMocsThenMocsIndexIsSetProperly) {
auto renderSurfaceState = FamilyType::cmdInitRenderSurfaceState;
uint32_t mocs = 4u;
uint32_t expectedMocsIndex = (mocs >> 1);
renderSurfaceState.setMemoryObjectControlState(mocs);
EXPECT_EQ(expectedMocsIndex, renderSurfaceState.TheStructure.Common.MemoryObjectControlState_IndexToMocsTables);
}
GEN9TEST_F(Gen9HwCmdTest, givenStateBaseAddressWhenProgrammingMocsThenMocsIndexIsSetProperly) {
auto stateBaseAddress = FamilyType::cmdInitStateBaseAddress;
uint32_t mocs = 4u;
uint32_t expectedMocsIndex = (mocs >> 1);
stateBaseAddress.setGeneralStateMemoryObjectControlState(mocs);
EXPECT_EQ(expectedMocsIndex, stateBaseAddress.TheStructure.Common.GeneralStateMemoryObjectControlState_IndexToMocsTables);
stateBaseAddress.setStatelessDataPortAccessMemoryObjectControlState(mocs);
EXPECT_EQ(expectedMocsIndex, stateBaseAddress.TheStructure.Common.StatelessDataPortAccessMemoryObjectControlState_IndexToMocsTables);
stateBaseAddress.setSurfaceStateMemoryObjectControlState(mocs);
EXPECT_EQ(expectedMocsIndex, stateBaseAddress.TheStructure.Common.SurfaceStateMemoryObjectControlState_IndexToMocsTables);
stateBaseAddress.setDynamicStateMemoryObjectControlState(mocs);
EXPECT_EQ(expectedMocsIndex, stateBaseAddress.TheStructure.Common.DynamicStateMemoryObjectControlState_IndexToMocsTables);
stateBaseAddress.setIndirectObjectMemoryObjectControlState(mocs);
EXPECT_EQ(expectedMocsIndex, stateBaseAddress.TheStructure.Common.IndirectObjectMemoryObjectControlState_IndexToMocsTables);
stateBaseAddress.setInstructionMemoryObjectControlState(mocs);
EXPECT_EQ(expectedMocsIndex, stateBaseAddress.TheStructure.Common.InstructionMemoryObjectControlState_IndexToMocsTables);
stateBaseAddress.setBindlessSurfaceStateMemoryObjectControlState(mocs);
EXPECT_EQ(expectedMocsIndex, stateBaseAddress.TheStructure.Common.BindlessSurfaceStateMemoryObjectControlState_IndexToMocsTables);
}
GEN9TEST_F(Gen9HwCmdTest, givenMediaSurfaceStateWhenProgrammingMocsThenMocsIndexIsSetProperly) {
auto mediaSurfaceState = FamilyType::cmdInitMediaSurfaceState;
uint32_t mocs = 4u;
uint32_t expectedMocsIndex = (mocs >> 1);
mediaSurfaceState.setSurfaceMemoryObjectControlState(mocs);
EXPECT_EQ(expectedMocsIndex, mediaSurfaceState.TheStructure.Common.SurfaceMemoryObjectControlState_IndexToMocsTables);
}