Files
compute-runtime/runtime/os_interface/linux/drm_allocation.h
Igor Venevtsev 684d58d2aa Make GraphicsAllocation constructors unambiguous
Related-To: NEO-2941

Change-Id: Iedd16d0dcb4158b5e7832043289e2e6aba1549d5
Signed-off-by: Igor Venevtsev <igor.venevtsev@intel.com>
2019-11-06 10:12:26 +01:00

58 lines
1.9 KiB
C++

/*
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "core/memory_manager/graphics_allocation.h"
namespace NEO {
class BufferObject;
struct OsHandle {
BufferObject *bo = nullptr;
};
using BufferObjects = std::array<BufferObject *, maxHandleCount>;
class DrmAllocation : public GraphicsAllocation {
public:
DrmAllocation(uint32_t rootDeviceIndex, AllocationType allocationType, BufferObject *bo, void *ptrIn, size_t sizeIn, osHandle sharedHandle, MemoryPool::Type pool)
: GraphicsAllocation(rootDeviceIndex, allocationType, ptrIn, sizeIn, sharedHandle, pool),
bufferObjects({{bo}}) {
}
DrmAllocation(uint32_t rootDeviceIndex, AllocationType allocationType, BufferObject *bo, void *ptrIn, uint64_t gpuAddress, size_t sizeIn, MemoryPool::Type pool)
: GraphicsAllocation(rootDeviceIndex, allocationType, ptrIn, gpuAddress, 0, sizeIn, pool),
bufferObjects({{bo}}) {
}
DrmAllocation(uint32_t rootDeviceIndex, AllocationType allocationType, BufferObjects &bos, void *ptrIn, uint64_t gpuAddress, size_t sizeIn, MemoryPool::Type pool)
: GraphicsAllocation(rootDeviceIndex, allocationType, ptrIn, gpuAddress, 0, sizeIn, pool),
bufferObjects(bos) {
}
std::string getAllocationInfoString() const override;
BufferObject *getBO() const {
if (fragmentsStorage.fragmentCount) {
return fragmentsStorage.fragmentStorageData[0].osHandleStorage->bo;
}
return this->bufferObjects[0];
}
const BufferObjects &getBOs() const {
return this->bufferObjects;
}
BufferObject *&getBufferObjectToModify(uint32_t handleIndex) {
return bufferObjects[handleIndex];
}
uint64_t peekInternalHandle(MemoryManager *memoryManager) override;
protected:
BufferObjects bufferObjects{};
};
} // namespace NEO