Files
compute-runtime/runtime/gmm_helper/resource_info_impl.cpp
Filip Hazubski 76638922bd Keep GmmClientContext in GmmResourceInfo deleter
Resolves: NEO-3575

Change-Id: I825a9acf993a46e6260bc7c77a955ed83da3b672
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
2019-09-22 08:46:33 -07:00

34 lines
1.0 KiB
C++

/*
* Copyright (C) 2018-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "runtime/gmm_helper/gmm_helper.h"
#include "runtime/gmm_helper/resource_info.h"
#include "gmm_client_context.h"
namespace NEO {
GmmResourceInfo::GmmResourceInfo(GMM_RESCREATE_PARAMS *resourceCreateParams) {
auto resourceInfoPtr = GmmHelper::getClientContext()->createResInfoObject(resourceCreateParams);
createResourceInfo(resourceInfoPtr);
}
GmmResourceInfo::GmmResourceInfo(GMM_RESOURCE_INFO *inputGmmResourceInfo) {
auto resourceInfoPtr = GmmHelper::getClientContext()->copyResInfoObject(inputGmmResourceInfo);
createResourceInfo(resourceInfoPtr);
}
void GmmResourceInfo::createResourceInfo(GMM_RESOURCE_INFO *resourceInfoPtr) {
auto gmmClientContext = GmmHelper::getClientContext();
auto customDeleter = [gmmClientContext](GMM_RESOURCE_INFO *gmmResourceInfo) {
gmmClientContext->destroyResInfoObject(gmmResourceInfo);
};
this->resourceInfo = UniquePtrType(resourceInfoPtr, customDeleter);
}
} // namespace NEO