2018-05-06 03:30:37 +08:00
|
|
|
/*
|
2019-02-27 18:39:32 +08:00
|
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
2018-09-18 15:11:08 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
2018-05-06 03:30:37 +08:00
|
|
|
|
2019-12-04 19:36:16 +08:00
|
|
|
#include "core/gmm_helper/gmm_helper.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
#include "runtime/gmm_helper/resource_info.h"
|
|
|
|
|
|
|
|
#include "gmm_client_context.h"
|
2018-05-06 03:30:37 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2018-05-06 03:30:37 +08:00
|
|
|
|
2019-12-30 21:14:27 +08:00
|
|
|
GmmResourceInfo::GmmResourceInfo(GmmClientContext *clientContext, GMM_RESCREATE_PARAMS *resourceCreateParams) : clientContext(clientContext) {
|
|
|
|
auto resourceInfoPtr = clientContext->createResInfoObject(resourceCreateParams);
|
2019-09-20 21:37:58 +08:00
|
|
|
createResourceInfo(resourceInfoPtr);
|
2018-05-06 03:30:37 +08:00
|
|
|
}
|
|
|
|
|
2019-12-30 21:14:27 +08:00
|
|
|
GmmResourceInfo::GmmResourceInfo(GmmClientContext *clientContext, GMM_RESOURCE_INFO *inputGmmResourceInfo) : clientContext(clientContext) {
|
|
|
|
auto resourceInfoPtr = clientContext->copyResInfoObject(inputGmmResourceInfo);
|
2019-09-20 21:37:58 +08:00
|
|
|
createResourceInfo(resourceInfoPtr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GmmResourceInfo::createResourceInfo(GMM_RESOURCE_INFO *resourceInfoPtr) {
|
2019-12-30 21:14:27 +08:00
|
|
|
auto customDeleter = [this](GMM_RESOURCE_INFO *gmmResourceInfo) {
|
|
|
|
this->clientContext->destroyResInfoObject(gmmResourceInfo);
|
2019-09-20 21:37:58 +08:00
|
|
|
};
|
|
|
|
this->resourceInfo = UniquePtrType(resourceInfoPtr, customDeleter);
|
2018-05-06 03:30:37 +08:00
|
|
|
}
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|