Revert "Program border color once per dsh"
Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
parent
1557cd21e0
commit
159404f38e
|
@ -571,19 +571,6 @@ TEST_P(CommandQueueIndirectHeapTest, WhenGettingIndirectHeapWithNewSizeThenMaxAv
|
|||
}
|
||||
}
|
||||
|
||||
TEST_P(CommandQueueIndirectHeapTest, WhenGettingIndirectHeapWithNewSizeThenBorderColorOffsetIsSetToMaxUint) {
|
||||
const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0};
|
||||
MockCommandQueue cmdQ(context.get(), pClDevice, props);
|
||||
|
||||
auto &indirectHeapInitial = cmdQ.getIndirectHeap(this->GetParam(), 10);
|
||||
indirectHeapInitial.setBorderColor(nullptr, 0);
|
||||
EXPECT_NE(indirectHeapInitial.getBorderColorOffset(), std::numeric_limits<uint32_t>::max());
|
||||
size_t requiredSize = indirectHeapInitial.getMaxAvailableSpace() + 42;
|
||||
|
||||
const auto &indirectHeap = cmdQ.getIndirectHeap(this->GetParam(), requiredSize);
|
||||
EXPECT_EQ(indirectHeap.getBorderColorOffset(), std::numeric_limits<uint32_t>::max());
|
||||
}
|
||||
|
||||
TEST_P(CommandQueueIndirectHeapTest, WhenGettingIndirectHeapThenSizeIsAlignedToCacheLine) {
|
||||
const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0};
|
||||
MockCommandQueue cmdQ(context.get(), pClDevice, props);
|
||||
|
@ -720,27 +707,6 @@ TEST_P(CommandQueueIndirectHeapTest, GivenCommandQueueWithHeapAllocatedWhenIndir
|
|||
EXPECT_EQ(0u, indirectHeap.getMaxAvailableSpace());
|
||||
}
|
||||
|
||||
TEST_P(CommandQueueIndirectHeapTest, GivenCommandQueueWithHeapAllocatedWhenIndirectHeapIsReleasedThenBorderColorOffsetResetWasCalled) {
|
||||
const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0};
|
||||
MockCommandQueue cmdQ(context.get(), pClDevice, props);
|
||||
|
||||
EXPECT_TRUE(pDevice->getDefaultEngine().commandStreamReceiver->getAllocationsForReuse().peekIsEmpty());
|
||||
|
||||
const auto &indirectHeap = cmdQ.getIndirectHeap(this->GetParam(), 100);
|
||||
auto heapSize = indirectHeap.getMaxAvailableSpace();
|
||||
|
||||
EXPECT_NE(0u, heapSize);
|
||||
|
||||
auto graphicsAllocation = indirectHeap.getGraphicsAllocation();
|
||||
EXPECT_NE(nullptr, graphicsAllocation);
|
||||
|
||||
auto &csr = pDevice->getUltCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>();
|
||||
csr.indirectHeap[this->GetParam()]->setBorderColor(nullptr, 0);
|
||||
EXPECT_NE(csr.indirectHeap[this->GetParam()]->getBorderColorOffset(), std::numeric_limits<uint32_t>::max());
|
||||
cmdQ.releaseIndirectHeap(this->GetParam());
|
||||
EXPECT_EQ(csr.indirectHeap[this->GetParam()]->getBorderColorOffset(), std::numeric_limits<uint32_t>::max());
|
||||
}
|
||||
|
||||
TEST_P(CommandQueueIndirectHeapTest, GivenCommandQueueWithoutHeapAllocatedWhenIndirectHeapIsReleasedThenIndirectHeapAllocationStaysNull) {
|
||||
const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0};
|
||||
MockCommandQueue cmdQ(context.get(), pClDevice, props);
|
||||
|
|
|
@ -946,7 +946,6 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, GivenKernelWithSamplersWhenInd
|
|||
typedef typename FamilyType::BINDING_TABLE_STATE BINDING_TABLE_STATE;
|
||||
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
|
||||
typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE;
|
||||
typedef typename FamilyType::SAMPLER_BORDER_COLOR_STATE SAMPLER_BORDER_COLOR_STATE;
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
|
||||
using GPGPU_WALKER = typename FamilyType::GPGPU_WALKER;
|
||||
|
||||
|
@ -961,7 +960,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, GivenKernelWithSamplersWhenInd
|
|||
auto &ioh = cmdQ.getIndirectHeap(IndirectHeap::INDIRECT_OBJECT, 8192);
|
||||
auto &ssh = cmdQ.getIndirectHeap(IndirectHeap::SURFACE_STATE, 8192);
|
||||
|
||||
const uint32_t samplerTableOffset = static_cast<uint32_t>(alignUp(sizeof(SAMPLER_BORDER_COLOR_STATE), INTERFACE_DESCRIPTOR_DATA::SAMPLERSTATEPOINTER_ALIGN_SIZE));
|
||||
const uint32_t samplerTableOffset = 64;
|
||||
const uint32_t samplerStateSize = sizeof(SAMPLER_STATE) * 2;
|
||||
mockKernelWithInternal->kernelInfo.setSamplerTable(0, 2, static_cast<DynamicStateHeapOffset>(samplerTableOffset));
|
||||
|
||||
|
@ -1008,8 +1007,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, GivenKernelWithSamplersWhenInd
|
|||
true,
|
||||
*pDevice);
|
||||
|
||||
auto expectedBorderColor = FamilyType::cmdInitBorderColor;
|
||||
bool isMemorySame = memcmp(borderColorPointer, &expectedBorderColor, sizeof(SAMPLER_BORDER_COLOR_STATE)) == 0;
|
||||
bool isMemorySame = memcmp(borderColorPointer, mockDsh, samplerTableOffset) == 0;
|
||||
EXPECT_TRUE(isMemorySame);
|
||||
|
||||
SAMPLER_STATE *pSamplerStatesCopied = reinterpret_cast<SAMPLER_STATE *>(borderColorPointer + samplerTableOffset);
|
||||
|
|
|
@ -203,7 +203,6 @@ IndirectHeap *CommandContainer::getHeapWithRequiredSizeAndAlignment(HeapType hea
|
|||
getResidencyContainer().push_back(newAlloc);
|
||||
getDeallocationContainer().push_back(oldAlloc);
|
||||
setIndirectHeapAllocation(heapType, newAlloc);
|
||||
indirectHeap->resetBorderColorOffset();
|
||||
if (oldBase != newBase) {
|
||||
setHeapDirty(heapType);
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ uint32_t EncodeStates<Family>::copySamplerState(IndirectHeap *dsh,
|
|||
const void *fnDynamicStateHeap,
|
||||
BindlessHeapsHelper *bindlessHeapHelper) {
|
||||
auto sizeSamplerState = sizeof(SAMPLER_STATE) * samplerCount;
|
||||
auto borderColorSize = samplerStateOffset - borderColorOffset;
|
||||
|
||||
SAMPLER_STATE *dstSamplerState = nullptr;
|
||||
uint32_t samplerStateOffsetInDsh = 0;
|
||||
|
@ -43,21 +44,27 @@ uint32_t EncodeStates<Family>::copySamplerState(IndirectHeap *dsh,
|
|||
dsh->align(EncodeStates<Family>::alignIndirectStatePointer);
|
||||
uint32_t borderColorOffsetInDsh = 0;
|
||||
if (!ApiSpecificConfig::getBindlessConfiguration()) {
|
||||
borderColorOffsetInDsh = dsh->getBorderColorOffset();
|
||||
if (borderColorOffsetInDsh == std::numeric_limits<uint32_t>::max()) {
|
||||
auto borderColor = Family::cmdInitBorderColor;
|
||||
dsh->setBorderColor(&borderColor, sizeof(borderColor));
|
||||
borderColorOffsetInDsh = dsh->getBorderColorOffset();
|
||||
}
|
||||
borderColorOffsetInDsh = static_cast<uint32_t>(dsh->getUsed());
|
||||
auto borderColor = dsh->getSpace(borderColorSize);
|
||||
|
||||
memcpy_s(borderColor, borderColorSize, ptrOffset(fnDynamicStateHeap, borderColorOffset),
|
||||
borderColorSize);
|
||||
|
||||
dsh->align(INTERFACE_DESCRIPTOR_DATA::SAMPLERSTATEPOINTER_ALIGN_SIZE);
|
||||
samplerStateOffsetInDsh = static_cast<uint32_t>(dsh->getUsed());
|
||||
|
||||
dstSamplerState = reinterpret_cast<SAMPLER_STATE *>(dsh->getSpace(sizeSamplerState));
|
||||
} else {
|
||||
borderColorOffsetInDsh = bindlessHeapHelper->getBorderColorOffset();
|
||||
if (borderColorOffsetInDsh == std::numeric_limits<uint32_t>::max()) {
|
||||
auto borderColor = Family::cmdInitBorderColor;
|
||||
bindlessHeapHelper->setBorderColor(&borderColor, sizeof(borderColor));
|
||||
borderColorOffsetInDsh = bindlessHeapHelper->getBorderColorOffset();
|
||||
auto borderColor = reinterpret_cast<const SAMPLER_BORDER_COLOR_STATE *>(ptrOffset(fnDynamicStateHeap, borderColorOffset));
|
||||
if (borderColor->getBorderColorRed() != 0.0f ||
|
||||
borderColor->getBorderColorGreen() != 0.0f ||
|
||||
borderColor->getBorderColorBlue() != 0.0f ||
|
||||
(borderColor->getBorderColorAlpha() != 0.0f && borderColor->getBorderColorAlpha() != 1.0f)) {
|
||||
UNRECOVERABLE_IF(true);
|
||||
} else if (borderColor->getBorderColorAlpha() == 0.0f) {
|
||||
borderColorOffsetInDsh = bindlessHeapHelper->getDefaultBorderColorOffset();
|
||||
} else {
|
||||
borderColorOffsetInDsh = bindlessHeapHelper->getAlphaBorderColorOffset();
|
||||
}
|
||||
dsh->align(INTERFACE_DESCRIPTOR_DATA::SAMPLERSTATEPOINTER_ALIGN_SIZE);
|
||||
auto samplerStateInDsh = bindlessHeapHelper->allocateSSInHeap(sizeSamplerState, nullptr, BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
|
|
|
@ -424,7 +424,6 @@ void CommandStreamReceiver::allocateHeapMemory(IndirectHeap::Type heapType,
|
|||
if (indirectHeap) {
|
||||
indirectHeap->replaceBuffer(heapMemory->getUnderlyingBuffer(), finalHeapSize);
|
||||
indirectHeap->replaceGraphicsAllocation(heapMemory);
|
||||
indirectHeap->resetBorderColorOffset();
|
||||
} else {
|
||||
indirectHeap = new IndirectHeap(heapMemory, requireInternalHeap);
|
||||
indirectHeap->overrideMaxSize(finalHeapSize);
|
||||
|
@ -442,7 +441,6 @@ void CommandStreamReceiver::releaseIndirectHeap(IndirectHeap::Type heapType) {
|
|||
internalAllocationStorage->storeAllocation(std::unique_ptr<GraphicsAllocation>(heapMemory), REUSABLE_ALLOCATION);
|
||||
heap->replaceBuffer(nullptr, 0);
|
||||
heap->replaceGraphicsAllocation(nullptr);
|
||||
heap->resetBorderColorOffset();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -189,5 +189,4 @@ const Family::MI_USER_INTERRUPT Family::cmdInitUserInterrupt = Family::MI_USER_I
|
|||
const Family::XY_SRC_COPY_BLT Family::cmdInitXyCopyBlt = Family::XY_SRC_COPY_BLT::sInit();
|
||||
const Family::MI_FLUSH_DW Family::cmdInitMiFlushDw = Family::MI_FLUSH_DW::sInit();
|
||||
const Family::XY_COLOR_BLT Family::cmdInitXyColorBlt = Family::XY_COLOR_BLT::sInit();
|
||||
const Family::SAMPLER_BORDER_COLOR_STATE Family::cmdInitBorderColor = Family::SAMPLER_BORDER_COLOR_STATE::sInit();
|
||||
} // namespace NEO
|
||||
|
|
|
@ -84,7 +84,6 @@ struct ICLFamily : public GEN11 {
|
|||
static const XY_SRC_COPY_BLT cmdInitXyCopyBlt;
|
||||
static const MI_FLUSH_DW cmdInitMiFlushDw;
|
||||
static const XY_COLOR_BLT cmdInitXyColorBlt;
|
||||
static const SAMPLER_BORDER_COLOR_STATE cmdInitBorderColor;
|
||||
|
||||
static constexpr bool supportsCmdSet(GFXCORE_FAMILY cmdSetBaseFamily) {
|
||||
return cmdSetBaseFamily == IGFX_GEN8_CORE;
|
||||
|
|
|
@ -194,5 +194,4 @@ const Family::L3_CONTROL Family::cmdInitL3ControlWithPostSync = Family::L3_CONTR
|
|||
const Family::XY_COPY_BLT Family::cmdInitXyCopyBlt = Family::XY_COPY_BLT::sInit();
|
||||
const Family::MI_FLUSH_DW Family::cmdInitMiFlushDw = Family::MI_FLUSH_DW::sInit();
|
||||
const Family::XY_FAST_COLOR_BLT Family::cmdInitXyColorBlt = Family::XY_FAST_COLOR_BLT::sInit();
|
||||
const Family::SAMPLER_BORDER_COLOR_STATE Family::cmdInitBorderColor = Family::SAMPLER_BORDER_COLOR_STATE::sInit();
|
||||
} // namespace NEO
|
||||
|
|
|
@ -90,7 +90,6 @@ struct TGLLPFamily : public GEN12LP {
|
|||
static const XY_COPY_BLT cmdInitXyCopyBlt;
|
||||
static const MI_FLUSH_DW cmdInitMiFlushDw;
|
||||
static const XY_FAST_COLOR_BLT cmdInitXyColorBlt;
|
||||
static const SAMPLER_BORDER_COLOR_STATE cmdInitBorderColor;
|
||||
|
||||
static constexpr bool supportsCmdSet(GFXCORE_FAMILY cmdSetBaseFamily) {
|
||||
return cmdSetBaseFamily == IGFX_GEN8_CORE;
|
||||
|
|
|
@ -68,5 +68,4 @@ const Family::MI_USER_INTERRUPT Family::cmdInitUserInterrupt = Family::MI_USER_I
|
|||
const Family::XY_SRC_COPY_BLT Family::cmdInitXyCopyBlt = Family::XY_SRC_COPY_BLT::sInit();
|
||||
const Family::MI_FLUSH_DW Family::cmdInitMiFlushDw = Family::MI_FLUSH_DW::sInit();
|
||||
const Family::XY_COLOR_BLT Family::cmdInitXyColorBlt = Family::XY_COLOR_BLT::sInit();
|
||||
const Family::SAMPLER_BORDER_COLOR_STATE Family::cmdInitBorderColor = Family::SAMPLER_BORDER_COLOR_STATE::sInit();
|
||||
} // namespace NEO
|
||||
|
|
|
@ -85,7 +85,6 @@ struct BDWFamily : public GEN8 {
|
|||
static const XY_SRC_COPY_BLT cmdInitXyCopyBlt;
|
||||
static const MI_FLUSH_DW cmdInitMiFlushDw;
|
||||
static const XY_COLOR_BLT cmdInitXyColorBlt;
|
||||
static const SAMPLER_BORDER_COLOR_STATE cmdInitBorderColor;
|
||||
|
||||
static constexpr bool supportsCmdSet(GFXCORE_FAMILY cmdSetBaseFamily) {
|
||||
return cmdSetBaseFamily == IGFX_GEN8_CORE;
|
||||
|
|
|
@ -63,5 +63,4 @@ const Family::MI_USER_INTERRUPT Family::cmdInitUserInterrupt = Family::MI_USER_I
|
|||
const Family::XY_SRC_COPY_BLT Family::cmdInitXyCopyBlt = Family::XY_SRC_COPY_BLT::sInit();
|
||||
const Family::MI_FLUSH_DW Family::cmdInitMiFlushDw = Family::MI_FLUSH_DW::sInit();
|
||||
const Family::XY_COLOR_BLT Family::cmdInitXyColorBlt = Family::XY_COLOR_BLT::sInit();
|
||||
const Family::SAMPLER_BORDER_COLOR_STATE Family::cmdInitBorderColor = Family::SAMPLER_BORDER_COLOR_STATE::sInit();
|
||||
} // namespace NEO
|
||||
|
|
|
@ -86,7 +86,6 @@ struct SKLFamily : public GEN9 {
|
|||
static const XY_SRC_COPY_BLT cmdInitXyCopyBlt;
|
||||
static const MI_FLUSH_DW cmdInitMiFlushDw;
|
||||
static const XY_COLOR_BLT cmdInitXyColorBlt;
|
||||
static const SAMPLER_BORDER_COLOR_STATE cmdInitBorderColor;
|
||||
|
||||
static constexpr bool supportsCmdSet(GFXCORE_FAMILY cmdSetBaseFamily) {
|
||||
return cmdSetBaseFamily == IGFX_GEN8_CORE;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
namespace NEO {
|
||||
|
||||
constexpr size_t globalSshAllocationSize = 4 * MemoryConstants::pageSize64k;
|
||||
constexpr size_t borderColorAlphaOffset = alignUp(4 * sizeof(float), MemoryConstants::cacheLineSize);
|
||||
using BindlesHeapType = BindlessHeapsHelper::BindlesHeapType;
|
||||
|
||||
BindlessHeapsHelper::BindlessHeapsHelper(MemoryManager *memManager, bool isMultiOsContextCapable, const uint32_t rootDeviceIndex) : memManager(memManager), isMultiOsContextCapable(isMultiOsContextCapable), rootDeviceIndex(rootDeviceIndex) {
|
||||
|
@ -27,6 +28,10 @@ BindlessHeapsHelper::BindlessHeapsHelper(MemoryManager *memManager, bool isMulti
|
|||
|
||||
borderColorStates = getHeapAllocation(MemoryConstants::pageSize, MemoryConstants::pageSize, true);
|
||||
UNRECOVERABLE_IF(borderColorStates == nullptr);
|
||||
float borderColorDefault[4] = {0, 0, 0, 0};
|
||||
memcpy_s(borderColorStates->getUnderlyingBuffer(), sizeof(borderColorDefault), borderColorDefault, sizeof(borderColorDefault));
|
||||
float borderColorAlpha[4] = {0, 0, 0, 1.0};
|
||||
memcpy_s(ptrOffset(borderColorStates->getUnderlyingBuffer(), borderColorAlphaOffset), sizeof(borderColorAlpha), borderColorAlpha, sizeof(borderColorDefault));
|
||||
}
|
||||
|
||||
BindlessHeapsHelper::~BindlessHeapsHelper() {
|
||||
|
@ -89,12 +94,11 @@ uint64_t BindlessHeapsHelper::getGlobalHeapsBase() {
|
|||
return surfaceStateHeaps[BindlesHeapType::GLOBAL_SSH]->getGraphicsAllocation()->getGpuBaseAddress();
|
||||
}
|
||||
|
||||
uint32_t BindlessHeapsHelper::getBorderColorOffset() {
|
||||
return borderColorOffset;
|
||||
uint32_t BindlessHeapsHelper::getDefaultBorderColorOffset() {
|
||||
return static_cast<uint32_t>(borderColorStates->getGpuAddress() - borderColorStates->getGpuBaseAddress());
|
||||
}
|
||||
void BindlessHeapsHelper::setBorderColor(void *borderColor, size_t size) {
|
||||
borderColorOffset = static_cast<uint32_t>(borderColorStates->getGpuAddress() - borderColorStates->getGpuBaseAddress());
|
||||
memcpy_s(borderColorStates->getUnderlyingBuffer(), borderColorStates->getUnderlyingBufferSize(), borderColor, size);
|
||||
uint32_t BindlessHeapsHelper::getAlphaBorderColorOffset() {
|
||||
return getDefaultBorderColorOffset() + borderColorAlphaOffset;
|
||||
}
|
||||
|
||||
IndirectHeap *BindlessHeapsHelper::getHeap(BindlesHeapType heapType) {
|
||||
|
|
|
@ -44,8 +44,8 @@ class BindlessHeapsHelper {
|
|||
SurfaceStateInHeapInfo allocateSSInHeap(size_t ssSize, GraphicsAllocation *surfaceAllocation, BindlesHeapType heapType);
|
||||
uint64_t getGlobalHeapsBase();
|
||||
void *getSpaceInHeap(size_t ssSize, BindlesHeapType heapType);
|
||||
uint32_t getBorderColorOffset();
|
||||
void setBorderColor(void *borderColor, size_t size);
|
||||
uint32_t getDefaultBorderColorOffset();
|
||||
uint32_t getAlphaBorderColorOffset();
|
||||
IndirectHeap *getHeap(BindlesHeapType heapType);
|
||||
void placeSSAllocationInReuseVectorOnFreeMemory(GraphicsAllocation *gfxAllocation);
|
||||
|
||||
|
@ -54,7 +54,6 @@ class BindlessHeapsHelper {
|
|||
MemoryManager *memManager = nullptr;
|
||||
bool isMultiOsContextCapable = false;
|
||||
const uint32_t rootDeviceIndex;
|
||||
uint32_t borderColorOffset = std::numeric_limits<uint32_t>::max();
|
||||
std::unique_ptr<IndirectHeap> surfaceStateHeaps[BindlesHeapType::NUM_HEAP_TYPES];
|
||||
GraphicsAllocation *borderColorStates;
|
||||
std::vector<GraphicsAllocation *> ssHeapsAllocations;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "shared/source/helpers/basic_math.h"
|
||||
#include "shared/source/helpers/constants.h"
|
||||
#include "shared/source/helpers/ptr_math.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
#include "shared/source/memory_manager/graphics_allocation.h"
|
||||
|
||||
namespace NEO {
|
||||
|
@ -45,13 +44,9 @@ class IndirectHeap : public LinearStream {
|
|||
uint64_t getHeapGpuStartOffset() const;
|
||||
uint64_t getHeapGpuBase() const;
|
||||
uint32_t getHeapSizeInPages() const;
|
||||
uint32_t getBorderColorOffset() const;
|
||||
void setBorderColor(void *borderColor, size_t size);
|
||||
void resetBorderColorOffset();
|
||||
|
||||
protected:
|
||||
bool canBeUtilizedAs4GbHeap = false;
|
||||
uint32_t borderColorOffset = std::numeric_limits<uint32_t>::max();
|
||||
};
|
||||
|
||||
inline void IndirectHeap::align(size_t alignment) {
|
||||
|
@ -82,16 +77,4 @@ inline uint64_t IndirectHeap::getHeapGpuBase() const {
|
|||
return this->graphicsAllocation->getGpuAddress();
|
||||
}
|
||||
}
|
||||
|
||||
inline uint32_t IndirectHeap::getBorderColorOffset() const {
|
||||
return borderColorOffset;
|
||||
}
|
||||
inline void IndirectHeap::setBorderColor(void *borderColor, size_t size) {
|
||||
borderColorOffset = static_cast<uint32_t>(getUsed());
|
||||
auto ptr = getSpace(size);
|
||||
memcpy_s(ptr, size, borderColor, size);
|
||||
}
|
||||
inline void IndirectHeap::resetBorderColorOffset() {
|
||||
borderColorOffset = std::numeric_limits<uint32_t>::max();
|
||||
}
|
||||
} // namespace NEO
|
||||
|
|
|
@ -110,17 +110,17 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenCreatedThenAllocatio
|
|||
}
|
||||
}
|
||||
|
||||
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenGetDefaultBorderColorOffsetWithoutSettingThenMaxUintReturned) {
|
||||
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex());
|
||||
auto expectedOffset = std::numeric_limits<uint32_t>::max();
|
||||
EXPECT_EQ(bindlessHeapHelper->getBorderColorOffset(), expectedOffset);
|
||||
}
|
||||
|
||||
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenGetDefaultBorderColorOffsetAfterSettingThenCorrectOffsetReturned) {
|
||||
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenGetDefaultBorderColorOffsetCalledThenCorrectOffsetReturned) {
|
||||
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex());
|
||||
auto expectedOffset = bindlessHeapHelper->borderColorStates->getGpuAddress() - bindlessHeapHelper->borderColorStates->getGpuBaseAddress();
|
||||
bindlessHeapHelper->setBorderColor(nullptr, 0);
|
||||
EXPECT_EQ(bindlessHeapHelper->getBorderColorOffset(), expectedOffset);
|
||||
EXPECT_EQ(bindlessHeapHelper->getDefaultBorderColorOffset(), expectedOffset);
|
||||
}
|
||||
|
||||
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenGetAlphaBorderColorOffsetCalledThenCorrectOffsetReturned) {
|
||||
auto borderColorSize = 0x40;
|
||||
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex());
|
||||
auto expectedOffset = bindlessHeapHelper->borderColorStates->getGpuAddress() - bindlessHeapHelper->borderColorStates->getGpuBaseAddress() + borderColorSize;
|
||||
EXPECT_EQ(bindlessHeapHelper->getAlphaBorderColorOffset(), expectedOffset);
|
||||
}
|
||||
|
||||
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInSpecialHeapThenOffsetLessThanFrontWindowSize) {
|
||||
|
|
|
@ -367,33 +367,6 @@ TEST_F(CommandContainerTest, givenNotEnoughSpaceWhenGetHeapWithRequiredSizeAndAl
|
|||
cmdContainer->getDeallocationContainer().clear();
|
||||
}
|
||||
|
||||
TEST_F(CommandContainerTest, givenNotEnoughSpaceWhenGetHeapWithRequiredSizeAndAlignmentCalledThenBorderColorOffestHasBeenReset) {
|
||||
std::unique_ptr<CommandContainer> cmdContainer(new CommandContainer);
|
||||
cmdContainer->initialize(pDevice);
|
||||
cmdContainer->setDirtyStateForAllHeaps(false);
|
||||
HeapType types[] = {HeapType::SURFACE_STATE,
|
||||
HeapType::DYNAMIC_STATE};
|
||||
|
||||
for (auto type : types) {
|
||||
auto heap = cmdContainer->getIndirectHeap(type);
|
||||
heap->setBorderColor(nullptr, 0);
|
||||
EXPECT_NE(heap->getBorderColorOffset(), std::numeric_limits<uint32_t>::max());
|
||||
const size_t sizeRequested = 32;
|
||||
const size_t alignment = 32;
|
||||
size_t availableSize = heap->getAvailableSpace();
|
||||
|
||||
heap->getSpace(availableSize - sizeRequested / 2);
|
||||
|
||||
EXPECT_LT(heap->getAvailableSpace(), sizeRequested + alignment);
|
||||
auto heapRequested = cmdContainer->getHeapWithRequiredSizeAndAlignment(type, sizeRequested, alignment);
|
||||
EXPECT_EQ(heapRequested->getBorderColorOffset(), std::numeric_limits<uint32_t>::max());
|
||||
}
|
||||
for (auto deallocation : cmdContainer->getDeallocationContainer()) {
|
||||
cmdContainer->getDevice()->getMemoryManager()->freeGraphicsMemory(deallocation);
|
||||
}
|
||||
cmdContainer->getDeallocationContainer().clear();
|
||||
}
|
||||
|
||||
TEST_F(CommandContainerTest, givenNotEnoughSpaceWhenCreatedAlocationHaveDifferentBaseThenHeapIsDirty) {
|
||||
std::unique_ptr<CommandContainer> cmdContainer(new CommandContainer);
|
||||
cmdContainer->initialize(pDevice);
|
||||
|
|
|
@ -33,7 +33,7 @@ HWTEST_F(CommandEncodeStatesTest, GivenCommandStreamWhenEncodeCopySamplerStateTh
|
|||
}
|
||||
using BindlessCommandEncodeStatesTest = Test<MemManagerFixture>;
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenCopySamplerStateThenBorderSetCorrectly) {
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorWithoutAlphaThenBorderColorPtrReturned) {
|
||||
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
|
@ -41,34 +41,99 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenCopySamplerSta
|
|||
uint32_t numSamplers = 1;
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex());
|
||||
|
||||
uint32_t borderColorSize = 0;
|
||||
uint32_t borderColorSize = 0x40;
|
||||
SAMPLER_BORDER_COLOR_STATE samplerState;
|
||||
samplerState.init();
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper());
|
||||
auto expectedValue = pDevice->getBindlessHeapsHelper()->getBorderColorOffset();
|
||||
auto expectedValue = pDevice->getBindlessHeapsHelper()->getDefaultBorderColorOffset();
|
||||
|
||||
auto pSmplr = reinterpret_cast<SAMPLER_STATE *>(dsh->getGraphicsAllocation()->getUnderlyingBuffer());
|
||||
EXPECT_EQ(pSmplr->getIndirectStatePointer(), expectedValue);
|
||||
}
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenCopySamplerStateCalledTwiceThenTheSameIndirectPointerIsSet) {
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorWithAlphaThenBorderColorPtrOffseted) {
|
||||
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
uint32_t numSamplers = 1;
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex());
|
||||
|
||||
SAMPLER_STATE samplerState;
|
||||
uint32_t borderColorSize = 0x40;
|
||||
SAMPLER_BORDER_COLOR_STATE samplerState;
|
||||
samplerState.init();
|
||||
samplerState.setBorderColorAlpha(1.0);
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EncodeStates<FamilyType>::copySamplerState(dsh, 0, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper());
|
||||
EncodeStates<FamilyType>::copySamplerState(dsh, 0, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper());
|
||||
EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper());
|
||||
auto expectedValue = pDevice->getBindlessHeapsHelper()->getAlphaBorderColorOffset();
|
||||
|
||||
auto pSmplr1 = reinterpret_cast<SAMPLER_STATE *>(dsh->getGraphicsAllocation()->getUnderlyingBuffer());
|
||||
auto pSmplr2 = reinterpret_cast<SAMPLER_STATE *>(ptrOffset(dsh->getGraphicsAllocation()->getUnderlyingBuffer(), static_cast<uint32_t>(alignUp(sizeof(samplerState), EncodeStates<FamilyType>::alignIndirectStatePointer))));
|
||||
EXPECT_EQ(pSmplr1->getIndirectStatePointer(), pSmplr2->getIndirectStatePointer());
|
||||
auto pSmplr = reinterpret_cast<SAMPLER_STATE *>(dsh->getGraphicsAllocation()->getUnderlyingBuffer());
|
||||
EXPECT_EQ(pSmplr->getIndirectStatePointer(), expectedValue);
|
||||
}
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsRedChanelIsNotZeroThenExceptionThrown) {
|
||||
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
uint32_t numSamplers = 1;
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex());
|
||||
|
||||
uint32_t borderColorSize = 0x40;
|
||||
SAMPLER_BORDER_COLOR_STATE samplerState;
|
||||
samplerState.init();
|
||||
samplerState.setBorderColorRed(0.5);
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EXPECT_THROW(EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper()), std::exception);
|
||||
}
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsGreenChanelIsNotZeroThenExceptionThrown) {
|
||||
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
uint32_t numSamplers = 1;
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex());
|
||||
|
||||
uint32_t borderColorSize = 0x40;
|
||||
SAMPLER_BORDER_COLOR_STATE samplerState;
|
||||
samplerState.init();
|
||||
samplerState.setBorderColorGreen(0.5);
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EXPECT_THROW(EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper()), std::exception);
|
||||
}
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsBlueChanelIsNotZeroThenExceptionThrown) {
|
||||
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
uint32_t numSamplers = 1;
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex());
|
||||
|
||||
uint32_t borderColorSize = 0x40;
|
||||
SAMPLER_BORDER_COLOR_STATE samplerState;
|
||||
samplerState.init();
|
||||
samplerState.setBorderColorBlue(0.5);
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EXPECT_THROW(EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper()), std::exception);
|
||||
}
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsAlphaChanelIsNotZeroOrOneThenExceptionThrown) {
|
||||
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
uint32_t numSamplers = 1;
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex());
|
||||
|
||||
uint32_t borderColorSize = 0x40;
|
||||
SAMPLER_BORDER_COLOR_STATE samplerState;
|
||||
samplerState.init();
|
||||
samplerState.setBorderColorAlpha(0.5);
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EXPECT_THROW(EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper()), std::exception);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandEncodeStatesTest, givenCreatedSurfaceStateBufferWhenAllocationProvidedThenUseAllocationAsInput) {
|
||||
|
|
Loading…
Reference in New Issue