fix: properly set ReadOnly flag for D3DKMTCreateAllocation2

This is an OS behavior to have failed an allocation with a
const buffer backing storage (PAGE_READONLY attribute set)
ReadOnly flag allows to create allocation with read-only
backing storage

Related-To: NEO-9664, HSD-16021966023

Signed-off-by: Igor Venevtsev <igor.venevtsev@intel.com>
This commit is contained in:
Igor Venevtsev
2024-04-19 09:51:16 +00:00
committed by Compute-Runtime-Automation
parent c60b19a8ba
commit 6425afc548
16 changed files with 184 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
* Copyright (C) 2021-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -65,6 +65,7 @@ struct MockWddmLinux : NEO::Wddm {
using Wddm::gfxPartition;
using Wddm::gfxPlatform;
using Wddm::gmmMemory;
using Wddm::isReadOnlyMemory;
};
struct MockGmmMemoryWddmLinux : NEO::GmmMemory {
@@ -795,6 +796,16 @@ TEST_F(WddmLinuxTest, whenCheckedIfResourcesCleanupCanBeSkippedAndDeviceIsLostTh
EXPECT_EQ(1, gdiMockConfig.getDeviceStateClb.callCount);
}
TEST_F(WddmLinuxTest, whenIsReadOnlyMemoryCalledThenCorrectValueReturned) {
EXPECT_FALSE(wddm->isReadOnlyMemory(nullptr));
static int mem[10];
EXPECT_FALSE(wddm->isReadOnlyMemory(mem));
static const int constMem[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
EXPECT_FALSE(wddm->isReadOnlyMemory(constMem));
}
class MockOsTimeLinux : public NEO::OSTimeLinux {
public:
MockOsTimeLinux(NEO::OSInterface &osInterface, std::unique_ptr<NEO::DeviceTime> deviceTime) : NEO::OSTimeLinux(osInterface, std::move(deviceTime)) {}