mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 16:24:18 +08:00
Remove obsolete methods form LinearStream
Change-Id: Id87dd58d9a373cf5d3f217e9ecc8db8a79b25190
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@@ -40,8 +40,6 @@ class LinearStream {
|
||||
uint64_t getGpuBase() const;
|
||||
uint64_t getCurrentGpuOffsetFromHeapBase() const;
|
||||
void *getSpace(size_t size);
|
||||
void *getSpaceUnsecure(size_t size);
|
||||
void putSpace(size_t size);
|
||||
size_t getMaxAvailableSpace() const;
|
||||
size_t getAvailableSpace() const;
|
||||
size_t getUsed() const;
|
||||
@@ -75,20 +73,11 @@ inline uint64_t LinearStream::getCurrentGpuOffsetFromHeapBase() const {
|
||||
return ptrOffset(this->graphicsAllocation->getGpuAddressToPatch(), sizeUsed);
|
||||
}
|
||||
|
||||
inline void *LinearStream::getSpaceUnsecure(size_t size) {
|
||||
auto memory = (uint8_t *)buffer + sizeUsed;
|
||||
sizeUsed += size;
|
||||
return memory;
|
||||
}
|
||||
|
||||
inline void *LinearStream::getSpace(size_t size) {
|
||||
UNRECOVERABLE_IF(sizeUsed + size > maxAvailableSpace);
|
||||
return getSpaceUnsecure(size);
|
||||
}
|
||||
|
||||
inline void LinearStream::putSpace(size_t size) {
|
||||
DEBUG_BREAK_IF(sizeUsed < size);
|
||||
sizeUsed -= size;
|
||||
auto memory = ptrOffset(buffer, sizeUsed);
|
||||
sizeUsed += size;
|
||||
return memory;
|
||||
}
|
||||
|
||||
inline size_t LinearStream::getMaxAvailableSpace() const {
|
||||
|
||||
@@ -675,41 +675,6 @@ INSTANTIATE_TEST_CASE_P(
|
||||
IndirectHeap::INDIRECT_OBJECT,
|
||||
IndirectHeap::SURFACE_STATE));
|
||||
|
||||
typedef Test<DeviceFixture> CommandQueueCSTest;
|
||||
HWTEST_F(CommandQueueCSTest, getCSShouldReturnACSWithEnoughSizeCSRTraffic) {
|
||||
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
|
||||
|
||||
auto WaNeeded = KernelCommandsHelper<FamilyType>::isPipeControlWArequired();
|
||||
|
||||
size_t sizeCSRNeeds =
|
||||
sizeof(typename FamilyType::PIPE_CONTROL) * (WaNeeded ? 2 : 1) + sizeof(typename FamilyType::MI_BATCH_BUFFER_END) + MemoryConstants::cacheLineSize - 1;
|
||||
|
||||
sizeCSRNeeds = alignUp(sizeCSRNeeds, MemoryConstants::cacheLineSize);
|
||||
|
||||
// NOTE: This test attempts to reserve the maximum amount
|
||||
// of memory such that if a client gets everything he wants
|
||||
// we don't overflow/corrupt memory when CSR appends its
|
||||
// work.
|
||||
size_t sizeCQReserves = CSRequirements::minCommandQueueCommandStreamSize;
|
||||
|
||||
EXPECT_EQ(sizeCSRNeeds, sizeCQReserves);
|
||||
|
||||
size_t sizeRequested = 0x1000 - sizeCQReserves;
|
||||
auto &cs = commandQueue.getCS(sizeRequested);
|
||||
ASSERT_GE(0x1000u, cs.getMaxAvailableSpace());
|
||||
|
||||
EXPECT_GE(cs.getAvailableSpace(), sizeRequested);
|
||||
cs.getSpace(sizeRequested);
|
||||
|
||||
// This should trigger an assert.
|
||||
//cs.getSpace(sizeCSRNeeds);
|
||||
|
||||
// This won't trigger an assert. CSR should use
|
||||
// this interface for CS's it doesn't own.
|
||||
cs.getSpaceUnsecure(sizeCSRNeeds);
|
||||
EXPECT_EQ(0x1000u, cs.getUsed());
|
||||
}
|
||||
|
||||
using CommandQueueTests = ::testing::Test;
|
||||
HWTEST_F(CommandQueueTests, givenMultipleCommandQueuesWhenMarkerIsEmittedThenGraphicsAllocationIsReused) {
|
||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(*platformDevices));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@@ -80,16 +80,6 @@ TEST_F(LinearStreamTest, getSpaceReducesAvailableSpace) {
|
||||
EXPECT_LT(linearStream.getAvailableSpace(), originalAvailable);
|
||||
}
|
||||
|
||||
TEST_F(LinearStreamTest, putSpaceReducesAvailableSpace) {
|
||||
auto originalAvailable = linearStream.getAvailableSpace();
|
||||
size_t sizeToAllocate = 2 * sizeof(uint32_t);
|
||||
|
||||
ASSERT_NE(nullptr, linearStream.getSpace(sizeToAllocate));
|
||||
linearStream.putSpace(sizeToAllocate);
|
||||
|
||||
EXPECT_EQ(linearStream.getAvailableSpace(), originalAvailable);
|
||||
}
|
||||
|
||||
TEST_F(LinearStreamTest, testGetUsed) {
|
||||
size_t sizeToAllocate = 2 * sizeof(uint32_t);
|
||||
ASSERT_NE(nullptr, linearStream.getSpace(sizeToAllocate));
|
||||
@@ -101,6 +91,11 @@ TEST_F(LinearStreamTest, givenLinearStreamWhenGetCpuBaseIsCalledThenCpuBaseAddre
|
||||
ASSERT_EQ(pCmdBuffer, linearStream.getCpuBase());
|
||||
}
|
||||
|
||||
TEST_F(LinearStreamTest, givenNotEnoughSpaceWhenGetSpaceIsCalledThenThrowException) {
|
||||
linearStream.getSpace(linearStream.getMaxAvailableSpace());
|
||||
EXPECT_THROW(linearStream.getSpace(1), std::exception);
|
||||
}
|
||||
|
||||
TEST_F(LinearStreamTest, testReplaceBuffer) {
|
||||
char buffer[256];
|
||||
linearStream.replaceBuffer(buffer, sizeof(buffer));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@@ -42,19 +42,19 @@ class MockDeviceQueueHw : public DeviceQueueHw<GfxFamily> {
|
||||
using BaseClass::addArbCheckCmdWa;
|
||||
using BaseClass::addLriCmd;
|
||||
using BaseClass::addLriCmdWa;
|
||||
using BaseClass::addMediaStateClearCmds;
|
||||
using BaseClass::addMiAtomicCmdWa;
|
||||
using BaseClass::addPipeControlCmdWa;
|
||||
using BaseClass::addProfilingEndCmds;
|
||||
using BaseClass::buildSlbDummyCommands;
|
||||
using BaseClass::getCSPrefetchSize;
|
||||
using BaseClass::getExecutionModelCleanupSectionSize;
|
||||
using BaseClass::getMediaStateClearCmdsSize;
|
||||
using BaseClass::getMinimumSlbSize;
|
||||
using BaseClass::getProfilingEndCmdsSize;
|
||||
using BaseClass::getSlbCS;
|
||||
using BaseClass::getWaCommandsSize;
|
||||
using BaseClass::offsetDsh;
|
||||
using BaseClass::addMediaStateClearCmds;
|
||||
using BaseClass::getMediaStateClearCmdsSize;
|
||||
using BaseClass::getProfilingEndCmdsSize;
|
||||
using BaseClass::getExecutionModelCleanupSectionSize;
|
||||
|
||||
bool arbCheckWa;
|
||||
bool miAtomicWa;
|
||||
@@ -107,7 +107,7 @@ class MockDeviceQueueHw : public DeviceQueueHw<GfxFamily> {
|
||||
size = slbCS->getUsed();
|
||||
miAtomicWa = true;
|
||||
}
|
||||
slbCS->putSpace(slbCS->getUsed()); // reset
|
||||
slbCS->replaceBuffer(slb->getUnderlyingBuffer(), slb->getUnderlyingBufferSize()); // reset
|
||||
|
||||
setupExpectedCmds();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user