Files
compute-runtime/runtime/os_interface/linux/drm_allocation.h
Mateusz Jablonski 5d640e7100 Remove multiOsContextCapable flag from GraphicsAllocation
Change-Id: I3ebeef39befdc2a3e0f9d7d76ae531622ecf1a42
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
2019-09-13 13:55:42 +02:00

58 lines
1.7 KiB
C++

/*
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "runtime/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(AllocationType allocationType, BufferObject *bo, void *ptrIn, size_t sizeIn, osHandle sharedHandle, MemoryPool::Type pool)
: GraphicsAllocation(allocationType, ptrIn, sizeIn, sharedHandle, pool),
bufferObjects({{bo}}) {
}
DrmAllocation(AllocationType allocationType, BufferObject *bo, void *ptrIn, uint64_t gpuAddress, size_t sizeIn, MemoryPool::Type pool)
: GraphicsAllocation(allocationType, ptrIn, gpuAddress, 0, sizeIn, pool),
bufferObjects({{bo}}) {
}
DrmAllocation(AllocationType allocationType, BufferObjects &bos, void *ptrIn, uint64_t gpuAddress, size_t sizeIn, MemoryPool::Type pool)
: GraphicsAllocation(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