mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 13:33:02 +08:00
Reorganization directory structure [3/n]
Change-Id: If3dfa3f6007f8810a6a1ae1a4f0c7da38544648d
This commit is contained in:
14
shared/source/gmm_helper/windows/gmm_memory.cpp
Normal file
14
shared/source/gmm_helper/windows/gmm_memory.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "gmm_memory.h"
|
||||
|
||||
namespace NEO {
|
||||
GmmMemory *GmmMemory::create(GmmClientContext *gmmClientContext) {
|
||||
return new GmmMemory(gmmClientContext);
|
||||
}
|
||||
} // namespace NEO
|
||||
20
shared/source/gmm_helper/windows/gmm_memory/gmm_memory.h
Normal file
20
shared/source/gmm_helper/windows/gmm_memory/gmm_memory.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "gmm_helper/windows/gmm_memory_base.h"
|
||||
|
||||
namespace NEO {
|
||||
class GmmMemory : public GmmMemoryBase {
|
||||
public:
|
||||
static GmmMemory *create(GmmClientContext *gmmClientContext);
|
||||
virtual ~GmmMemory() = default;
|
||||
|
||||
protected:
|
||||
using GmmMemoryBase::GmmMemoryBase;
|
||||
};
|
||||
} // namespace NEO
|
||||
58
shared/source/gmm_helper/windows/gmm_memory_base.cpp
Normal file
58
shared/source/gmm_helper/windows/gmm_memory_base.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "gmm_helper/windows/gmm_memory_base.h"
|
||||
|
||||
#include "helpers/debug_helpers.h"
|
||||
#include "os_interface/windows/windows_defs.h"
|
||||
|
||||
#include "gmm_client_context.h"
|
||||
|
||||
namespace NEO {
|
||||
GmmMemoryBase::GmmMemoryBase(GmmClientContext *gmmClientContext) : clientContext(*gmmClientContext->getHandle()) {
|
||||
}
|
||||
bool GmmMemoryBase::configureDeviceAddressSpace(GMM_ESCAPE_HANDLE hAdapter,
|
||||
GMM_ESCAPE_HANDLE hDevice,
|
||||
GMM_ESCAPE_FUNC_TYPE pfnEscape,
|
||||
GMM_GFX_SIZE_T SvmSize,
|
||||
BOOLEAN BDWL3Coherency) {
|
||||
return clientContext.ConfigureDeviceAddressSpace(
|
||||
{hAdapter},
|
||||
{hDevice},
|
||||
{pfnEscape},
|
||||
SvmSize,
|
||||
0,
|
||||
0,
|
||||
BDWL3Coherency,
|
||||
0,
|
||||
0) != 0;
|
||||
}
|
||||
|
||||
bool GmmMemoryBase::configureDevice(GMM_ESCAPE_HANDLE hAdapter,
|
||||
GMM_ESCAPE_HANDLE hDevice,
|
||||
GMM_ESCAPE_FUNC_TYPE pfnEscape,
|
||||
GMM_GFX_SIZE_T SvmSize,
|
||||
BOOLEAN BDWL3Coherency,
|
||||
uintptr_t &minAddress,
|
||||
bool obtainMinAddress) {
|
||||
minAddress = windowsMinAddress;
|
||||
auto retVal = configureDeviceAddressSpace(hAdapter, hDevice, pfnEscape, SvmSize, BDWL3Coherency);
|
||||
if (obtainMinAddress) {
|
||||
minAddress = getInternalGpuVaRangeLimit();
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
uintptr_t GmmMemoryBase::getInternalGpuVaRangeLimit() {
|
||||
return static_cast<uintptr_t>(clientContext.GetInternalGpuVaRangeLimit());
|
||||
}
|
||||
|
||||
bool GmmMemoryBase::setDeviceInfo(GMM_DEVICE_INFO *deviceInfo) {
|
||||
auto status = clientContext.GmmSetDeviceInfo(deviceInfo);
|
||||
DEBUG_BREAK_IF(status != GMM_SUCCESS);
|
||||
return GMM_SUCCESS == status;
|
||||
}
|
||||
}; // namespace NEO
|
||||
41
shared/source/gmm_helper/windows/gmm_memory_base.h
Normal file
41
shared/source/gmm_helper/windows/gmm_memory_base.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "gmm_helper/gmm_lib.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace NEO {
|
||||
class GmmClientContext;
|
||||
class GmmMemoryBase {
|
||||
public:
|
||||
virtual ~GmmMemoryBase() = default;
|
||||
|
||||
MOCKABLE_VIRTUAL bool configureDeviceAddressSpace(GMM_ESCAPE_HANDLE hAdapter,
|
||||
GMM_ESCAPE_HANDLE hDevice,
|
||||
GMM_ESCAPE_FUNC_TYPE pfnEscape,
|
||||
GMM_GFX_SIZE_T SvmSize,
|
||||
BOOLEAN BDWL3Coherency);
|
||||
|
||||
bool configureDevice(GMM_ESCAPE_HANDLE hAdapter,
|
||||
GMM_ESCAPE_HANDLE hDevice,
|
||||
GMM_ESCAPE_FUNC_TYPE pfnEscape,
|
||||
GMM_GFX_SIZE_T SvmSize,
|
||||
BOOLEAN BDWL3Coherency,
|
||||
uintptr_t &minAddress,
|
||||
bool obtainMinAddress);
|
||||
|
||||
MOCKABLE_VIRTUAL uintptr_t getInternalGpuVaRangeLimit();
|
||||
|
||||
MOCKABLE_VIRTUAL bool setDeviceInfo(GMM_DEVICE_INFO *deviceInfo);
|
||||
|
||||
protected:
|
||||
GmmMemoryBase(GmmClientContext *gmmClientContext);
|
||||
GMM_CLIENT_CONTEXT &clientContext;
|
||||
};
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user