2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2019-01-07 16:29:49 +08:00
|
|
|
* Copyright (C) 2017-2019 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "runtime/memory_manager/graphics_allocation.h"
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
class BufferObject;
|
|
|
|
|
|
|
|
struct OsHandle {
|
|
|
|
BufferObject *bo = nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
class DrmAllocation : public GraphicsAllocation {
|
|
|
|
public:
|
2019-02-27 18:38:25 +08:00
|
|
|
DrmAllocation(AllocationType allocationType, BufferObject *bo, void *ptrIn, size_t sizeIn, osHandle sharedHandle, MemoryPool::Type pool, bool multiOsContextCapable)
|
|
|
|
: GraphicsAllocation(allocationType, ptrIn, sizeIn, sharedHandle, pool, multiOsContextCapable),
|
2019-02-26 18:37:51 +08:00
|
|
|
bo(bo) {
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
2019-02-26 18:37:51 +08:00
|
|
|
|
2019-02-27 18:38:25 +08:00
|
|
|
DrmAllocation(AllocationType allocationType, BufferObject *bo, void *ptrIn, uint64_t gpuAddress, size_t sizeIn, MemoryPool::Type pool, bool multiOsContextCapable)
|
|
|
|
: GraphicsAllocation(allocationType, ptrIn, gpuAddress, 0, sizeIn, pool, multiOsContextCapable),
|
2019-02-26 18:37:51 +08:00
|
|
|
bo(bo) {
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
2019-02-14 18:38:04 +08:00
|
|
|
std::string getAllocationInfoString() const override;
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
BufferObject *getBO() const {
|
|
|
|
if (fragmentsStorage.fragmentCount) {
|
|
|
|
return fragmentsStorage.fragmentStorageData[0].osHandleStorage->bo;
|
|
|
|
}
|
|
|
|
return this->bo;
|
|
|
|
}
|
2019-06-06 22:26:47 +08:00
|
|
|
uint64_t peekInternalHandle(MemoryManager *memoryManager) override;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
BufferObject *bo;
|
|
|
|
};
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|