mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 05:56:36 +08:00
Set correct AllocationType in createGraphicsAllocationFromSharedHandle
Resolves: NEO-3077 Change-Id: I893544f4bfc19ffa8f49878bc9b44df4820cd619 Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
864360fa21
commit
7a7cb3d33a
@@ -10,6 +10,7 @@
|
||||
#include "runtime/gmm_helper/gmm.h"
|
||||
#include "runtime/gmm_helper/gmm_helper.h"
|
||||
#include "runtime/helpers/aligned_memory.h"
|
||||
#include "runtime/helpers/array_count.h"
|
||||
#include "runtime/mem_obj/buffer.h"
|
||||
#include "runtime/mem_obj/image.h"
|
||||
#include "runtime/mem_obj/mem_obj_helper.h"
|
||||
@@ -223,6 +224,32 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenCreateAllocationFromHa
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerSimpleTest, givenAllocationPropertiesWhenCreateAllocationFromHandleIsCalledThenCorrectAllocationTypeIsSet) {
|
||||
memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment));
|
||||
auto osHandle = 1u;
|
||||
gdi->getQueryResourceInfoArgOut().NumAllocations = 1;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(nullptr, 0, false));
|
||||
|
||||
D3DDDI_OPENALLOCATIONINFO allocationInfo;
|
||||
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
|
||||
allocationInfo.hAllocation = ALLOCATION_HANDLE;
|
||||
allocationInfo.PrivateDriverDataSize = sizeof(GMM_RESOURCE_INFO);
|
||||
|
||||
gdi->getOpenResourceArgOut().pOpenAllocationInfo = &allocationInfo;
|
||||
|
||||
AllocationProperties propertiesBuffer(false, 0, GraphicsAllocation::AllocationType::SHARED_BUFFER);
|
||||
AllocationProperties propertiesImage(false, 0, GraphicsAllocation::AllocationType::SHARED_IMAGE);
|
||||
|
||||
AllocationProperties *properties[2] = {&propertiesBuffer, &propertiesImage};
|
||||
|
||||
for (uint32_t i = 0; i < arrayCount(properties); i++) {
|
||||
auto allocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, *properties[i], false);
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(properties[i]->allocationType, allocation->getAllocationType());
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerSimpleTest, whenCreateAllocationFromHandleAndMapCallFailsThenFreeGraphicsMemoryIsCalled) {
|
||||
memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment));
|
||||
auto osHandle = 1u;
|
||||
@@ -456,6 +483,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromNTHandleIsCall
|
||||
ASSERT_NE(nullptr, gpuAllocation);
|
||||
EXPECT_EQ(NT_RESOURCE_HANDLE, wddmAlloc->resourceHandle);
|
||||
EXPECT_EQ(NT_ALLOCATION_HANDLE, wddmAlloc->getDefaultHandle());
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::SHARED_IMAGE, wddmAlloc->getAllocationType());
|
||||
|
||||
memoryManager->freeGraphicsMemory(gpuAllocation);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user