Do not call malloc for Virtual Alloc mock.

Change-Id: Ic6689716c4f4cdfa8f18eaccb39e375f9f48b56c
Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
Michal Mrozek
2019-11-27 11:44:32 +01:00
committed by sys_ocldev
parent 8f6a390a2f
commit 0071964138
3 changed files with 5 additions and 3 deletions

View File

@@ -499,7 +499,7 @@ bool WddmMemoryManager::createWddmAllocation(WddmAllocation *allocation, void *r
}
bool WddmMemoryManager::mapGpuVaForOneHandleAllocation(WddmAllocation *allocation, const void *preferredGpuVirtualAddress) {
D3DGPU_VIRTUAL_ADDRESS addressToMap = reinterpret_cast<D3DGPU_VIRTUAL_ADDRESS>(preferredGpuVirtualAddress);
D3DGPU_VIRTUAL_ADDRESS addressToMap = castToUint64(const_cast<void *>(preferredGpuVirtualAddress));
auto heapIndex = selectHeap(allocation, preferredGpuVirtualAddress != nullptr, is32bit || executionEnvironment.isFullRangeSvm());
if (!executionEnvironment.isFullRangeSvm()) {
addressToMap = 0u;

View File

@@ -8,6 +8,7 @@
#pragma once
#include "core/memory_manager/host_ptr_defines.h"
#include "core/memory_manager/memory_constants.h"
#include "runtime/os_interface/windows/wddm/wddm.h"
#include "runtime/os_interface/windows/wddm_residency_allocations_container.h"
#include "runtime/os_interface/windows/windows_defs.h"
@@ -21,6 +22,8 @@
namespace NEO {
class GraphicsAllocation;
constexpr auto virtualAllocAddress = is64bit ? 0x7FFFF0000000 : 0xFF000000;
class WddmMock : public Wddm {
public:
using Wddm::adapter;

View File

@@ -12,12 +12,11 @@
namespace NEO {
BOOL WINAPI ULTVirtualFree(LPVOID ptr, SIZE_T size, DWORD flags) {
free(ptr);
return 1;
}
LPVOID WINAPI ULTVirtualAlloc(LPVOID inPtr, SIZE_T size, DWORD flags, DWORD type) {
return malloc(size);
return reinterpret_cast<LPVOID>(virtualAllocAddress);
}
Wddm::CreateDXGIFactoryFcn getCreateDxgiFactory() {