| 1 |
/* |
| 2 |
* Copyright (C) 2023 Intel Corporation |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: MIT |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
#include "shared/source/execution_environment/root_device_environment.h" |
| 9 |
#include "shared/source/gmm_helper/gmm.h" |
| 10 |
#include "shared/source/gmm_helper/resource_info.h" |
| 11 |
#include "shared/source/helpers/surface_format_info.h" |
| 12 |
|
| 13 |
#include "opencl/source/cl_device/cl_device.h" |
| 14 |
#include "opencl/source/context/context.h" |
| 15 |
#include "opencl/source/sharings/unified/unified_image.h" |
| 16 |
|
| 17 |
namespace NEO { |
| 18 |
|
| 19 |
void *UnifiedImage::swapGmm(GraphicsAllocation *graphicsAllocation, Context *context, ImageInfo *imgInfo) { |
| 20 |
if (graphicsAllocation->getDefaultGmm()->gmmResourceInfo->getResourceType() == RESOURCE_BUFFER) { |
| 21 |
auto gmmHelper = context->getDevice(0)->getRootDeviceEnvironment().getGmmHelper(); |
| 22 |
auto gmm = std::make_unique<Gmm>(gmmHelper, *imgInfo, StorageInfo{}, false); |
| 23 |
gmm->updateImgInfoAndDesc(*imgInfo, 0, NEO::ImagePlane::noPlane); |
| 24 |
delete graphicsAllocation->getDefaultGmm(); |
| 25 |
graphicsAllocation->setDefaultGmm(gmm.release()); |
| 26 |
} |
| 27 |
|
| 28 |
return 0; |
| 29 |
} |
| 30 |
|
| 31 |
} // namespace NEO |