2019-02-14 18:38:04 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2019 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "runtime/os_interface/linux/drm_allocation.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2019-02-14 18:38:04 +08:00
|
|
|
#include "runtime/os_interface/linux/drm_buffer_object.h"
|
2019-06-06 22:26:47 +08:00
|
|
|
#include "runtime/os_interface/linux/drm_memory_manager.h"
|
2019-02-14 18:38:04 +08:00
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2019-02-14 18:38:04 +08:00
|
|
|
std::string DrmAllocation::getAllocationInfoString() const {
|
|
|
|
std::stringstream ss;
|
|
|
|
if (bo != nullptr) {
|
|
|
|
ss << " Handle: " << bo->peekHandle();
|
|
|
|
}
|
|
|
|
return ss.str();
|
|
|
|
}
|
2019-06-04 19:42:57 +08:00
|
|
|
|
2019-06-06 22:26:47 +08:00
|
|
|
uint64_t DrmAllocation::peekInternalHandle(MemoryManager *memoryManager) {
|
|
|
|
auto drmMemoryManager = static_cast<DrmMemoryManager *>(memoryManager);
|
|
|
|
if (DebugManager.flags.AllowOpenFdOperations.get()) {
|
|
|
|
return static_cast<uint64_t>(drmMemoryManager->obtainFdFromHandle(getBO()->peekHandle()));
|
|
|
|
} else {
|
|
|
|
return 0llu;
|
|
|
|
}
|
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|