Files
compute-runtime/runtime/os_interface/linux/drm_allocation.h
Mrozek, Michal 14b8bbb3aa Add capability to query internal handle from cl_mem.
Related-To: NEO-3252

Change-Id: I935c308dfa3f77c6d965df7316fe3fb4c21b112a
Signed-off-by: Mrozek, Michal <michal.mrozek@intel.com>
2019-06-03 13:40:08 +02:00

45 lines
1.3 KiB
C++

/*
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "core/helpers/ptr_math.h"
#include "runtime/memory_manager/graphics_allocation.h"
namespace NEO {
class BufferObject;
struct OsHandle {
BufferObject *bo = nullptr;
};
class DrmAllocation : public GraphicsAllocation {
public:
DrmAllocation(AllocationType allocationType, BufferObject *bo, void *ptrIn, size_t sizeIn, osHandle sharedHandle, MemoryPool::Type pool, bool multiOsContextCapable)
: GraphicsAllocation(allocationType, ptrIn, sizeIn, sharedHandle, pool, multiOsContextCapable),
bo(bo) {
}
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),
bo(bo) {
}
std::string getAllocationInfoString() const override;
BufferObject *getBO() const {
if (fragmentsStorage.fragmentCount) {
return fragmentsStorage.fragmentStorageData[0].osHandleStorage->bo;
}
return this->bo;
}
uint64_t peekInternalHandle() override { return castToUint64(getBO()); }
protected:
BufferObject *bo;
};
} // namespace NEO