mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Wddm interface [3/n]: Improve constructing Wddm object
- Only Wddm object owns Gdi - Dont pass Gdi object to constructor - Move Wddm related files to new directory Change-Id: Iadd26634c7692db760d7d3367211c32d2c2c8121
This commit is contained in:

committed by
sys_ocldev

parent
06287af541
commit
bab9ad6cda
@ -55,7 +55,7 @@ set(RUNTIME_SRCS_DLL_WINDOWS
|
|||||||
${IGDRCL_SOURCE_DIR}/runtime/gmm_helper/gmm_memory.cpp
|
${IGDRCL_SOURCE_DIR}/runtime/gmm_helper/gmm_memory.cpp
|
||||||
${IGDRCL_SOURCE_DIR}/runtime/gmm_helper/page_table_mngr.cpp
|
${IGDRCL_SOURCE_DIR}/runtime/gmm_helper/page_table_mngr.cpp
|
||||||
${IGDRCL_SOURCE_DIR}/runtime/os_interface/windows/sys_calls.cpp
|
${IGDRCL_SOURCE_DIR}/runtime/os_interface/windows/sys_calls.cpp
|
||||||
${IGDRCL_SOURCE_DIR}/runtime/os_interface/windows/wddm_create.cpp
|
${IGDRCL_SOURCE_DIR}/runtime/os_interface/windows/wddm/wddm_create.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_sources(${NEO_DYNAMIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_DLL_BASE})
|
target_sources(${NEO_DYNAMIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_DLL_BASE})
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Intel Corporation
|
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@ -21,8 +21,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hw_cmds.h"
|
#include "hw_cmds.h"
|
||||||
#include "runtime/os_interface/windows/wddm.h"
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||||
#include "runtime/os_interface/windows/wddm.inl"
|
#include "runtime/os_interface/windows/wddm/wddm.inl"
|
||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Intel Corporation
|
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@ -21,8 +21,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hw_cmds.h"
|
#include "hw_cmds.h"
|
||||||
#include "runtime/os_interface/windows/wddm.h"
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||||
#include "runtime/os_interface/windows/wddm.inl"
|
#include "runtime/os_interface/windows/wddm/wddm.inl"
|
||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
|
|
||||||
|
@ -56,9 +56,6 @@ set(RUNTIME_SRCS_OS_INTERFACE_WINDOWS
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/source_level_debugger_windows.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/source_level_debugger_windows.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/sys_calls.h
|
${CMAKE_CURRENT_SOURCE_DIR}/sys_calls.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/thk_wrapper.h
|
${CMAKE_CURRENT_SOURCE_DIR}/thk_wrapper.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm.cpp
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm.h
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm.inl
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_32bit_memory.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/wddm_32bit_memory.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_allocation.h
|
${CMAKE_CURRENT_SOURCE_DIR}/wddm_allocation.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_device_command_stream.h
|
${CMAKE_CURRENT_SOURCE_DIR}/wddm_device_command_stream.h
|
||||||
@ -71,6 +68,9 @@ set(RUNTIME_SRCS_OS_INTERFACE_WINDOWS
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/windows_inc.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/windows_inc.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/windows_wrapper.h
|
${CMAKE_CURRENT_SOURCE_DIR}/windows_wrapper.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm.inl
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Intel Corporation
|
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@ -20,7 +20,7 @@
|
|||||||
* OTHER DEALINGS IN THE SOFTWARE.
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "runtime/os_interface/windows/wddm.h"
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||||
#include "runtime/os_interface/windows/deferrable_deletion_win.h"
|
#include "runtime/os_interface/windows/deferrable_deletion_win.h"
|
||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "runtime/os_interface/device_factory.h"
|
#include "runtime/os_interface/device_factory.h"
|
||||||
#include "runtime/os_interface/hw_info_config.h"
|
#include "runtime/os_interface/hw_info_config.h"
|
||||||
#include "runtime/os_interface/windows/os_interface.h"
|
#include "runtime/os_interface/windows/os_interface.h"
|
||||||
#include "runtime/os_interface/windows/wddm.h"
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Intel Corporation
|
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@ -20,7 +20,7 @@
|
|||||||
* OTHER DEALINGS IN THE SOFTWARE.
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "runtime/os_interface/windows/wddm.h"
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||||
#include "runtime/device/driver_info.h"
|
#include "runtime/device/driver_info.h"
|
||||||
#include "runtime/os_interface/windows/driver_info.h"
|
#include "runtime/os_interface/windows/driver_info.h"
|
||||||
#include "runtime/os_interface/windows/os_interface.h"
|
#include "runtime/os_interface/windows/os_interface.h"
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "os_interface.h"
|
#include "os_interface.h"
|
||||||
|
|
||||||
#include "runtime/os_interface/windows/wddm.h"
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||||
#include "runtime/os_interface/windows/sys_calls.h"
|
#include "runtime/os_interface/windows/sys_calls.h"
|
||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "runtime/os_interface/windows/wddm.h"
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||||
#include "runtime/os_interface/windows/os_interface.h"
|
#include "runtime/os_interface/windows/os_interface.h"
|
||||||
#include "runtime/os_interface/windows/os_time.h"
|
#include "runtime/os_interface/windows/os_time.h"
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
#include "runtime/gmm_helper/gmm_helper.h"
|
||||||
#include "runtime/gmm_helper/resource_info.h"
|
#include "runtime/gmm_helper/resource_info.h"
|
||||||
#include "runtime/gmm_helper/page_table_mngr.h"
|
#include "runtime/gmm_helper/page_table_mngr.h"
|
||||||
#include "runtime/os_interface/windows/wddm.h"
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||||
#include "runtime/os_interface/hw_info_config.h"
|
#include "runtime/os_interface/hw_info_config.h"
|
||||||
#include "runtime/os_interface/windows/wddm_allocation.h"
|
#include "runtime/os_interface/windows/wddm_allocation.h"
|
||||||
#include "runtime/os_interface/windows/registry_reader.h"
|
#include "runtime/os_interface/windows/registry_reader.h"
|
||||||
@ -53,18 +53,16 @@ Wddm::GetSystemInfoFcn Wddm::getSystemInfo = getGetSystemInfo();
|
|||||||
Wddm::VirtualAllocFcn Wddm::virtualAllocFnc = getVirtualAlloc();
|
Wddm::VirtualAllocFcn Wddm::virtualAllocFnc = getVirtualAlloc();
|
||||||
Wddm::VirtualFreeFcn Wddm::virtualFreeFnc = getVirtualFree();
|
Wddm::VirtualFreeFcn Wddm::virtualFreeFnc = getVirtualFree();
|
||||||
|
|
||||||
Wddm::Wddm(Gdi *gdi) : initialized(false),
|
Wddm::Wddm() : initialized(false),
|
||||||
gdiAllocated(false),
|
adapter(0),
|
||||||
gdi(gdi),
|
context(0),
|
||||||
adapter(0),
|
device(0),
|
||||||
context(0),
|
pagingQueue(0),
|
||||||
device(0),
|
pagingQueueSyncObject(0),
|
||||||
pagingQueue(0),
|
pagingFenceAddress(nullptr),
|
||||||
pagingQueueSyncObject(0),
|
currentPagingFenceValue(0),
|
||||||
pagingFenceAddress(nullptr),
|
hwContextId(0),
|
||||||
currentPagingFenceValue(0),
|
trimCallbackHandle(nullptr) {
|
||||||
hwContextId(0),
|
|
||||||
trimCallbackHandle(nullptr) {
|
|
||||||
featureTable.reset(new FeatureTable());
|
featureTable.reset(new FeatureTable());
|
||||||
waTable.reset(new WorkaroundTable());
|
waTable.reset(new WorkaroundTable());
|
||||||
gtSystemInfo.reset(new GT_SYSTEM_INFO);
|
gtSystemInfo.reset(new GT_SYSTEM_INFO);
|
||||||
@ -81,10 +79,7 @@ Wddm::Wddm(Gdi *gdi) : initialized(false),
|
|||||||
gmmMemory = std::unique_ptr<GmmMemory>(GmmMemory::create());
|
gmmMemory = std::unique_ptr<GmmMemory>(GmmMemory::create());
|
||||||
minAddress = 0;
|
minAddress = 0;
|
||||||
kmDafListener = std::unique_ptr<KmDafListener>(new KmDafListener);
|
kmDafListener = std::unique_ptr<KmDafListener>(new KmDafListener);
|
||||||
}
|
gdi = std::unique_ptr<Gdi>(new Gdi());
|
||||||
|
|
||||||
Wddm::Wddm() : Wddm(new Gdi()) {
|
|
||||||
gdiAllocated = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Wddm::~Wddm() {
|
Wddm::~Wddm() {
|
||||||
@ -95,8 +90,6 @@ Wddm::~Wddm() {
|
|||||||
destroyPagingQueue();
|
destroyPagingQueue();
|
||||||
destroyDevice();
|
destroyDevice();
|
||||||
closeAdapter();
|
closeAdapter();
|
||||||
if (gdiAllocated)
|
|
||||||
delete gdi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Wddm::enumAdapters(unsigned int devNum, HardwareInfo &outHardwareInfo) {
|
bool Wddm::enumAdapters(unsigned int devNum, HardwareInfo &outHardwareInfo) {
|
@ -50,19 +50,6 @@ struct WorkaroundTable;
|
|||||||
struct KmDafListener;
|
struct KmDafListener;
|
||||||
|
|
||||||
class Wddm {
|
class Wddm {
|
||||||
private:
|
|
||||||
struct MonitoredFence {
|
|
||||||
D3DKMT_HANDLE fenceHandle;
|
|
||||||
D3DGPU_VIRTUAL_ADDRESS gpuAddress;
|
|
||||||
volatile uint64_t *cpuAddress;
|
|
||||||
volatile uint64_t currentFenceValue;
|
|
||||||
uint64_t lastSubmittedFence;
|
|
||||||
};
|
|
||||||
|
|
||||||
protected:
|
|
||||||
Wddm();
|
|
||||||
Wddm(Gdi *gdi);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef HRESULT(WINAPI *CreateDXGIFactoryFcn)(REFIID riid, void **ppFactory);
|
typedef HRESULT(WINAPI *CreateDXGIFactoryFcn)(REFIID riid, void **ppFactory);
|
||||||
typedef void(WINAPI *GetSystemInfoFcn)(SYSTEM_INFO *pSystemInfo);
|
typedef void(WINAPI *GetSystemInfoFcn)(SYSTEM_INFO *pSystemInfo);
|
||||||
@ -71,7 +58,7 @@ class Wddm {
|
|||||||
|
|
||||||
virtual ~Wddm();
|
virtual ~Wddm();
|
||||||
|
|
||||||
static Wddm *createWddm(Gdi *gdi = nullptr);
|
static Wddm *createWddm();
|
||||||
|
|
||||||
static bool enumAdapters(unsigned int devNum, HardwareInfo &outHardwareInfo);
|
static bool enumAdapters(unsigned int devNum, HardwareInfo &outHardwareInfo);
|
||||||
|
|
||||||
@ -140,7 +127,7 @@ class Wddm {
|
|||||||
D3DKMT_HANDLE getDevice() const { return device; }
|
D3DKMT_HANDLE getDevice() const { return device; }
|
||||||
D3DKMT_HANDLE getPagingQueue() const { return pagingQueue; }
|
D3DKMT_HANDLE getPagingQueue() const { return pagingQueue; }
|
||||||
D3DKMT_HANDLE getPagingQueueSyncObject() const { return pagingQueueSyncObject; }
|
D3DKMT_HANDLE getPagingQueueSyncObject() const { return pagingQueueSyncObject; }
|
||||||
Gdi *getGdi() const { return gdi; }
|
Gdi *getGdi() const { return gdi.get(); }
|
||||||
|
|
||||||
PFND3DKMT_ESCAPE getEscapeHandle() const;
|
PFND3DKMT_ESCAPE getEscapeHandle() const;
|
||||||
|
|
||||||
@ -175,8 +162,7 @@ class Wddm {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool initialized;
|
bool initialized;
|
||||||
bool gdiAllocated;
|
std::unique_ptr<Gdi> gdi;
|
||||||
Gdi *gdi;
|
|
||||||
D3DKMT_HANDLE adapter;
|
D3DKMT_HANDLE adapter;
|
||||||
D3DKMT_HANDLE context;
|
D3DKMT_HANDLE context;
|
||||||
D3DKMT_HANDLE device;
|
D3DKMT_HANDLE device;
|
||||||
@ -208,6 +194,7 @@ class Wddm {
|
|||||||
std::unique_ptr<GmmMemory> gmmMemory;
|
std::unique_ptr<GmmMemory> gmmMemory;
|
||||||
uintptr_t minAddress;
|
uintptr_t minAddress;
|
||||||
|
|
||||||
|
Wddm();
|
||||||
MOCKABLE_VIRTUAL bool mapGpuVirtualAddressImpl(Gmm *gmm, D3DKMT_HANDLE handle, void *cpuPtr, uint64_t size, D3DGPU_VIRTUAL_ADDRESS &gpuPtr, bool allocation32bit, bool use64kbPages, bool useHeap1);
|
MOCKABLE_VIRTUAL bool mapGpuVirtualAddressImpl(Gmm *gmm, D3DKMT_HANDLE handle, void *cpuPtr, uint64_t size, D3DGPU_VIRTUAL_ADDRESS &gpuPtr, bool allocation32bit, bool use64kbPages, bool useHeap1);
|
||||||
MOCKABLE_VIRTUAL bool openAdapter();
|
MOCKABLE_VIRTUAL bool openAdapter();
|
||||||
bool createDevice();
|
bool createDevice();
|
@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "runtime/os_interface/windows/gdi_interface.h"
|
#include "runtime/os_interface/windows/gdi_interface.h"
|
||||||
#include "runtime/os_interface/windows/wddm.h"
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
|
|
@ -21,11 +21,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "runtime/gmm_helper/gmm_helper.h"
|
#include "runtime/gmm_helper/gmm_helper.h"
|
||||||
#include "runtime/os_interface/windows/wddm.h"
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||||
#include <dxgi.h>
|
#include <dxgi.h>
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
|
|
||||||
Wddm *Wddm::createWddm(Gdi *gdi) {
|
Wddm *Wddm::createWddm() {
|
||||||
return new Wddm();
|
return new Wddm();
|
||||||
}
|
}
|
||||||
|
|
@ -29,7 +29,7 @@
|
|||||||
#include "runtime/command_stream/preemption.h"
|
#include "runtime/command_stream/preemption.h"
|
||||||
#include "runtime/mem_obj/mem_obj.h"
|
#include "runtime/mem_obj/mem_obj.h"
|
||||||
#include "runtime/device/device.h"
|
#include "runtime/device/device.h"
|
||||||
#include "runtime/os_interface/windows/wddm.h"
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||||
#include "runtime/os_interface/windows/wddm_device_command_stream.h"
|
#include "runtime/os_interface/windows/wddm_device_command_stream.h"
|
||||||
#include "runtime/helpers/ptr_math.h"
|
#include "runtime/helpers/ptr_math.h"
|
||||||
#include "runtime/helpers/translationtable_callbacks.h"
|
#include "runtime/helpers/translationtable_callbacks.h"
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#include "runtime/helpers/engine_node.h"
|
#include "runtime/helpers/engine_node.h"
|
||||||
#include "runtime/helpers/hw_info.h"
|
#include "runtime/helpers/hw_info.h"
|
||||||
#include "runtime/os_interface/windows/wddm.h"
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#include "runtime/memory_manager/deferrable_deletion.h"
|
#include "runtime/memory_manager/deferrable_deletion.h"
|
||||||
#include "runtime/os_interface/windows/wddm_memory_manager.h"
|
#include "runtime/os_interface/windows/wddm_memory_manager.h"
|
||||||
#include "runtime/os_interface/windows/wddm_allocation.h"
|
#include "runtime/os_interface/windows/wddm_allocation.h"
|
||||||
#include "runtime/os_interface/windows/wddm.h"
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
|
@ -22,8 +22,19 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <d3dkmthk.h>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
|
|
||||||
constexpr uintptr_t windowsMinAddress = 0x200000;
|
constexpr uintptr_t windowsMinAddress = 0x200000;
|
||||||
|
|
||||||
|
struct MonitoredFence {
|
||||||
|
D3DKMT_HANDLE fenceHandle;
|
||||||
|
D3DGPU_VIRTUAL_ADDRESS gpuAddress;
|
||||||
|
volatile uint64_t *cpuAddress;
|
||||||
|
volatile uint64_t currentFenceValue;
|
||||||
|
uint64_t lastSubmittedFence;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace OCLRT
|
} // namespace OCLRT
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "runtime/os_interface/windows/wddm.h"
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
@ -57,7 +57,6 @@ class WddmMock : public Wddm {
|
|||||||
using Wddm::pagingQueue;
|
using Wddm::pagingQueue;
|
||||||
|
|
||||||
WddmMock() : Wddm(){};
|
WddmMock() : Wddm(){};
|
||||||
WddmMock(Gdi *gdi) : Wddm(gdi) {}
|
|
||||||
~WddmMock();
|
~WddmMock();
|
||||||
|
|
||||||
bool makeResident(D3DKMT_HANDLE *handles, uint32_t count, bool cantTrimFurther, uint64_t *numberOfBytesToTrim) override;
|
bool makeResident(D3DKMT_HANDLE *handles, uint32_t count, bool cantTrimFurther, uint64_t *numberOfBytesToTrim) override;
|
||||||
|
@ -96,13 +96,15 @@ class WddmCommandStreamWithMockGdiFixture {
|
|||||||
MemoryManager *memManager = nullptr;
|
MemoryManager *memManager = nullptr;
|
||||||
MockDevice *device = nullptr;
|
MockDevice *device = nullptr;
|
||||||
WddmMock *wddm = nullptr;
|
WddmMock *wddm = nullptr;
|
||||||
MockGdi gdi;
|
MockGdi *gdi = nullptr;
|
||||||
DebugManagerStateRestore stateRestore;
|
DebugManagerStateRestore stateRestore;
|
||||||
GraphicsAllocation *tagAllocation;
|
GraphicsAllocation *tagAllocation;
|
||||||
GraphicsAllocation *preemptionAllocation = nullptr;
|
GraphicsAllocation *preemptionAllocation = nullptr;
|
||||||
|
|
||||||
virtual void SetUp() {
|
virtual void SetUp() {
|
||||||
wddm = static_cast<WddmMock *>(Wddm::createWddm(&gdi));
|
wddm = static_cast<WddmMock *>(Wddm::createWddm());
|
||||||
|
gdi = new MockGdi();
|
||||||
|
wddm->gdi.reset(gdi);
|
||||||
ASSERT_NE(wddm, nullptr);
|
ASSERT_NE(wddm, nullptr);
|
||||||
DebugManager.flags.CsrDispatchMode.set(static_cast<uint32_t>(DispatchMode::ImmediateDispatch));
|
DebugManager.flags.CsrDispatchMode.set(static_cast<uint32_t>(DispatchMode::ImmediateDispatch));
|
||||||
csr = new WddmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>(*platformDevices[0], wddm);
|
csr = new WddmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>(*platformDevices[0], wddm);
|
||||||
@ -605,12 +607,12 @@ TEST_F(WddmCommandStreamMockGdiTest, FlushCallsWddmMakeResidentForResidencyAlloc
|
|||||||
|
|
||||||
EXPECT_EQ(1u, memManager->getResidencyAllocations().size());
|
EXPECT_EQ(1u, memManager->getResidencyAllocations().size());
|
||||||
|
|
||||||
gdi.getMakeResidentArg().NumAllocations = 0;
|
gdi->getMakeResidentArg().NumAllocations = 0;
|
||||||
|
|
||||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||||
csr->flush(batchBuffer, EngineType::ENGINE_RCS, nullptr);
|
csr->flush(batchBuffer, EngineType::ENGINE_RCS, nullptr);
|
||||||
|
|
||||||
EXPECT_NE(0u, gdi.getMakeResidentArg().NumAllocations);
|
EXPECT_NE(0u, gdi->getMakeResidentArg().NumAllocations);
|
||||||
|
|
||||||
memManager->freeGraphicsMemory(commandBuffer);
|
memManager->freeGraphicsMemory(commandBuffer);
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "unit_tests/os_interface/windows/hw_info_config_tests.h"
|
#include "unit_tests/os_interface/windows/hw_info_config_tests.h"
|
||||||
|
|
||||||
#include "runtime/os_interface/windows/os_interface.h"
|
#include "runtime/os_interface/windows/os_interface.h"
|
||||||
#include "runtime/os_interface/windows/wddm.h"
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||||
|
|
||||||
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
||||||
#include "unit_tests/libult/mock_gfx_family.h"
|
#include "unit_tests/libult/mock_gfx_family.h"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Intel Corporation
|
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "runtime/os_interface/windows/wddm.h"
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||||
#include "runtime/os_interface/windows/os_interface.h"
|
#include "runtime/os_interface/windows/os_interface.h"
|
||||||
#include "runtime/helpers/hw_info.h"
|
#include "runtime/helpers/hw_info.h"
|
||||||
#include "runtime/helpers/options.h"
|
#include "runtime/helpers/options.h"
|
||||||
|
@ -28,7 +28,6 @@ using namespace OCLRT;
|
|||||||
class WddmMockReserveAddress : public WddmMock {
|
class WddmMockReserveAddress : public WddmMock {
|
||||||
public:
|
public:
|
||||||
WddmMockReserveAddress() : WddmMock() {}
|
WddmMockReserveAddress() : WddmMock() {}
|
||||||
WddmMockReserveAddress(Gdi *gdi) : WddmMock(gdi) {}
|
|
||||||
|
|
||||||
void *virtualAlloc(void *inPtr, size_t size, unsigned long flags, unsigned long type) override {
|
void *virtualAlloc(void *inPtr, size_t size, unsigned long flags, unsigned long type) override {
|
||||||
if (returnGood != 0) {
|
if (returnGood != 0) {
|
||||||
|
@ -34,10 +34,8 @@ LPVOID WINAPI ULTVirtualAlloc(LPVOID inPtr, SIZE_T size, DWORD flags, DWORD type
|
|||||||
return malloc(size);
|
return malloc(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
Wddm *Wddm::createWddm(Gdi *gdi) {
|
Wddm *Wddm::createWddm() {
|
||||||
if (gdi == nullptr)
|
return new WddmMock();
|
||||||
return new WddmMock();
|
|
||||||
return new WddmMock(gdi);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Wddm::CreateDXGIFactoryFcn getCreateDxgiFactory() {
|
Wddm::CreateDXGIFactoryFcn getCreateDxgiFactory() {
|
||||||
|
@ -32,13 +32,15 @@
|
|||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
struct WddmFixture {
|
struct WddmFixture {
|
||||||
virtual void SetUp() {
|
virtual void SetUp() {
|
||||||
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm(&gdi)));
|
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm()));
|
||||||
|
gdi = new MockGdi();
|
||||||
|
wddm->gdi.reset(gdi);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown(){};
|
virtual void TearDown(){};
|
||||||
|
|
||||||
std::unique_ptr<WddmMock> wddm;
|
std::unique_ptr<WddmMock> wddm;
|
||||||
MockGdi gdi;
|
MockGdi *gdi = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct WddmFixtureWithMockGdiDll : public GdiDllFixture {
|
struct WddmFixtureWithMockGdiDll : public GdiDllFixture {
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
* OTHER DEALINGS IN THE SOFTWARE.
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "runtime/os_interface/windows/wddm.h"
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||||
#include "runtime/os_interface/windows/wddm_allocation.h"
|
#include "runtime/os_interface/windows/wddm_allocation.h"
|
||||||
#include "unit_tests/os_interface/windows/mock_kmdaf_listener.h"
|
#include "unit_tests/os_interface/windows/mock_kmdaf_listener.h"
|
||||||
#include "unit_tests/os_interface/windows/mock_gdi_interface.h"
|
#include "unit_tests/os_interface/windows/mock_gdi_interface.h"
|
||||||
@ -31,7 +31,9 @@ using namespace OCLRT;
|
|||||||
|
|
||||||
class WddmWithKmDafMock : public Wddm {
|
class WddmWithKmDafMock : public Wddm {
|
||||||
public:
|
public:
|
||||||
WddmWithKmDafMock(Gdi *gdi) : Wddm(gdi) {
|
using Wddm::gdi;
|
||||||
|
|
||||||
|
WddmWithKmDafMock() : Wddm() {
|
||||||
kmDafListener.reset(new KmDafListenerMock);
|
kmDafListener.reset(new KmDafListenerMock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,16 +53,13 @@ class WddmWithKmDafMock : public Wddm {
|
|||||||
class WddmKmDafListenerTest : public ::testing::Test {
|
class WddmKmDafListenerTest : public ::testing::Test {
|
||||||
public:
|
public:
|
||||||
void SetUp() {
|
void SetUp() {
|
||||||
wddmWithKmDafMock = new WddmWithKmDafMock(&gdi);
|
wddmWithKmDafMock.reset(new WddmWithKmDafMock());
|
||||||
|
wddmWithKmDafMock->gdi.reset(new MockGdi());
|
||||||
wddmWithKmDafMock->init<DEFAULT_TEST_FAMILY_NAME>();
|
wddmWithKmDafMock->init<DEFAULT_TEST_FAMILY_NAME>();
|
||||||
wddmWithKmDafMock->getFeatureTable()->ftrKmdDaf = true;
|
wddmWithKmDafMock->getFeatureTable()->ftrKmdDaf = true;
|
||||||
}
|
}
|
||||||
void TearDown() {
|
|
||||||
delete wddmWithKmDafMock;
|
|
||||||
}
|
|
||||||
|
|
||||||
WddmWithKmDafMock *wddmWithKmDafMock;
|
std::unique_ptr<WddmWithKmDafMock> wddmWithKmDafMock;
|
||||||
MockGdi gdi;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenLockResourceIsCalledThenKmDafListenerNotifyLockIsFedWithCorrectParams) {
|
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenLockResourceIsCalledThenKmDafListenerNotifyLockIsFedWithCorrectParams) {
|
||||||
|
@ -958,7 +958,7 @@ HWTEST_F(WddmMemoryManagerResidencyTest, makeResidentResidencyAllocationsMarksTr
|
|||||||
EXPECT_TRUE(allocationTriple->fragmentsStorage.fragmentStorageData[i].residency->resident);
|
EXPECT_TRUE(allocationTriple->fragmentsStorage.fragmentStorageData[i].residency->resident);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPECT_EQ(5u, gdi.getMakeResidentArg().NumAllocations);
|
EXPECT_EQ(5u, gdi->getMakeResidentArg().NumAllocations);
|
||||||
|
|
||||||
memoryManager->freeGraphicsMemory(allocationTriple);
|
memoryManager->freeGraphicsMemory(allocationTriple);
|
||||||
}
|
}
|
||||||
@ -986,9 +986,9 @@ HWTEST_F(WddmMemoryManagerResidencyTest, makeResidentResidencyAllocationsSetsLas
|
|||||||
|
|
||||||
HWTEST_F(WddmMemoryManagerResidencyTest, trimCallbackIsRegisteredInWddmMemoryManagerCtor) {
|
HWTEST_F(WddmMemoryManagerResidencyTest, trimCallbackIsRegisteredInWddmMemoryManagerCtor) {
|
||||||
SetUpMm<FamilyType>();
|
SetUpMm<FamilyType>();
|
||||||
EXPECT_EQ((PFND3DKMT_TRIMNOTIFICATIONCALLBACK)memoryManager->trimCallback, gdi.getRegisterTrimNotificationArg().Callback);
|
EXPECT_EQ((PFND3DKMT_TRIMNOTIFICATIONCALLBACK)memoryManager->trimCallback, gdi->getRegisterTrimNotificationArg().Callback);
|
||||||
EXPECT_EQ(reinterpret_cast<void *>(memoryManager.get()), gdi.getRegisterTrimNotificationArg().Context);
|
EXPECT_EQ(reinterpret_cast<void *>(memoryManager.get()), gdi->getRegisterTrimNotificationArg().Context);
|
||||||
EXPECT_EQ(wddm->getDevice(), gdi.getRegisterTrimNotificationArg().hDevice);
|
EXPECT_EQ(wddm->getDevice(), gdi->getRegisterTrimNotificationArg().hDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(WddmMemoryManagerResidencyTest, givenNotUsedAllocationsFromPreviousPeriodicTrimWhenTrimResidencyPeriodicTrimIsCalledThenAllocationsAreEvictedMarkedAndRemovedFromTrimCandidateList) {
|
HWTEST_F(WddmMemoryManagerResidencyTest, givenNotUsedAllocationsFromPreviousPeriodicTrimWhenTrimResidencyPeriodicTrimIsCalledThenAllocationsAreEvictedMarkedAndRemovedFromTrimCandidateList) {
|
||||||
@ -1149,7 +1149,7 @@ HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetWithZeroSizeReturnsTrue) {
|
|||||||
|
|
||||||
HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetAllDoneAllocations) {
|
HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetAllDoneAllocations) {
|
||||||
SetUpMm<FamilyType>();
|
SetUpMm<FamilyType>();
|
||||||
gdi.setNonZeroNumBytesToTrimInEvict();
|
gdi->setNonZeroNumBytesToTrimInEvict();
|
||||||
|
|
||||||
WddmAllocation allocation1, allocation2, allocation3;
|
WddmAllocation allocation1, allocation2, allocation3;
|
||||||
allocation1.getResidencyData().resident = true;
|
allocation1.getResidencyData().resident = true;
|
||||||
@ -1188,7 +1188,7 @@ HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetAllDoneAllocations) {
|
|||||||
|
|
||||||
HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetReturnsFalseWhenNumBytesToTrimIsNotZero) {
|
HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetReturnsFalseWhenNumBytesToTrimIsNotZero) {
|
||||||
SetUpMm<FamilyType>();
|
SetUpMm<FamilyType>();
|
||||||
gdi.setNonZeroNumBytesToTrimInEvict();
|
gdi->setNonZeroNumBytesToTrimInEvict();
|
||||||
|
|
||||||
WddmAllocation allocation1;
|
WddmAllocation allocation1;
|
||||||
allocation1.getResidencyData().resident = true;
|
allocation1.getResidencyData().resident = true;
|
||||||
@ -1250,7 +1250,7 @@ HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetStopsEvictingWhenNumBytesTo
|
|||||||
|
|
||||||
HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetMarksEvictedAllocationNonResident) {
|
HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetMarksEvictedAllocationNonResident) {
|
||||||
SetUpMm<FamilyType>();
|
SetUpMm<FamilyType>();
|
||||||
gdi.setNonZeroNumBytesToTrimInEvict();
|
gdi->setNonZeroNumBytesToTrimInEvict();
|
||||||
|
|
||||||
WddmAllocation allocation1, allocation2, allocation3;
|
WddmAllocation allocation1, allocation2, allocation3;
|
||||||
allocation1.getResidencyData().resident = true;
|
allocation1.getResidencyData().resident = true;
|
||||||
@ -1283,7 +1283,7 @@ HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetMarksEvictedAllocationNonRe
|
|||||||
|
|
||||||
HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetWaitsFromCpuWhenLastFenceIsGreaterThanMonitored) {
|
HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetWaitsFromCpuWhenLastFenceIsGreaterThanMonitored) {
|
||||||
SetUpMm<FamilyType>();
|
SetUpMm<FamilyType>();
|
||||||
gdi.setNonZeroNumBytesToTrimInEvict();
|
gdi->setNonZeroNumBytesToTrimInEvict();
|
||||||
|
|
||||||
WddmAllocation allocation1;
|
WddmAllocation allocation1;
|
||||||
allocation1.getResidencyData().resident = true;
|
allocation1.getResidencyData().resident = true;
|
||||||
@ -1300,19 +1300,19 @@ HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetWaitsFromCpuWhenLastFenceIs
|
|||||||
|
|
||||||
memoryManager->addToTrimCandidateList(&allocation1);
|
memoryManager->addToTrimCandidateList(&allocation1);
|
||||||
|
|
||||||
gdi.getWaitFromCpuArg().hDevice = (D3DKMT_HANDLE)0;
|
gdi->getWaitFromCpuArg().hDevice = (D3DKMT_HANDLE)0;
|
||||||
|
|
||||||
bool status = memoryManager->trimResidencyToBudget(3 * 4096);
|
bool status = memoryManager->trimResidencyToBudget(3 * 4096);
|
||||||
|
|
||||||
EXPECT_EQ(1u, wddm->makeNonResidentResult.called);
|
EXPECT_EQ(1u, wddm->makeNonResidentResult.called);
|
||||||
EXPECT_FALSE(allocation1.getResidencyData().resident);
|
EXPECT_FALSE(allocation1.getResidencyData().resident);
|
||||||
|
|
||||||
EXPECT_EQ(wddm->getDevice(), gdi.getWaitFromCpuArg().hDevice);
|
EXPECT_EQ(wddm->getDevice(), gdi->getWaitFromCpuArg().hDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetEvictsDoneFragmentsOnly) {
|
HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetEvictsDoneFragmentsOnly) {
|
||||||
SetUpMm<FamilyType>();
|
SetUpMm<FamilyType>();
|
||||||
gdi.setNonZeroNumBytesToTrimInEvict();
|
gdi->setNonZeroNumBytesToTrimInEvict();
|
||||||
void *ptr = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x1000);
|
void *ptr = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x1000);
|
||||||
WddmAllocation allocation1(ptr, 0x1000, ptr, 0x1000, nullptr);
|
WddmAllocation allocation1(ptr, 0x1000, ptr, 0x1000, nullptr);
|
||||||
WddmAllocation allocation2(ptr, 0x1000, ptr, 0x1000, nullptr);
|
WddmAllocation allocation2(ptr, 0x1000, ptr, 0x1000, nullptr);
|
||||||
@ -1387,7 +1387,7 @@ HWTEST_F(WddmMemoryManagerResidencyTest, checkTrimCandidateListCompaction) {
|
|||||||
|
|
||||||
HWTEST_F(WddmMemoryManagerResidencyTest, givenThreeAllocationsAlignedSizeBiggerThanAllocSizeWhenBudgetEqualTwoAlignedAllocationThenEvictOnlyTwo) {
|
HWTEST_F(WddmMemoryManagerResidencyTest, givenThreeAllocationsAlignedSizeBiggerThanAllocSizeWhenBudgetEqualTwoAlignedAllocationThenEvictOnlyTwo) {
|
||||||
SetUpMm<FamilyType>();
|
SetUpMm<FamilyType>();
|
||||||
gdi.setNonZeroNumBytesToTrimInEvict();
|
gdi->setNonZeroNumBytesToTrimInEvict();
|
||||||
size_t underlyingSize = 0xF00;
|
size_t underlyingSize = 0xF00;
|
||||||
size_t alignedSize = 0x1000;
|
size_t alignedSize = 0x1000;
|
||||||
size_t budget = 2 * alignedSize;
|
size_t budget = 2 * alignedSize;
|
||||||
|
@ -62,7 +62,9 @@ typedef ::Test<WddmMemoryManagerFixture> WddmMemoryManagerTest;
|
|||||||
class MockWddmMemoryManagerFixture {
|
class MockWddmMemoryManagerFixture {
|
||||||
public:
|
public:
|
||||||
void SetUp() {
|
void SetUp() {
|
||||||
wddm = static_cast<WddmMock *>(Wddm::createWddm(&gdi));
|
wddm = static_cast<WddmMock *>(Wddm::createWddm());
|
||||||
|
gdi = new MockGdi();
|
||||||
|
wddm->gdi.reset(gdi);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename FamiltyType>
|
template <typename FamiltyType>
|
||||||
@ -81,7 +83,7 @@ class MockWddmMemoryManagerFixture {
|
|||||||
virtual void TearDown() {}
|
virtual void TearDown() {}
|
||||||
std::unique_ptr<MockWddmMemoryManager> memoryManager;
|
std::unique_ptr<MockWddmMemoryManager> memoryManager;
|
||||||
WddmMock *wddm = nullptr;
|
WddmMock *wddm = nullptr;
|
||||||
MockGdi gdi;
|
MockGdi *gdi = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef ::Test<MockWddmMemoryManagerFixture> WddmMemoryManagerResidencyTest;
|
typedef ::Test<MockWddmMemoryManagerFixture> WddmMemoryManagerResidencyTest;
|
||||||
|
@ -680,14 +680,14 @@ HWTEST_F(WddmTest, makeResidentMultipleHandles) {
|
|||||||
handles[0] = allocation.handle;
|
handles[0] = allocation.handle;
|
||||||
handles[1] = allocation.handle;
|
handles[1] = allocation.handle;
|
||||||
|
|
||||||
gdi.getMakeResidentArg().NumAllocations = 0;
|
gdi->getMakeResidentArg().NumAllocations = 0;
|
||||||
gdi.getMakeResidentArg().AllocationList = nullptr;
|
gdi->getMakeResidentArg().AllocationList = nullptr;
|
||||||
|
|
||||||
bool error = wddm->makeResident(handles, 2, false, nullptr);
|
bool error = wddm->makeResident(handles, 2, false, nullptr);
|
||||||
EXPECT_TRUE(error);
|
EXPECT_TRUE(error);
|
||||||
|
|
||||||
EXPECT_EQ(2u, gdi.getMakeResidentArg().NumAllocations);
|
EXPECT_EQ(2u, gdi->getMakeResidentArg().NumAllocations);
|
||||||
EXPECT_EQ(handles, gdi.getMakeResidentArg().AllocationList);
|
EXPECT_EQ(handles, gdi->getMakeResidentArg().AllocationList);
|
||||||
|
|
||||||
mm.freeSystemMemory(allocation.getUnderlyingBuffer());
|
mm.freeSystemMemory(allocation.getUnderlyingBuffer());
|
||||||
}
|
}
|
||||||
@ -705,15 +705,15 @@ HWTEST_F(WddmTest, makeResidentMultipleHandlesWithReturnBytesToTrim) {
|
|||||||
handles[0] = allocation.handle;
|
handles[0] = allocation.handle;
|
||||||
handles[1] = allocation.handle;
|
handles[1] = allocation.handle;
|
||||||
|
|
||||||
gdi.getMakeResidentArg().NumAllocations = 0;
|
gdi->getMakeResidentArg().NumAllocations = 0;
|
||||||
gdi.getMakeResidentArg().AllocationList = nullptr;
|
gdi->getMakeResidentArg().AllocationList = nullptr;
|
||||||
gdi.getMakeResidentArg().NumBytesToTrim = 30;
|
gdi->getMakeResidentArg().NumBytesToTrim = 30;
|
||||||
|
|
||||||
uint64_t bytesToTrim = 0;
|
uint64_t bytesToTrim = 0;
|
||||||
bool success = wddm->makeResident(handles, 2, false, &bytesToTrim);
|
bool success = wddm->makeResident(handles, 2, false, &bytesToTrim);
|
||||||
EXPECT_TRUE(success);
|
EXPECT_TRUE(success);
|
||||||
|
|
||||||
EXPECT_EQ(gdi.getMakeResidentArg().NumBytesToTrim, bytesToTrim);
|
EXPECT_EQ(gdi->getMakeResidentArg().NumBytesToTrim, bytesToTrim);
|
||||||
|
|
||||||
mm.freeSystemMemory(allocation.getUnderlyingBuffer());
|
mm.freeSystemMemory(allocation.getUnderlyingBuffer());
|
||||||
}
|
}
|
||||||
@ -723,19 +723,19 @@ HWTEST_F(WddmTest, makeNonResidentCallsEvict) {
|
|||||||
|
|
||||||
D3DKMT_HANDLE handle = (D3DKMT_HANDLE)0x1234;
|
D3DKMT_HANDLE handle = (D3DKMT_HANDLE)0x1234;
|
||||||
|
|
||||||
gdi.getEvictArg().AllocationList = nullptr;
|
gdi->getEvictArg().AllocationList = nullptr;
|
||||||
gdi.getEvictArg().Flags.Value = 0;
|
gdi->getEvictArg().Flags.Value = 0;
|
||||||
gdi.getEvictArg().hDevice = 0;
|
gdi->getEvictArg().hDevice = 0;
|
||||||
gdi.getEvictArg().NumAllocations = 0;
|
gdi->getEvictArg().NumAllocations = 0;
|
||||||
gdi.getEvictArg().NumBytesToTrim = 20;
|
gdi->getEvictArg().NumBytesToTrim = 20;
|
||||||
|
|
||||||
uint64_t sizeToTrim = 10;
|
uint64_t sizeToTrim = 10;
|
||||||
wddm->evict(&handle, 1, sizeToTrim);
|
wddm->evict(&handle, 1, sizeToTrim);
|
||||||
|
|
||||||
EXPECT_EQ(1u, gdi.getEvictArg().NumAllocations);
|
EXPECT_EQ(1u, gdi->getEvictArg().NumAllocations);
|
||||||
EXPECT_EQ(&handle, gdi.getEvictArg().AllocationList);
|
EXPECT_EQ(&handle, gdi->getEvictArg().AllocationList);
|
||||||
EXPECT_EQ(wddm->getDevice(), gdi.getEvictArg().hDevice);
|
EXPECT_EQ(wddm->getDevice(), gdi->getEvictArg().hDevice);
|
||||||
EXPECT_EQ(0u, gdi.getEvictArg().NumBytesToTrim);
|
EXPECT_EQ(0u, gdi->getEvictArg().NumBytesToTrim);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(WddmTest, destroyAllocationWithLastFenceValueGreaterThanCurrentValueCallsWaitFromCpu) {
|
HWTEST_F(WddmTest, destroyAllocationWithLastFenceValueGreaterThanCurrentValueCallsWaitFromCpu) {
|
||||||
@ -749,28 +749,28 @@ HWTEST_F(WddmTest, destroyAllocationWithLastFenceValueGreaterThanCurrentValueCal
|
|||||||
|
|
||||||
D3DKMT_HANDLE handle = (D3DKMT_HANDLE)0x1234;
|
D3DKMT_HANDLE handle = (D3DKMT_HANDLE)0x1234;
|
||||||
|
|
||||||
gdi.getWaitFromCpuArg().FenceValueArray = nullptr;
|
gdi->getWaitFromCpuArg().FenceValueArray = nullptr;
|
||||||
gdi.getWaitFromCpuArg().Flags.Value = 0;
|
gdi->getWaitFromCpuArg().Flags.Value = 0;
|
||||||
gdi.getWaitFromCpuArg().hDevice = (D3DKMT_HANDLE)0;
|
gdi->getWaitFromCpuArg().hDevice = (D3DKMT_HANDLE)0;
|
||||||
gdi.getWaitFromCpuArg().ObjectCount = 0;
|
gdi->getWaitFromCpuArg().ObjectCount = 0;
|
||||||
gdi.getWaitFromCpuArg().ObjectHandleArray = nullptr;
|
gdi->getWaitFromCpuArg().ObjectHandleArray = nullptr;
|
||||||
|
|
||||||
gdi.getDestroyArg().AllocationCount = 0;
|
gdi->getDestroyArg().AllocationCount = 0;
|
||||||
gdi.getDestroyArg().Flags.Value = 0;
|
gdi->getDestroyArg().Flags.Value = 0;
|
||||||
gdi.getDestroyArg().hDevice = (D3DKMT_HANDLE)0;
|
gdi->getDestroyArg().hDevice = (D3DKMT_HANDLE)0;
|
||||||
gdi.getDestroyArg().hResource = (D3DKMT_HANDLE)0;
|
gdi->getDestroyArg().hResource = (D3DKMT_HANDLE)0;
|
||||||
gdi.getDestroyArg().phAllocationList = nullptr;
|
gdi->getDestroyArg().phAllocationList = nullptr;
|
||||||
|
|
||||||
wddm->destroyAllocation(&allocation);
|
wddm->destroyAllocation(&allocation);
|
||||||
|
|
||||||
EXPECT_NE(nullptr, gdi.getWaitFromCpuArg().FenceValueArray);
|
EXPECT_NE(nullptr, gdi->getWaitFromCpuArg().FenceValueArray);
|
||||||
EXPECT_EQ(wddm->getDevice(), gdi.getWaitFromCpuArg().hDevice);
|
EXPECT_EQ(wddm->getDevice(), gdi->getWaitFromCpuArg().hDevice);
|
||||||
EXPECT_EQ(1u, gdi.getWaitFromCpuArg().ObjectCount);
|
EXPECT_EQ(1u, gdi->getWaitFromCpuArg().ObjectCount);
|
||||||
EXPECT_EQ(&wddm->getMonitoredFence().fenceHandle, gdi.getWaitFromCpuArg().ObjectHandleArray);
|
EXPECT_EQ(&wddm->getMonitoredFence().fenceHandle, gdi->getWaitFromCpuArg().ObjectHandleArray);
|
||||||
|
|
||||||
EXPECT_EQ(wddm->getDevice(), gdi.getDestroyArg().hDevice);
|
EXPECT_EQ(wddm->getDevice(), gdi->getDestroyArg().hDevice);
|
||||||
EXPECT_EQ(1u, gdi.getDestroyArg().AllocationCount);
|
EXPECT_EQ(1u, gdi->getDestroyArg().AllocationCount);
|
||||||
EXPECT_NE(nullptr, gdi.getDestroyArg().phAllocationList);
|
EXPECT_NE(nullptr, gdi->getDestroyArg().phAllocationList);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(WddmTest, destroyAllocationWithLastFenceValueLessEqualToCurrentValueDoesNotCallWaitFromCpu) {
|
HWTEST_F(WddmTest, destroyAllocationWithLastFenceValueLessEqualToCurrentValueDoesNotCallWaitFromCpu) {
|
||||||
@ -784,28 +784,28 @@ HWTEST_F(WddmTest, destroyAllocationWithLastFenceValueLessEqualToCurrentValueDoe
|
|||||||
|
|
||||||
D3DKMT_HANDLE handle = (D3DKMT_HANDLE)0x1234;
|
D3DKMT_HANDLE handle = (D3DKMT_HANDLE)0x1234;
|
||||||
|
|
||||||
gdi.getWaitFromCpuArg().FenceValueArray = nullptr;
|
gdi->getWaitFromCpuArg().FenceValueArray = nullptr;
|
||||||
gdi.getWaitFromCpuArg().Flags.Value = 0;
|
gdi->getWaitFromCpuArg().Flags.Value = 0;
|
||||||
gdi.getWaitFromCpuArg().hDevice = (D3DKMT_HANDLE)0;
|
gdi->getWaitFromCpuArg().hDevice = (D3DKMT_HANDLE)0;
|
||||||
gdi.getWaitFromCpuArg().ObjectCount = 0;
|
gdi->getWaitFromCpuArg().ObjectCount = 0;
|
||||||
gdi.getWaitFromCpuArg().ObjectHandleArray = nullptr;
|
gdi->getWaitFromCpuArg().ObjectHandleArray = nullptr;
|
||||||
|
|
||||||
gdi.getDestroyArg().AllocationCount = 0;
|
gdi->getDestroyArg().AllocationCount = 0;
|
||||||
gdi.getDestroyArg().Flags.Value = 0;
|
gdi->getDestroyArg().Flags.Value = 0;
|
||||||
gdi.getDestroyArg().hDevice = (D3DKMT_HANDLE)0;
|
gdi->getDestroyArg().hDevice = (D3DKMT_HANDLE)0;
|
||||||
gdi.getDestroyArg().hResource = (D3DKMT_HANDLE)0;
|
gdi->getDestroyArg().hResource = (D3DKMT_HANDLE)0;
|
||||||
gdi.getDestroyArg().phAllocationList = nullptr;
|
gdi->getDestroyArg().phAllocationList = nullptr;
|
||||||
|
|
||||||
wddm->destroyAllocation(&allocation);
|
wddm->destroyAllocation(&allocation);
|
||||||
|
|
||||||
EXPECT_EQ(nullptr, gdi.getWaitFromCpuArg().FenceValueArray);
|
EXPECT_EQ(nullptr, gdi->getWaitFromCpuArg().FenceValueArray);
|
||||||
EXPECT_EQ((D3DKMT_HANDLE)0, gdi.getWaitFromCpuArg().hDevice);
|
EXPECT_EQ((D3DKMT_HANDLE)0, gdi->getWaitFromCpuArg().hDevice);
|
||||||
EXPECT_EQ(0u, gdi.getWaitFromCpuArg().ObjectCount);
|
EXPECT_EQ(0u, gdi->getWaitFromCpuArg().ObjectCount);
|
||||||
EXPECT_EQ(nullptr, gdi.getWaitFromCpuArg().ObjectHandleArray);
|
EXPECT_EQ(nullptr, gdi->getWaitFromCpuArg().ObjectHandleArray);
|
||||||
|
|
||||||
EXPECT_EQ(wddm->getDevice(), gdi.getDestroyArg().hDevice);
|
EXPECT_EQ(wddm->getDevice(), gdi->getDestroyArg().hDevice);
|
||||||
EXPECT_EQ(1u, gdi.getDestroyArg().AllocationCount);
|
EXPECT_EQ(1u, gdi->getDestroyArg().AllocationCount);
|
||||||
EXPECT_NE(nullptr, gdi.getDestroyArg().phAllocationList);
|
EXPECT_NE(nullptr, gdi->getDestroyArg().phAllocationList);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(WddmTest, WhenLastFenceLessEqualThanMonitoredThenWaitFromCpuIsNotCalled) {
|
HWTEST_F(WddmTest, WhenLastFenceLessEqualThanMonitoredThenWaitFromCpuIsNotCalled) {
|
||||||
@ -817,20 +817,20 @@ HWTEST_F(WddmTest, WhenLastFenceLessEqualThanMonitoredThenWaitFromCpuIsNotCalled
|
|||||||
|
|
||||||
*wddm->getMonitoredFence().cpuAddress = 10;
|
*wddm->getMonitoredFence().cpuAddress = 10;
|
||||||
|
|
||||||
gdi.getWaitFromCpuArg().FenceValueArray = nullptr;
|
gdi->getWaitFromCpuArg().FenceValueArray = nullptr;
|
||||||
gdi.getWaitFromCpuArg().Flags.Value = 0;
|
gdi->getWaitFromCpuArg().Flags.Value = 0;
|
||||||
gdi.getWaitFromCpuArg().hDevice = (D3DKMT_HANDLE)0;
|
gdi->getWaitFromCpuArg().hDevice = (D3DKMT_HANDLE)0;
|
||||||
gdi.getWaitFromCpuArg().ObjectCount = 0;
|
gdi->getWaitFromCpuArg().ObjectCount = 0;
|
||||||
gdi.getWaitFromCpuArg().ObjectHandleArray = nullptr;
|
gdi->getWaitFromCpuArg().ObjectHandleArray = nullptr;
|
||||||
|
|
||||||
auto status = wddm->waitFromCpu(10);
|
auto status = wddm->waitFromCpu(10);
|
||||||
|
|
||||||
EXPECT_TRUE(status);
|
EXPECT_TRUE(status);
|
||||||
|
|
||||||
EXPECT_EQ(nullptr, gdi.getWaitFromCpuArg().FenceValueArray);
|
EXPECT_EQ(nullptr, gdi->getWaitFromCpuArg().FenceValueArray);
|
||||||
EXPECT_EQ((D3DKMT_HANDLE)0, gdi.getWaitFromCpuArg().hDevice);
|
EXPECT_EQ((D3DKMT_HANDLE)0, gdi->getWaitFromCpuArg().hDevice);
|
||||||
EXPECT_EQ(0u, gdi.getWaitFromCpuArg().ObjectCount);
|
EXPECT_EQ(0u, gdi->getWaitFromCpuArg().ObjectCount);
|
||||||
EXPECT_EQ(nullptr, gdi.getWaitFromCpuArg().ObjectHandleArray);
|
EXPECT_EQ(nullptr, gdi->getWaitFromCpuArg().ObjectHandleArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(WddmTest, WhenLastFenceGreaterThanMonitoredThenWaitFromCpuIsCalled) {
|
HWTEST_F(WddmTest, WhenLastFenceGreaterThanMonitoredThenWaitFromCpuIsCalled) {
|
||||||
@ -842,32 +842,32 @@ HWTEST_F(WddmTest, WhenLastFenceGreaterThanMonitoredThenWaitFromCpuIsCalled) {
|
|||||||
|
|
||||||
*wddm->getMonitoredFence().cpuAddress = 10;
|
*wddm->getMonitoredFence().cpuAddress = 10;
|
||||||
|
|
||||||
gdi.getWaitFromCpuArg().FenceValueArray = nullptr;
|
gdi->getWaitFromCpuArg().FenceValueArray = nullptr;
|
||||||
gdi.getWaitFromCpuArg().Flags.Value = 0;
|
gdi->getWaitFromCpuArg().Flags.Value = 0;
|
||||||
gdi.getWaitFromCpuArg().hDevice = (D3DKMT_HANDLE)0;
|
gdi->getWaitFromCpuArg().hDevice = (D3DKMT_HANDLE)0;
|
||||||
gdi.getWaitFromCpuArg().ObjectCount = 0;
|
gdi->getWaitFromCpuArg().ObjectCount = 0;
|
||||||
gdi.getWaitFromCpuArg().ObjectHandleArray = nullptr;
|
gdi->getWaitFromCpuArg().ObjectHandleArray = nullptr;
|
||||||
|
|
||||||
auto status = wddm->waitFromCpu(20);
|
auto status = wddm->waitFromCpu(20);
|
||||||
|
|
||||||
EXPECT_TRUE(status);
|
EXPECT_TRUE(status);
|
||||||
|
|
||||||
EXPECT_NE(nullptr, gdi.getWaitFromCpuArg().FenceValueArray);
|
EXPECT_NE(nullptr, gdi->getWaitFromCpuArg().FenceValueArray);
|
||||||
EXPECT_EQ((D3DKMT_HANDLE)wddm->getDevice(), gdi.getWaitFromCpuArg().hDevice);
|
EXPECT_EQ((D3DKMT_HANDLE)wddm->getDevice(), gdi->getWaitFromCpuArg().hDevice);
|
||||||
EXPECT_EQ(1u, gdi.getWaitFromCpuArg().ObjectCount);
|
EXPECT_EQ(1u, gdi->getWaitFromCpuArg().ObjectCount);
|
||||||
EXPECT_NE(nullptr, gdi.getWaitFromCpuArg().ObjectHandleArray);
|
EXPECT_NE(nullptr, gdi->getWaitFromCpuArg().ObjectHandleArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(WddmTest, createMonitoredFenceIsInitializedWithFenceValueZeroAndCurrentFenceValueIsSetToOne) {
|
HWTEST_F(WddmTest, createMonitoredFenceIsInitializedWithFenceValueZeroAndCurrentFenceValueIsSetToOne) {
|
||||||
wddm->init<FamilyType>();
|
wddm->init<FamilyType>();
|
||||||
|
|
||||||
gdi.createSynchronizationObject2 = gdi.createSynchronizationObject2Mock;
|
gdi->createSynchronizationObject2 = gdi->createSynchronizationObject2Mock;
|
||||||
|
|
||||||
gdi.getCreateSynchronizationObject2Arg().Info.MonitoredFence.InitialFenceValue = 300;
|
gdi->getCreateSynchronizationObject2Arg().Info.MonitoredFence.InitialFenceValue = 300;
|
||||||
|
|
||||||
wddm->createMonitoredFence();
|
wddm->createMonitoredFence();
|
||||||
|
|
||||||
EXPECT_EQ(0u, gdi.getCreateSynchronizationObject2Arg().Info.MonitoredFence.InitialFenceValue);
|
EXPECT_EQ(0u, gdi->getCreateSynchronizationObject2Arg().Info.MonitoredFence.InitialFenceValue);
|
||||||
EXPECT_EQ(1u, wddm->getMonitoredFence().currentFenceValue);
|
EXPECT_EQ(1u, wddm->getMonitoredFence().currentFenceValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -882,7 +882,7 @@ HWTEST_F(WddmTest, givenOpenSharedHandleWhenZeroAllocationsThenReturnNull) {
|
|||||||
D3DKMT_HANDLE handle = 0;
|
D3DKMT_HANDLE handle = 0;
|
||||||
WddmAllocation *alloc = nullptr;
|
WddmAllocation *alloc = nullptr;
|
||||||
|
|
||||||
gdi.queryResourceInfo = reinterpret_cast<PFND3DKMT_QUERYRESOURCEINFO>(queryResourceInfoMock);
|
gdi->queryResourceInfo = reinterpret_cast<PFND3DKMT_QUERYRESOURCEINFO>(queryResourceInfoMock);
|
||||||
auto ret = wddm->openSharedHandle(handle, alloc);
|
auto ret = wddm->openSharedHandle(handle, alloc);
|
||||||
|
|
||||||
EXPECT_EQ(false, ret);
|
EXPECT_EQ(false, ret);
|
||||||
@ -895,7 +895,7 @@ HWTEST_F(WddmTest, givenReadOnlyMemoryWhenCreateAllocationFailsWithNoVideoMemory
|
|||||||
return STATUS_GRAPHICS_NO_VIDEO_MEMORY;
|
return STATUS_GRAPHICS_NO_VIDEO_MEMORY;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
gdi.createAllocation = MockCreateAllocation::mockCreateAllocation;
|
gdi->createAllocation = MockCreateAllocation::mockCreateAllocation;
|
||||||
wddm->init<FamilyType>();
|
wddm->init<FamilyType>();
|
||||||
|
|
||||||
OsHandleStorage handleStorage;
|
OsHandleStorage handleStorage;
|
||||||
|
Reference in New Issue
Block a user