2018-05-06 03:30:37 +08:00
|
|
|
/*
|
2021-05-19 06:30:46 +08:00
|
|
|
* Copyright (C) 2018-2021 Intel Corporation
|
2018-09-18 15:11:08 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
2018-05-06 03:30:37 +08:00
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/gmm_helper/windows/gmm_memory_base.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2021-06-29 01:36:16 +08:00
|
|
|
#include "shared/source/gmm_helper/client_context/gmm_client_context.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/helpers/debug_helpers.h"
|
|
|
|
#include "shared/source/os_interface/windows/windows_defs.h"
|
2018-05-06 03:30:37 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2020-01-24 22:03:28 +08:00
|
|
|
GmmMemoryBase::GmmMemoryBase(GmmClientContext *gmmClientContext) : clientContext(*gmmClientContext->getHandle()) {
|
2018-07-03 16:00:12 +08:00
|
|
|
}
|
2018-08-23 17:29:39 +08:00
|
|
|
|
|
|
|
bool GmmMemoryBase::configureDevice(GMM_ESCAPE_HANDLE hAdapter,
|
|
|
|
GMM_ESCAPE_HANDLE hDevice,
|
|
|
|
GMM_ESCAPE_FUNC_TYPE pfnEscape,
|
2021-06-11 03:43:22 +08:00
|
|
|
GMM_GFX_SIZE_T svmSize,
|
|
|
|
BOOLEAN bdwL3Coherency,
|
2019-12-23 21:28:33 +08:00
|
|
|
uintptr_t &minAddress,
|
|
|
|
bool obtainMinAddress) {
|
2018-08-23 17:29:39 +08:00
|
|
|
minAddress = windowsMinAddress;
|
2021-06-11 03:43:22 +08:00
|
|
|
auto retVal = configureDeviceAddressSpace(hAdapter, hDevice, pfnEscape, svmSize, bdwL3Coherency);
|
2019-12-23 21:28:33 +08:00
|
|
|
if (obtainMinAddress) {
|
|
|
|
minAddress = getInternalGpuVaRangeLimit();
|
|
|
|
}
|
|
|
|
return retVal;
|
|
|
|
}
|
|
|
|
uintptr_t GmmMemoryBase::getInternalGpuVaRangeLimit() {
|
2020-01-24 22:03:28 +08:00
|
|
|
return static_cast<uintptr_t>(clientContext.GetInternalGpuVaRangeLimit());
|
2019-12-23 21:28:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool GmmMemoryBase::setDeviceInfo(GMM_DEVICE_INFO *deviceInfo) {
|
2020-01-24 22:03:28 +08:00
|
|
|
auto status = clientContext.GmmSetDeviceInfo(deviceInfo);
|
2019-12-23 21:28:33 +08:00
|
|
|
DEBUG_BREAK_IF(status != GMM_SUCCESS);
|
|
|
|
return GMM_SUCCESS == status;
|
2018-05-06 03:30:37 +08:00
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
}; // namespace NEO
|