refactor: move gmm client context initialization to separate file

Related-To: NEO-11080

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2025-10-24 10:42:02 +00:00
committed by Compute-Runtime-Automation
parent ff48090c11
commit cf4e6858fa
4 changed files with 59 additions and 45 deletions

View File

@@ -6,7 +6,8 @@
set(NEO_CORE_GMM_HELPER_CLIENT_CONTEXT
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/gmm_client_context.cpp
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}gmm_client_context.cpp
${CMAKE_CURRENT_SOURCE_DIR}/gmm_client_context_base.cpp
${CMAKE_CURRENT_SOURCE_DIR}/gmm_client_context_${DRIVER_MODEL}.cpp
${CMAKE_CURRENT_SOURCE_DIR}/gmm_client_context.h
${CMAKE_CURRENT_SOURCE_DIR}/map_gpu_va_gmm.h

View File

@@ -9,7 +9,6 @@
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/gmm_helper/client_context/gmm_handle_allocator.h"
#include "shared/source/gmm_helper/gmm_interface.h"
#include "shared/source/helpers/debug_helpers.h"
#include "shared/source/helpers/hw_info.h"
@@ -17,8 +16,6 @@
#include "shared/source/sku_info/operations/sku_info_transfer.h"
namespace NEO {
GmmClientContext::GmmClientContext() = default;
GmmClientContext::~GmmClientContext() = default;
void GmmClientContext::initialize(const RootDeviceEnvironment &rootDeviceEnvironment) {
auto hardwareInfo = rootDeviceEnvironment.getHardwareInfo();
@@ -57,44 +54,4 @@ void GmmClientContext::initialize(const RootDeviceEnvironment &rootDeviceEnviron
clientContext = {outArgs.pGmmClientContext, deleter};
}
MEMORY_OBJECT_CONTROL_STATE GmmClientContext::cachePolicyGetMemoryObject(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE usage) {
return clientContext->CachePolicyGetMemoryObject(pResInfo, usage);
}
GMM_RESOURCE_INFO *GmmClientContext::createResInfoObject(GMM_RESCREATE_PARAMS *pCreateParams) {
return clientContext->CreateResInfoObject(pCreateParams);
}
GMM_RESOURCE_INFO *GmmClientContext::copyResInfoObject(GMM_RESOURCE_INFO *pSrcRes) {
return clientContext->CopyResInfoObject(pSrcRes);
}
void GmmClientContext::destroyResInfoObject(GMM_RESOURCE_INFO *pResInfo) {
clientContext->DestroyResInfoObject(pResInfo);
}
GMM_CLIENT_CONTEXT *GmmClientContext::getHandle() const {
return clientContext.get();
}
uint8_t GmmClientContext::getSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT format) {
return clientContext->GetSurfaceStateCompressionFormat(format);
}
uint8_t GmmClientContext::getMediaSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT format) {
return clientContext->GetMediaSurfaceStateCompressionFormat(format);
}
uint32_t GmmClientContext::cachePolicyGetPATIndex(GMM_RESOURCE_INFO *gmmResourceInfo, GMM_RESOURCE_USAGE_TYPE usage, bool compressed, bool cacheable) {
bool outValue = compressed;
uint32_t patIndex = clientContext->CachePolicyGetPATIndex(gmmResourceInfo, usage, &outValue, cacheable);
DEBUG_BREAK_IF(outValue != compressed);
return patIndex;
}
void GmmClientContext::setHandleAllocator(std::unique_ptr<GmmHandleAllocator> allocator) {
this->handleAllocator = std::move(allocator);
}
} // namespace NEO

View File

@@ -0,0 +1,56 @@
/*
* Copyright (C) 2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/gmm_helper/client_context/gmm_client_context.h"
#include "shared/source/gmm_helper/client_context/gmm_handle_allocator.h"
#include "shared/source/helpers/debug_helpers.h"
namespace NEO {
GmmClientContext::GmmClientContext() = default;
GmmClientContext::~GmmClientContext() = default;
MEMORY_OBJECT_CONTROL_STATE GmmClientContext::cachePolicyGetMemoryObject(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE usage) {
return clientContext->CachePolicyGetMemoryObject(pResInfo, usage);
}
GMM_RESOURCE_INFO *GmmClientContext::createResInfoObject(GMM_RESCREATE_PARAMS *pCreateParams) {
return clientContext->CreateResInfoObject(pCreateParams);
}
GMM_RESOURCE_INFO *GmmClientContext::copyResInfoObject(GMM_RESOURCE_INFO *pSrcRes) {
return clientContext->CopyResInfoObject(pSrcRes);
}
void GmmClientContext::destroyResInfoObject(GMM_RESOURCE_INFO *pResInfo) {
clientContext->DestroyResInfoObject(pResInfo);
}
GMM_CLIENT_CONTEXT *GmmClientContext::getHandle() const {
return clientContext.get();
}
uint8_t GmmClientContext::getSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT format) {
return clientContext->GetSurfaceStateCompressionFormat(format);
}
uint8_t GmmClientContext::getMediaSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT format) {
return clientContext->GetMediaSurfaceStateCompressionFormat(format);
}
uint32_t GmmClientContext::cachePolicyGetPATIndex(GMM_RESOURCE_INFO *gmmResourceInfo, GMM_RESOURCE_USAGE_TYPE usage, bool compressed, bool cacheable) {
bool outValue = compressed;
uint32_t patIndex = clientContext->CachePolicyGetPATIndex(gmmResourceInfo, usage, &outValue, cacheable);
DEBUG_BREAK_IF(outValue != compressed);
return patIndex;
}
void GmmClientContext::setHandleAllocator(std::unique_ptr<GmmHandleAllocator> allocator) {
this->handleAllocator = std::move(allocator);
}
} // namespace NEO