Cleanup includes in drm_memory_manager.h

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2022-07-26 18:39:17 +02:00
committed by Compute-Runtime-Automation
parent c94b6581c2
commit db2d1a53b9
18 changed files with 78 additions and 50 deletions

View File

@@ -8,6 +8,8 @@
#include "shared/test/common/mocks/linux/mock_drm_memory_manager.h"
#include "shared/source/os_interface/linux/allocator_helper.h"
#include "shared/source/os_interface/linux/drm_allocation.h"
#include "shared/source/os_interface/linux/drm_buffer_object.h"
#include "shared/source/os_interface/linux/drm_memory_manager.h"
#include "shared/test/common/mocks/mock_allocation_properties.h"
#include "shared/test/common/mocks/mock_host_ptr_manager.h"
@@ -56,6 +58,15 @@ TestedDrmMemoryManager::TestedDrmMemoryManager(bool enableLocalMemory,
this->executionEnvironment = &executionEnvironment;
}
BufferObject *TestedDrmMemoryManager::findAndReferenceSharedBufferObject(int boHandle, uint32_t rootDeviceIndex) {
if (failOnfindAndReferenceSharedBufferObject) {
DrmMockCustom drmMock(*executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]);
auto patIndex = drmMock.getPatIndex(nullptr, AllocationType::BUFFER, CacheRegion::Default, CachePolicy::WriteBack, false);
return new (std::nothrow) BufferObject(&drmMock, patIndex, boHandle, 4096u, 2u);
}
return MemoryManagerCreate<DrmMemoryManager>::findAndReferenceSharedBufferObject(boHandle, rootDeviceIndex);
}
void TestedDrmMemoryManager::injectPinBB(BufferObject *newPinBB, uint32_t rootDeviceIndex) {
BufferObject *currentPinBB = pinBBs[rootDeviceIndex];
pinBBs[rootDeviceIndex] = nullptr;
@@ -77,7 +88,7 @@ DrmAllocation *TestedDrmMemoryManager::allocate32BitGraphicsMemory(uint32_t root
MockAllocationProperties properties(rootDeviceIndex, allocateMemory, size, allocationType);
getAllocationData(allocationData, properties, ptr, createStorageInfoFromProperties(properties));
bool useLocalMemory = !allocationData.flags.useSystemMemory && this->localMemorySupported[rootDeviceIndex];
return allocate32BitGraphicsMemoryImpl(allocationData, useLocalMemory);
return static_cast<DrmAllocation *>(allocate32BitGraphicsMemoryImpl(allocationData, useLocalMemory));
}
void TestedDrmMemoryManager::closeSharedHandle(GraphicsAllocation *gfxAllocation) {

View File

@@ -6,6 +6,7 @@
*/
#pragma once
#include "shared/source/os_interface/linux/drm_gem_close_worker.h"
#include "shared/source/os_interface/linux/drm_memory_manager.h"
#include "shared/test/common/mocks/mock_memory_manager.h"
#include "shared/test/common/os_interface/linux/device_command_stream_fixture.h"
@@ -114,14 +115,7 @@ class TestedDrmMemoryManager : public MemoryManagerCreate<DrmMemoryManager> {
void forceLimitedRangeAllocator(uint64_t range);
void overrideGfxPartition(GfxPartition *newGfxPartition);
BufferObject *findAndReferenceSharedBufferObject(int boHandle, uint32_t rootDeviceIndex) override {
if (failOnfindAndReferenceSharedBufferObject) {
DrmMockCustom drmMock(*executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]);
auto patIndex = drmMock.getPatIndex(nullptr, AllocationType::BUFFER, CacheRegion::Default, CachePolicy::WriteBack, false);
return new (std::nothrow) BufferObject(&drmMock, patIndex, boHandle, 4096u, 2u);
}
return MemoryManagerCreate<DrmMemoryManager>::findAndReferenceSharedBufferObject(boHandle, rootDeviceIndex);
}
BufferObject *findAndReferenceSharedBufferObject(int boHandle, uint32_t rootDeviceIndex) override;
DrmAllocation *allocate32BitGraphicsMemory(uint32_t rootDeviceIndex, size_t size, const void *ptr, AllocationType allocationType);
~TestedDrmMemoryManager() override;