mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 22:43:00 +08:00
add method for setting allocation priority
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
9a22d06efe
commit
c5546a5cfb
@@ -301,6 +301,17 @@ void WddmMock::createPagingFenceLogger() {
|
||||
}
|
||||
}
|
||||
|
||||
bool WddmMock::setAllocationPriority(const D3DKMT_HANDLE *handles, uint32_t allocationCount, uint32_t priority) {
|
||||
if (callBaseSetAllocationPriority) {
|
||||
auto status = Wddm::setAllocationPriority(handles, allocationCount, priority);
|
||||
setAllocationPriorityResult.success = status;
|
||||
setAllocationPriorityResult.called++;
|
||||
setAllocationPriorityResult.uint64ParamPassed = priority;
|
||||
return status;
|
||||
}
|
||||
return setAllocationPriorityResult.success;
|
||||
}
|
||||
|
||||
void *GmockWddm::virtualAllocWrapper(void *inPtr, size_t size, uint32_t flags, uint32_t type) {
|
||||
void *tmp = reinterpret_cast<void *>(virtualAllocAddress);
|
||||
size += MemoryConstants::pageSize;
|
||||
|
||||
@@ -96,6 +96,7 @@ class WddmMock : public Wddm {
|
||||
}
|
||||
return verifyAdapterLuidReturnValue;
|
||||
}
|
||||
bool setAllocationPriority(const D3DKMT_HANDLE *handles, uint32_t allocationCount, uint32_t priority) override;
|
||||
|
||||
bool configureDeviceAddressSpace() {
|
||||
configureDeviceAddressSpaceResult.called++;
|
||||
@@ -147,6 +148,7 @@ class WddmMock : public Wddm {
|
||||
WddmMockHelpers::CallResult getPagingFenceAddressResult;
|
||||
WddmMockHelpers::CallResult reserveGpuVirtualAddressResult;
|
||||
WddmMockHelpers::CallResult waitOnPagingFenceFromCpuResult;
|
||||
WddmMockHelpers::CallResult setAllocationPriorityResult;
|
||||
|
||||
NTSTATUS createAllocationStatus = STATUS_SUCCESS;
|
||||
bool verifyAdapterLuidReturnValue = true;
|
||||
@@ -163,6 +165,7 @@ class WddmMock : public Wddm {
|
||||
bool callBaseMakeResident = true;
|
||||
bool callBaseCreatePagingLogger = true;
|
||||
bool shutdownStatus = false;
|
||||
bool callBaseSetAllocationPriority = true;
|
||||
};
|
||||
|
||||
struct GmockWddm : WddmMock {
|
||||
|
||||
@@ -49,6 +49,8 @@ struct GdiDllFixture {
|
||||
reinterpret_cast<decltype(&getCreateSynchronizationObject2FailCall)>(mockGdiDll->getProcAddress("getCreateSynchronizationObject2FailCall"));
|
||||
getRegisterTrimNotificationFailCallFcn =
|
||||
reinterpret_cast<decltype(&getRegisterTrimNotificationFailCall)>(mockGdiDll->getProcAddress("getRegisterTrimNotificationFailCall"));
|
||||
getLastPriorityFcn =
|
||||
reinterpret_cast<decltype(&getLastPriority)>(mockGdiDll->getProcAddress("getLastPriority"));
|
||||
setMockLastDestroyedResHandleFcn((D3DKMT_HANDLE)0);
|
||||
*getDestroySynchronizationObjectDataFcn() = {};
|
||||
*getCreateSynchronizationObject2FailCallFcn() = false;
|
||||
@@ -86,4 +88,5 @@ struct GdiDllFixture {
|
||||
decltype(&getMonitorFenceCpuFenceAddress) getMonitorFenceCpuFenceAddressFcn = nullptr;
|
||||
decltype(&getCreateSynchronizationObject2FailCall) getCreateSynchronizationObject2FailCallFcn = nullptr;
|
||||
decltype(&getRegisterTrimNotificationFailCall) getRegisterTrimNotificationFailCallFcn = nullptr;
|
||||
decltype(&getLastPriority) getLastPriorityFcn = nullptr;
|
||||
};
|
||||
|
||||
@@ -1533,3 +1533,23 @@ TEST(VerifyAdapterType, whenAdapterSupportsRenderThenCreateHwDeviceId) {
|
||||
auto hwDeviceId = createHwDeviceIdFromAdapterLuid(*osEnv, adapterLuid);
|
||||
EXPECT_NE(nullptr, hwDeviceId.get());
|
||||
}
|
||||
|
||||
TEST_F(WddmTestWithMockGdiDll, givenInvalidInputwhenSettingAllocationPriorityThenFalseIsReturned) {
|
||||
init();
|
||||
EXPECT_FALSE(wddm->setAllocationPriority(nullptr, 0, DXGI_RESOURCE_PRIORITY_MAXIMUM));
|
||||
EXPECT_FALSE(wddm->setAllocationPriority(nullptr, 5, DXGI_RESOURCE_PRIORITY_MAXIMUM));
|
||||
{
|
||||
D3DKMT_HANDLE handles[] = {ALLOCATION_HANDLE, 0};
|
||||
EXPECT_FALSE(wddm->setAllocationPriority(handles, 2, DXGI_RESOURCE_PRIORITY_MAXIMUM));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(WddmTestWithMockGdiDll, givenValidInputwhenSettingAllocationPriorityThenTrueIsReturned) {
|
||||
init();
|
||||
D3DKMT_HANDLE handles[] = {ALLOCATION_HANDLE, ALLOCATION_HANDLE + 1};
|
||||
EXPECT_TRUE(wddm->setAllocationPriority(handles, 2, DXGI_RESOURCE_PRIORITY_MAXIMUM));
|
||||
EXPECT_EQ(DXGI_RESOURCE_PRIORITY_MAXIMUM, getLastPriorityFcn());
|
||||
|
||||
EXPECT_TRUE(wddm->setAllocationPriority(handles, 2, DXGI_RESOURCE_PRIORITY_NORMAL));
|
||||
EXPECT_EQ(DXGI_RESOURCE_PRIORITY_NORMAL, getLastPriorityFcn());
|
||||
}
|
||||
Reference in New Issue
Block a user