From c60364e1e061ec6578896a24f60941b7506edcaf Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Thu, 7 May 2020 20:31:29 -0500 Subject: [PATCH] Allow linear swizzle mode with tiled image requests. Mesa address lib faults if the only acceptable swizzle modes are forbidden. The old address lib simply ignored the forbidden list in this case. Mesa addrlib will not select linear unless there is no other option so allowing linear mode for tiled images will still use tiled modes when possible. Change-Id: I1aa44d072db902c968484dbff67b482af03b45d9 --- runtime/hsa-runtime/image/image_manager_ai.cpp | 7 +------ runtime/hsa-runtime/image/image_manager_kv.cpp | 7 +------ runtime/hsa-runtime/image/image_manager_nv.cpp | 7 +++---- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/runtime/hsa-runtime/image/image_manager_ai.cpp b/runtime/hsa-runtime/image/image_manager_ai.cpp index 3e5fc06858..ab790b3d41 100755 --- a/runtime/hsa-runtime/image/image_manager_ai.cpp +++ b/runtime/hsa-runtime/image/image_manager_ai.cpp @@ -516,19 +516,14 @@ uint32_t ImageManagerAi::GetAddrlibSurfaceInfoAi( prefSettingsInput.resourceLoction = ADDR_RSRC_LOC_UNDEF; prefSettingsInput.resourceType = in.resourceType; + // Disallow all swizzles but linear. if (tileMode == Image::TileMode::LINEAR) { - // this should force linear. prefSettingsInput.forbiddenBlock.macroThin4KB = 1; prefSettingsInput.forbiddenBlock.macroThick4KB = 1; prefSettingsInput.forbiddenBlock.macroThin64KB = 1; prefSettingsInput.forbiddenBlock.macroThick64KB = 1; } - else - { - // this should not allow linear. - prefSettingsInput.forbiddenBlock.linear = 1; - } prefSettingsInput.forbiddenBlock.micro = 1; // but don't ever allow the 256b swizzle modes prefSettingsInput.forbiddenBlock.var = 1; // and don't allow variable-size block modes diff --git a/runtime/hsa-runtime/image/image_manager_kv.cpp b/runtime/hsa-runtime/image/image_manager_kv.cpp index 11742cb7f4..8d40cd86a8 100755 --- a/runtime/hsa-runtime/image/image_manager_kv.cpp +++ b/runtime/hsa-runtime/image/image_manager_kv.cpp @@ -837,19 +837,14 @@ bool ImageManagerKv::GetAddrlibSurfaceInfo( prefSettingsInput.resourceLoction = ADDR_RSRC_LOC_UNDEF; prefSettingsInput.resourceType = in.resourceType; + // Disallow all swizzles but linear. if (tileMode == Image::TileMode::LINEAR) { - // this should force linear. prefSettingsInput.forbiddenBlock.macroThin4KB = 1; prefSettingsInput.forbiddenBlock.macroThick4KB = 1; prefSettingsInput.forbiddenBlock.macroThin64KB = 1; prefSettingsInput.forbiddenBlock.macroThick64KB = 1; } - else - { - // this should not allow linear. - prefSettingsInput.forbiddenBlock.linear = 1; - } prefSettingsInput.forbiddenBlock.micro = 1; // but don't ever allow the 256b swizzle modes prefSettingsInput.forbiddenBlock.var = 1; // and don't allow variable-size block modes diff --git a/runtime/hsa-runtime/image/image_manager_nv.cpp b/runtime/hsa-runtime/image/image_manager_nv.cpp index 0911e2ca82..5380e13375 100755 --- a/runtime/hsa-runtime/image/image_manager_nv.cpp +++ b/runtime/hsa-runtime/image/image_manager_nv.cpp @@ -629,8 +629,8 @@ uint32_t ImageManagerNv::GetAddrlibSurfaceInfoNv( prefSettingsInput.resourceLoction = ADDR_RSRC_LOC_UNDEF; prefSettingsInput.resourceType = in.resourceType; + // Disallow all swizzles but linear. if (tileMode == Image::TileMode::LINEAR) { - // this should force linear. prefSettingsInput.forbiddenBlock.macroThin4KB = 1; prefSettingsInput.forbiddenBlock.macroThick4KB = 1; prefSettingsInput.forbiddenBlock.macroThin64KB = 1; @@ -638,9 +638,8 @@ uint32_t ImageManagerNv::GetAddrlibSurfaceInfoNv( prefSettingsInput.forbiddenBlock.micro = 1; prefSettingsInput.forbiddenBlock.var = 1; } else { - // this should not allow linear. - prefSettingsInput.forbiddenBlock.linear = 1; - // Debug setting, simplifies buffer alignment. + // Debug setting, simplifies buffer alignment until language runtimes have official gfx10 + // support. prefSettingsInput.forbiddenBlock.macroThin64KB = 1; prefSettingsInput.forbiddenBlock.macroThick64KB = 1; }