From 71286be6ad3c40d3c4f3c5d93dcf6c0f05a54669 Mon Sep 17 00:00:00 2001 From: Maciej Plewka Date: Fri, 19 Apr 2024 10:25:07 +0000 Subject: [PATCH] fix: Pass umd type info to kmd Signed-off-by: Maciej Plewka --- shared/source/os_interface/windows/sharedata_wrapper.h | 1 + .../windows/wddm/init_context_private_data.cpp | 3 ++- .../test/unit_test/os_interface/windows/wddm_tests.cpp | 9 +++++++++ .../source/wsl_compute_helper_types_demarshall.h | 3 +++ .../source/wsl_compute_helper_types_marshall.h | 3 ++- .../source/wsl_compute_helper_types_tokens.h | 1 + .../source/wsl_compute_helper_types_tokens_structs.h | 1 + 7 files changed, 19 insertions(+), 2 deletions(-) diff --git a/shared/source/os_interface/windows/sharedata_wrapper.h b/shared/source/os_interface/windows/sharedata_wrapper.h index 14f76b1caf..c79977bad3 100644 --- a/shared/source/os_interface/windows/sharedata_wrapper.h +++ b/shared/source/os_interface/windows/sharedata_wrapper.h @@ -163,6 +163,7 @@ struct CREATECONTEXT_PVTDATA { // NOLINT(readability-identifier-naming) uint8_t IsMediaUsage; // NOLINT(readability-identifier-naming) uint8_t GpuVAContext; // NOLINT(readability-identifier-naming) BOOLEAN NoRingFlushes; // NOLINT(readability-identifier-naming) + uint32_t UmdContextType; // NOLINT(readability-identifier-naming) }; struct PLATFORM_KMD : PLATFORM_GMM { // NOLINT(readability-identifier-naming) diff --git a/shared/source/os_interface/windows/wddm/init_context_private_data.cpp b/shared/source/os_interface/windows/wddm/init_context_private_data.cpp index c1e8a2ef6f..dfab5b315d 100644 --- a/shared/source/os_interface/windows/wddm/init_context_private_data.cpp +++ b/shared/source/os_interface/windows/wddm/init_context_private_data.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -16,6 +16,7 @@ CREATECONTEXT_PVTDATA initPrivateData(OsContextWin &osContext) { privateData.IsDwm = FALSE; privateData.GpuVAContext = TRUE; privateData.IsMediaUsage = false; + privateData.UmdContextType = UMD_OCL; return privateData; } diff --git a/shared/test/unit_test/os_interface/windows/wddm_tests.cpp b/shared/test/unit_test/os_interface/windows/wddm_tests.cpp index 57a40207ef..b4246539c5 100644 --- a/shared/test/unit_test/os_interface/windows/wddm_tests.cpp +++ b/shared/test/unit_test/os_interface/windows/wddm_tests.cpp @@ -89,6 +89,15 @@ TEST_F(WddmTests, whenCreatingContextWithPowerHintSuccessIsReturned) { EXPECT_TRUE(wddm->createContext(*newContext)); } +TEST_F(WddmTests, whenCreatingContextThenUmdTypeInPrivateDataIsSetToOpenCL) { + init(); + auto newContext = osContext.get(); + wddm->createContext(*newContext); + auto data = getCreateContextDataFcn(); + auto umdType = reinterpret_cast(data->pPrivateDriverData)->UmdContextType; + EXPECT_EQ(umdType, UMD_OCL); +} + TEST_F(WddmTests, whenftrEuDebugIsFalseThenDebuggingEnabledReturnsFalse) { init(); EXPECT_FALSE(wddm->isDebugAttachAvailable()); diff --git a/shared/wsl_compute_helper/source/wsl_compute_helper_types_demarshall.h b/shared/wsl_compute_helper/source/wsl_compute_helper_types_demarshall.h index 9a7b2a461f..5ba9e7dc05 100644 --- a/shared/wsl_compute_helper/source/wsl_compute_helper_types_demarshall.h +++ b/shared/wsl_compute_helper/source/wsl_compute_helper_types_demarshall.h @@ -4564,6 +4564,9 @@ struct Demarshaller { case TOK_FBC_CREATECONTEXT_PVTDATA__GPU_VACONTEXT: { dst.GpuVAContext = readTokValue(*tok); } break; + case TOK_FBD_CREATECONTEXT_PVTDATA__UMD_CONTEXT_TYPE: { + dst.UmdContextType = readTokValue(*tok); + } break; case TOK_FBC_CREATECONTEXT_PVTDATA__NO_RING_FLUSHES: { dst.NoRingFlushes = readTokValue(*tok); } break; diff --git a/shared/wsl_compute_helper/source/wsl_compute_helper_types_marshall.h b/shared/wsl_compute_helper/source/wsl_compute_helper_types_marshall.h index 6328be02b8..cde94ee7e6 100644 --- a/shared/wsl_compute_helper/source/wsl_compute_helper_types_marshall.h +++ b/shared/wsl_compute_helper/source/wsl_compute_helper_types_marshall.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2023 Intel Corporation + * Copyright (C) 2021-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -2343,6 +2343,7 @@ inline void marshall(TOKSTR__CREATECONTEXT_PVTDATA &dst, const _CREATECONTEXT_PV dst.IsMediaUsage.setValue(src.IsMediaUsage); dst.GpuVAContext.setValue(src.GpuVAContext); dst.NoRingFlushes.setValue(src.NoRingFlushes); + dst.UmdContextType.setValue(src.UmdContextType); } template <> struct Marshaller { diff --git a/shared/wsl_compute_helper/source/wsl_compute_helper_types_tokens.h b/shared/wsl_compute_helper/source/wsl_compute_helper_types_tokens.h index 8f1139e7a6..cf75c3bb1e 100644 --- a/shared/wsl_compute_helper/source/wsl_compute_helper_types_tokens.h +++ b/shared/wsl_compute_helper/source/wsl_compute_helper_types_tokens.h @@ -875,6 +875,7 @@ enum TOK : uint32_t { TOK_FS_TIME_STAMP_DATA_HEADER__M_HEADER = 3986, TOK_FS_TIME_STAMP_DATA_HEADER__M_DATA = 3987, TOK_FS_GMM_TEXTURE_INFO_REC____PLATFORM = 3988, // !(_DEBUG || _RELEASE_INTERNAL) + TOK_FBD_CREATECONTEXT_PVTDATA__UMD_CONTEXT_TYPE = 4271, TOK_FBD_GMM_RESOURCE_FLAG_REC__ANONYMOUS12521__DENIABLE_LOCAL_ONLY_FOR_COMPRESSION = 4283, //------------------- diff --git a/shared/wsl_compute_helper/source/wsl_compute_helper_types_tokens_structs.h b/shared/wsl_compute_helper/source/wsl_compute_helper_types_tokens_structs.h index 1ce897e109..709994ab00 100644 --- a/shared/wsl_compute_helper/source/wsl_compute_helper_types_tokens_structs.h +++ b/shared/wsl_compute_helper/source/wsl_compute_helper_types_tokens_structs.h @@ -1037,6 +1037,7 @@ struct TOKSTR__CREATECONTEXT_PVTDATA { TokenDword IsMediaUsage = {TOK_FBC_CREATECONTEXT_PVTDATA__IS_MEDIA_USAGE}; TokenDword GpuVAContext = {TOK_FBC_CREATECONTEXT_PVTDATA__GPU_VACONTEXT}; TokenDword NoRingFlushes = {TOK_FBC_CREATECONTEXT_PVTDATA__NO_RING_FLUSHES}; + TokenDword UmdContextType = {TOK_FBD_CREATECONTEXT_PVTDATA__UMD_CONTEXT_TYPE}; }; static_assert(std::is_standard_layout_v, ""); static_assert(sizeof(TOKSTR__CREATECONTEXT_PVTDATA) % sizeof(uint32_t) == 0, "");