diff --git a/shared/source/gmm_helper/gmm.cpp b/shared/source/gmm_helper/gmm.cpp index 7badc5ba79..ea867aa050 100644 --- a/shared/source/gmm_helper/gmm.cpp +++ b/shared/source/gmm_helper/gmm.cpp @@ -18,10 +18,11 @@ #include "shared/source/helpers/ptr_math.h" #include "shared/source/helpers/surface_format_info.h" #include "shared/source/memory_manager/allocation_type.h" +#include "shared/source/memory_manager/definitions/storage_info.h" namespace NEO { Gmm::Gmm(GmmHelper *gmmHelper, const void *alignedPtr, size_t alignedSize, size_t alignment, GMM_RESOURCE_USAGE_TYPE_ENUM gmmResourceUsage, - bool preferCompressed, StorageInfo storageInfo, bool allowLargePages) : gmmHelper(gmmHelper) { + bool preferCompressed, const StorageInfo &storageInfo, bool allowLargePages) : gmmHelper(gmmHelper) { resourceParams.Type = RESOURCE_BUFFER; resourceParams.Format = GMM_FORMAT_GENERIC_8BIT; resourceParams.BaseWidth64 = static_cast(alignedSize); @@ -69,7 +70,7 @@ Gmm::Gmm(GmmHelper *gmmHelper, GMM_RESOURCE_INFO *inputGmm, bool openingHandle) Gmm::~Gmm() = default; -Gmm::Gmm(GmmHelper *gmmHelper, ImageInfo &inputOutputImgInfo, StorageInfo storageInfo, bool preferCompressed) : gmmHelper(gmmHelper) { +Gmm::Gmm(GmmHelper *gmmHelper, ImageInfo &inputOutputImgInfo, const StorageInfo &storageInfo, bool preferCompressed) : gmmHelper(gmmHelper) { this->resourceParams = {}; setupImageResourceParams(inputOutputImgInfo, preferCompressed); applyMemoryFlags(storageInfo); @@ -333,7 +334,7 @@ uint32_t Gmm::getAuxQPitch() { return this->gmmResourceInfo->getAuxQPitch(); } -void Gmm::applyMemoryFlags(StorageInfo &storageInfo) { +void Gmm::applyMemoryFlags(const StorageInfo &storageInfo) { auto hardwareInfo = gmmHelper->getClientContext()->getHardwareInfo(); if (hardwareInfo->featureTable.flags.ftrLocalMemory) { diff --git a/shared/source/gmm_helper/gmm.h b/shared/source/gmm_helper/gmm.h index 7b9cbea00a..14e84ea8b0 100644 --- a/shared/source/gmm_helper/gmm.h +++ b/shared/source/gmm_helper/gmm.h @@ -7,7 +7,6 @@ #pragma once #include "shared/source/gmm_helper/gmm_lib.h" -#include "shared/source/memory_manager/definitions/storage_info.h" #include #include @@ -16,6 +15,7 @@ namespace NEO { enum class ImagePlane; struct HardwareInfo; struct ImageInfo; +struct StorageInfo; class GmmResourceInfo; class GmmHelper; @@ -23,17 +23,17 @@ class Gmm { public: virtual ~Gmm(); Gmm() = delete; - Gmm(GmmHelper *gmmHelper, ImageInfo &inputOutputImgInfo, StorageInfo storageInfo, bool preferCompressed); + Gmm(GmmHelper *gmmHelper, ImageInfo &inputOutputImgInfo, const StorageInfo &storageInfo, bool preferCompressed); Gmm(GmmHelper *gmmHelper, const void *alignedPtr, size_t alignedSize, size_t alignment, - GMM_RESOURCE_USAGE_TYPE_ENUM gmmResourceUsage, bool preferCompressed, StorageInfo storageInfo, bool allowLargePages); + GMM_RESOURCE_USAGE_TYPE_ENUM gmmResourceUsage, bool preferCompressed, const StorageInfo &storageInfo, bool allowLargePages); Gmm(GmmHelper *gmmHelper, GMM_RESOURCE_INFO *inputGmm); Gmm(GmmHelper *gmmHelper, GMM_RESOURCE_INFO *inputGmm, bool openingHandle); void queryImageParams(ImageInfo &inputOutputImgInfo); void applyAuxFlagsForBuffer(bool preferCompression); - void applyMemoryFlags(StorageInfo &storageInfo); - void applyAppResource(StorageInfo &storageInfo); + void applyMemoryFlags(const StorageInfo &storageInfo); + void applyAppResource(const StorageInfo &storageInfo); bool unifiedAuxTranslationCapable() const; bool hasMultisampleControlSurface() const; diff --git a/shared/source/gmm_helper/gmm_utils.cpp b/shared/source/gmm_helper/gmm_utils.cpp index 5ea1942008..d92880e487 100644 --- a/shared/source/gmm_helper/gmm_utils.cpp +++ b/shared/source/gmm_helper/gmm_utils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2021 Intel Corporation + * Copyright (C) 2020-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -12,4 +12,4 @@ using namespace NEO; void Gmm::applyExtraMemoryFlags(const StorageInfo &storageInfo) {} bool Gmm::extraMemoryFlagsRequired() { return false; } -void Gmm::applyAppResource(StorageInfo &storageInfo) {} +void Gmm::applyAppResource(const StorageInfo &storageInfo) {} diff --git a/shared/source/gmm_helper/resource_info_impl.cpp b/shared/source/gmm_helper/resource_info_impl.cpp index 71c87c6922..cb782b3c33 100644 --- a/shared/source/gmm_helper/resource_info_impl.cpp +++ b/shared/source/gmm_helper/resource_info_impl.cpp @@ -8,6 +8,7 @@ #include "shared/source/gmm_helper/client_context/gmm_client_context.h" #include "shared/source/gmm_helper/gmm_helper.h" #include "shared/source/gmm_helper/resource_info.h" +#include "shared/source/helpers/debug_helpers.h" namespace NEO { diff --git a/shared/source/os_interface/linux/page_table_manager_functions.cpp b/shared/source/os_interface/linux/page_table_manager_functions.cpp index 11aa95ddcd..cda937527c 100644 --- a/shared/source/os_interface/linux/page_table_manager_functions.cpp +++ b/shared/source/os_interface/linux/page_table_manager_functions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 Intel Corporation + * Copyright (C) 2019-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -8,6 +8,7 @@ #include "shared/source/gmm_helper/client_context/gmm_client_context.h" #include "shared/source/gmm_helper/gmm_helper.h" #include "shared/source/gmm_helper/page_table_mngr.h" +#include "shared/source/helpers/debug_helpers.h" namespace NEO { GmmPageTableMngr::GmmPageTableMngr(GmmClientContext *gmmClientContext, unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb) : clientContext(gmmClientContext->getHandle()) { diff --git a/shared/test/common/fixtures/windows/memory_allocator_multi_device_fixture_windows.cpp b/shared/test/common/fixtures/windows/memory_allocator_multi_device_fixture_windows.cpp index fe1bf16588..938b3eecea 100644 --- a/shared/test/common/fixtures/windows/memory_allocator_multi_device_fixture_windows.cpp +++ b/shared/test/common/fixtures/windows/memory_allocator_multi_device_fixture_windows.cpp @@ -7,6 +7,7 @@ #include "shared/source/execution_environment/root_device_environment.h" #include "shared/source/gmm_helper/resource_info.h" +#include "shared/source/memory_manager/definitions/storage_info.h" #include "shared/source/os_interface/os_interface.h" #include "shared/source/os_interface/windows/os_environment_win.h" #include "shared/test/common/fixtures/memory_allocator_multi_device_fixture.h" @@ -23,9 +24,9 @@ void MemoryAllocatorMultiDeviceSystemSpecificFixture::SetUp(ExecutionEnvironment gdi->getOpenResourceArgOut().pOpenAllocationInfo = &allocationInfo; auto osEnvironment = new OsEnvironmentWin(); osEnvironment->gdi.reset(gdi); - for (auto i = 0u; i < executionEnvironment.rootDeviceEnvironments.size(); i++) { - gmm = std::make_unique(executionEnvironment.rootDeviceEnvironments[i]->getGmmHelper(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); - auto wddm = static_cast(executionEnvironment.rootDeviceEnvironments[i]->osInterface->getDriverModel()->as()); + for (const auto &rootDeviceEnvironment : executionEnvironment.rootDeviceEnvironments) { + gmm = std::make_unique(rootDeviceEnvironment->getGmmHelper(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true); + auto wddm = static_cast(rootDeviceEnvironment->osInterface->getDriverModel()->as()); wddm->hwDeviceId = std::make_unique(ADAPTER_HANDLE, LUID{}, osEnvironment, std::make_unique()); wddm->callBaseMapGpuVa = false; diff --git a/shared/test/unit_test/gmm_helper/gmm_resource_info_tests.cpp b/shared/test/unit_test/gmm_helper/gmm_resource_info_tests.cpp index e52db153d3..7dde6d2a9e 100644 --- a/shared/test/unit_test/gmm_helper/gmm_resource_info_tests.cpp +++ b/shared/test/unit_test/gmm_helper/gmm_resource_info_tests.cpp @@ -8,6 +8,7 @@ #include "shared/source/gmm_helper/client_context/gmm_handle_allocator.h" #include "shared/source/gmm_helper/gmm_helper.h" #include "shared/source/gmm_helper/resource_info.h" +#include "shared/source/helpers/constants.h" #include "shared/test/common/helpers/default_hw_info.h" #include "shared/test/common/mocks/mock_gmm_client_context.h" #include "shared/test/common/mocks/mock_gmm_resource_info.h"