Return zero as scratch required GSBA when no scratch allocation present

Change-Id: Idc59b6d0193b7310d9330432df8ccf300a93a912
Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2019-05-22 15:40:03 +02:00
committed by sys_ocldev
parent b64210d3db
commit 52dc359511
2 changed files with 15 additions and 3 deletions

View File

@ -49,9 +49,13 @@ void ScratchSpaceControllerBase::createScratchSpaceAllocation() {
}
uint64_t ScratchSpaceControllerBase::calculateNewGSH() {
uint64_t gsh = 0;
if (scratchAllocation) {
auto &hwHelper = HwHelper::get(executionEnvironment.getHardwareInfo()->platform.eRenderCoreFamily);
auto scratchSpaceOffsetFor64bit = hwHelper.getScratchSpaceOffsetFor64bit();
return scratchAllocation->getGpuAddress() - scratchSpaceOffsetFor64bit;
gsh = scratchAllocation->getGpuAddress() - scratchSpaceOffsetFor64bit;
}
return gsh;
}
uint64_t ScratchSpaceControllerBase::getScratchPatchAddress() {
//for 32 bit scratch space pointer is being programmed in Media VFE State and is relative to 0 as General State Base Address

View File

@ -256,6 +256,14 @@ HWTEST_F(CommandStreamReceiverHwTest, WhenScratchSpaceIsRequiredThenCorrectAddre
EXPECT_TRUE(UnitTestHelper<FamilyType>::evaluateGshAddressForScratchSpace((expectedScratchAddress - MemoryConstants::pageSize), scratchController->calculateNewGSH()));
}
HWTEST_F(CommandStreamReceiverHwTest, WhenScratchSpaceIsNotRequiredThenGshAddressZeroIsReturned) {
auto commandStreamReceiver = std::make_unique<MockCsrHw<FamilyType>>(*pDevice->executionEnvironment);
auto scratchController = commandStreamReceiver->getScratchSpaceController();
EXPECT_EQ(nullptr, scratchController->getScratchSpaceAllocation());
EXPECT_EQ(0u, scratchController->calculateNewGSH());
}
struct BcsTests : public CommandStreamReceiverHwTest {
void SetUp() override {
CommandStreamReceiverHwTest::SetUp();