SWDEV-245531 - GLInterop: Add Buffer Interop support

Change-Id: I38326173475e84f8eca2605522542ef89a3cf524
This commit is contained in:
Ravi C Akkenapally
2021-05-10 18:24:06 -07:00
والد e637c2f637
کامیت 0aa524363d
3فایلهای تغییر یافته به همراه15 افزوده شده و 2 حذف شده
-1
مشاهده پرونده
@@ -683,7 +683,6 @@ char* Device::getExtensionString() {
return result;
}
} // namespace amd
namespace device {
+6 -1
مشاهده پرونده
@@ -174,6 +174,11 @@ class Context : public RuntimeObject {
//! Returns the context info structure
const Info& info() const { return info_; }
void setInfo(Info info) {
info_ = info;
return;
}
//! Returns a pointer to the original properties
const cl_context_properties* properties() const { return properties_; }
@@ -208,7 +213,7 @@ class Context : public RuntimeObject {
{ deviceQueues_[&dev].defDeviceQueue_ = queue; };
private:
const Info info_; //!< Context info structure
Info info_; //!< Context info structure
cl_context_properties* properties_; //!< Original properties
GLFunctions* glenv_; //!< OpenGL context
Device* customHostAllocDevice_; //!< Device responsible for host allocations
@@ -301,6 +301,11 @@ bool Memory::create(void* initFrom, bool sysMemAlloc, bool skipAlloc, bool force
LogPrintfError("Can't allocate memory size - 0x%08X bytes!", getSize());
return false;
}
if (isInterop()) {
// Interop resources dont' have svm allocations, we use device address for mapping.
amd::MemObjMap::AddMemObj(
reinterpret_cast<void*>(static_cast<uintptr_t>(mem->virtualAddress())), this);
}
}
}
@@ -410,6 +415,10 @@ Memory::~Memory() {
if (NULL != deviceMemories_) {
// Destroy all device memory objects
for (uint i = 0; i < numDevices_; ++i) {
if (isInterop() && deviceMemories_[i].value_ != nullptr) {
amd::MemObjMap::RemoveMemObj(reinterpret_cast<void*>(
static_cast<uintptr_t>(deviceMemories_[i].value_->virtualAddress())));
}
delete deviceMemories_[i].value_;
}
}