mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 22:43:00 +08:00
Refactor allocateGraphicsMemoryInPreferredPool
- extend AllocationType to code necessary flags - remove redundant args - refactor Buffer::create() Change-Id: Ic4b2e0931fad8198ad1cf4f79de210d815048ccf
This commit is contained in:
committed by
sys_ocldev
parent
c2454d5aa2
commit
4441387969
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "runtime/aub_mem_dump/aub_mem_dump.h"
|
||||
#include "runtime/command_stream/aub_command_stream_receiver_hw.h"
|
||||
#include "runtime/helpers/array_count.h"
|
||||
#include "runtime/helpers/dispatch_info.h"
|
||||
#include "runtime/helpers/flat_batch_buffer_helper_hw.h"
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
@@ -702,6 +703,29 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
|
||||
memoryManager->freeGraphicsMemory(gfxDefaultAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenWriteMemoryIsCalledOnBufferAndImageTypeAllocationsThenAllocationsHaveAubWritableSetToFalse) {
|
||||
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true));
|
||||
memoryManager.reset(aubCsr->createMemoryManager(false));
|
||||
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
|
||||
|
||||
GraphicsAllocation::AllocationType onlyOneTimeAubWritableTypes[] = {
|
||||
GraphicsAllocation::AllocationType::BUFFER,
|
||||
GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY,
|
||||
GraphicsAllocation::AllocationType::BUFFER_COMPRESSED,
|
||||
GraphicsAllocation::AllocationType::IMAGE};
|
||||
|
||||
for (size_t i = 0; i < arrayCount(onlyOneTimeAubWritableTypes); i++) {
|
||||
gfxAllocation->setAubWritable(true);
|
||||
gfxAllocation->setAllocationType(onlyOneTimeAubWritableTypes[i]);
|
||||
aubCsr->writeMemory(*gfxAllocation);
|
||||
|
||||
EXPECT_FALSE(gfxAllocation->isAubWritable());
|
||||
}
|
||||
memoryManager->freeGraphicsMemory(gfxAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcessResidencyIsCalledOnBufferAndImageAllocationsThenAllocationsTypesShouldBeMadeNonAubWritable) {
|
||||
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true));
|
||||
|
||||
Reference in New Issue
Block a user