mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 15:53:45 +08:00
Move PageTableManager to RootDeviceEnvironment
Related-To: NEO-2285 Change-Id: I77699b5f540b6ac5b73cf1830712a5591326b766 Signed-off-by: Andrzej Swierczynski <andrzej.swierczynski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
8f5e9c8a3a
commit
cc46cdf46c
4
Jenkinsfile
vendored
4
Jenkinsfile
vendored
@@ -1,5 +1,5 @@
|
|||||||
#!groovy
|
#!groovy
|
||||||
dependenciesRevision='42bc9ab3a399b043aa54824c449d5d7a96b7ea82-1354'
|
dependenciesRevision='42bc9ab3a399b043aa54824c449d5d7a96b7ea82-1354'
|
||||||
strategy='EQUAL'
|
strategy='EQUAL'
|
||||||
allowedCD=256
|
allowedCD=259
|
||||||
allowedF=7
|
allowedF=11
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include "runtime/aub/aub_center.h"
|
#include "runtime/aub/aub_center.h"
|
||||||
#include "runtime/execution_environment/execution_environment.h"
|
#include "runtime/execution_environment/execution_environment.h"
|
||||||
|
#include "runtime/gmm_helper/page_table_mngr.h"
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ namespace NEO {
|
|||||||
|
|
||||||
class AubCenter;
|
class AubCenter;
|
||||||
class ExecutionEnvironment;
|
class ExecutionEnvironment;
|
||||||
|
class GmmPageTableMngr;
|
||||||
|
|
||||||
struct RootDeviceEnvironment {
|
struct RootDeviceEnvironment {
|
||||||
RootDeviceEnvironment(ExecutionEnvironment &executionEnvironment);
|
RootDeviceEnvironment(ExecutionEnvironment &executionEnvironment);
|
||||||
@@ -24,6 +25,7 @@ struct RootDeviceEnvironment {
|
|||||||
|
|
||||||
MOCKABLE_VIRTUAL void initAubCenter(bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType);
|
MOCKABLE_VIRTUAL void initAubCenter(bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType);
|
||||||
|
|
||||||
|
std::unique_ptr<GmmPageTableMngr> pageTableManager;
|
||||||
std::unique_ptr<AubCenter> aubCenter;
|
std::unique_ptr<AubCenter> aubCenter;
|
||||||
ExecutionEnvironment &executionEnvironment;
|
ExecutionEnvironment &executionEnvironment;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class WddmPreemptionTests : public Test<WddmFixtureWithMockGdiDll> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void createAndInitWddm(unsigned int forceReturnPreemptionRegKeyValue) {
|
void createAndInitWddm(unsigned int forceReturnPreemptionRegKeyValue) {
|
||||||
wddm = static_cast<WddmMock *>(Wddm::createWddm());
|
wddm = static_cast<WddmMock *>(Wddm::createWddm(*executionEnvironment->rootDeviceEnvironments[0].get()));
|
||||||
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||||
executionEnvironment->osInterface->get()->setWddm(wddm);
|
executionEnvironment->osInterface->get()->setWddm(wddm);
|
||||||
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
|
|||||||
void programStateSip(LinearStream &cmdStream, Device &device);
|
void programStateSip(LinearStream &cmdStream, Device &device);
|
||||||
void programVFEState(LinearStream &csr, DispatchFlags &dispatchFlags, uint32_t maxFrontEndThreads);
|
void programVFEState(LinearStream &csr, DispatchFlags &dispatchFlags, uint32_t maxFrontEndThreads);
|
||||||
void programStallingPipeControlForBarrier(LinearStream &cmdStream, DispatchFlags &dispatchFlags);
|
void programStallingPipeControlForBarrier(LinearStream &cmdStream, DispatchFlags &dispatchFlags);
|
||||||
virtual void initPageTableManagerRegisters(LinearStream &csr){};
|
|
||||||
void programEngineModeCommands(LinearStream &csr, const DispatchFlags &dispatchFlags);
|
void programEngineModeCommands(LinearStream &csr, const DispatchFlags &dispatchFlags);
|
||||||
void programEngineModeEpliogue(LinearStream &csr, const DispatchFlags &dispatchFlags);
|
void programEngineModeEpliogue(LinearStream &csr, const DispatchFlags &dispatchFlags);
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "core/command_stream/linear_stream.h"
|
#include "core/command_stream/linear_stream.h"
|
||||||
#include "core/command_stream/preemption.h"
|
#include "core/command_stream/preemption.h"
|
||||||
#include "core/debug_settings/debug_settings_manager.h"
|
#include "core/debug_settings/debug_settings_manager.h"
|
||||||
|
#include "core/execution_environment/root_device_environment.h"
|
||||||
#include "core/helpers/cache_policy.h"
|
#include "core/helpers/cache_policy.h"
|
||||||
#include "core/helpers/hw_helper.h"
|
#include "core/helpers/hw_helper.h"
|
||||||
#include "core/helpers/options.h"
|
#include "core/helpers/options.h"
|
||||||
@@ -21,6 +22,7 @@
|
|||||||
#include "runtime/command_stream/scratch_space_controller_base.h"
|
#include "runtime/command_stream/scratch_space_controller_base.h"
|
||||||
#include "runtime/device/device.h"
|
#include "runtime/device/device.h"
|
||||||
#include "runtime/event/event.h"
|
#include "runtime/event/event.h"
|
||||||
|
#include "runtime/gmm_helper/page_table_mngr.h"
|
||||||
#include "runtime/gtpin/gtpin_notify.h"
|
#include "runtime/gtpin/gtpin_notify.h"
|
||||||
#include "runtime/helpers/blit_commands_helper.h"
|
#include "runtime/helpers/blit_commands_helper.h"
|
||||||
#include "runtime/helpers/flat_batch_buffer_helper_hw.h"
|
#include "runtime/helpers/flat_batch_buffer_helper_hw.h"
|
||||||
@@ -259,7 +261,9 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
|||||||
}
|
}
|
||||||
|
|
||||||
programEngineModeCommands(commandStreamCSR, dispatchFlags);
|
programEngineModeCommands(commandStreamCSR, dispatchFlags);
|
||||||
initPageTableManagerRegisters(commandStreamCSR);
|
if (executionEnvironment.rootDeviceEnvironments[device.getRootDeviceIndex()]->pageTableManager.get()) {
|
||||||
|
executionEnvironment.rootDeviceEnvironments[device.getRootDeviceIndex()]->pageTableManager->initPageTableManagerRegisters();
|
||||||
|
}
|
||||||
programComputeMode(commandStreamCSR, dispatchFlags);
|
programComputeMode(commandStreamCSR, dispatchFlags);
|
||||||
programL3(commandStreamCSR, dispatchFlags, newL3Config);
|
programL3(commandStreamCSR, dispatchFlags, newL3Config);
|
||||||
programPipelineSelect(commandStreamCSR, dispatchFlags.pipelineSelectArgs);
|
programPipelineSelect(commandStreamCSR, dispatchFlags.pipelineSelectArgs);
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ set(RUNTIME_SRCS_DLL_BASE
|
|||||||
${NEO_SOURCE_DIR}/core/utilities/clflush.cpp
|
${NEO_SOURCE_DIR}/core/utilities/clflush.cpp
|
||||||
${NEO_SOURCE_DIR}/core/utilities/debug_settings_reader_creator.cpp
|
${NEO_SOURCE_DIR}/core/utilities/debug_settings_reader_creator.cpp
|
||||||
${NEO_SOURCE_DIR}/runtime/api/api.cpp
|
${NEO_SOURCE_DIR}/runtime/api/api.cpp
|
||||||
|
${NEO_SOURCE_DIR}/runtime/gmm_helper/page_table_mngr.cpp
|
||||||
${NEO_SOURCE_DIR}/runtime/gmm_helper/resource_info.cpp
|
${NEO_SOURCE_DIR}/runtime/gmm_helper/resource_info.cpp
|
||||||
${NEO_SOURCE_DIR}/runtime/helpers/built_ins_helper.cpp
|
${NEO_SOURCE_DIR}/runtime/helpers/built_ins_helper.cpp
|
||||||
${NEO_SOURCE_DIR}/runtime/program/evaluate_unhandled_token.cpp
|
${NEO_SOURCE_DIR}/runtime/program/evaluate_unhandled_token.cpp
|
||||||
@@ -52,7 +53,6 @@ set(RUNTIME_SRCS_DLL_WINDOWS
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/windows/os_interface.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/windows/os_interface.cpp
|
||||||
${NEO_SOURCE_DIR}/core/os_interface/windows/sys_calls.cpp
|
${NEO_SOURCE_DIR}/core/os_interface/windows/sys_calls.cpp
|
||||||
${NEO_SOURCE_DIR}/runtime/gmm_helper/gmm_memory.cpp
|
${NEO_SOURCE_DIR}/runtime/gmm_helper/gmm_memory.cpp
|
||||||
${NEO_SOURCE_DIR}/runtime/gmm_helper/page_table_mngr.cpp
|
|
||||||
${NEO_SOURCE_DIR}/runtime/os_interface/windows/wddm/wddm_calls.cpp
|
${NEO_SOURCE_DIR}/runtime/os_interface/windows/wddm/wddm_calls.cpp
|
||||||
${NEO_SOURCE_DIR}/runtime/os_interface/windows/wddm/wddm_create.cpp
|
${NEO_SOURCE_DIR}/runtime/os_interface/windows/wddm/wddm_create.cpp
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ set(RUNTIME_SRCS_GMM_HELPER_BASE
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/resource_info.h
|
${CMAKE_CURRENT_SOURCE_DIR}/resource_info.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/resource_info_impl.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/resource_info_impl.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/gmm_utils.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/gmm_utils.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/page_table_mngr.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/page_table_mngr_impl.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(RUNTIME_SRCS_GMM_HELPER_WINDOWS
|
set(RUNTIME_SRCS_GMM_HELPER_WINDOWS
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/page_table_mngr.h
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/page_table_mngr_impl.cpp
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_memory${BRANCH_DIR_SUFFIX}/gmm_memory.h
|
${CMAKE_CURRENT_SOURCE_DIR}/gmm_memory${BRANCH_DIR_SUFFIX}/gmm_memory.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_memory_base.h
|
${CMAKE_CURRENT_SOURCE_DIR}/gmm_memory_base.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_memory_base.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/gmm_memory_base.cpp
|
||||||
|
|||||||
@@ -8,33 +8,37 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "core/gmm_helper/gmm_lib.h"
|
#include "core/gmm_helper/gmm_lib.h"
|
||||||
|
|
||||||
|
#include "External/Common/GmmPageTableMgr.h"
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
class Gmm;
|
||||||
|
class LinearStream;
|
||||||
class GmmPageTableMngr {
|
class GmmPageTableMngr {
|
||||||
public:
|
public:
|
||||||
MOCKABLE_VIRTUAL ~GmmPageTableMngr();
|
MOCKABLE_VIRTUAL ~GmmPageTableMngr();
|
||||||
|
|
||||||
static GmmPageTableMngr *create(unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb);
|
static GmmPageTableMngr *create(unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb);
|
||||||
|
|
||||||
MOCKABLE_VIRTUAL GMM_STATUS initContextAuxTableRegister(HANDLE initialBBHandle, GMM_ENGINE_TYPE engineType) {
|
MOCKABLE_VIRTUAL void setCsrHandle(void *csrHandle);
|
||||||
return pageTableManager->InitContextAuxTableRegister(initialBBHandle, engineType);
|
|
||||||
}
|
|
||||||
|
|
||||||
MOCKABLE_VIRTUAL GMM_STATUS initContextTRTableRegister(HANDLE initialBBHandle, GMM_ENGINE_TYPE engineType) {
|
bool updateAuxTable(uint64_t gpuVa, Gmm *gmm, bool map);
|
||||||
return pageTableManager->InitContextTRTableRegister(initialBBHandle, engineType);
|
void initPageTableManagerRegisters();
|
||||||
}
|
|
||||||
|
bool initialized = false;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
GmmPageTableMngr() = default;
|
||||||
|
|
||||||
MOCKABLE_VIRTUAL GMM_STATUS updateAuxTable(const GMM_DDI_UPDATEAUXTABLE *ddiUpdateAuxTable) {
|
MOCKABLE_VIRTUAL GMM_STATUS updateAuxTable(const GMM_DDI_UPDATEAUXTABLE *ddiUpdateAuxTable) {
|
||||||
return pageTableManager->UpdateAuxTable(ddiUpdateAuxTable);
|
return pageTableManager->UpdateAuxTable(ddiUpdateAuxTable);
|
||||||
}
|
}
|
||||||
MOCKABLE_VIRTUAL void setCsrHandle(void *csrHandle) {
|
|
||||||
pageTableManager->GmmSetCsrHandle(csrHandle);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
MOCKABLE_VIRTUAL GMM_STATUS initContextAuxTableRegister(HANDLE initialBBHandle, GMM_ENGINE_TYPE engineType) {
|
||||||
GmmPageTableMngr() = default;
|
return pageTableManager->InitContextAuxTableRegister(initialBBHandle, engineType);
|
||||||
|
}
|
||||||
|
|
||||||
GmmPageTableMngr(unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb);
|
GmmPageTableMngr(unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb);
|
||||||
GMM_CLIENT_CONTEXT *clientContext = nullptr;
|
GMM_CLIENT_CONTEXT *clientContext = nullptr;
|
||||||
|
|||||||
@@ -6,8 +6,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "core/gmm_helper/gmm_helper.h"
|
#include "core/gmm_helper/gmm_helper.h"
|
||||||
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
#include "runtime/gmm_helper/page_table_mngr.h"
|
#include "runtime/gmm_helper/page_table_mngr.h"
|
||||||
#include "runtime/platform/platform.h"
|
#include "runtime/gmm_helper/resource_info.h"
|
||||||
|
|
||||||
#include "gmm_client_context.h"
|
#include "gmm_client_context.h"
|
||||||
|
|
||||||
@@ -18,9 +19,22 @@ GmmPageTableMngr::~GmmPageTableMngr() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GmmPageTableMngr::GmmPageTableMngr(unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb) {
|
bool GmmPageTableMngr::updateAuxTable(uint64_t gpuVa, Gmm *gmm, bool map) {
|
||||||
clientContext = platform()->peekGmmClientContext()->getHandle();
|
GMM_DDI_UPDATEAUXTABLE ddiUpdateAuxTable = {};
|
||||||
pageTableManager = clientContext->CreatePageTblMgrObject(translationTableCb, translationTableFlags);
|
ddiUpdateAuxTable.BaseGpuVA = gpuVa;
|
||||||
|
ddiUpdateAuxTable.BaseResInfo = gmm->gmmResourceInfo->peekHandle();
|
||||||
|
ddiUpdateAuxTable.DoNotWait = true;
|
||||||
|
ddiUpdateAuxTable.Map = map ? 1u : 0u;
|
||||||
|
|
||||||
|
return updateAuxTable(&ddiUpdateAuxTable) == GMM_STATUS::GMM_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GmmPageTableMngr::initPageTableManagerRegisters() {
|
||||||
|
if (!initialized) {
|
||||||
|
initContextAuxTableRegister(this, GMM_ENGINE_TYPE::ENGINE_TYPE_RCS);
|
||||||
|
|
||||||
|
initialized = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#include "runtime/memory_manager/memory_manager.h"
|
#include "runtime/memory_manager/memory_manager.h"
|
||||||
|
|
||||||
|
#include "core/execution_environment/root_device_environment.h"
|
||||||
|
#include "core/gmm_helper/gmm_helper.h"
|
||||||
#include "core/helpers/aligned_memory.h"
|
#include "core/helpers/aligned_memory.h"
|
||||||
#include "core/helpers/basic_math.h"
|
#include "core/helpers/basic_math.h"
|
||||||
#include "core/helpers/hw_helper.h"
|
#include "core/helpers/hw_helper.h"
|
||||||
@@ -19,6 +21,7 @@
|
|||||||
#include "runtime/event/hw_timestamps.h"
|
#include "runtime/event/hw_timestamps.h"
|
||||||
#include "runtime/event/perf_counter.h"
|
#include "runtime/event/perf_counter.h"
|
||||||
#include "runtime/gmm_helper/gmm.h"
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
|
#include "runtime/gmm_helper/page_table_mngr.h"
|
||||||
#include "runtime/gmm_helper/resource_info.h"
|
#include "runtime/gmm_helper/resource_info.h"
|
||||||
#include "runtime/helpers/hardware_commands_helper.h"
|
#include "runtime/helpers/hardware_commands_helper.h"
|
||||||
#include "runtime/mem_obj/image.h"
|
#include "runtime/mem_obj/image.h"
|
||||||
@@ -328,6 +331,14 @@ GraphicsAllocation *MemoryManager::allocateGraphicsMemoryInPreferredPool(const A
|
|||||||
return allocation;
|
return allocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MemoryManager::mapAuxGpuVA(GraphicsAllocation *graphicsAllocation) {
|
||||||
|
auto index = graphicsAllocation->getRootDeviceIndex();
|
||||||
|
if (executionEnvironment.rootDeviceEnvironments[index]->pageTableManager.get()) {
|
||||||
|
return executionEnvironment.rootDeviceEnvironments[index]->pageTableManager->updateAuxTable(graphicsAllocation->getGpuAddress(), graphicsAllocation->getDefaultGmm(), true);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
GraphicsAllocation *MemoryManager::allocateGraphicsMemory(const AllocationData &allocationData) {
|
GraphicsAllocation *MemoryManager::allocateGraphicsMemory(const AllocationData &allocationData) {
|
||||||
if (allocationData.type == GraphicsAllocation::AllocationType::IMAGE || allocationData.type == GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY) {
|
if (allocationData.type == GraphicsAllocation::AllocationType::IMAGE || allocationData.type == GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY) {
|
||||||
UNRECOVERABLE_IF(allocationData.imgInfo == nullptr);
|
UNRECOVERABLE_IF(allocationData.imgInfo == nullptr);
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ class MemoryManager {
|
|||||||
|
|
||||||
virtual GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex) = 0;
|
virtual GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex) = 0;
|
||||||
|
|
||||||
virtual bool mapAuxGpuVA(GraphicsAllocation *graphicsAllocation) { return false; }
|
virtual bool mapAuxGpuVA(GraphicsAllocation *graphicsAllocation);
|
||||||
|
|
||||||
void *lockResource(GraphicsAllocation *graphicsAllocation);
|
void *lockResource(GraphicsAllocation *graphicsAllocation);
|
||||||
void unlockResource(GraphicsAllocation *graphicsAllocation);
|
void unlockResource(GraphicsAllocation *graphicsAllocation);
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ set(RUNTIME_SRCS_OS_INTERFACE_LINUX
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/os_thread_linux.h
|
${CMAKE_CURRENT_SOURCE_DIR}/os_thread_linux.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/os_time_linux.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/os_time_linux.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/os_time_linux.h
|
${CMAKE_CURRENT_SOURCE_DIR}/os_time_linux.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/page_table_manager_functions.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_linux.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_linux.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_linux.h
|
${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_linux.h
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily> {
|
|||||||
bool waitForFlushStamp(FlushStamp &flushStampToWait) override;
|
bool waitForFlushStamp(FlushStamp &flushStampToWait) override;
|
||||||
|
|
||||||
DrmMemoryManager *getMemoryManager() const;
|
DrmMemoryManager *getMemoryManager() const;
|
||||||
|
GmmPageTableMngr *createPageTableManager() override;
|
||||||
|
|
||||||
gemCloseWorkerMode peekGemCloseWorkerOperationMode() const {
|
gemCloseWorkerMode peekGemCloseWorkerOperationMode() const {
|
||||||
return this->gemCloseWorkerOperationMode;
|
return this->gemCloseWorkerOperationMode;
|
||||||
|
|||||||
@@ -6,9 +6,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "core/command_stream/linear_stream.h"
|
#include "core/command_stream/linear_stream.h"
|
||||||
|
#include "core/gmm_helper/gmm_helper.h"
|
||||||
#include "core/helpers/aligned_memory.h"
|
#include "core/helpers/aligned_memory.h"
|
||||||
#include "core/helpers/preamble.h"
|
#include "core/helpers/preamble.h"
|
||||||
#include "runtime/execution_environment/execution_environment.h"
|
#include "runtime/execution_environment/execution_environment.h"
|
||||||
|
#include "runtime/gmm_helper/page_table_mngr.h"
|
||||||
#include "runtime/helpers/flush_stamp.h"
|
#include "runtime/helpers/flush_stamp.h"
|
||||||
#include "runtime/mem_obj/buffer.h"
|
#include "runtime/mem_obj/buffer.h"
|
||||||
#include "runtime/os_interface/linux/drm_allocation.h"
|
#include "runtime/os_interface/linux/drm_allocation.h"
|
||||||
@@ -146,6 +148,14 @@ DrmMemoryManager *DrmCommandStreamReceiver<GfxFamily>::getMemoryManager() const
|
|||||||
return static_cast<DrmMemoryManager *>(CommandStreamReceiver::getMemoryManager());
|
return static_cast<DrmMemoryManager *>(CommandStreamReceiver::getMemoryManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename GfxFamily>
|
||||||
|
GmmPageTableMngr *DrmCommandStreamReceiver<GfxFamily>::createPageTableManager() {
|
||||||
|
GmmPageTableMngr *gmmPageTableMngr = GmmPageTableMngr::create(TT_TYPE::AUXTT, nullptr);
|
||||||
|
gmmPageTableMngr->setCsrHandle(this);
|
||||||
|
this->executionEnvironment.rootDeviceEnvironments[this->rootDeviceIndex]->pageTableManager.reset(gmmPageTableMngr);
|
||||||
|
return gmmPageTableMngr;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
bool DrmCommandStreamReceiver<GfxFamily>::waitForFlushStamp(FlushStamp &flushStamp) {
|
bool DrmCommandStreamReceiver<GfxFamily>::waitForFlushStamp(FlushStamp &flushStamp) {
|
||||||
drm_i915_gem_wait wait = {};
|
drm_i915_gem_wait wait = {};
|
||||||
|
|||||||
21
runtime/os_interface/linux/page_table_manager_functions.cpp
Normal file
21
runtime/os_interface/linux/page_table_manager_functions.cpp
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "core/gmm_helper/gmm_helper.h"
|
||||||
|
#include "runtime/gmm_helper/page_table_mngr.h"
|
||||||
|
#include "runtime/platform/platform.h"
|
||||||
|
|
||||||
|
#include "gmm_client_context.h"
|
||||||
|
|
||||||
|
namespace NEO {
|
||||||
|
GmmPageTableMngr::GmmPageTableMngr(unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb) {
|
||||||
|
clientContext = platform()->peekGmmClientContext()->getHandle();
|
||||||
|
pageTableManager = clientContext->CreatePageTblMgrObject(translationTableFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GmmPageTableMngr::setCsrHandle(void *csrHandle) {}
|
||||||
|
} // namespace NEO
|
||||||
@@ -31,6 +31,7 @@ set(RUNTIME_SRCS_OS_INTERFACE_WINDOWS
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/os_thread_win.h
|
${CMAKE_CURRENT_SOURCE_DIR}/os_thread_win.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/os_time_win.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/os_time_win.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/os_time_win.h
|
${CMAKE_CURRENT_SOURCE_DIR}/os_time_win.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/page_table_manager_functions.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_win.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_win.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_win.h
|
${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_win.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/thk_wrapper.h
|
${CMAKE_CURRENT_SOURCE_DIR}/thk_wrapper.h
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ bool DeviceFactory::getDevices(size_t &numDevices, ExecutionEnvironment &executi
|
|||||||
executionEnvironment.prepareRootDeviceEnvironments(static_cast<uint32_t>(numRootDevices));
|
executionEnvironment.prepareRootDeviceEnvironments(static_cast<uint32_t>(numRootDevices));
|
||||||
|
|
||||||
auto hardwareInfo = executionEnvironment.getMutableHardwareInfo();
|
auto hardwareInfo = executionEnvironment.getMutableHardwareInfo();
|
||||||
std::unique_ptr<Wddm> wddm(Wddm::createWddm());
|
std::unique_ptr<Wddm> wddm(Wddm::createWddm(*executionEnvironment.rootDeviceEnvironments[0].get()));
|
||||||
if (!wddm->init(*hardwareInfo)) {
|
if (!wddm->init(*hardwareInfo)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "core/gmm_helper/gmm_helper.h"
|
||||||
|
#include "runtime/gmm_helper/page_table_mngr.h"
|
||||||
|
#include "runtime/platform/platform.h"
|
||||||
|
|
||||||
|
#include "gmm_client_context.h"
|
||||||
|
|
||||||
|
namespace NEO {
|
||||||
|
GmmPageTableMngr::GmmPageTableMngr(unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb) {
|
||||||
|
clientContext = platform()->peekGmmClientContext()->getHandle();
|
||||||
|
pageTableManager = clientContext->CreatePageTblMgrObject(translationTableCb, translationTableFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GmmPageTableMngr::setCsrHandle(void *csrHandle) {
|
||||||
|
pageTableManager->GmmSetCsrHandle(csrHandle);
|
||||||
|
}
|
||||||
|
} // namespace NEO
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "runtime/os_interface/windows/wddm/wddm.h"
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||||
|
|
||||||
#include "core/command_stream/preemption.h"
|
#include "core/command_stream/preemption.h"
|
||||||
|
#include "core/execution_environment/root_device_environment.h"
|
||||||
#include "core/gmm_helper/gmm_helper.h"
|
#include "core/gmm_helper/gmm_helper.h"
|
||||||
#include "core/helpers/interlocked_max.h"
|
#include "core/helpers/interlocked_max.h"
|
||||||
#include "core/os_interface/windows/debug_registry_reader.h"
|
#include "core/os_interface/windows/debug_registry_reader.h"
|
||||||
@@ -60,15 +61,14 @@ 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() {
|
Wddm::Wddm(RootDeviceEnvironment &rootDeviceEnvironment) : rootDeviceEnvironment(rootDeviceEnvironment) {
|
||||||
featureTable.reset(new FeatureTable());
|
featureTable.reset(new FeatureTable());
|
||||||
workaroundTable.reset(new WorkaroundTable());
|
workaroundTable.reset(new WorkaroundTable());
|
||||||
gtSystemInfo.reset(new GT_SYSTEM_INFO);
|
gtSystemInfo.reset(new GT_SYSTEM_INFO);
|
||||||
gfxPlatform.reset(new PLATFORM);
|
gfxPlatform.reset(new PLATFORM);
|
||||||
memset(gtSystemInfo.get(), 0, sizeof(*gtSystemInfo));
|
memset(gtSystemInfo.get(), 0, sizeof(*gtSystemInfo));
|
||||||
memset(gfxPlatform.get(), 0, sizeof(*gfxPlatform));
|
memset(gfxPlatform.get(), 0, sizeof(*gfxPlatform));
|
||||||
|
this->registryReader.reset(new RegistryReader(false, "System\\CurrentControlSet\\Control\\GraphicsDrivers\\Scheduler"));
|
||||||
registryReader.reset(new RegistryReader(false, "System\\CurrentControlSet\\Control\\GraphicsDrivers\\Scheduler"));
|
|
||||||
adapterLuid.HighPart = 0;
|
adapterLuid.HighPart = 0;
|
||||||
adapterLuid.LowPart = 0;
|
adapterLuid.LowPart = 0;
|
||||||
kmDafListener = std::unique_ptr<KmDafListener>(new KmDafListener);
|
kmDafListener = std::unique_ptr<KmDafListener>(new KmDafListener);
|
||||||
@@ -78,7 +78,6 @@ Wddm::Wddm() {
|
|||||||
|
|
||||||
Wddm::~Wddm() {
|
Wddm::~Wddm() {
|
||||||
temporaryResources.reset();
|
temporaryResources.reset();
|
||||||
resetPageTableManager(nullptr);
|
|
||||||
destroyPagingQueue();
|
destroyPagingQueue();
|
||||||
destroyDevice();
|
destroyDevice();
|
||||||
closeAdapter();
|
closeAdapter();
|
||||||
@@ -398,8 +397,8 @@ bool Wddm::mapGpuVirtualAddress(Gmm *gmm, D3DKMT_HANDLE handle, D3DGPU_VIRTUAL_A
|
|||||||
|
|
||||||
kmDafListener->notifyMapGpuVA(featureTable->ftrKmdDaf, adapter, device, handle, MapGPUVA.VirtualAddress, gdi->escape);
|
kmDafListener->notifyMapGpuVA(featureTable->ftrKmdDaf, adapter, device, handle, MapGPUVA.VirtualAddress, gdi->escape);
|
||||||
|
|
||||||
if (gmm->isRenderCompressed && pageTableManager.get()) {
|
if (gmm->isRenderCompressed && rootDeviceEnvironment.pageTableManager.get()) {
|
||||||
return updateAuxTable(gpuPtr, gmm, true);
|
return rootDeviceEnvironment.pageTableManager->updateAuxTable(gpuPtr, gmm, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -906,19 +905,6 @@ void Wddm::releaseReservedAddress(void *reservedAddress) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Wddm::updateAuxTable(D3DGPU_VIRTUAL_ADDRESS gpuVa, Gmm *gmm, bool map) {
|
|
||||||
GMM_DDI_UPDATEAUXTABLE ddiUpdateAuxTable = {};
|
|
||||||
ddiUpdateAuxTable.BaseGpuVA = gpuVa;
|
|
||||||
ddiUpdateAuxTable.BaseResInfo = gmm->gmmResourceInfo->peekHandle();
|
|
||||||
ddiUpdateAuxTable.DoNotWait = true;
|
|
||||||
ddiUpdateAuxTable.Map = map ? 1u : 0u;
|
|
||||||
return pageTableManager->updateAuxTable(&ddiUpdateAuxTable) == GMM_STATUS::GMM_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Wddm::resetPageTableManager(GmmPageTableMngr *newPageTableManager) {
|
|
||||||
pageTableManager.reset(newPageTableManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Wddm::reserveValidAddressRange(size_t size, void *&reservedMem) {
|
bool Wddm::reserveValidAddressRange(size_t size, void *&reservedMem) {
|
||||||
reservedMem = virtualAlloc(nullptr, size, MEM_RESERVE, PAGE_READWRITE);
|
reservedMem = virtualAlloc(nullptr, size, MEM_RESERVE, PAGE_READWRITE);
|
||||||
if (reservedMem == nullptr) {
|
if (reservedMem == nullptr) {
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ namespace NEO {
|
|||||||
class Gdi;
|
class Gdi;
|
||||||
class Gmm;
|
class Gmm;
|
||||||
class GmmMemory;
|
class GmmMemory;
|
||||||
class GmmPageTableMngr;
|
|
||||||
class OsContextWin;
|
class OsContextWin;
|
||||||
class SettingsReader;
|
class SettingsReader;
|
||||||
class WddmAllocation;
|
class WddmAllocation;
|
||||||
@@ -33,6 +32,7 @@ class WddmResidentAllocationsContainer;
|
|||||||
struct AllocationStorageData;
|
struct AllocationStorageData;
|
||||||
struct HardwareInfo;
|
struct HardwareInfo;
|
||||||
struct KmDafListener;
|
struct KmDafListener;
|
||||||
|
struct RootDeviceEnvironment;
|
||||||
struct MonitoredFence;
|
struct MonitoredFence;
|
||||||
struct OsHandleStorage;
|
struct OsHandleStorage;
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ class Wddm {
|
|||||||
|
|
||||||
virtual ~Wddm();
|
virtual ~Wddm();
|
||||||
|
|
||||||
static Wddm *createWddm();
|
static Wddm *createWddm(RootDeviceEnvironment &rootDeviceEnvironment);
|
||||||
bool init(HardwareInfo &outHardwareInfo);
|
bool init(HardwareInfo &outHardwareInfo);
|
||||||
|
|
||||||
MOCKABLE_VIRTUAL bool evict(const D3DKMT_HANDLE *handleList, uint32_t numOfHandles, uint64_t &sizeToTrim);
|
MOCKABLE_VIRTUAL bool evict(const D3DKMT_HANDLE *handleList, uint32_t numOfHandles, uint64_t &sizeToTrim);
|
||||||
@@ -131,10 +131,6 @@ class Wddm {
|
|||||||
|
|
||||||
std::unique_ptr<SettingsReader> registryReader;
|
std::unique_ptr<SettingsReader> registryReader;
|
||||||
|
|
||||||
GmmPageTableMngr *getPageTableManager() const { return pageTableManager.get(); }
|
|
||||||
void resetPageTableManager(GmmPageTableMngr *newPageTableManager);
|
|
||||||
bool updateAuxTable(D3DGPU_VIRTUAL_ADDRESS gpuVa, Gmm *gmm, bool map);
|
|
||||||
|
|
||||||
uintptr_t getWddmMinAddress() const {
|
uintptr_t getWddmMinAddress() const {
|
||||||
return this->minAddress;
|
return this->minAddress;
|
||||||
}
|
}
|
||||||
@@ -181,6 +177,7 @@ class Wddm {
|
|||||||
uint32_t maxRenderFrequency = 0;
|
uint32_t maxRenderFrequency = 0;
|
||||||
bool instrumentationEnabled = false;
|
bool instrumentationEnabled = false;
|
||||||
std::string deviceRegistryPath;
|
std::string deviceRegistryPath;
|
||||||
|
RootDeviceEnvironment &rootDeviceEnvironment;
|
||||||
|
|
||||||
unsigned long hwContextId = 0;
|
unsigned long hwContextId = 0;
|
||||||
LUID adapterLuid;
|
LUID adapterLuid;
|
||||||
@@ -188,7 +185,7 @@ class Wddm {
|
|||||||
std::unique_ptr<GmmMemory> gmmMemory;
|
std::unique_ptr<GmmMemory> gmmMemory;
|
||||||
uintptr_t minAddress = 0;
|
uintptr_t minAddress = 0;
|
||||||
|
|
||||||
Wddm();
|
Wddm(RootDeviceEnvironment &rootDeviceEnvironment);
|
||||||
MOCKABLE_VIRTUAL bool openAdapter();
|
MOCKABLE_VIRTUAL bool openAdapter();
|
||||||
MOCKABLE_VIRTUAL bool waitOnGPU(D3DKMT_HANDLE context);
|
MOCKABLE_VIRTUAL bool waitOnGPU(D3DKMT_HANDLE context);
|
||||||
bool createDevice(PreemptionMode preemptionMode);
|
bool createDevice(PreemptionMode preemptionMode);
|
||||||
@@ -205,8 +202,6 @@ class Wddm {
|
|||||||
static VirtualFreeFcn virtualFreeFnc;
|
static VirtualFreeFcn virtualFreeFnc;
|
||||||
static VirtualAllocFcn virtualAllocFnc;
|
static VirtualAllocFcn virtualAllocFnc;
|
||||||
|
|
||||||
std::unique_ptr<GmmPageTableMngr> pageTableManager;
|
|
||||||
|
|
||||||
std::unique_ptr<KmDafListener> kmDafListener;
|
std::unique_ptr<KmDafListener> kmDafListener;
|
||||||
std::unique_ptr<WddmInterface> wddmInterface;
|
std::unique_ptr<WddmInterface> wddmInterface;
|
||||||
std::unique_ptr<WddmResidentAllocationsContainer> temporaryResources;
|
std::unique_ptr<WddmResidentAllocationsContainer> temporaryResources;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include "runtime/os_interface/windows/wddm/wddm.h"
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
Wddm *Wddm::createWddm() {
|
Wddm *Wddm::createWddm(RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||||
return new Wddm();
|
return new Wddm(rootDeviceEnvironment);
|
||||||
}
|
}
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -36,11 +36,9 @@ class WddmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily>
|
|||||||
GmmPageTableMngr *createPageTableManager() override;
|
GmmPageTableMngr *createPageTableManager() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initPageTableManagerRegisters(LinearStream &csr) override;
|
|
||||||
void kmDafLockAllocations(ResidencyContainer &allocationsForResidency);
|
void kmDafLockAllocations(ResidencyContainer &allocationsForResidency);
|
||||||
|
|
||||||
Wddm *wddm;
|
Wddm *wddm;
|
||||||
COMMAND_BUFFER_HEADER_REC *commandBufferHeader;
|
COMMAND_BUFFER_HEADER_REC *commandBufferHeader;
|
||||||
bool pageTableManagerInitialized = false;
|
|
||||||
};
|
};
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -134,22 +134,12 @@ GmmPageTableMngr *WddmCommandStreamReceiver<GfxFamily>::createPageTableManager()
|
|||||||
GMM_TRANSLATIONTABLE_CALLBACKS ttCallbacks = {};
|
GMM_TRANSLATIONTABLE_CALLBACKS ttCallbacks = {};
|
||||||
ttCallbacks.pfWriteL3Adr = TTCallbacks<GfxFamily>::writeL3Address;
|
ttCallbacks.pfWriteL3Adr = TTCallbacks<GfxFamily>::writeL3Address;
|
||||||
|
|
||||||
GmmPageTableMngr *gmmPageTableMngr = GmmPageTableMngr::create(TT_TYPE::TRTT | TT_TYPE::AUXTT, &ttCallbacks);
|
GmmPageTableMngr *gmmPageTableMngr = GmmPageTableMngr::create(TT_TYPE::AUXTT, &ttCallbacks);
|
||||||
gmmPageTableMngr->setCsrHandle(this);
|
gmmPageTableMngr->setCsrHandle(this);
|
||||||
this->wddm->resetPageTableManager(gmmPageTableMngr);
|
this->executionEnvironment.rootDeviceEnvironments[this->rootDeviceIndex]->pageTableManager.reset(gmmPageTableMngr);
|
||||||
return gmmPageTableMngr;
|
return gmmPageTableMngr;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename GfxFamily>
|
|
||||||
void WddmCommandStreamReceiver<GfxFamily>::initPageTableManagerRegisters(LinearStream &csr) {
|
|
||||||
if (wddm->getPageTableManager() && !pageTableManagerInitialized) {
|
|
||||||
wddm->getPageTableManager()->initContextTRTableRegister(this, GMM_ENGINE_TYPE::ENGINE_TYPE_RCS);
|
|
||||||
wddm->getPageTableManager()->initContextAuxTableRegister(this, GMM_ENGINE_TYPE::ENGINE_TYPE_RCS);
|
|
||||||
|
|
||||||
pageTableManagerInitialized = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
void WddmCommandStreamReceiver<GfxFamily>::kmDafLockAllocations(ResidencyContainer &allocationsForResidency) {
|
void WddmCommandStreamReceiver<GfxFamily>::kmDafLockAllocations(ResidencyContainer &allocationsForResidency) {
|
||||||
for (auto &graphicsAllocation : allocationsForResidency) {
|
for (auto &graphicsAllocation : allocationsForResidency) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include "runtime/os_interface/windows/wddm_memory_manager.h"
|
#include "runtime/os_interface/windows/wddm_memory_manager.h"
|
||||||
|
|
||||||
|
#include "core/execution_environment/root_device_environment.h"
|
||||||
#include "core/gmm_helper/gmm_helper.h"
|
#include "core/gmm_helper/gmm_helper.h"
|
||||||
#include "core/helpers/aligned_memory.h"
|
#include "core/helpers/aligned_memory.h"
|
||||||
#include "core/helpers/deferred_deleter_helper.h"
|
#include "core/helpers/deferred_deleter_helper.h"
|
||||||
@@ -17,6 +18,7 @@
|
|||||||
#include "runtime/device/device.h"
|
#include "runtime/device/device.h"
|
||||||
#include "runtime/execution_environment/execution_environment.h"
|
#include "runtime/execution_environment/execution_environment.h"
|
||||||
#include "runtime/gmm_helper/gmm.h"
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
|
#include "runtime/gmm_helper/page_table_mngr.h"
|
||||||
#include "runtime/gmm_helper/resource_info.h"
|
#include "runtime/gmm_helper/resource_info.h"
|
||||||
#include "runtime/helpers/surface_formats.h"
|
#include "runtime/helpers/surface_formats.h"
|
||||||
#include "runtime/memory_manager/deferrable_deletion.h"
|
#include "runtime/memory_manager/deferrable_deletion.h"
|
||||||
@@ -333,8 +335,9 @@ void WddmMemoryManager::freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation
|
|||||||
|
|
||||||
auto defaultGmm = gfxAllocation->getDefaultGmm();
|
auto defaultGmm = gfxAllocation->getDefaultGmm();
|
||||||
if (defaultGmm) {
|
if (defaultGmm) {
|
||||||
if (defaultGmm->isRenderCompressed && wddm->getPageTableManager()) {
|
auto index = gfxAllocation->getRootDeviceIndex();
|
||||||
auto status = wddm->updateAuxTable(input->getGpuAddress(), defaultGmm, false);
|
if (defaultGmm->isRenderCompressed && executionEnvironment.rootDeviceEnvironments[index]->pageTableManager.get()) {
|
||||||
|
auto status = executionEnvironment.rootDeviceEnvironments[index]->pageTableManager->updateAuxTable(input->getGpuAddress(), defaultGmm, false);
|
||||||
DEBUG_BREAK_IF(!status);
|
DEBUG_BREAK_IF(!status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -493,10 +496,6 @@ uint64_t WddmMemoryManager::getSystemSharedMemory() {
|
|||||||
return wddm->getSystemSharedMemory();
|
return wddm->getSystemSharedMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WddmMemoryManager::mapAuxGpuVA(GraphicsAllocation *graphicsAllocation) {
|
|
||||||
return wddm->updateAuxTable(graphicsAllocation->getGpuAddress(), graphicsAllocation->getDefaultGmm(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
AlignedMallocRestrictions *WddmMemoryManager::getAlignedMallocRestrictions() {
|
AlignedMallocRestrictions *WddmMemoryManager::getAlignedMallocRestrictions() {
|
||||||
return &mallocRestrictions;
|
return &mallocRestrictions;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,8 +54,6 @@ class WddmMemoryManager : public MemoryManager {
|
|||||||
|
|
||||||
bool isMemoryBudgetExhausted() const override;
|
bool isMemoryBudgetExhausted() const override;
|
||||||
|
|
||||||
bool mapAuxGpuVA(GraphicsAllocation *graphicsAllocation) override;
|
|
||||||
|
|
||||||
AlignedMallocRestrictions *getAlignedMallocRestrictions() override;
|
AlignedMallocRestrictions *getAlignedMallocRestrictions() override;
|
||||||
|
|
||||||
bool copyMemoryToAllocation(GraphicsAllocation *graphicsAllocation, const void *memoryToCopy, size_t sizeToCopy) override;
|
bool copyMemoryToAllocation(GraphicsAllocation *graphicsAllocation, const void *memoryToCopy, size_t sizeToCopy) override;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ struct CreateCommandStreamReceiverTest : public ::testing::TestWithParam<Command
|
|||||||
HWTEST_P(CreateCommandStreamReceiverTest, givenCreateCommandStreamWhenCsrIsSetToValidTypeThenTheFuntionReturnsCommandStreamReceiver) {
|
HWTEST_P(CreateCommandStreamReceiverTest, givenCreateCommandStreamWhenCsrIsSetToValidTypeThenTheFuntionReturnsCommandStreamReceiver) {
|
||||||
DebugManagerStateRestore stateRestorer;
|
DebugManagerStateRestore stateRestorer;
|
||||||
HardwareInfo *hwInfo = nullptr;
|
HardwareInfo *hwInfo = nullptr;
|
||||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||||
MockAubCenterFixture::setMockAubCenter(*executionEnvironment->rootDeviceEnvironments[0]);
|
MockAubCenterFixture::setMockAubCenter(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||||
|
|
||||||
CommandStreamReceiverType csrType = GetParam();
|
CommandStreamReceiverType csrType = GetParam();
|
||||||
|
|||||||
@@ -5,8 +5,10 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "core/execution_environment/root_device_environment.h"
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
#include "unit_tests/fixtures/device_fixture.h"
|
#include "unit_tests/fixtures/device_fixture.h"
|
||||||
|
#include "unit_tests/mocks/mock_execution_environment.h"
|
||||||
#include "unit_tests/mocks/mock_ostime.h"
|
#include "unit_tests/mocks/mock_ostime.h"
|
||||||
#include "unit_tests/mocks/mock_ostime_win.h"
|
#include "unit_tests/mocks/mock_ostime_win.h"
|
||||||
#include "unit_tests/mocks/mock_wddm.h"
|
#include "unit_tests/mocks/mock_wddm.h"
|
||||||
@@ -20,7 +22,9 @@ namespace ULT {
|
|||||||
typedef ::testing::Test MockOSTimeWinTest;
|
typedef ::testing::Test MockOSTimeWinTest;
|
||||||
|
|
||||||
TEST_F(MockOSTimeWinTest, DynamicResolution) {
|
TEST_F(MockOSTimeWinTest, DynamicResolution) {
|
||||||
auto wddmMock = std::unique_ptr<WddmMock>(new WddmMock());
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
|
||||||
|
auto wddmMock = std::unique_ptr<WddmMock>(new WddmMock(rootDeviceEnvironment));
|
||||||
auto mDev = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
auto mDev = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||||
|
|
||||||
auto hwInfo = mDev->getHardwareInfo();
|
auto hwInfo = mDev->getHardwareInfo();
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ struct BufferEnqueueFixture : public HardwareParse,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown() override {
|
void TearDown() override {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
void DeviceInstrumentationFixture::SetUp(bool instrumentation) {
|
void DeviceInstrumentationFixture::SetUp(bool instrumentation) {
|
||||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||||
hwInfo->capabilityTable.instrumentationEnabled = instrumentation;
|
hwInfo->capabilityTable.instrumentationEnabled = instrumentation;
|
||||||
device = std::unique_ptr<Device>(Device::create<RootDevice>(executionEnvironment, 0));
|
device = std::unique_ptr<Device>(Device::create<RootDevice>(executionEnvironment, 0));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ struct MockAubCsrToTestNotifyAubCapture : public AUBCommandStreamReceiverHw<GfxF
|
|||||||
|
|
||||||
GEN12LPTEST_F(Gen12LpGmmCallbacksTests, givenCsrWithoutAubDumpWhenNotifyAubCaptureCallbackIsCalledThenDoNothing) {
|
GEN12LPTEST_F(Gen12LpGmmCallbacksTests, givenCsrWithoutAubDumpWhenNotifyAubCaptureCallbackIsCalledThenDoNothing) {
|
||||||
HardwareInfo *hwInfo = nullptr;
|
HardwareInfo *hwInfo = nullptr;
|
||||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||||
executionEnvironment->initializeMemoryManager();
|
executionEnvironment->initializeMemoryManager();
|
||||||
auto csr = std::make_unique<WddmCommandStreamReceiver<FamilyType>>(*executionEnvironment, 0);
|
auto csr = std::make_unique<WddmCommandStreamReceiver<FamilyType>>(*executionEnvironment, 0);
|
||||||
uint64_t address = 0xFEDCBA9876543210;
|
uint64_t address = 0xFEDCBA9876543210;
|
||||||
|
|||||||
@@ -12,8 +12,9 @@
|
|||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
|
||||||
ExecutionEnvironment *getExecutionEnvironmentImpl(HardwareInfo *&hwInfo) {
|
ExecutionEnvironment *getExecutionEnvironmentImpl(HardwareInfo *&hwInfo, uint32_t rootDeviceEnvironments) {
|
||||||
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||||
|
executionEnvironment->prepareRootDeviceEnvironments(rootDeviceEnvironments);
|
||||||
size_t numDevicesReturned = 0;
|
size_t numDevicesReturned = 0;
|
||||||
hwInfo = nullptr;
|
hwInfo = nullptr;
|
||||||
DeviceFactory::getDevices(numDevicesReturned, *executionEnvironment);
|
DeviceFactory::getDevices(numDevicesReturned, *executionEnvironment);
|
||||||
|
|||||||
@@ -13,5 +13,5 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
ExecutionEnvironment *getExecutionEnvironmentImpl(HardwareInfo *&hwInfo);
|
ExecutionEnvironment *getExecutionEnvironmentImpl(HardwareInfo *&hwInfo, uint32_t rootDeviceEnvironments);
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -7,9 +7,11 @@
|
|||||||
|
|
||||||
#include "core/command_stream/preemption.h"
|
#include "core/command_stream/preemption.h"
|
||||||
#include "core/helpers/cache_policy.h"
|
#include "core/helpers/cache_policy.h"
|
||||||
|
#include "core/memory_manager/graphics_allocation.h"
|
||||||
#include "core/memory_manager/memory_constants.h"
|
#include "core/memory_manager/memory_constants.h"
|
||||||
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
|
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
|
||||||
#include "runtime/event/event.h"
|
#include "runtime/event/event.h"
|
||||||
|
#include "runtime/gmm_helper/page_table_mngr.h"
|
||||||
#include "runtime/helpers/dispatch_info.h"
|
#include "runtime/helpers/dispatch_info.h"
|
||||||
#include "runtime/helpers/hardware_commands_helper.h"
|
#include "runtime/helpers/hardware_commands_helper.h"
|
||||||
#include "runtime/mem_obj/image.h"
|
#include "runtime/mem_obj/image.h"
|
||||||
@@ -2017,3 +2019,19 @@ HWTEST_F(MemoryAllocatorTest, givenMemoryManagerWhenHostPtrTrackingEnabledThenNo
|
|||||||
result = memoryManager->useNonSvmHostPtrAlloc(GraphicsAllocation::AllocationType::MAP_ALLOCATION);
|
result = memoryManager->useNonSvmHostPtrAlloc(GraphicsAllocation::AllocationType::MAP_ALLOCATION);
|
||||||
EXPECT_EQ(!executionEnvironment->isFullRangeSvm(), result);
|
EXPECT_EQ(!executionEnvironment->isFullRangeSvm(), result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using PageTableManagerTest = ::testing::Test;
|
||||||
|
|
||||||
|
HWTEST_F(PageTableManagerTest, givenMemoryManagerThatSupportsPageTableManagerWhenMapAuxGpuVAIsCalledThenItReturnsTrue) {
|
||||||
|
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||||
|
executionEnvironment->prepareRootDeviceEnvironments(2);
|
||||||
|
auto memoryManager = new MockMemoryManager(false, false, *executionEnvironment);
|
||||||
|
executionEnvironment->memoryManager.reset(memoryManager);
|
||||||
|
MockGraphicsAllocation allocation(1u, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull);
|
||||||
|
MockGmm gmm;
|
||||||
|
allocation.setDefaultGmm(&gmm);
|
||||||
|
bool mapped = memoryManager->mapAuxGpuVA(&allocation);
|
||||||
|
auto hwInfo = executionEnvironment->getHardwareInfo();
|
||||||
|
|
||||||
|
EXPECT_EQ(HwHelper::get(hwInfo->platform.eRenderCoreFamily).isPageTableManagerSupported(*hwInfo), mapped);
|
||||||
|
}
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ set(IGDRCL_SRCS_tests_mocks
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm.h
|
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_client_context_base.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_client_context_base.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_client_context_base.h
|
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_client_context_base.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_page_table_mngr.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_page_table_mngr.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_resource_info.h
|
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_resource_info.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_resource_info.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_resource_info.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_graphics_allocation.h
|
${CMAKE_CURRENT_SOURCE_DIR}/mock_graphics_allocation.h
|
||||||
@@ -72,6 +74,7 @@ set(IGDRCL_SRCS_tests_mocks
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_tbx_csr.h
|
${CMAKE_CURRENT_SOURCE_DIR}/mock_tbx_csr.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_tbx_stream.h
|
${CMAKE_CURRENT_SOURCE_DIR}/mock_tbx_stream.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_timestamp_container.h
|
${CMAKE_CURRENT_SOURCE_DIR}/mock_timestamp_container.h
|
||||||
|
${NEO_SOURCE_DIR}/runtime/gmm_helper/page_table_mngr_impl.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
@@ -82,8 +85,6 @@ if(WIN32)
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_memory_base.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_memory_base.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_memory_base.h
|
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_memory_base.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_memory${BRANCH_DIR_SUFFIX}/mock_gmm_memory.h
|
${CMAKE_CURRENT_SOURCE_DIR}/gmm_memory${BRANCH_DIR_SUFFIX}/mock_gmm_memory.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_page_table_mngr.h
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_page_table_mngr.cpp
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_wddm_interface20.h
|
${CMAKE_CURRENT_SOURCE_DIR}/mock_wddm_interface20.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_wddm_interface23.h
|
${CMAKE_CURRENT_SOURCE_DIR}/mock_wddm_interface23.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_wddm.h
|
${CMAKE_CURRENT_SOURCE_DIR}/mock_wddm.h
|
||||||
@@ -97,6 +98,7 @@ else()
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/linux/mock_drm_allocation.h
|
${CMAKE_CURRENT_SOURCE_DIR}/linux/mock_drm_allocation.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/linux/mock_drm_memory_manager.h
|
${CMAKE_CURRENT_SOURCE_DIR}/linux/mock_drm_memory_manager.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/linux/mock_drm_command_stream_receiver.h
|
${CMAKE_CURRENT_SOURCE_DIR}/linux/mock_drm_command_stream_receiver.h
|
||||||
|
${NEO_SOURCE_DIR}/runtime/os_interface/linux/page_table_manager_functions.cpp
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ using namespace ::testing;
|
|||||||
GmmPageTableMngr *GmmPageTableMngr::create(unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb) {
|
GmmPageTableMngr *GmmPageTableMngr::create(unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb) {
|
||||||
auto pageTableMngr = new ::testing::NiceMock<MockGmmPageTableMngr>(translationTableFlags, translationTableCb);
|
auto pageTableMngr = new ::testing::NiceMock<MockGmmPageTableMngr>(translationTableFlags, translationTableCb);
|
||||||
ON_CALL(*pageTableMngr, initContextAuxTableRegister(_, _)).WillByDefault(Return(GMM_SUCCESS));
|
ON_CALL(*pageTableMngr, initContextAuxTableRegister(_, _)).WillByDefault(Return(GMM_SUCCESS));
|
||||||
ON_CALL(*pageTableMngr, initContextTRTableRegister(_, _)).WillByDefault(Return(GMM_SUCCESS));
|
|
||||||
ON_CALL(*pageTableMngr, updateAuxTable(_)).WillByDefault(Return(GMM_SUCCESS));
|
ON_CALL(*pageTableMngr, updateAuxTable(_)).WillByDefault(Return(GMM_SUCCESS));
|
||||||
return pageTableMngr;
|
return pageTableMngr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,18 +11,25 @@
|
|||||||
|
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Winconsistent-missing-override"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
class MockGmmPageTableMngr : public GmmPageTableMngr {
|
class MockGmmPageTableMngr : public GmmPageTableMngr {
|
||||||
public:
|
public:
|
||||||
MockGmmPageTableMngr() = default;
|
MockGmmPageTableMngr() = default;
|
||||||
|
|
||||||
MockGmmPageTableMngr(unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb)
|
MockGmmPageTableMngr(unsigned int translationTableFlags, GMM_TRANSLATIONTABLE_CALLBACKS *translationTableCb)
|
||||||
: translationTableFlags(translationTableFlags), translationTableCb(*translationTableCb){};
|
: translationTableFlags(translationTableFlags) {
|
||||||
|
if (translationTableCb) {
|
||||||
|
this->translationTableCb = *translationTableCb;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
MOCK_METHOD2(initContextAuxTableRegister, GMM_STATUS(HANDLE initialBBHandle, GMM_ENGINE_TYPE engineType));
|
MOCK_METHOD2(initContextAuxTableRegister, GMM_STATUS(HANDLE initialBBHandle, GMM_ENGINE_TYPE engineType));
|
||||||
|
|
||||||
MOCK_METHOD2(initContextTRTableRegister, GMM_STATUS(HANDLE initialBBHandle, GMM_ENGINE_TYPE engineType));
|
|
||||||
|
|
||||||
MOCK_METHOD1(updateAuxTable, GMM_STATUS(const GMM_DDI_UPDATEAUXTABLE *ddiUpdateAuxTable));
|
MOCK_METHOD1(updateAuxTable, GMM_STATUS(const GMM_DDI_UPDATEAUXTABLE *ddiUpdateAuxTable));
|
||||||
|
|
||||||
void setCsrHandle(void *csrHandle) override;
|
void setCsrHandle(void *csrHandle) override;
|
||||||
@@ -30,8 +37,12 @@ class MockGmmPageTableMngr : public GmmPageTableMngr {
|
|||||||
uint32_t setCsrHanleCalled = 0;
|
uint32_t setCsrHanleCalled = 0;
|
||||||
void *passedCsrHandle = nullptr;
|
void *passedCsrHandle = nullptr;
|
||||||
|
|
||||||
GMM_TRANSLATIONTABLE_CALLBACKS translationTableCb = {};
|
|
||||||
unsigned int translationTableFlags = 0;
|
unsigned int translationTableFlags = 0;
|
||||||
|
GMM_TRANSLATIONTABLE_CALLBACKS translationTableCb = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include "unit_tests/mocks/mock_wddm.h"
|
#include "unit_tests/mocks/mock_wddm.h"
|
||||||
|
|
||||||
|
#include "core/execution_environment/root_device_environment.h"
|
||||||
#include "core/helpers/aligned_memory.h"
|
#include "core/helpers/aligned_memory.h"
|
||||||
#include "runtime/os_interface/windows/gdi_interface.h"
|
#include "runtime/os_interface/windows/gdi_interface.h"
|
||||||
#include "runtime/os_interface/windows/wddm_allocation.h"
|
#include "runtime/os_interface/windows/wddm_allocation.h"
|
||||||
@@ -17,7 +18,7 @@
|
|||||||
|
|
||||||
using namespace NEO;
|
using namespace NEO;
|
||||||
|
|
||||||
WddmMock::WddmMock() : Wddm() {
|
WddmMock::WddmMock(RootDeviceEnvironment &rootDeviceEnvironment) : Wddm(rootDeviceEnvironment) {
|
||||||
this->temporaryResources = std::make_unique<MockWddmResidentAllocationsContainer>(this);
|
this->temporaryResources = std::make_unique<MockWddmResidentAllocationsContainer>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,3 +274,7 @@ void *GmockWddm::virtualAllocWrapper(void *inPtr, size_t size, uint32_t flags, u
|
|||||||
virtualAllocAddress += size;
|
virtualAllocAddress += size;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GmockWddm::GmockWddm(RootDeviceEnvironment &rootDeviceEnvironment) : WddmMock(rootDeviceEnvironment) {
|
||||||
|
virtualAllocAddress = NEO::windowsMinAddress;
|
||||||
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class WddmMock : public Wddm {
|
|||||||
using Wddm::temporaryResources;
|
using Wddm::temporaryResources;
|
||||||
using Wddm::wddmInterface;
|
using Wddm::wddmInterface;
|
||||||
|
|
||||||
WddmMock();
|
WddmMock(RootDeviceEnvironment &rootDeviceEnvironment);
|
||||||
~WddmMock();
|
~WddmMock();
|
||||||
|
|
||||||
bool makeResident(const D3DKMT_HANDLE *handles, uint32_t count, bool cantTrimFurther, uint64_t *numberOfBytesToTrim) override;
|
bool makeResident(const D3DKMT_HANDLE *handles, uint32_t count, bool cantTrimFurther, uint64_t *numberOfBytesToTrim) override;
|
||||||
@@ -115,8 +115,8 @@ class WddmMock : public Wddm {
|
|||||||
WddmMockHelpers::CallResult getPagingFenceAddressResult;
|
WddmMockHelpers::CallResult getPagingFenceAddressResult;
|
||||||
WddmMockHelpers::CallResult reserveGpuVirtualAddressResult;
|
WddmMockHelpers::CallResult reserveGpuVirtualAddressResult;
|
||||||
|
|
||||||
NTSTATUS createAllocationStatus;
|
NTSTATUS createAllocationStatus = STATUS_SUCCESS;
|
||||||
bool mapGpuVaStatus;
|
bool mapGpuVaStatus = true;
|
||||||
bool callBaseDestroyAllocations = true;
|
bool callBaseDestroyAllocations = true;
|
||||||
bool failOpenSharedHandle = false;
|
bool failOpenSharedHandle = false;
|
||||||
bool callBaseMapGpuVa = true;
|
bool callBaseMapGpuVa = true;
|
||||||
@@ -127,9 +127,7 @@ class WddmMock : public Wddm {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct GmockWddm : WddmMock {
|
struct GmockWddm : WddmMock {
|
||||||
GmockWddm() {
|
GmockWddm(RootDeviceEnvironment &rootDeviceEnvironment);
|
||||||
virtualAllocAddress = NEO::windowsMinAddress;
|
|
||||||
}
|
|
||||||
~GmockWddm() = default;
|
~GmockWddm() = default;
|
||||||
bool virtualFreeWrapper(void *ptr, size_t size, uint32_t flags) {
|
bool virtualFreeWrapper(void *ptr, size_t size, uint32_t flags) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ using namespace NEO;
|
|||||||
struct DeviceCommandStreamLeaksTest : ::testing::Test {
|
struct DeviceCommandStreamLeaksTest : ::testing::Test {
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
HardwareInfo *hwInfo = nullptr;
|
HardwareInfo *hwInfo = nullptr;
|
||||||
executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||||
MockAubCenterFixture::setMockAubCenter(*executionEnvironment->rootDeviceEnvironments[0]);
|
MockAubCenterFixture::setMockAubCenter(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "core/command_stream/preemption.h"
|
#include "core/command_stream/preemption.h"
|
||||||
|
#include "core/gmm_helper/gmm_helper.h"
|
||||||
|
#include "core/memory_manager/graphics_allocation.h"
|
||||||
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
|
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
|
||||||
|
#include "runtime/gmm_helper/page_table_mngr.h"
|
||||||
|
#include "runtime/gmm_helper/resource_info.h"
|
||||||
#include "runtime/helpers/flush_stamp.h"
|
#include "runtime/helpers/flush_stamp.h"
|
||||||
#include "runtime/helpers/memory_properties_flags_helpers.h"
|
#include "runtime/helpers/memory_properties_flags_helpers.h"
|
||||||
#include "runtime/mem_obj/buffer.h"
|
#include "runtime/mem_obj/buffer.h"
|
||||||
@@ -22,6 +26,8 @@
|
|||||||
#include "unit_tests/helpers/execution_environment_helper.h"
|
#include "unit_tests/helpers/execution_environment_helper.h"
|
||||||
#include "unit_tests/helpers/hw_parse.h"
|
#include "unit_tests/helpers/hw_parse.h"
|
||||||
#include "unit_tests/mocks/linux/mock_drm_command_stream_receiver.h"
|
#include "unit_tests/mocks/linux/mock_drm_command_stream_receiver.h"
|
||||||
|
#include "unit_tests/mocks/mock_gmm.h"
|
||||||
|
#include "unit_tests/mocks/mock_gmm_page_table_mngr.h"
|
||||||
#include "unit_tests/mocks/mock_host_ptr_manager.h"
|
#include "unit_tests/mocks/mock_host_ptr_manager.h"
|
||||||
#include "unit_tests/mocks/mock_program.h"
|
#include "unit_tests/mocks/mock_program.h"
|
||||||
#include "unit_tests/mocks/mock_submissions_aggregator.h"
|
#include "unit_tests/mocks/mock_submissions_aggregator.h"
|
||||||
@@ -1370,3 +1376,66 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenAllocationWithSingleBuffer
|
|||||||
|
|
||||||
mm->freeGraphicsMemory(allocation);
|
mm->freeGraphicsMemory(allocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename GfxFamily>
|
||||||
|
struct MockDrmCsr : public DrmCommandStreamReceiver<GfxFamily> {
|
||||||
|
using DrmCommandStreamReceiver<GfxFamily>::DrmCommandStreamReceiver;
|
||||||
|
};
|
||||||
|
|
||||||
|
HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenDrmCommandStreamReceiverWhenCreatePageTableMngrIsCalledThenCreatePageTableManager) {
|
||||||
|
executionEnvironment.prepareRootDeviceEnvironments(2);
|
||||||
|
auto csr = std::make_unique<MockDrmCsr<FamilyType>>(executionEnvironment, 1, gemCloseWorkerMode::gemCloseWorkerActive);
|
||||||
|
auto pageTableManager = csr->createPageTableManager();
|
||||||
|
EXPECT_EQ(executionEnvironment.rootDeviceEnvironments[1]->pageTableManager.get(), pageTableManager);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenDrmCommandStreamReceiverWhenInitializePageTableMngrRegistersIsCalledThenInitializePageTableManager) {
|
||||||
|
executionEnvironment.prepareRootDeviceEnvironments(2);
|
||||||
|
auto csr = std::make_unique<MockDrmCsr<FamilyType>>(executionEnvironment, 1, gemCloseWorkerMode::gemCloseWorkerActive);
|
||||||
|
csr->createPageTableManager();
|
||||||
|
auto &rootDeviceEnvironment = executionEnvironment.rootDeviceEnvironments[1];
|
||||||
|
|
||||||
|
MockGmmPageTableMngr *mockMngr = static_cast<MockGmmPageTableMngr *>(rootDeviceEnvironment->pageTableManager.get());
|
||||||
|
EXPECT_CALL(*mockMngr, initContextAuxTableRegister(::testing::_, ::testing::_)).Times(1);
|
||||||
|
|
||||||
|
EXPECT_FALSE(rootDeviceEnvironment->pageTableManager->initialized);
|
||||||
|
LinearStream linearStream = {};
|
||||||
|
rootDeviceEnvironment->pageTableManager->initPageTableManagerRegisters();
|
||||||
|
EXPECT_TRUE(rootDeviceEnvironment->pageTableManager->initialized);
|
||||||
|
|
||||||
|
rootDeviceEnvironment->pageTableManager->initPageTableManagerRegisters();
|
||||||
|
EXPECT_TRUE(rootDeviceEnvironment->pageTableManager->initialized);
|
||||||
|
|
||||||
|
rootDeviceEnvironment->pageTableManager.reset(nullptr);
|
||||||
|
EXPECT_EQ(rootDeviceEnvironment->pageTableManager, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenPageTableManagerAndMapTrueWhenUpdateAuxTableIsCalledThenItReturnsTrue) {
|
||||||
|
auto mockMngr = new MockGmmPageTableMngr();
|
||||||
|
executionEnvironment.rootDeviceEnvironments[0]->pageTableManager.reset(mockMngr);
|
||||||
|
auto gmm = std::make_unique<MockGmm>();
|
||||||
|
GMM_DDI_UPDATEAUXTABLE ddiUpdateAuxTable = {};
|
||||||
|
EXPECT_CALL(*mockMngr, updateAuxTable(::testing::_)).Times(1).WillOnce(::testing::Invoke([&](const GMM_DDI_UPDATEAUXTABLE *arg) {ddiUpdateAuxTable = *arg; return GMM_SUCCESS; }));
|
||||||
|
auto result = executionEnvironment.rootDeviceEnvironments[0]->pageTableManager->updateAuxTable(0, gmm.get(), true);
|
||||||
|
EXPECT_EQ(ddiUpdateAuxTable.BaseGpuVA, 0ull);
|
||||||
|
EXPECT_EQ(ddiUpdateAuxTable.BaseResInfo, gmm->gmmResourceInfo->peekHandle());
|
||||||
|
EXPECT_EQ(ddiUpdateAuxTable.DoNotWait, true);
|
||||||
|
EXPECT_EQ(ddiUpdateAuxTable.Map, 1u);
|
||||||
|
|
||||||
|
EXPECT_TRUE(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenPageTableManagerAndMapFalseWhenUpdateAuxTableIsCalledThenItReturnsTrue) {
|
||||||
|
auto mockMngr = new MockGmmPageTableMngr();
|
||||||
|
executionEnvironment.rootDeviceEnvironments[0]->pageTableManager.reset(mockMngr);
|
||||||
|
auto gmm = std::make_unique<MockGmm>();
|
||||||
|
GMM_DDI_UPDATEAUXTABLE ddiUpdateAuxTable = {};
|
||||||
|
EXPECT_CALL(*mockMngr, updateAuxTable(::testing::_)).Times(1).WillOnce(::testing::Invoke([&](const GMM_DDI_UPDATEAUXTABLE *arg) {ddiUpdateAuxTable = *arg; return GMM_SUCCESS; }));
|
||||||
|
auto result = executionEnvironment.rootDeviceEnvironments[0]->pageTableManager->updateAuxTable(0, gmm.get(), false);
|
||||||
|
EXPECT_EQ(ddiUpdateAuxTable.BaseGpuVA, 0ull);
|
||||||
|
EXPECT_EQ(ddiUpdateAuxTable.BaseResInfo, gmm->gmmResourceInfo->peekHandle());
|
||||||
|
EXPECT_EQ(ddiUpdateAuxTable.DoNotWait, true);
|
||||||
|
EXPECT_EQ(ddiUpdateAuxTable.Map, 0u);
|
||||||
|
|
||||||
|
EXPECT_TRUE(result);
|
||||||
|
}
|
||||||
|
|||||||
@@ -7,6 +7,9 @@
|
|||||||
|
|
||||||
#include "mock_performance_counters.h"
|
#include "mock_performance_counters.h"
|
||||||
|
|
||||||
|
#include "core/execution_environment/root_device_environment.h"
|
||||||
|
#include "runtime/os_interface/os_interface.h"
|
||||||
|
#include "unit_tests/mocks/mock_execution_environment.h"
|
||||||
using namespace MetricsLibraryApi;
|
using namespace MetricsLibraryApi;
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
@@ -340,6 +343,20 @@ void PerformanceCountersMetricsLibraryFixture::TearDown() {
|
|||||||
PerformanceCountersFixture::TearDown();
|
PerformanceCountersFixture::TearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////
|
||||||
|
// PerformanceCountersFixture::PerformanceCountersFixture
|
||||||
|
//////////////////////////////////////////////////////
|
||||||
|
PerformanceCountersFixture::PerformanceCountersFixture() {
|
||||||
|
executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||||
|
rootDeviceEnvironment = std::make_unique<RootDeviceEnvironment>(*executionEnvironment);
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////
|
||||||
|
// PerformanceCountersFixture::~PerformanceCountersFixture
|
||||||
|
//////////////////////////////////////////////////////
|
||||||
|
PerformanceCountersFixture::~PerformanceCountersFixture() {
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
// PerformanceCountersMetricsLibraryFixture::createPerformanceCounters
|
// PerformanceCountersMetricsLibraryFixture::createPerformanceCounters
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -215,10 +215,14 @@ struct PerformanceCountersDeviceFixture {
|
|||||||
decltype(&PerformanceCounters::create) createFunc;
|
decltype(&PerformanceCounters::create) createFunc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct MockExecutionEnvironment;
|
||||||
|
struct RootDeviceEnvironment;
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
// PerformanceCountersFixture
|
// PerformanceCountersFixture
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
struct PerformanceCountersFixture {
|
struct PerformanceCountersFixture {
|
||||||
|
PerformanceCountersFixture();
|
||||||
|
~PerformanceCountersFixture();
|
||||||
virtual void SetUp();
|
virtual void SetUp();
|
||||||
virtual void TearDown();
|
virtual void TearDown();
|
||||||
virtual void createPerfCounters();
|
virtual void createPerfCounters();
|
||||||
@@ -228,6 +232,8 @@ struct PerformanceCountersFixture {
|
|||||||
std::unique_ptr<MockCommandQueue> queue;
|
std::unique_ptr<MockCommandQueue> queue;
|
||||||
std::unique_ptr<OSInterface> osInterface;
|
std::unique_ptr<OSInterface> osInterface;
|
||||||
std::unique_ptr<PerformanceCounters> performanceCountersBase;
|
std::unique_ptr<PerformanceCounters> performanceCountersBase;
|
||||||
|
std::unique_ptr<MockExecutionEnvironment> executionEnvironment;
|
||||||
|
std::unique_ptr<RootDeviceEnvironment> rootDeviceEnvironment;
|
||||||
};
|
};
|
||||||
|
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "core/execution_environment/root_device_environment.h"
|
||||||
#include "core/helpers/options.h"
|
#include "core/helpers/options.h"
|
||||||
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
|
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
|
||||||
#include "runtime/os_interface/os_interface.h"
|
#include "runtime/os_interface/os_interface.h"
|
||||||
@@ -12,6 +13,7 @@
|
|||||||
#include "runtime/utilities/tag_allocator.h"
|
#include "runtime/utilities/tag_allocator.h"
|
||||||
#include "unit_tests/fixtures/device_instrumentation_fixture.h"
|
#include "unit_tests/fixtures/device_instrumentation_fixture.h"
|
||||||
#include "unit_tests/mocks/mock_device.h"
|
#include "unit_tests/mocks/mock_device.h"
|
||||||
|
#include "unit_tests/mocks/mock_execution_environment.h"
|
||||||
#include "unit_tests/os_interface/mock_performance_counters.h"
|
#include "unit_tests/os_interface/mock_performance_counters.h"
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|||||||
@@ -5,7 +5,9 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "core/execution_environment/root_device_environment.h"
|
||||||
#include "runtime/os_interface/windows/deferrable_deletion_win.h"
|
#include "runtime/os_interface/windows/deferrable_deletion_win.h"
|
||||||
|
#include "unit_tests/mocks/mock_execution_environment.h"
|
||||||
#include "unit_tests/mocks/mock_wddm.h"
|
#include "unit_tests/mocks/mock_wddm.h"
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
@@ -35,15 +37,22 @@ class MockDeferrableDeletion : public DeferrableDeletionImpl {
|
|||||||
|
|
||||||
class DeferrableDeletionTest : public ::testing::Test {
|
class DeferrableDeletionTest : public ::testing::Test {
|
||||||
public:
|
public:
|
||||||
WddmMock wddm;
|
std::unique_ptr<MockExecutionEnvironment> executionEnvironment;
|
||||||
|
std::unique_ptr<WddmMock> wddm;
|
||||||
const D3DKMT_HANDLE handle = 0;
|
const D3DKMT_HANDLE handle = 0;
|
||||||
uint32_t allocationCount = 1;
|
uint32_t allocationCount = 1;
|
||||||
D3DKMT_HANDLE resourceHandle = 0;
|
D3DKMT_HANDLE resourceHandle = 0;
|
||||||
|
|
||||||
|
void SetUp() override {
|
||||||
|
executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||||
|
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||||
|
wddm = std::make_unique<WddmMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(DeferrableDeletionTest, givenDeferrableDeletionWhenIsCreatedThenObjectMembersAreSetProperly) {
|
TEST_F(DeferrableDeletionTest, givenDeferrableDeletionWhenIsCreatedThenObjectMembersAreSetProperly) {
|
||||||
MockDeferrableDeletion deletion(&wddm, &handle, allocationCount, resourceHandle);
|
MockDeferrableDeletion deletion(wddm.get(), &handle, allocationCount, resourceHandle);
|
||||||
EXPECT_EQ(&wddm, deletion.wddm);
|
EXPECT_EQ(wddm.get(), deletion.wddm);
|
||||||
EXPECT_NE(nullptr, deletion.handles);
|
EXPECT_NE(nullptr, deletion.handles);
|
||||||
EXPECT_EQ(handle, *deletion.handles);
|
EXPECT_EQ(handle, *deletion.handles);
|
||||||
EXPECT_NE(&handle, deletion.handles);
|
EXPECT_NE(&handle, deletion.handles);
|
||||||
@@ -52,9 +61,9 @@ TEST_F(DeferrableDeletionTest, givenDeferrableDeletionWhenIsCreatedThenObjectMem
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DeferrableDeletionTest, givenDeferrableDeletionWhenApplyIsCalledThenDeletionIsApplied) {
|
TEST_F(DeferrableDeletionTest, givenDeferrableDeletionWhenApplyIsCalledThenDeletionIsApplied) {
|
||||||
wddm.callBaseDestroyAllocations = false;
|
wddm->callBaseDestroyAllocations = false;
|
||||||
std::unique_ptr<DeferrableDeletion> deletion(DeferrableDeletion::create((Wddm *)&wddm, &handle, allocationCount, resourceHandle));
|
std::unique_ptr<DeferrableDeletion> deletion(DeferrableDeletion::create((Wddm *)wddm.get(), &handle, allocationCount, resourceHandle));
|
||||||
EXPECT_EQ(0, wddm.destroyAllocationResult.called);
|
EXPECT_EQ(0, wddm->destroyAllocationResult.called);
|
||||||
deletion->apply();
|
deletion->apply();
|
||||||
EXPECT_EQ(1, wddm.destroyAllocationResult.called);
|
EXPECT_EQ(1, wddm->destroyAllocationResult.called);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class WddmCommandStreamFixture {
|
|||||||
virtual void SetUp() {
|
virtual void SetUp() {
|
||||||
HardwareInfo *hwInfo = nullptr;
|
HardwareInfo *hwInfo = nullptr;
|
||||||
DebugManager.flags.CsrDispatchMode.set(static_cast<uint32_t>(DispatchMode::ImmediateDispatch));
|
DebugManager.flags.CsrDispatchMode.set(static_cast<uint32_t>(DispatchMode::ImmediateDispatch));
|
||||||
auto executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
auto executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||||
|
|
||||||
memoryManager = new MockWddmMemoryManager(*executionEnvironment);
|
memoryManager = new MockWddmMemoryManager(*executionEnvironment);
|
||||||
executionEnvironment->memoryManager.reset(memoryManager);
|
executionEnvironment->memoryManager.reset(memoryManager);
|
||||||
@@ -82,7 +82,6 @@ struct MockWddmCsr : public WddmCommandStreamReceiver<GfxFamily> {
|
|||||||
using CommandStreamReceiver::dispatchMode;
|
using CommandStreamReceiver::dispatchMode;
|
||||||
using CommandStreamReceiver::getCS;
|
using CommandStreamReceiver::getCS;
|
||||||
using WddmCommandStreamReceiver<GfxFamily>::commandBufferHeader;
|
using WddmCommandStreamReceiver<GfxFamily>::commandBufferHeader;
|
||||||
using WddmCommandStreamReceiver<GfxFamily>::pageTableManagerInitialized;
|
|
||||||
using WddmCommandStreamReceiver<GfxFamily>::WddmCommandStreamReceiver;
|
using WddmCommandStreamReceiver<GfxFamily>::WddmCommandStreamReceiver;
|
||||||
|
|
||||||
void overrideDispatchPolicy(DispatchMode overrideValue) {
|
void overrideDispatchPolicy(DispatchMode overrideValue) {
|
||||||
@@ -117,7 +116,7 @@ class WddmCommandStreamWithMockGdiFixture {
|
|||||||
|
|
||||||
virtual void SetUp() {
|
virtual void SetUp() {
|
||||||
HardwareInfo *hwInfo = nullptr;
|
HardwareInfo *hwInfo = nullptr;
|
||||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||||
wddm = static_cast<WddmMock *>(executionEnvironment->osInterface->get()->getWddm());
|
wddm = static_cast<WddmMock *>(executionEnvironment->osInterface->get()->getWddm());
|
||||||
gdi = new MockGdi();
|
gdi = new MockGdi();
|
||||||
wddm->gdi.reset(gdi);
|
wddm->gdi.reset(gdi);
|
||||||
@@ -144,8 +143,8 @@ using WddmDefaultTest = ::Test<DeviceFixture>;
|
|||||||
using DeviceCommandStreamTest = ::Test<MockAubCenterFixture>;
|
using DeviceCommandStreamTest = ::Test<MockAubCenterFixture>;
|
||||||
|
|
||||||
TEST_F(DeviceCommandStreamTest, CreateWddmCSR) {
|
TEST_F(DeviceCommandStreamTest, CreateWddmCSR) {
|
||||||
auto wddm = Wddm::createWddm();
|
|
||||||
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||||
|
auto wddm = Wddm::createWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||||
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||||
executionEnvironment->osInterface->get()->setWddm(static_cast<WddmMock *>(wddm));
|
executionEnvironment->osInterface->get()->setWddm(static_cast<WddmMock *>(wddm));
|
||||||
executionEnvironment->initializeMemoryManager();
|
executionEnvironment->initializeMemoryManager();
|
||||||
@@ -156,8 +155,8 @@ TEST_F(DeviceCommandStreamTest, CreateWddmCSR) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DeviceCommandStreamTest, CreateWddmCSRWithAubDump) {
|
TEST_F(DeviceCommandStreamTest, CreateWddmCSRWithAubDump) {
|
||||||
auto wddm = Wddm::createWddm();
|
|
||||||
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||||
|
auto wddm = Wddm::createWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||||
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||||
executionEnvironment->osInterface->get()->setWddm(static_cast<WddmMock *>(wddm));
|
executionEnvironment->osInterface->get()->setWddm(static_cast<WddmMock *>(wddm));
|
||||||
executionEnvironment->initializeMemoryManager();
|
executionEnvironment->initializeMemoryManager();
|
||||||
@@ -238,7 +237,7 @@ TEST_F(WddmCommandStreamTest, givenWdmmWhenSubmitIsCalledThenCoherencyRequiredFl
|
|||||||
|
|
||||||
TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOffWhenWorkloadIsSubmittedThenHeaderDoesntHavePreemptionFieldSet) {
|
TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOffWhenWorkloadIsSubmittedThenHeaderDoesntHavePreemptionFieldSet) {
|
||||||
HardwareInfo *hwInfo = nullptr;
|
HardwareInfo *hwInfo = nullptr;
|
||||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||||
hwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::Disabled;
|
hwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::Disabled;
|
||||||
executionEnvironment->setHwInfo(hwInfo);
|
executionEnvironment->setHwInfo(hwInfo);
|
||||||
auto wddm = static_cast<WddmMock *>(executionEnvironment->osInterface->get()->getWddm());
|
auto wddm = static_cast<WddmMock *>(executionEnvironment->osInterface->get()->getWddm());
|
||||||
@@ -263,7 +262,7 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOf
|
|||||||
|
|
||||||
TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOnWhenWorkloadIsSubmittedThenHeaderDoesHavePreemptionFieldSet) {
|
TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOnWhenWorkloadIsSubmittedThenHeaderDoesHavePreemptionFieldSet) {
|
||||||
HardwareInfo *hwInfo = nullptr;
|
HardwareInfo *hwInfo = nullptr;
|
||||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||||
hwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
|
hwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
|
||||||
executionEnvironment->setHwInfo(hwInfo);
|
executionEnvironment->setHwInfo(hwInfo);
|
||||||
auto wddm = static_cast<WddmMock *>(executionEnvironment->osInterface->get()->getWddm());
|
auto wddm = static_cast<WddmMock *>(executionEnvironment->osInterface->get()->getWddm());
|
||||||
@@ -289,7 +288,7 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOn
|
|||||||
|
|
||||||
TEST(WddmPreemptionHeaderTests, givenDeviceSupportingPreemptionWhenCommandStreamReceiverIsCreatedThenHeaderContainsPreemptionFieldSet) {
|
TEST(WddmPreemptionHeaderTests, givenDeviceSupportingPreemptionWhenCommandStreamReceiverIsCreatedThenHeaderContainsPreemptionFieldSet) {
|
||||||
HardwareInfo *hwInfo = nullptr;
|
HardwareInfo *hwInfo = nullptr;
|
||||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||||
hwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
|
hwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
|
||||||
executionEnvironment->setHwInfo(hwInfo);
|
executionEnvironment->setHwInfo(hwInfo);
|
||||||
auto commandStreamReceiver = std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(*executionEnvironment, 0);
|
auto commandStreamReceiver = std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(*executionEnvironment, 0);
|
||||||
@@ -300,7 +299,7 @@ TEST(WddmPreemptionHeaderTests, givenDeviceSupportingPreemptionWhenCommandStream
|
|||||||
|
|
||||||
TEST(WddmPreemptionHeaderTests, givenDevicenotSupportingPreemptionWhenCommandStreamReceiverIsCreatedThenHeaderPreemptionFieldIsNotSet) {
|
TEST(WddmPreemptionHeaderTests, givenDevicenotSupportingPreemptionWhenCommandStreamReceiverIsCreatedThenHeaderPreemptionFieldIsNotSet) {
|
||||||
HardwareInfo *hwInfo = nullptr;
|
HardwareInfo *hwInfo = nullptr;
|
||||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||||
hwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::Disabled;
|
hwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::Disabled;
|
||||||
executionEnvironment->setHwInfo(hwInfo);
|
executionEnvironment->setHwInfo(hwInfo);
|
||||||
auto commandStreamReceiver = std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(*executionEnvironment, 0);
|
auto commandStreamReceiver = std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(*executionEnvironment, 0);
|
||||||
@@ -820,7 +819,7 @@ HWTEST_F(WddmSimpleTest, givenDefaultWddmCsrWhenItIsCreatedThenBatchingIsTurnedO
|
|||||||
DebugManager.flags.CsrDispatchMode.set(0);
|
DebugManager.flags.CsrDispatchMode.set(0);
|
||||||
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, 0u));
|
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, 0u));
|
||||||
auto wddm = Wddm::createWddm();
|
auto wddm = Wddm::createWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||||
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||||
executionEnvironment->osInterface->get()->setWddm(wddm);
|
executionEnvironment->osInterface->get()->setWddm(wddm);
|
||||||
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||||
@@ -829,7 +828,7 @@ HWTEST_F(WddmSimpleTest, givenDefaultWddmCsrWhenItIsCreatedThenBatchingIsTurnedO
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(WddmDefaultTest, givenFtrWddmHwQueuesFlagWhenCreatingCsrThenPickWddmVersionBasingOnFtrFlag) {
|
HWTEST_F(WddmDefaultTest, givenFtrWddmHwQueuesFlagWhenCreatingCsrThenPickWddmVersionBasingOnFtrFlag) {
|
||||||
auto wddm = Wddm::createWddm();
|
auto wddm = Wddm::createWddm(*pDevice->executionEnvironment->rootDeviceEnvironments[0].get());
|
||||||
pDevice->executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
pDevice->executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||||
pDevice->executionEnvironment->osInterface->get()->setWddm(wddm);
|
pDevice->executionEnvironment->osInterface->get()->setWddm(wddm);
|
||||||
pDevice->executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
pDevice->executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||||
@@ -860,22 +859,23 @@ struct WddmCsrCompressionParameterizedTest : WddmCsrCompressionTests, ::testing:
|
|||||||
};
|
};
|
||||||
|
|
||||||
HWTEST_P(WddmCsrCompressionParameterizedTest, givenEnabledCompressionWhenInitializedThenCreatePagetableMngr) {
|
HWTEST_P(WddmCsrCompressionParameterizedTest, givenEnabledCompressionWhenInitializedThenCreatePagetableMngr) {
|
||||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
uint32_t index = 1u;
|
||||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, 0u));
|
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 2);
|
||||||
|
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, 1u));
|
||||||
setCompressionEnabled(compressionEnabled, !compressionEnabled);
|
setCompressionEnabled(compressionEnabled, !compressionEnabled);
|
||||||
myMockWddm = static_cast<WddmMock *>(executionEnvironment->osInterface->get()->getWddm());
|
myMockWddm = static_cast<WddmMock *>(executionEnvironment->osInterface->get()->getWddm());
|
||||||
EXPECT_EQ(nullptr, myMockWddm->getPageTableManager());
|
EXPECT_EQ(nullptr, executionEnvironment->rootDeviceEnvironments[index]->pageTableManager.get());
|
||||||
|
|
||||||
MockWddmCsr<FamilyType> mockWddmCsr(*executionEnvironment, 0);
|
MockWddmCsr<FamilyType> mockWddmCsr(*executionEnvironment, index);
|
||||||
mockWddmCsr.createPageTableManager();
|
mockWddmCsr.createPageTableManager();
|
||||||
ASSERT_NE(nullptr, myMockWddm->getPageTableManager());
|
ASSERT_NE(nullptr, executionEnvironment->rootDeviceEnvironments[index]->pageTableManager.get());
|
||||||
|
|
||||||
auto mockMngr = reinterpret_cast<MockGmmPageTableMngr *>(myMockWddm->getPageTableManager());
|
auto mockMngr = reinterpret_cast<MockGmmPageTableMngr *>(executionEnvironment->rootDeviceEnvironments[index]->pageTableManager.get());
|
||||||
EXPECT_EQ(1u, mockMngr->setCsrHanleCalled);
|
EXPECT_EQ(1u, mockMngr->setCsrHanleCalled);
|
||||||
EXPECT_EQ(&mockWddmCsr, mockMngr->passedCsrHandle);
|
EXPECT_EQ(&mockWddmCsr, mockMngr->passedCsrHandle);
|
||||||
|
|
||||||
GMM_TRANSLATIONTABLE_CALLBACKS expectedTTCallbacks = {};
|
GMM_TRANSLATIONTABLE_CALLBACKS expectedTTCallbacks = {};
|
||||||
unsigned int expectedFlags = (TT_TYPE::TRTT | TT_TYPE::AUXTT);
|
unsigned int expectedFlags = TT_TYPE::AUXTT;
|
||||||
|
|
||||||
expectedTTCallbacks.pfWriteL3Adr = TTCallbacks<FamilyType>::writeL3Address;
|
expectedTTCallbacks.pfWriteL3Adr = TTCallbacks<FamilyType>::writeL3Address;
|
||||||
|
|
||||||
@@ -884,25 +884,24 @@ HWTEST_P(WddmCsrCompressionParameterizedTest, givenEnabledCompressionWhenInitial
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(WddmCsrCompressionTests, givenDisabledCompressionWhenInitializedThenDontCreatePagetableMngr) {
|
HWTEST_F(WddmCsrCompressionTests, givenDisabledCompressionWhenInitializedThenDontCreatePagetableMngr) {
|
||||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 2);
|
||||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, 0u));
|
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, 1u));
|
||||||
setCompressionEnabled(false, false);
|
setCompressionEnabled(false, false);
|
||||||
myMockWddm = static_cast<WddmMock *>(executionEnvironment->osInterface->get()->getWddm());
|
myMockWddm = static_cast<WddmMock *>(executionEnvironment->osInterface->get()->getWddm());
|
||||||
MockWddmCsr<FamilyType> mockWddmCsr(*executionEnvironment, 0);
|
MockWddmCsr<FamilyType> mockWddmCsr(*executionEnvironment, 1);
|
||||||
EXPECT_EQ(nullptr, myMockWddm->getPageTableManager());
|
EXPECT_EQ(nullptr, executionEnvironment->rootDeviceEnvironments[1]->pageTableManager.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_P(WddmCsrCompressionParameterizedTest, givenEnabledCompressionWhenFlushingThenInitTranslationTableOnce) {
|
HWTEST_P(WddmCsrCompressionParameterizedTest, givenEnabledCompressionWhenFlushingThenInitTranslationTableOnce) {
|
||||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 2);
|
||||||
setCompressionEnabled(compressionEnabled, !compressionEnabled);
|
setCompressionEnabled(compressionEnabled, !compressionEnabled);
|
||||||
myMockWddm = static_cast<WddmMock *>(executionEnvironment->osInterface->get()->getWddm());
|
myMockWddm = static_cast<WddmMock *>(executionEnvironment->osInterface->get()->getWddm());
|
||||||
auto mockWddmCsr = new MockWddmCsr<FamilyType>(*executionEnvironment, 0);
|
auto mockWddmCsr = new MockWddmCsr<FamilyType>(*executionEnvironment, 1);
|
||||||
mockWddmCsr->createPageTableManager();
|
mockWddmCsr->createPageTableManager();
|
||||||
mockWddmCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
|
mockWddmCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
|
||||||
executionEnvironment->memoryManager.reset(new WddmMemoryManager(*executionEnvironment));
|
executionEnvironment->memoryManager.reset(new WddmMemoryManager(*executionEnvironment));
|
||||||
|
|
||||||
auto mockMngr = reinterpret_cast<MockGmmPageTableMngr *>(myMockWddm->getPageTableManager());
|
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, 1u));
|
||||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, 0u));
|
|
||||||
device->resetCommandStreamReceiver(mockWddmCsr);
|
device->resetCommandStreamReceiver(mockWddmCsr);
|
||||||
|
|
||||||
auto memoryManager = executionEnvironment->memoryManager.get();
|
auto memoryManager = executionEnvironment->memoryManager.get();
|
||||||
@@ -912,20 +911,13 @@ HWTEST_P(WddmCsrCompressionParameterizedTest, givenEnabledCompressionWhenFlushin
|
|||||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||||
IndirectHeap cs(graphicsAllocation);
|
IndirectHeap cs(graphicsAllocation);
|
||||||
|
|
||||||
EXPECT_FALSE(mockWddmCsr->pageTableManagerInitialized);
|
EXPECT_FALSE(executionEnvironment->rootDeviceEnvironments[1]->pageTableManager->initialized);
|
||||||
|
|
||||||
EXPECT_CALL(*mockMngr, initContextAuxTableRegister(mockWddmCsr, GMM_ENGINE_TYPE::ENGINE_TYPE_RCS))
|
|
||||||
.Times(1)
|
|
||||||
.WillOnce(Return(GMM_SUCCESS));
|
|
||||||
EXPECT_CALL(*mockMngr, initContextTRTableRegister(mockWddmCsr, GMM_ENGINE_TYPE::ENGINE_TYPE_RCS))
|
|
||||||
.Times(1)
|
|
||||||
.WillOnce(Return(GMM_SUCCESS));
|
|
||||||
|
|
||||||
DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||||
|
|
||||||
mockWddmCsr->flushTask(cs, 0u, cs, cs, cs, 0u, dispatchFlags, *device);
|
mockWddmCsr->flushTask(cs, 0u, cs, cs, cs, 0u, dispatchFlags, *device);
|
||||||
|
|
||||||
EXPECT_TRUE(mockWddmCsr->pageTableManagerInitialized);
|
EXPECT_TRUE(executionEnvironment->rootDeviceEnvironments[1]->pageTableManager->initialized);
|
||||||
|
|
||||||
// flush again to check if PT manager was initialized once
|
// flush again to check if PT manager was initialized once
|
||||||
mockWddmCsr->flushTask(cs, 0u, cs, cs, cs, 0u, dispatchFlags, *device);
|
mockWddmCsr->flushTask(cs, 0u, cs, cs, cs, 0u, dispatchFlags, *device);
|
||||||
@@ -940,31 +932,31 @@ INSTANTIATE_TEST_CASE_P(
|
|||||||
::testing::Bool());
|
::testing::Bool());
|
||||||
|
|
||||||
HWTEST_F(WddmCsrCompressionTests, givenDisabledCompressionWhenFlushingThenDontInitTranslationTable) {
|
HWTEST_F(WddmCsrCompressionTests, givenDisabledCompressionWhenFlushingThenDontInitTranslationTable) {
|
||||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 2);
|
||||||
setCompressionEnabled(false, false);
|
setCompressionEnabled(false, false);
|
||||||
myMockWddm = static_cast<WddmMock *>(executionEnvironment->osInterface->get()->getWddm());
|
myMockWddm = static_cast<WddmMock *>(executionEnvironment->osInterface->get()->getWddm());
|
||||||
|
|
||||||
auto mockWddmCsr = new MockWddmCsr<FamilyType>(*executionEnvironment, 0);
|
auto mockWddmCsr = new MockWddmCsr<FamilyType>(*executionEnvironment, 1);
|
||||||
mockWddmCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
|
mockWddmCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
|
||||||
executionEnvironment->memoryManager.reset(new WddmMemoryManager(*executionEnvironment));
|
executionEnvironment->memoryManager.reset(new WddmMemoryManager(*executionEnvironment));
|
||||||
|
|
||||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, 0u));
|
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, 1u));
|
||||||
device->resetCommandStreamReceiver(mockWddmCsr);
|
device->resetCommandStreamReceiver(mockWddmCsr);
|
||||||
|
|
||||||
auto memoryManager = executionEnvironment->memoryManager.get();
|
auto memoryManager = executionEnvironment->memoryManager.get();
|
||||||
|
|
||||||
EXPECT_EQ(nullptr, myMockWddm->getPageTableManager());
|
EXPECT_EQ(nullptr, executionEnvironment->rootDeviceEnvironments[1]->pageTableManager.get());
|
||||||
|
|
||||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||||
IndirectHeap cs(graphicsAllocation);
|
IndirectHeap cs(graphicsAllocation);
|
||||||
|
|
||||||
EXPECT_FALSE(mockWddmCsr->pageTableManagerInitialized);
|
EXPECT_EQ(nullptr, executionEnvironment->rootDeviceEnvironments[1]->pageTableManager.get());
|
||||||
|
|
||||||
DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||||
|
|
||||||
mockWddmCsr->flushTask(cs, 0u, cs, cs, cs, 0u, dispatchFlags, *device);
|
mockWddmCsr->flushTask(cs, 0u, cs, cs, cs, 0u, dispatchFlags, *device);
|
||||||
|
|
||||||
EXPECT_FALSE(mockWddmCsr->pageTableManagerInitialized);
|
EXPECT_EQ(nullptr, executionEnvironment->rootDeviceEnvironments[1]->pageTableManager.get());
|
||||||
|
|
||||||
mockWddmCsr->flushBatchedSubmissions();
|
mockWddmCsr->flushBatchedSubmissions();
|
||||||
memoryManager->freeGraphicsMemory(graphicsAllocation);
|
memoryManager->freeGraphicsMemory(graphicsAllocation);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "core/command_stream/preemption.h"
|
#include "core/command_stream/preemption.h"
|
||||||
|
#include "core/execution_environment/root_device_environment.h"
|
||||||
#include "core/helpers/options.h"
|
#include "core/helpers/options.h"
|
||||||
#include "core/os_interface/windows/debug_registry_reader.h"
|
#include "core/os_interface/windows/debug_registry_reader.h"
|
||||||
#include "runtime/execution_environment/execution_environment.h"
|
#include "runtime/execution_environment/execution_environment.h"
|
||||||
@@ -16,6 +17,7 @@
|
|||||||
#include "unit_tests/libult/create_command_stream.h"
|
#include "unit_tests/libult/create_command_stream.h"
|
||||||
#include "unit_tests/mocks/mock_csr.h"
|
#include "unit_tests/mocks/mock_csr.h"
|
||||||
#include "unit_tests/mocks/mock_device.h"
|
#include "unit_tests/mocks/mock_device.h"
|
||||||
|
#include "unit_tests/mocks/mock_execution_environment.h"
|
||||||
#include "unit_tests/mocks/mock_wddm.h"
|
#include "unit_tests/mocks/mock_wddm.h"
|
||||||
#include "unit_tests/os_interface/windows/registry_reader_tests.h"
|
#include "unit_tests/os_interface/windows/registry_reader_tests.h"
|
||||||
|
|
||||||
@@ -49,7 +51,7 @@ CommandStreamReceiver *createMockCommandStreamReceiver(bool withAubDump, Executi
|
|||||||
auto csr = new MockCommandStreamReceiver(executionEnvironment, rootDeviceIndex);
|
auto csr = new MockCommandStreamReceiver(executionEnvironment, rootDeviceIndex);
|
||||||
if (!executionEnvironment.osInterface) {
|
if (!executionEnvironment.osInterface) {
|
||||||
executionEnvironment.osInterface = std::make_unique<OSInterface>();
|
executionEnvironment.osInterface = std::make_unique<OSInterface>();
|
||||||
auto wddm = new WddmMock();
|
auto wddm = new WddmMock(*executionEnvironment.rootDeviceEnvironments[0]);
|
||||||
auto hwInfo = *executionEnvironment.getHardwareInfo();
|
auto hwInfo = *executionEnvironment.getHardwareInfo();
|
||||||
wddm->init(hwInfo);
|
wddm->init(hwInfo);
|
||||||
executionEnvironment.osInterface->get()->setWddm(wddm);
|
executionEnvironment.osInterface->get()->setWddm(wddm);
|
||||||
@@ -121,8 +123,10 @@ TEST(DriverInfo, GivenDriverInfoWhenThenReturnNonNullptr) {
|
|||||||
|
|
||||||
TEST(DriverInfo, givenInitializedOsInterfaceWhenCreateDriverInfoThenReturnDriverInfoWindowsNotNullptr) {
|
TEST(DriverInfo, givenInitializedOsInterfaceWhenCreateDriverInfoThenReturnDriverInfoWindowsNotNullptr) {
|
||||||
|
|
||||||
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
|
||||||
std::unique_ptr<OSInterface> osInterface(new OSInterface());
|
std::unique_ptr<OSInterface> osInterface(new OSInterface());
|
||||||
osInterface->get()->setWddm(Wddm::createWddm());
|
osInterface->get()->setWddm(Wddm::createWddm(rootDeviceEnvironment));
|
||||||
EXPECT_NE(nullptr, osInterface->get()->getWddm());
|
EXPECT_NE(nullptr, osInterface->get()->getWddm());
|
||||||
|
|
||||||
std::unique_ptr<DriverInfo> driverInfo(DriverInfo::create(osInterface.get()));
|
std::unique_ptr<DriverInfo> driverInfo(DriverInfo::create(osInterface.get()));
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "core/execution_environment/root_device_environment.h"
|
||||||
#include "public/cl_gl_private_intel.h"
|
#include "public/cl_gl_private_intel.h"
|
||||||
#include "runtime/helpers/timestamp_packet.h"
|
#include "runtime/helpers/timestamp_packet.h"
|
||||||
#include "runtime/os_interface/os_interface.h"
|
#include "runtime/os_interface/os_interface.h"
|
||||||
@@ -15,6 +16,7 @@
|
|||||||
#include "runtime/sharings/gl/gl_arb_sync_event.h"
|
#include "runtime/sharings/gl/gl_arb_sync_event.h"
|
||||||
#include "runtime/sharings/gl/gl_sharing.h"
|
#include "runtime/sharings/gl/gl_sharing.h"
|
||||||
#include "unit_tests/mocks/gl/mock_gl_sharing.h"
|
#include "unit_tests/mocks/gl/mock_gl_sharing.h"
|
||||||
|
#include "unit_tests/mocks/mock_execution_environment.h"
|
||||||
#include "unit_tests/os_interface/windows/wddm_fixture.h"
|
#include "unit_tests/os_interface/windows/wddm_fixture.h"
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
@@ -79,14 +81,16 @@ TEST(glSharingBasicTest, GivenSharingFunctionsWhenItIsConstructedThenBackupConte
|
|||||||
|
|
||||||
struct GlArbSyncEventOsTest : public ::testing::Test {
|
struct GlArbSyncEventOsTest : public ::testing::Test {
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
|
rootDeviceEnvironment = std::make_unique<RootDeviceEnvironment>(executionEnvironment);
|
||||||
sharing.GLContextHandle = 0x2cU;
|
sharing.GLContextHandle = 0x2cU;
|
||||||
sharing.GLDeviceHandle = 0x3cU;
|
sharing.GLDeviceHandle = 0x3cU;
|
||||||
wddm = new WddmMock();
|
wddm = new WddmMock(*rootDeviceEnvironment);
|
||||||
gdi = new MockGdi();
|
gdi = new MockGdi();
|
||||||
wddm->gdi.reset(gdi);
|
wddm->gdi.reset(gdi);
|
||||||
osInterface.get()->setWddm(wddm);
|
osInterface.get()->setWddm(wddm);
|
||||||
}
|
}
|
||||||
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
std::unique_ptr<RootDeviceEnvironment> rootDeviceEnvironment;
|
||||||
GlSharingFunctionsMock sharing;
|
GlSharingFunctionsMock sharing;
|
||||||
MockGdi *gdi = nullptr;
|
MockGdi *gdi = nullptr;
|
||||||
WddmMock *wddm = nullptr;
|
WddmMock *wddm = nullptr;
|
||||||
@@ -209,7 +213,7 @@ TEST_F(GlArbSyncEventOsTest, GivenNewGlSyncInfoWhenCreateEventFailsThenSetupArbS
|
|||||||
MockOSInterface mockOsInterface;
|
MockOSInterface mockOsInterface;
|
||||||
MockOSInterfaceImpl *mockOsInterfaceImpl = static_cast<MockOSInterfaceImpl *>(mockOsInterface.get());
|
MockOSInterfaceImpl *mockOsInterfaceImpl = static_cast<MockOSInterfaceImpl *>(mockOsInterface.get());
|
||||||
|
|
||||||
auto wddm = new WddmMock();
|
auto wddm = new WddmMock(*rootDeviceEnvironment.get());
|
||||||
auto gdi = new MockGdi();
|
auto gdi = new MockGdi();
|
||||||
wddm->gdi.reset(gdi);
|
wddm->gdi.reset(gdi);
|
||||||
auto hwInfo = *platformDevices[0];
|
auto hwInfo = *platformDevices[0];
|
||||||
@@ -238,7 +242,7 @@ TEST_F(GlArbSyncEventOsTest, GivenInvalidGlSyncInfoWhenCleanupArbSyncObjectIsCal
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
auto wddm = new WddmMock();
|
auto wddm = new WddmMock(*rootDeviceEnvironment.get());
|
||||||
auto gdi = new MockGdi();
|
auto gdi = new MockGdi();
|
||||||
wddm->gdi.reset(gdi);
|
wddm->gdi.reset(gdi);
|
||||||
auto hwInfo = *platformDevices[0];
|
auto hwInfo = *platformDevices[0];
|
||||||
@@ -268,7 +272,7 @@ TEST_F(GlArbSyncEventOsTest, GivenValidGlSyncInfoWhenCleanupArbSyncObjectIsCalle
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
auto wddm = new WddmMock();
|
auto wddm = new WddmMock(*rootDeviceEnvironment.get());
|
||||||
auto gdi = new MockGdi();
|
auto gdi = new MockGdi();
|
||||||
wddm->gdi.reset(gdi);
|
wddm->gdi.reset(gdi);
|
||||||
auto hwInfo = *platformDevices[0];
|
auto hwInfo = *platformDevices[0];
|
||||||
|
|||||||
@@ -7,12 +7,14 @@
|
|||||||
|
|
||||||
#include "unit_tests/os_interface/windows/hw_info_config_win_tests.h"
|
#include "unit_tests/os_interface/windows/hw_info_config_win_tests.h"
|
||||||
|
|
||||||
|
#include "core/execution_environment/root_device_environment.h"
|
||||||
#include "core/helpers/hw_helper.h"
|
#include "core/helpers/hw_helper.h"
|
||||||
#include "core/helpers/options.h"
|
#include "core/helpers/options.h"
|
||||||
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
|
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
|
||||||
#include "runtime/os_interface/windows/os_interface.h"
|
#include "runtime/os_interface/windows/os_interface.h"
|
||||||
#include "runtime/os_interface/windows/wddm/wddm.h"
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
#include "unit_tests/mocks/mock_execution_environment.h"
|
||||||
|
|
||||||
#include "instrumentation.h"
|
#include "instrumentation.h"
|
||||||
|
|
||||||
@@ -52,12 +54,20 @@ template <>
|
|||||||
void HwInfoConfigHw<IGFX_UNKNOWN>::adjustPlatformForProductFamily(HardwareInfo *hwInfo) {
|
void HwInfoConfigHw<IGFX_UNKNOWN>::adjustPlatformForProductFamily(HardwareInfo *hwInfo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HwInfoConfigTestWindows::HwInfoConfigTestWindows() {
|
||||||
|
this->executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||||
|
this->rootDeviceEnvironment = std::make_unique<RootDeviceEnvironment>(*executionEnvironment);
|
||||||
|
}
|
||||||
|
|
||||||
|
HwInfoConfigTestWindows::~HwInfoConfigTestWindows() {
|
||||||
|
}
|
||||||
|
|
||||||
void HwInfoConfigTestWindows::SetUp() {
|
void HwInfoConfigTestWindows::SetUp() {
|
||||||
HwInfoConfigTest::SetUp();
|
HwInfoConfigTest::SetUp();
|
||||||
|
|
||||||
osInterface.reset(new OSInterface());
|
osInterface.reset(new OSInterface());
|
||||||
|
|
||||||
std::unique_ptr<Wddm> wddm(Wddm::createWddm());
|
std::unique_ptr<Wddm> wddm(Wddm::createWddm(*rootDeviceEnvironment));
|
||||||
wddm->init(outHwInfo);
|
wddm->init(outHwInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,15 +14,23 @@
|
|||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
|
||||||
|
struct MockExecutionEnvironment;
|
||||||
|
struct RootDeviceEnvironment;
|
||||||
|
|
||||||
struct DummyHwConfig : HwInfoConfigHw<IGFX_UNKNOWN> {
|
struct DummyHwConfig : HwInfoConfigHw<IGFX_UNKNOWN> {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct HwInfoConfigTestWindows : public HwInfoConfigTest {
|
struct HwInfoConfigTestWindows : public HwInfoConfigTest {
|
||||||
|
HwInfoConfigTestWindows();
|
||||||
|
~HwInfoConfigTestWindows();
|
||||||
|
|
||||||
void SetUp() override;
|
void SetUp() override;
|
||||||
void TearDown() override;
|
void TearDown() override;
|
||||||
|
|
||||||
std::unique_ptr<OSInterface> osInterface;
|
std::unique_ptr<OSInterface> osInterface;
|
||||||
DummyHwConfig hwConfig;
|
DummyHwConfig hwConfig;
|
||||||
|
std::unique_ptr<MockExecutionEnvironment> executionEnvironment;
|
||||||
|
std::unique_ptr<RootDeviceEnvironment> rootDeviceEnvironment;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ void PerformanceCountersFixture::SetUp() {
|
|||||||
context = std::make_unique<MockContext>(device.get());
|
context = std::make_unique<MockContext>(device.get());
|
||||||
queue = std::make_unique<MockCommandQueue>(context.get(), device.get(), &queueProperties);
|
queue = std::make_unique<MockCommandQueue>(context.get(), device.get(), &queueProperties);
|
||||||
osInterface = std::unique_ptr<OSInterface>(new OSInterface());
|
osInterface = std::unique_ptr<OSInterface>(new OSInterface());
|
||||||
osInterface->get()->setWddm(new WddmMock());
|
osInterface->get()->setWddm(new WddmMock(*rootDeviceEnvironment));
|
||||||
device->setOSTime(new MockOSTimeWin(osInterface.get()));
|
device->setOSTime(new MockOSTimeWin(osInterface.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,9 @@
|
|||||||
|
|
||||||
#include "unit_tests/os_interface/windows/os_interface_win_tests.h"
|
#include "unit_tests/os_interface/windows/os_interface_win_tests.h"
|
||||||
|
|
||||||
|
#include "core/execution_environment/root_device_environment.h"
|
||||||
#include "runtime/os_interface/windows/os_context_win.h"
|
#include "runtime/os_interface/windows/os_context_win.h"
|
||||||
|
#include "unit_tests/mocks/mock_execution_environment.h"
|
||||||
#include "unit_tests/os_interface/windows/wddm_fixture.h"
|
#include "unit_tests/os_interface/windows/wddm_fixture.h"
|
||||||
|
|
||||||
TEST_F(OsInterfaceTest, GivenWindowsWhenOsSupportFor64KBpagesIsBeingQueriedThenTrueIsReturned) {
|
TEST_F(OsInterfaceTest, GivenWindowsWhenOsSupportFor64KBpagesIsBeingQueriedThenTrueIsReturned) {
|
||||||
@@ -22,7 +24,9 @@ TEST_F(OsInterfaceTest, GivenWindowsWhenCreateEentIsCalledThenValidEventHandleIs
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(OsContextTest, givenWddmWhenCreateOsContextAfterInitWddmThenOsContextIsInitializedTrimCallbackIsRegisteredMemoryOperationsHandlerCreated) {
|
TEST(OsContextTest, givenWddmWhenCreateOsContextAfterInitWddmThenOsContextIsInitializedTrimCallbackIsRegisteredMemoryOperationsHandlerCreated) {
|
||||||
auto wddm = new WddmMock;
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
|
||||||
|
auto wddm = new WddmMock(rootDeviceEnvironment);
|
||||||
OSInterface osInterface;
|
OSInterface osInterface;
|
||||||
osInterface.get()->setWddm(wddm);
|
osInterface.get()->setWddm(wddm);
|
||||||
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
|
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
|
||||||
@@ -36,7 +40,9 @@ TEST(OsContextTest, givenWddmWhenCreateOsContextAfterInitWddmThenOsContextIsInit
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(OsInterfaceTest, whenOsInterfaceSetupGmmInputArgsThenProperAdapterBDFIsSet) {
|
TEST_F(OsInterfaceTest, whenOsInterfaceSetupGmmInputArgsThenProperAdapterBDFIsSet) {
|
||||||
auto wddm = new WddmMock;
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
|
||||||
|
auto wddm = new WddmMock(rootDeviceEnvironment);
|
||||||
osInterface->get()->setWddm(wddm);
|
osInterface->get()->setWddm(wddm);
|
||||||
auto hwInfo = *platformDevices[0];
|
auto hwInfo = *platformDevices[0];
|
||||||
wddm->init(hwInfo);
|
wddm->init(hwInfo);
|
||||||
|
|||||||
@@ -5,7 +5,9 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "core/execution_environment/root_device_environment.h"
|
||||||
#include "runtime/os_interface/windows/os_interface.h"
|
#include "runtime/os_interface/windows/os_interface.h"
|
||||||
|
#include "unit_tests/mocks/mock_execution_environment.h"
|
||||||
#include "unit_tests/os_interface/windows/wddm_fixture.h"
|
#include "unit_tests/os_interface/windows/wddm_fixture.h"
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
@@ -85,7 +87,9 @@ TEST(OSTimeWinTests, givenNoOSInterfaceWhenGetCpuGpuTimeThenReturnsError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(OSTimeWinTests, givenOSInterfaceWhenGetCpuGpuTimeThenReturnsSuccess) {
|
TEST(OSTimeWinTests, givenOSInterfaceWhenGetCpuGpuTimeThenReturnsSuccess) {
|
||||||
auto wddm = new WddmMock;
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
|
||||||
|
auto wddm = new WddmMock(rootDeviceEnvironment);
|
||||||
TimeStampData CPUGPUTime01 = {0};
|
TimeStampData CPUGPUTime01 = {0};
|
||||||
TimeStampData CPUGPUTime02 = {0};
|
TimeStampData CPUGPUTime02 = {0};
|
||||||
std::unique_ptr<OSInterface> osInterface(new OSInterface());
|
std::unique_ptr<OSInterface> osInterface(new OSInterface());
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "core/execution_environment/root_device_environment.h"
|
||||||
#include "core/gmm_helper/gmm_helper.h"
|
#include "core/gmm_helper/gmm_helper.h"
|
||||||
#include "core/helpers/hw_info.h"
|
#include "core/helpers/hw_info.h"
|
||||||
#include "core/helpers/options.h"
|
#include "core/helpers/options.h"
|
||||||
@@ -21,6 +22,7 @@
|
|||||||
#include "runtime/os_interface/windows/wddm_allocation.h"
|
#include "runtime/os_interface/windows/wddm_allocation.h"
|
||||||
#include "runtime/os_interface/windows/wddm_memory_manager.h"
|
#include "runtime/os_interface/windows/wddm_memory_manager.h"
|
||||||
#include "unit_tests/helpers/variable_backup.h"
|
#include "unit_tests/helpers/variable_backup.h"
|
||||||
|
#include "unit_tests/mocks/mock_execution_environment.h"
|
||||||
#include "unit_tests/mocks/mock_gfx_partition.h"
|
#include "unit_tests/mocks/mock_gfx_partition.h"
|
||||||
#include "unit_tests/mocks/mock_gmm_resource_info.h"
|
#include "unit_tests/mocks/mock_gmm_resource_info.h"
|
||||||
#include "unit_tests/mocks/mock_memory_manager.h"
|
#include "unit_tests/mocks/mock_memory_manager.h"
|
||||||
@@ -78,8 +80,6 @@ TEST_F(Wddm20Tests, doubleCreation) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Wddm20Tests, givenNullPageTableManagerAndRenderCompressedResourceWhenMappingGpuVaThenDontUpdateAuxTable) {
|
TEST_F(Wddm20Tests, givenNullPageTableManagerAndRenderCompressedResourceWhenMappingGpuVaThenDontUpdateAuxTable) {
|
||||||
wddm->resetPageTableManager(nullptr);
|
|
||||||
|
|
||||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(nullptr, 1, false));
|
auto gmm = std::unique_ptr<Gmm>(new Gmm(nullptr, 1, false));
|
||||||
auto mockGmmRes = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
auto mockGmmRes = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||||
mockGmmRes->setUnifiedAuxTranslationCapable();
|
mockGmmRes->setUnifiedAuxTranslationCapable();
|
||||||
@@ -100,10 +100,13 @@ TEST(Wddm20EnumAdaptersTest, WhenAdapterDescriptionContainsDCHDAndgdrclPathDoesn
|
|||||||
|
|
||||||
struct MockWddm : Wddm {
|
struct MockWddm : Wddm {
|
||||||
using Wddm::openAdapter;
|
using Wddm::openAdapter;
|
||||||
};
|
|
||||||
|
|
||||||
MockWddm wddm;
|
MockWddm(RootDeviceEnvironment &rootDeviceEnvironment) : Wddm(rootDeviceEnvironment) {}
|
||||||
bool isOpened = wddm.openAdapter();
|
};
|
||||||
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
|
||||||
|
auto wddm = std::make_unique<MockWddm>(rootDeviceEnvironment);
|
||||||
|
bool isOpened = wddm->openAdapter();
|
||||||
|
|
||||||
EXPECT_FALSE(isOpened);
|
EXPECT_FALSE(isOpened);
|
||||||
}
|
}
|
||||||
@@ -116,9 +119,12 @@ TEST(Wddm20EnumAdaptersTest, WhenAdapterDescriptionContainsDCHIAndgdrclPathDoesn
|
|||||||
|
|
||||||
struct MockWddm : Wddm {
|
struct MockWddm : Wddm {
|
||||||
using Wddm::openAdapter;
|
using Wddm::openAdapter;
|
||||||
};
|
|
||||||
|
|
||||||
auto wddm = std::make_unique<MockWddm>();
|
MockWddm(RootDeviceEnvironment &rootDeviceEnvironment) : Wddm(rootDeviceEnvironment) {}
|
||||||
|
};
|
||||||
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
|
||||||
|
auto wddm = std::make_unique<MockWddm>(rootDeviceEnvironment);
|
||||||
bool isOpened = wddm->openAdapter();
|
bool isOpened = wddm->openAdapter();
|
||||||
|
|
||||||
EXPECT_FALSE(isOpened);
|
EXPECT_FALSE(isOpened);
|
||||||
@@ -132,9 +138,12 @@ TEST(Wddm20EnumAdaptersTest, WhenAdapterDescriptionContainsDCHDAndgdrclPathConta
|
|||||||
|
|
||||||
struct MockWddm : Wddm {
|
struct MockWddm : Wddm {
|
||||||
using Wddm::openAdapter;
|
using Wddm::openAdapter;
|
||||||
};
|
|
||||||
|
|
||||||
auto wddm = std::make_unique<MockWddm>();
|
MockWddm(RootDeviceEnvironment &rootDeviceEnvironment) : Wddm(rootDeviceEnvironment) {}
|
||||||
|
};
|
||||||
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
|
||||||
|
auto wddm = std::make_unique<MockWddm>(rootDeviceEnvironment);
|
||||||
bool isOpened = wddm->openAdapter();
|
bool isOpened = wddm->openAdapter();
|
||||||
|
|
||||||
EXPECT_TRUE(isOpened);
|
EXPECT_TRUE(isOpened);
|
||||||
@@ -148,9 +157,12 @@ TEST(Wddm20EnumAdaptersTest, WhenAdapterDescriptionContainsDCHIAndgdrclPathConta
|
|||||||
|
|
||||||
struct MockWddm : Wddm {
|
struct MockWddm : Wddm {
|
||||||
using Wddm::openAdapter;
|
using Wddm::openAdapter;
|
||||||
};
|
|
||||||
|
|
||||||
auto wddm = std::make_unique<MockWddm>();
|
MockWddm(RootDeviceEnvironment &rootDeviceEnvironment) : Wddm(rootDeviceEnvironment) {}
|
||||||
|
};
|
||||||
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
|
||||||
|
auto wddm = std::make_unique<MockWddm>(rootDeviceEnvironment);
|
||||||
bool isOpened = wddm->openAdapter();
|
bool isOpened = wddm->openAdapter();
|
||||||
|
|
||||||
EXPECT_TRUE(isOpened);
|
EXPECT_TRUE(isOpened);
|
||||||
@@ -164,7 +176,9 @@ TEST(Wddm20EnumAdaptersTest, expectTrue) {
|
|||||||
&hwInfo->gtSystemInfo,
|
&hwInfo->gtSystemInfo,
|
||||||
hwInfo->capabilityTable.gpuAddressSpace));
|
hwInfo->capabilityTable.gpuAddressSpace));
|
||||||
|
|
||||||
std::unique_ptr<Wddm> wddm(Wddm::createWddm());
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
|
||||||
|
std::unique_ptr<Wddm> wddm(Wddm::createWddm(rootDeviceEnvironment));
|
||||||
bool success = wddm->init(outHwInfo);
|
bool success = wddm->init(outHwInfo);
|
||||||
|
|
||||||
EXPECT_TRUE(success);
|
EXPECT_TRUE(success);
|
||||||
@@ -180,7 +194,9 @@ TEST(Wddm20EnumAdaptersTest, givenEmptyHardwareInfoWhenEnumAdapterIsCalledThenCa
|
|||||||
&hwInfo->gtSystemInfo,
|
&hwInfo->gtSystemInfo,
|
||||||
hwInfo->capabilityTable.gpuAddressSpace));
|
hwInfo->capabilityTable.gpuAddressSpace));
|
||||||
|
|
||||||
std::unique_ptr<Wddm> wddm(Wddm::createWddm());
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
|
||||||
|
std::unique_ptr<Wddm> wddm(Wddm::createWddm(rootDeviceEnvironment));
|
||||||
bool success = wddm->init(outHwInfo);
|
bool success = wddm->init(outHwInfo);
|
||||||
EXPECT_TRUE(success);
|
EXPECT_TRUE(success);
|
||||||
|
|
||||||
@@ -203,7 +219,9 @@ TEST(Wddm20EnumAdaptersTest, givenUnknownPlatformWhenEnumAdapterIsCalledThenFals
|
|||||||
&hwInfo.gtSystemInfo,
|
&hwInfo.gtSystemInfo,
|
||||||
hwInfo.capabilityTable.gpuAddressSpace));
|
hwInfo.capabilityTable.gpuAddressSpace));
|
||||||
|
|
||||||
std::unique_ptr<Wddm> wddm(Wddm::createWddm());
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
|
||||||
|
std::unique_ptr<Wddm> wddm(Wddm::createWddm(rootDeviceEnvironment));
|
||||||
auto ret = wddm->init(outHwInfo);
|
auto ret = wddm->init(outHwInfo);
|
||||||
EXPECT_FALSE(ret);
|
EXPECT_FALSE(ret);
|
||||||
|
|
||||||
@@ -875,7 +893,7 @@ TEST_F(WddmLockWithMakeResidentTests, givenAllocationWhenApplyBlockingMakeReside
|
|||||||
TEST_F(WddmLockWithMakeResidentTests, givenAllocationWhenApplyBlockingMakeResidentAndMakeResidentCallFailsThenEvictTemporaryResourcesAndRetry) {
|
TEST_F(WddmLockWithMakeResidentTests, givenAllocationWhenApplyBlockingMakeResidentAndMakeResidentCallFailsThenEvictTemporaryResourcesAndRetry) {
|
||||||
MockWddmAllocation allocation;
|
MockWddmAllocation allocation;
|
||||||
allocation.handle = 0x3;
|
allocation.handle = 0x3;
|
||||||
GmockWddm gmockWddm;
|
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||||
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
||||||
EXPECT_CALL(gmockWddm, makeResident(&allocation.handle, ::testing::_, ::testing::_, ::testing::_)).Times(2).WillRepeatedly(::testing::Return(false));
|
EXPECT_CALL(gmockWddm, makeResident(&allocation.handle, ::testing::_, ::testing::_, ::testing::_)).Times(2).WillRepeatedly(::testing::Return(false));
|
||||||
gmockWddm.temporaryResources->makeResidentResource(allocation.handle);
|
gmockWddm.temporaryResources->makeResidentResource(allocation.handle);
|
||||||
@@ -884,7 +902,7 @@ TEST_F(WddmLockWithMakeResidentTests, givenAllocationWhenApplyBlockingMakeReside
|
|||||||
TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndTemporaryResourcesAreEvictedSuccessfullyThenCallMakeResidentOneMoreTime) {
|
TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndTemporaryResourcesAreEvictedSuccessfullyThenCallMakeResidentOneMoreTime) {
|
||||||
MockWddmAllocation allocation;
|
MockWddmAllocation allocation;
|
||||||
allocation.handle = 0x3;
|
allocation.handle = 0x3;
|
||||||
GmockWddm gmockWddm;
|
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||||
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
||||||
mockTemporaryResources->resourceHandles.push_back(allocation.handle);
|
mockTemporaryResources->resourceHandles.push_back(allocation.handle);
|
||||||
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillRepeatedly(::testing::Return(true));
|
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillRepeatedly(::testing::Return(true));
|
||||||
@@ -895,7 +913,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndTemporaryR
|
|||||||
TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeResidentStillFailsThenDontStoreTemporaryResource) {
|
TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeResidentStillFailsThenDontStoreTemporaryResource) {
|
||||||
MockWddmAllocation allocation;
|
MockWddmAllocation allocation;
|
||||||
allocation.handle = 0x2;
|
allocation.handle = 0x2;
|
||||||
GmockWddm gmockWddm;
|
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||||
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
||||||
mockTemporaryResources->resourceHandles.push_back(0x1);
|
mockTemporaryResources->resourceHandles.push_back(0x1);
|
||||||
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillRepeatedly(::testing::Return(true));
|
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillRepeatedly(::testing::Return(true));
|
||||||
@@ -907,7 +925,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeReside
|
|||||||
TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeResidentPassesAfterEvictThenStoreTemporaryResource) {
|
TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeResidentPassesAfterEvictThenStoreTemporaryResource) {
|
||||||
MockWddmAllocation allocation;
|
MockWddmAllocation allocation;
|
||||||
allocation.handle = 0x2;
|
allocation.handle = 0x2;
|
||||||
GmockWddm gmockWddm;
|
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||||
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
||||||
mockTemporaryResources->resourceHandles.push_back(0x1);
|
mockTemporaryResources->resourceHandles.push_back(0x1);
|
||||||
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillRepeatedly(::testing::Return(true));
|
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillRepeatedly(::testing::Return(true));
|
||||||
@@ -920,7 +938,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeReside
|
|||||||
TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeResidentPassesThenStoreTemporaryResource) {
|
TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeResidentPassesThenStoreTemporaryResource) {
|
||||||
MockWddmAllocation allocation;
|
MockWddmAllocation allocation;
|
||||||
allocation.handle = 0x2;
|
allocation.handle = 0x2;
|
||||||
GmockWddm gmockWddm;
|
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||||
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
||||||
mockTemporaryResources->resourceHandles.push_back(0x1);
|
mockTemporaryResources->resourceHandles.push_back(0x1);
|
||||||
EXPECT_CALL(gmockWddm, makeResident(&allocation.handle, ::testing::_, ::testing::_, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
|
EXPECT_CALL(gmockWddm, makeResident(&allocation.handle, ::testing::_, ::testing::_, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
|
||||||
@@ -939,7 +957,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenEvictingAllTemporaryResourcesThenAcqui
|
|||||||
}
|
}
|
||||||
TEST_F(WddmLockWithMakeResidentTests, whenEvictingAllTemporaryResourcesAndAllEvictionsSucceedThenReturnSuccess) {
|
TEST_F(WddmLockWithMakeResidentTests, whenEvictingAllTemporaryResourcesAndAllEvictionsSucceedThenReturnSuccess) {
|
||||||
MockWddmAllocation allocation;
|
MockWddmAllocation allocation;
|
||||||
GmockWddm gmockWddm;
|
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||||
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
||||||
mockTemporaryResources->resourceHandles.push_back(allocation.handle);
|
mockTemporaryResources->resourceHandles.push_back(allocation.handle);
|
||||||
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
|
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
|
||||||
@@ -948,7 +966,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenEvictingAllTemporaryResourcesAndAllEvi
|
|||||||
EXPECT_EQ(MemoryOperationsStatus::SUCCESS, mockTemporaryResources->evictAllResourcesResult.operationSuccess);
|
EXPECT_EQ(MemoryOperationsStatus::SUCCESS, mockTemporaryResources->evictAllResourcesResult.operationSuccess);
|
||||||
}
|
}
|
||||||
TEST_F(WddmLockWithMakeResidentTests, givenThreeAllocationsWhenEvictingAllTemporaryResourcesThenCallEvictForEachAllocationAndCleanList) {
|
TEST_F(WddmLockWithMakeResidentTests, givenThreeAllocationsWhenEvictingAllTemporaryResourcesThenCallEvictForEachAllocationAndCleanList) {
|
||||||
GmockWddm gmockWddm;
|
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||||
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
||||||
constexpr uint32_t numAllocations = 3u;
|
constexpr uint32_t numAllocations = 3u;
|
||||||
for (auto i = 0u; i < numAllocations; i++) {
|
for (auto i = 0u; i < numAllocations; i++) {
|
||||||
@@ -959,7 +977,7 @@ TEST_F(WddmLockWithMakeResidentTests, givenThreeAllocationsWhenEvictingAllTempor
|
|||||||
EXPECT_TRUE(mockTemporaryResources->resourceHandles.empty());
|
EXPECT_TRUE(mockTemporaryResources->resourceHandles.empty());
|
||||||
}
|
}
|
||||||
TEST_F(WddmLockWithMakeResidentTests, givenThreeAllocationsWhenEvictingAllTemporaryResourcesAndOneOfThemFailsThenReturnFail) {
|
TEST_F(WddmLockWithMakeResidentTests, givenThreeAllocationsWhenEvictingAllTemporaryResourcesAndOneOfThemFailsThenReturnFail) {
|
||||||
GmockWddm gmockWddm;
|
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||||
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
||||||
constexpr uint32_t numAllocations = 3u;
|
constexpr uint32_t numAllocations = 3u;
|
||||||
for (auto i = 0u; i < numAllocations; i++) {
|
for (auto i = 0u; i < numAllocations; i++) {
|
||||||
@@ -986,7 +1004,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenEvictingNonExistingTemporaryResourceTh
|
|||||||
EXPECT_EQ(MemoryOperationsStatus::MEMORY_NOT_FOUND, mockTemporaryResources->evictResourceResult.operationSuccess);
|
EXPECT_EQ(MemoryOperationsStatus::MEMORY_NOT_FOUND, mockTemporaryResources->evictResourceResult.operationSuccess);
|
||||||
}
|
}
|
||||||
TEST_F(WddmLockWithMakeResidentTests, whenEvictingTemporaryResourceAndEvictFailsThenReturnFail) {
|
TEST_F(WddmLockWithMakeResidentTests, whenEvictingTemporaryResourceAndEvictFailsThenReturnFail) {
|
||||||
GmockWddm gmockWddm;
|
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||||
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
||||||
mockTemporaryResources->resourceHandles.push_back(ALLOCATION_HANDLE);
|
mockTemporaryResources->resourceHandles.push_back(ALLOCATION_HANDLE);
|
||||||
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillOnce(::testing::Return(false));
|
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillOnce(::testing::Return(false));
|
||||||
@@ -995,7 +1013,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenEvictingTemporaryResourceAndEvictFails
|
|||||||
EXPECT_EQ(MemoryOperationsStatus::FAILED, mockTemporaryResources->evictResourceResult.operationSuccess);
|
EXPECT_EQ(MemoryOperationsStatus::FAILED, mockTemporaryResources->evictResourceResult.operationSuccess);
|
||||||
}
|
}
|
||||||
TEST_F(WddmLockWithMakeResidentTests, whenEvictingTemporaryResourceAndEvictSucceedThenReturnSuccess) {
|
TEST_F(WddmLockWithMakeResidentTests, whenEvictingTemporaryResourceAndEvictSucceedThenReturnSuccess) {
|
||||||
GmockWddm gmockWddm;
|
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||||
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
||||||
mockTemporaryResources->resourceHandles.push_back(ALLOCATION_HANDLE);
|
mockTemporaryResources->resourceHandles.push_back(ALLOCATION_HANDLE);
|
||||||
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
|
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
|
||||||
@@ -1053,10 +1071,13 @@ TEST_F(WddmGfxPartitionTest, initGfxPartition) {
|
|||||||
TEST_F(Wddm20Tests, givenWddmWhenOpenAdapterAndForceDeviceIdIsTheSameAsTheExistingDeviceThenReturnTrue) {
|
TEST_F(Wddm20Tests, givenWddmWhenOpenAdapterAndForceDeviceIdIsTheSameAsTheExistingDeviceThenReturnTrue) {
|
||||||
DebugManagerStateRestore stateRestore;
|
DebugManagerStateRestore stateRestore;
|
||||||
DebugManager.flags.ForceDeviceId.set("1234"); // Existing device Id
|
DebugManager.flags.ForceDeviceId.set("1234"); // Existing device Id
|
||||||
struct MockWddm : Wddm {
|
struct MockWddm : public Wddm {
|
||||||
using Wddm::openAdapter;
|
using Wddm::openAdapter;
|
||||||
|
|
||||||
|
MockWddm(RootDeviceEnvironment &rootDeviceEnvironment) : Wddm(rootDeviceEnvironment) {}
|
||||||
};
|
};
|
||||||
MockWddm wddm;
|
|
||||||
|
MockWddm wddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||||
bool result = wddm.openAdapter();
|
bool result = wddm.openAdapter();
|
||||||
EXPECT_TRUE(result);
|
EXPECT_TRUE(result);
|
||||||
}
|
}
|
||||||
@@ -1064,10 +1085,13 @@ TEST_F(Wddm20Tests, givenWddmWhenOpenAdapterAndForceDeviceIdIsTheSameAsTheExisti
|
|||||||
TEST_F(Wddm20Tests, givenWddmWhenOpenAdapterAndForceDeviceIdIsDifferentFromTheExistingDeviceThenReturnFalse) {
|
TEST_F(Wddm20Tests, givenWddmWhenOpenAdapterAndForceDeviceIdIsDifferentFromTheExistingDeviceThenReturnFalse) {
|
||||||
DebugManagerStateRestore stateRestore;
|
DebugManagerStateRestore stateRestore;
|
||||||
DebugManager.flags.ForceDeviceId.set("1111");
|
DebugManager.flags.ForceDeviceId.set("1111");
|
||||||
struct MockWddm : Wddm {
|
struct MockWddm : public Wddm {
|
||||||
using Wddm::openAdapter;
|
using Wddm::openAdapter;
|
||||||
|
|
||||||
|
MockWddm(RootDeviceEnvironment &rootDeviceEnvironment) : Wddm(rootDeviceEnvironment) {}
|
||||||
};
|
};
|
||||||
MockWddm wddm;
|
|
||||||
|
MockWddm wddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||||
bool result = wddm.openAdapter();
|
bool result = wddm.openAdapter();
|
||||||
EXPECT_FALSE(result);
|
EXPECT_FALSE(result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "core/helpers/hw_helper.h"
|
#include "core/helpers/hw_helper.h"
|
||||||
#include "core/memory_manager/memory_constants.h"
|
#include "core/memory_manager/memory_constants.h"
|
||||||
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
|
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
|
||||||
|
#include "runtime/execution_environment/execution_environment.h"
|
||||||
#include "runtime/os_interface/windows/gdi_interface.h"
|
#include "runtime/os_interface/windows/gdi_interface.h"
|
||||||
#include "runtime/os_interface/windows/os_context_win.h"
|
#include "runtime/os_interface/windows/os_context_win.h"
|
||||||
#include "runtime/os_interface/windows/os_interface.h"
|
#include "runtime/os_interface/windows/os_interface.h"
|
||||||
@@ -25,7 +26,7 @@ struct Wddm23TestsWithoutWddmInit : public ::testing::Test, GdiDllFixture {
|
|||||||
GdiDllFixture::SetUp();
|
GdiDllFixture::SetUp();
|
||||||
|
|
||||||
executionEnvironment = platformImpl->peekExecutionEnvironment();
|
executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||||
wddm = static_cast<WddmMock *>(Wddm::createWddm());
|
wddm = static_cast<WddmMock *>(Wddm::createWddm(*executionEnvironment->rootDeviceEnvironments[0].get()));
|
||||||
osInterface = std::make_unique<OSInterface>();
|
osInterface = std::make_unique<OSInterface>();
|
||||||
osInterface->get()->setWddm(wddm);
|
osInterface->get()->setWddm(wddm);
|
||||||
|
|
||||||
|
|||||||
@@ -6,15 +6,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "core/command_stream/preemption.h"
|
#include "core/command_stream/preemption.h"
|
||||||
|
#include "core/execution_environment/root_device_environment.h"
|
||||||
#include "core/helpers/options.h"
|
#include "core/helpers/options.h"
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
#include "unit_tests/mocks/mock_execution_environment.h"
|
||||||
#include "unit_tests/mocks/mock_wddm.h"
|
#include "unit_tests/mocks/mock_wddm.h"
|
||||||
|
|
||||||
using namespace NEO;
|
using namespace NEO;
|
||||||
|
|
||||||
class WddmMockReserveAddress : public WddmMock {
|
class WddmMockReserveAddress : public WddmMock {
|
||||||
public:
|
public:
|
||||||
WddmMockReserveAddress() : WddmMock() {}
|
WddmMockReserveAddress(RootDeviceEnvironment &rootDeviceEnvironment) : WddmMock(rootDeviceEnvironment) {}
|
||||||
|
|
||||||
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) {
|
||||||
@@ -55,7 +57,9 @@ class WddmMockReserveAddress : public WddmMock {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TEST(WddmReserveAddressTest, givenWddmWhenFirstIsSuccessfulThenReturnReserveAddress) {
|
TEST(WddmReserveAddressTest, givenWddmWhenFirstIsSuccessfulThenReturnReserveAddress) {
|
||||||
std::unique_ptr<WddmMockReserveAddress> wddm(new WddmMockReserveAddress());
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
|
||||||
|
std::unique_ptr<WddmMockReserveAddress> wddm(new WddmMockReserveAddress(rootDeviceEnvironment));
|
||||||
size_t size = 0x1000;
|
size_t size = 0x1000;
|
||||||
void *reserve = nullptr;
|
void *reserve = nullptr;
|
||||||
|
|
||||||
@@ -72,7 +76,9 @@ TEST(WddmReserveAddressTest, givenWddmWhenFirstIsSuccessfulThenReturnReserveAddr
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(WddmReserveAddressTest, givenWddmWhenFirstIsNullThenReturnNull) {
|
TEST(WddmReserveAddressTest, givenWddmWhenFirstIsNullThenReturnNull) {
|
||||||
std::unique_ptr<WddmMockReserveAddress> wddm(new WddmMockReserveAddress());
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
|
||||||
|
std::unique_ptr<WddmMockReserveAddress> wddm(new WddmMockReserveAddress(rootDeviceEnvironment));
|
||||||
size_t size = 0x1000;
|
size_t size = 0x1000;
|
||||||
void *reserve = nullptr;
|
void *reserve = nullptr;
|
||||||
|
|
||||||
@@ -85,7 +91,9 @@ TEST(WddmReserveAddressTest, givenWddmWhenFirstIsNullThenReturnNull) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(WddmReserveAddressTest, givenWddmWhenFirstIsInvalidSecondSuccessfulThenReturnSecond) {
|
TEST(WddmReserveAddressTest, givenWddmWhenFirstIsInvalidSecondSuccessfulThenReturnSecond) {
|
||||||
std::unique_ptr<WddmMockReserveAddress> wddm(new WddmMockReserveAddress());
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
|
||||||
|
std::unique_ptr<WddmMockReserveAddress> wddm(new WddmMockReserveAddress(rootDeviceEnvironment));
|
||||||
size_t size = 0x1000;
|
size_t size = 0x1000;
|
||||||
void *reserve = nullptr;
|
void *reserve = nullptr;
|
||||||
|
|
||||||
@@ -102,7 +110,9 @@ TEST(WddmReserveAddressTest, givenWddmWhenFirstIsInvalidSecondSuccessfulThenRetu
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(WddmReserveAddressTest, givenWddmWhenSecondIsInvalidThirdSuccessfulThenReturnThird) {
|
TEST(WddmReserveAddressTest, givenWddmWhenSecondIsInvalidThirdSuccessfulThenReturnThird) {
|
||||||
std::unique_ptr<WddmMockReserveAddress> wddm(new WddmMockReserveAddress());
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
|
||||||
|
std::unique_ptr<WddmMockReserveAddress> wddm(new WddmMockReserveAddress(rootDeviceEnvironment));
|
||||||
size_t size = 0x1000;
|
size_t size = 0x1000;
|
||||||
void *reserve = nullptr;
|
void *reserve = nullptr;
|
||||||
|
|
||||||
@@ -119,7 +129,9 @@ TEST(WddmReserveAddressTest, givenWddmWhenSecondIsInvalidThirdSuccessfulThenRetu
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(WddmReserveAddressTest, givenWddmWhenFirstIsInvalidSecondNullThenReturnSecondNull) {
|
TEST(WddmReserveAddressTest, givenWddmWhenFirstIsInvalidSecondNullThenReturnSecondNull) {
|
||||||
std::unique_ptr<WddmMockReserveAddress> wddm(new WddmMockReserveAddress());
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
|
||||||
|
std::unique_ptr<WddmMockReserveAddress> wddm(new WddmMockReserveAddress(rootDeviceEnvironment));
|
||||||
size_t size = 0x1000;
|
size_t size = 0x1000;
|
||||||
void *reserve = nullptr;
|
void *reserve = nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include "unit_tests/mocks/mock_wddm.h"
|
#include "unit_tests/mocks/mock_wddm.h"
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
Wddm *Wddm::createWddm() {
|
Wddm *Wddm::createWddm(RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||||
return new WddmMock();
|
return new WddmMock(rootDeviceEnvironment);
|
||||||
}
|
}
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace NEO {
|
|||||||
struct WddmFixture : ::testing::Test {
|
struct WddmFixture : ::testing::Test {
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
executionEnvironment = platformImpl->peekExecutionEnvironment();
|
executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||||
wddm = static_cast<WddmMock *>(Wddm::createWddm());
|
wddm = static_cast<WddmMock *>(Wddm::createWddm(*executionEnvironment->rootDeviceEnvironments[0].get()));
|
||||||
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||||
executionEnvironment->osInterface->get()->setWddm(wddm);
|
executionEnvironment->osInterface->get()->setWddm(wddm);
|
||||||
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||||
@@ -55,7 +55,7 @@ struct WddmFixtureWithMockGdiDll : public GdiDllFixture {
|
|||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
executionEnvironment = platformImpl->peekExecutionEnvironment();
|
executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||||
GdiDllFixture::SetUp();
|
GdiDllFixture::SetUp();
|
||||||
wddm = static_cast<WddmMock *>(Wddm::createWddm());
|
wddm = static_cast<WddmMock *>(Wddm::createWddm(*executionEnvironment->rootDeviceEnvironments[0].get()));
|
||||||
wddmMockInterface = new WddmMockInterface20(*wddm);
|
wddmMockInterface = new WddmMockInterface20(*wddm);
|
||||||
wddm->wddmInterface.reset(wddmMockInterface);
|
wddm->wddmInterface.reset(wddmMockInterface);
|
||||||
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||||
@@ -87,7 +87,7 @@ struct WddmFixtureWithMockGdiDll : public GdiDllFixture {
|
|||||||
struct WddmInstrumentationGmmFixture {
|
struct WddmInstrumentationGmmFixture {
|
||||||
void SetUp() {
|
void SetUp() {
|
||||||
executionEnvironment = platformImpl->peekExecutionEnvironment();
|
executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||||
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm()));
|
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm(*executionEnvironment->rootDeviceEnvironments[0].get())));
|
||||||
gmmMem = new ::testing::NiceMock<GmockGmmMemory>();
|
gmmMem = new ::testing::NiceMock<GmockGmmMemory>();
|
||||||
wddm->gmmMemory.reset(gmmMem);
|
wddm->gmmMemory.reset(gmmMem);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "core/command_stream/preemption.h"
|
#include "core/command_stream/preemption.h"
|
||||||
|
#include "core/execution_environment/root_device_environment.h"
|
||||||
#include "core/gmm_helper/gmm_helper.h"
|
#include "core/gmm_helper/gmm_helper.h"
|
||||||
#include "runtime/gmm_helper/gmm.h"
|
#include "runtime/gmm_helper/gmm.h"
|
||||||
#include "runtime/memory_manager/memory_manager.h"
|
#include "runtime/memory_manager/memory_manager.h"
|
||||||
@@ -26,7 +27,7 @@ class WddmWithKmDafMock : public Wddm {
|
|||||||
using Wddm::gdi;
|
using Wddm::gdi;
|
||||||
using Wddm::mapGpuVirtualAddress;
|
using Wddm::mapGpuVirtualAddress;
|
||||||
|
|
||||||
WddmWithKmDafMock() : Wddm() {
|
WddmWithKmDafMock(RootDeviceEnvironment &rootDeviceEnvironment) : Wddm(rootDeviceEnvironment) {
|
||||||
kmDafListener.reset(new KmDafListenerMock);
|
kmDafListener.reset(new KmDafListenerMock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,7 +40,7 @@ class WddmKmDafListenerTest : public ::testing::Test {
|
|||||||
public:
|
public:
|
||||||
void SetUp() {
|
void SetUp() {
|
||||||
executionEnvironment = platformImpl->peekExecutionEnvironment();
|
executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||||
wddmWithKmDafMock.reset(new WddmWithKmDafMock());
|
wddmWithKmDafMock.reset(new WddmWithKmDafMock(*executionEnvironment->rootDeviceEnvironments[0].get()));
|
||||||
wddmWithKmDafMock->gdi.reset(new MockGdi());
|
wddmWithKmDafMock->gdi.reset(new MockGdi());
|
||||||
auto hwInfo = *platformDevices[0];
|
auto hwInfo = *platformDevices[0];
|
||||||
wddmWithKmDafMock->init(hwInfo);
|
wddmWithKmDafMock->init(hwInfo);
|
||||||
|
|||||||
@@ -36,17 +36,17 @@ using namespace ::testing;
|
|||||||
void WddmMemoryManagerFixture::SetUp() {
|
void WddmMemoryManagerFixture::SetUp() {
|
||||||
GdiDllFixture::SetUp();
|
GdiDllFixture::SetUp();
|
||||||
|
|
||||||
wddm = static_cast<WddmMock *>(Wddm::createWddm());
|
executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||||
|
wddm = static_cast<WddmMock *>(Wddm::createWddm(*executionEnvironment->rootDeviceEnvironments[0].get()));
|
||||||
if (platformDevices[0]->capabilityTable.ftrRenderCompressedBuffers || platformDevices[0]->capabilityTable.ftrRenderCompressedImages) {
|
if (platformDevices[0]->capabilityTable.ftrRenderCompressedBuffers || platformDevices[0]->capabilityTable.ftrRenderCompressedImages) {
|
||||||
GMM_TRANSLATIONTABLE_CALLBACKS dummyTTCallbacks = {};
|
GMM_TRANSLATIONTABLE_CALLBACKS dummyTTCallbacks = {};
|
||||||
wddm->resetPageTableManager(GmmPageTableMngr::create(0, &dummyTTCallbacks));
|
executionEnvironment->rootDeviceEnvironments[0]->pageTableManager.reset(GmmPageTableMngr::create(0, &dummyTTCallbacks));
|
||||||
}
|
}
|
||||||
auto hwInfo = *platformDevices[0];
|
auto hwInfo = *platformDevices[0];
|
||||||
wddm->init(hwInfo);
|
wddm->init(hwInfo);
|
||||||
constexpr uint64_t heap32Base = (is32bit) ? 0x1000 : 0x800000000000;
|
constexpr uint64_t heap32Base = (is32bit) ? 0x1000 : 0x800000000000;
|
||||||
wddm->setHeap32(heap32Base, 1000 * MemoryConstants::pageSize - 1);
|
wddm->setHeap32(heap32Base, 1000 * MemoryConstants::pageSize - 1);
|
||||||
|
|
||||||
executionEnvironment = platformImpl->peekExecutionEnvironment();
|
|
||||||
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||||
executionEnvironment->osInterface->get()->setWddm(wddm);
|
executionEnvironment->osInterface->get()->setWddm(wddm);
|
||||||
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||||
@@ -107,8 +107,8 @@ TEST(WddmAllocationTest, givenMemoryPoolWhenPassedToWddmAllocationConstructorThe
|
|||||||
|
|
||||||
TEST(WddmMemoryManagerExternalHeapTest, externalHeapIsCreatedWithCorrectBase) {
|
TEST(WddmMemoryManagerExternalHeapTest, externalHeapIsCreatedWithCorrectBase) {
|
||||||
HardwareInfo *hwInfo;
|
HardwareInfo *hwInfo;
|
||||||
auto executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
auto executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||||
std::unique_ptr<WddmMock> wddm(static_cast<WddmMock *>(Wddm::createWddm()));
|
std::unique_ptr<WddmMock> wddm(static_cast<WddmMock *>(Wddm::createWddm(*executionEnvironment->rootDeviceEnvironments[0].get())));
|
||||||
uint64_t base = 0x56000;
|
uint64_t base = 0x56000;
|
||||||
uint64_t size = 0x9000;
|
uint64_t size = 0x9000;
|
||||||
wddm->setHeap32(base, size);
|
wddm->setHeap32(base, size);
|
||||||
@@ -121,8 +121,8 @@ TEST(WddmMemoryManagerExternalHeapTest, externalHeapIsCreatedWithCorrectBase) {
|
|||||||
|
|
||||||
TEST(WddmMemoryManagerWithDeferredDeleterTest, givenWMMWhenAsyncDeleterIsEnabledAndWaitForDeletionsIsCalledThenDeleterInWddmIsSetToNullptr) {
|
TEST(WddmMemoryManagerWithDeferredDeleterTest, givenWMMWhenAsyncDeleterIsEnabledAndWaitForDeletionsIsCalledThenDeleterInWddmIsSetToNullptr) {
|
||||||
HardwareInfo *hwInfo;
|
HardwareInfo *hwInfo;
|
||||||
auto executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
auto executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||||
auto wddm = std::make_unique<WddmMock>();
|
auto wddm = std::make_unique<WddmMock>(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||||
executionEnvironment->osInterface->get()->setWddm(wddm.release());
|
executionEnvironment->osInterface->get()->setWddm(wddm.release());
|
||||||
bool actualDeleterFlag = DebugManager.flags.EnableDeferredDeleter.get();
|
bool actualDeleterFlag = DebugManager.flags.EnableDeferredDeleter.get();
|
||||||
DebugManager.flags.EnableDeferredDeleter.set(true);
|
DebugManager.flags.EnableDeferredDeleter.set(true);
|
||||||
@@ -1302,8 +1302,8 @@ TEST_F(WddmMemoryManagerWithAsyncDeleterTest, givenMemoryManagerWithoutAsyncDele
|
|||||||
|
|
||||||
TEST(WddmMemoryManagerDefaults, givenDefaultWddmMemoryManagerWhenItIsQueriedForInternalHeapBaseThenHeapInternalBaseIsReturned) {
|
TEST(WddmMemoryManagerDefaults, givenDefaultWddmMemoryManagerWhenItIsQueriedForInternalHeapBaseThenHeapInternalBaseIsReturned) {
|
||||||
HardwareInfo *hwInfo;
|
HardwareInfo *hwInfo;
|
||||||
auto executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
auto executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||||
auto wddm = new WddmMock();
|
auto wddm = new WddmMock(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||||
executionEnvironment->osInterface->get()->setWddm(wddm);
|
executionEnvironment->osInterface->get()->setWddm(wddm);
|
||||||
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||||
auto hwInfoMock = *platformDevices[0];
|
auto hwInfoMock = *platformDevices[0];
|
||||||
@@ -1439,9 +1439,9 @@ TEST_F(MockWddmMemoryManagerTest, givenPageTableManagerWhenMapAuxGpuVaCalledThen
|
|||||||
WddmMemoryManager memoryManager(*executionEnvironment);
|
WddmMemoryManager memoryManager(*executionEnvironment);
|
||||||
|
|
||||||
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||||
wddm->resetPageTableManager(mockMngr);
|
executionEnvironment->rootDeviceEnvironments[1]->pageTableManager.reset(mockMngr);
|
||||||
|
|
||||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(AllocationProperties(1, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY));
|
||||||
|
|
||||||
GMM_DDI_UPDATEAUXTABLE givenDdiUpdateAuxTable = {};
|
GMM_DDI_UPDATEAUXTABLE givenDdiUpdateAuxTable = {};
|
||||||
GMM_DDI_UPDATEAUXTABLE expectedDdiUpdateAuxTable = {};
|
GMM_DDI_UPDATEAUXTABLE expectedDdiUpdateAuxTable = {};
|
||||||
@@ -1462,12 +1462,12 @@ TEST_F(MockWddmMemoryManagerTest, givenRenderCompressedAllocationWhenMappedGpuVa
|
|||||||
std::unique_ptr<Gmm> gmm(new Gmm(reinterpret_cast<void *>(123), 4096u, false));
|
std::unique_ptr<Gmm> gmm(new Gmm(reinterpret_cast<void *>(123), 4096u, false));
|
||||||
gmm->isRenderCompressed = true;
|
gmm->isRenderCompressed = true;
|
||||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
||||||
WddmMock wddm;
|
WddmMock wddm(*executionEnvironment->rootDeviceEnvironments[1].get());
|
||||||
auto hwInfo = *platformDevices[0];
|
auto hwInfo = *platformDevices[0];
|
||||||
wddm.init(hwInfo);
|
wddm.init(hwInfo);
|
||||||
|
|
||||||
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||||
wddm.resetPageTableManager(mockMngr);
|
executionEnvironment->rootDeviceEnvironments[1]->pageTableManager.reset(mockMngr);
|
||||||
|
|
||||||
GMM_DDI_UPDATEAUXTABLE givenDdiUpdateAuxTable = {};
|
GMM_DDI_UPDATEAUXTABLE givenDdiUpdateAuxTable = {};
|
||||||
GMM_DDI_UPDATEAUXTABLE expectedDdiUpdateAuxTable = {};
|
GMM_DDI_UPDATEAUXTABLE expectedDdiUpdateAuxTable = {};
|
||||||
@@ -1494,9 +1494,9 @@ TEST_F(MockWddmMemoryManagerTest, givenRenderCompressedAllocationWhenReleaseingT
|
|||||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 123;
|
D3DGPU_VIRTUAL_ADDRESS gpuVa = 123;
|
||||||
|
|
||||||
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||||
wddm->resetPageTableManager(mockMngr);
|
executionEnvironment->rootDeviceEnvironments[1]->pageTableManager.reset(mockMngr);
|
||||||
|
|
||||||
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemoryWithProperties(AllocationProperties(1, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY)));
|
||||||
wddmAlloc->setGpuAddress(gpuVa);
|
wddmAlloc->setGpuAddress(gpuVa);
|
||||||
wddmAlloc->getDefaultGmm()->isRenderCompressed = true;
|
wddmAlloc->getDefaultGmm()->isRenderCompressed = true;
|
||||||
|
|
||||||
@@ -1519,7 +1519,7 @@ TEST_F(MockWddmMemoryManagerTest, givenNonRenderCompressedAllocationWhenReleasei
|
|||||||
WddmMemoryManager memoryManager(*executionEnvironment);
|
WddmMemoryManager memoryManager(*executionEnvironment);
|
||||||
|
|
||||||
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||||
wddm->resetPageTableManager(mockMngr);
|
executionEnvironment->rootDeviceEnvironments[1]->pageTableManager.reset(mockMngr);
|
||||||
|
|
||||||
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||||
wddmAlloc->getDefaultGmm()->isRenderCompressed = false;
|
wddmAlloc->getDefaultGmm()->isRenderCompressed = false;
|
||||||
@@ -1533,12 +1533,12 @@ TEST_F(MockWddmMemoryManagerTest, givenNonRenderCompressedAllocationWhenMappedGp
|
|||||||
std::unique_ptr<Gmm> gmm(new Gmm(reinterpret_cast<void *>(123), 4096u, false));
|
std::unique_ptr<Gmm> gmm(new Gmm(reinterpret_cast<void *>(123), 4096u, false));
|
||||||
gmm->isRenderCompressed = false;
|
gmm->isRenderCompressed = false;
|
||||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
||||||
WddmMock wddm;
|
WddmMock wddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||||
auto hwInfo = *platformDevices[0];
|
auto hwInfo = *platformDevices[0];
|
||||||
wddm.init(hwInfo);
|
wddm.init(hwInfo);
|
||||||
|
|
||||||
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||||
wddm.resetPageTableManager(mockMngr);
|
executionEnvironment->rootDeviceEnvironments[1]->pageTableManager.reset(mockMngr);
|
||||||
|
|
||||||
EXPECT_CALL(*mockMngr, updateAuxTable(_)).Times(0);
|
EXPECT_CALL(*mockMngr, updateAuxTable(_)).Times(0);
|
||||||
|
|
||||||
@@ -1550,7 +1550,7 @@ TEST_F(MockWddmMemoryManagerTest, givenFailingAllocationWhenMappedGpuVaThenRetur
|
|||||||
std::unique_ptr<Gmm> gmm(new Gmm(reinterpret_cast<void *>(123), 4096u, false));
|
std::unique_ptr<Gmm> gmm(new Gmm(reinterpret_cast<void *>(123), 4096u, false));
|
||||||
gmm->isRenderCompressed = false;
|
gmm->isRenderCompressed = false;
|
||||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
||||||
WddmMock wddm;
|
WddmMock wddm(*executionEnvironment->rootDeviceEnvironments[1].get());
|
||||||
auto hwInfo = *platformDevices[0];
|
auto hwInfo = *platformDevices[0];
|
||||||
wddm.init(hwInfo);
|
wddm.init(hwInfo);
|
||||||
|
|
||||||
@@ -1565,7 +1565,7 @@ TEST_F(MockWddmMemoryManagerTest, givenRenderCompressedFlagSetWhenInternalIsUnse
|
|||||||
WddmMemoryManager memoryManager(*executionEnvironment);
|
WddmMemoryManager memoryManager(*executionEnvironment);
|
||||||
|
|
||||||
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||||
wddm->resetPageTableManager(mockMngr);
|
executionEnvironment->rootDeviceEnvironments[1]->pageTableManager.reset(mockMngr);
|
||||||
|
|
||||||
auto myGmm = new Gmm(reinterpret_cast<void *>(123), 4096u, false);
|
auto myGmm = new Gmm(reinterpret_cast<void *>(123), 4096u, false);
|
||||||
myGmm->isRenderCompressed = false;
|
myGmm->isRenderCompressed = false;
|
||||||
@@ -1582,6 +1582,30 @@ TEST_F(MockWddmMemoryManagerTest, givenRenderCompressedFlagSetWhenInternalIsUnse
|
|||||||
memoryManager.freeGraphicsMemory(wddmAlloc);
|
memoryManager.freeGraphicsMemory(wddmAlloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(MockWddmMemoryManagerTest, givenRenderCompressedFlagSetWhenInternalIsSetThenUpdateAuxTable) {
|
||||||
|
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
||||||
|
auto hwInfo = *platformDevices[0];
|
||||||
|
wddm->init(hwInfo);
|
||||||
|
WddmMemoryManager memoryManager(*executionEnvironment);
|
||||||
|
|
||||||
|
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||||
|
executionEnvironment->rootDeviceEnvironments[1]->pageTableManager.reset(mockMngr);
|
||||||
|
|
||||||
|
auto myGmm = new Gmm(reinterpret_cast<void *>(123), 4096u, false);
|
||||||
|
myGmm->isRenderCompressed = true;
|
||||||
|
myGmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = 1;
|
||||||
|
|
||||||
|
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||||
|
delete wddmAlloc->getDefaultGmm();
|
||||||
|
wddmAlloc->setDefaultGmm(myGmm);
|
||||||
|
|
||||||
|
EXPECT_CALL(*mockMngr, updateAuxTable(_)).Times(1);
|
||||||
|
|
||||||
|
auto result = wddm->mapGpuVirtualAddress(myGmm, ALLOCATION_HANDLE, wddm->getGfxPartition().Standard.Base, wddm->getGfxPartition().Standard.Limit, 0u, gpuVa);
|
||||||
|
EXPECT_TRUE(result);
|
||||||
|
memoryManager.freeGraphicsMemory(wddmAlloc);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(WddmMemoryManagerTest2, givenReadOnlyMemoryWhenCreateAllocationFailsThenPopulateOsHandlesReturnsInvalidPointer) {
|
TEST_F(WddmMemoryManagerTest2, givenReadOnlyMemoryWhenCreateAllocationFailsThenPopulateOsHandlesReturnsInvalidPointer) {
|
||||||
OsHandleStorage handleStorage;
|
OsHandleStorage handleStorage;
|
||||||
handleStorage.fragmentCount = 1;
|
handleStorage.fragmentCount = 1;
|
||||||
@@ -1626,7 +1650,7 @@ TEST_F(WddmMemoryManagerTest2, givenReadOnlyMemoryPassedToPopulateOsHandlesWhenC
|
|||||||
TEST(WddmMemoryManagerCleanupTest, givenUsedTagAllocationInWddmMemoryManagerWhenCleanupMemoryManagerThenDontAccessCsr) {
|
TEST(WddmMemoryManagerCleanupTest, givenUsedTagAllocationInWddmMemoryManagerWhenCleanupMemoryManagerThenDontAccessCsr) {
|
||||||
ExecutionEnvironment &executionEnvironment = *platform()->peekExecutionEnvironment();
|
ExecutionEnvironment &executionEnvironment = *platform()->peekExecutionEnvironment();
|
||||||
auto csr = std::unique_ptr<CommandStreamReceiver>(createCommandStream(executionEnvironment, 0));
|
auto csr = std::unique_ptr<CommandStreamReceiver>(createCommandStream(executionEnvironment, 0));
|
||||||
auto wddm = new WddmMock();
|
auto wddm = new WddmMock(*executionEnvironment.rootDeviceEnvironments[0].get());
|
||||||
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
|
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
|
||||||
auto hwInfo = *platformDevices[0];
|
auto hwInfo = *platformDevices[0];
|
||||||
wddm->init(hwInfo);
|
wddm->init(hwInfo);
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class MockWddmMemoryManagerFixture {
|
|||||||
executionEnvironment = platformImpl->peekExecutionEnvironment();
|
executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||||
gdi = new MockGdi();
|
gdi = new MockGdi();
|
||||||
|
|
||||||
wddm = static_cast<WddmMock *>(Wddm::createWddm());
|
wddm = static_cast<WddmMock *>(Wddm::createWddm(*executionEnvironment->rootDeviceEnvironments[0].get()));
|
||||||
wddm->gdi.reset(gdi);
|
wddm->gdi.reset(gdi);
|
||||||
constexpr uint64_t heap32Base = (is32bit) ? 0x1000 : 0x800000000000;
|
constexpr uint64_t heap32Base = (is32bit) ? 0x1000 : 0x800000000000;
|
||||||
wddm->setHeap32(heap32Base, 1000 * MemoryConstants::pageSize - 1);
|
wddm->setHeap32(heap32Base, 1000 * MemoryConstants::pageSize - 1);
|
||||||
@@ -96,7 +96,8 @@ class WddmMemoryManagerFixtureWithGmockWddm : public ExecutionEnvironmentFixture
|
|||||||
|
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
// wddm is deleted by memory manager
|
// wddm is deleted by memory manager
|
||||||
wddm = new NiceMock<GmockWddm>;
|
|
||||||
|
wddm = new NiceMock<GmockWddm>(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||||
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||||
ASSERT_NE(nullptr, wddm);
|
ASSERT_NE(nullptr, wddm);
|
||||||
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
|
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
|
||||||
@@ -162,8 +163,8 @@ class WddmMemoryManagerSimpleTest : public MockWddmMemoryManagerFixture, public
|
|||||||
class MockWddmMemoryManagerTest : public ::testing::Test {
|
class MockWddmMemoryManagerTest : public ::testing::Test {
|
||||||
public:
|
public:
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 2);
|
||||||
wddm = new WddmMock();
|
wddm = new WddmMock(*executionEnvironment->rootDeviceEnvironments[1].get());
|
||||||
executionEnvironment->osInterface->get()->setWddm(wddm);
|
executionEnvironment->osInterface->get()->setWddm(wddm);
|
||||||
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "core/command_stream/preemption.h"
|
#include "core/command_stream/preemption.h"
|
||||||
|
#include "core/execution_environment/root_device_environment.h"
|
||||||
#include "core/helpers/hw_helper.h"
|
#include "core/helpers/hw_helper.h"
|
||||||
#include "core/memory_manager/memory_operations_handler.h"
|
#include "core/memory_manager/memory_operations_handler.h"
|
||||||
#include "runtime/execution_environment/execution_environment.h"
|
#include "runtime/execution_environment/execution_environment.h"
|
||||||
@@ -19,6 +20,7 @@
|
|||||||
#include "runtime/platform/platform.h"
|
#include "runtime/platform/platform.h"
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
#include "unit_tests/mocks/mock_allocation_properties.h"
|
#include "unit_tests/mocks/mock_allocation_properties.h"
|
||||||
|
#include "unit_tests/mocks/mock_execution_environment.h"
|
||||||
#include "unit_tests/mocks/mock_wddm.h"
|
#include "unit_tests/mocks/mock_wddm.h"
|
||||||
#include "unit_tests/os_interface/windows/mock_gdi_interface.h"
|
#include "unit_tests/os_interface/windows/mock_gdi_interface.h"
|
||||||
#include "unit_tests/os_interface/windows/mock_wddm_allocation.h"
|
#include "unit_tests/os_interface/windows/mock_wddm_allocation.h"
|
||||||
@@ -64,7 +66,9 @@ struct WddmResidencyControllerTest : ::testing::Test {
|
|||||||
const uint32_t osContextId = 0u;
|
const uint32_t osContextId = 0u;
|
||||||
|
|
||||||
void SetUp() {
|
void SetUp() {
|
||||||
wddm = std::unique_ptr<WddmMock>(static_cast<WddmMock *>(Wddm::createWddm()));
|
executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||||
|
rootDeviceEnvironment = std::make_unique<RootDeviceEnvironment>(*executionEnvironment);
|
||||||
|
wddm = std::unique_ptr<WddmMock>(static_cast<WddmMock *>(Wddm::createWddm(*rootDeviceEnvironment)));
|
||||||
auto hwInfo = *platformDevices[0];
|
auto hwInfo = *platformDevices[0];
|
||||||
wddm->init(hwInfo);
|
wddm->init(hwInfo);
|
||||||
mockOsContextWin = std::make_unique<MockOsContextWin>(*wddm, osContextId, 0, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false);
|
mockOsContextWin = std::make_unique<MockOsContextWin>(*wddm, osContextId, 0, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false);
|
||||||
@@ -74,6 +78,8 @@ struct WddmResidencyControllerTest : ::testing::Test {
|
|||||||
|
|
||||||
std::unique_ptr<WddmMock> wddm;
|
std::unique_ptr<WddmMock> wddm;
|
||||||
std::unique_ptr<MockOsContextWin> mockOsContextWin;
|
std::unique_ptr<MockOsContextWin> mockOsContextWin;
|
||||||
|
std::unique_ptr<MockExecutionEnvironment> executionEnvironment;
|
||||||
|
std::unique_ptr<RootDeviceEnvironment> rootDeviceEnvironment;
|
||||||
MockWddmResidencyController *residencyController = nullptr;
|
MockWddmResidencyController *residencyController = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -81,7 +87,9 @@ struct WddmResidencyControllerWithGdiTest : ::testing::Test {
|
|||||||
const uint32_t osContextId = 0u;
|
const uint32_t osContextId = 0u;
|
||||||
|
|
||||||
void SetUp() {
|
void SetUp() {
|
||||||
wddm = std::unique_ptr<WddmMock>(static_cast<WddmMock *>(Wddm::createWddm()));
|
executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||||
|
rootDeviceEnvironment = std::make_unique<RootDeviceEnvironment>(*executionEnvironment);
|
||||||
|
wddm = std::unique_ptr<WddmMock>(static_cast<WddmMock *>(Wddm::createWddm(*rootDeviceEnvironment)));
|
||||||
gdi = new MockGdi();
|
gdi = new MockGdi();
|
||||||
wddm->gdi.reset(gdi);
|
wddm->gdi.reset(gdi);
|
||||||
auto hwInfo = *platformDevices[0];
|
auto hwInfo = *platformDevices[0];
|
||||||
@@ -95,6 +103,8 @@ struct WddmResidencyControllerWithGdiTest : ::testing::Test {
|
|||||||
|
|
||||||
std::unique_ptr<WddmMock> wddm;
|
std::unique_ptr<WddmMock> wddm;
|
||||||
std::unique_ptr<MockOsContextWin> mockOsContextWin;
|
std::unique_ptr<MockOsContextWin> mockOsContextWin;
|
||||||
|
std::unique_ptr<MockExecutionEnvironment> executionEnvironment;
|
||||||
|
std::unique_ptr<RootDeviceEnvironment> rootDeviceEnvironment;
|
||||||
MockWddmResidencyController *residencyController = nullptr;
|
MockWddmResidencyController *residencyController = nullptr;
|
||||||
MockGdi *gdi;
|
MockGdi *gdi;
|
||||||
};
|
};
|
||||||
@@ -103,7 +113,7 @@ struct WddmResidencyControllerWithMockWddmTest : public WddmResidencyControllerT
|
|||||||
void SetUp() {
|
void SetUp() {
|
||||||
executionEnvironment = platformImpl->peekExecutionEnvironment();
|
executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||||
|
|
||||||
wddm = new ::testing::NiceMock<GmockWddm>();
|
wddm = new ::testing::NiceMock<GmockWddm>(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||||
wddm->gdi = std::make_unique<MockGdi>();
|
wddm->gdi = std::make_unique<MockGdi>();
|
||||||
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
|
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
|
||||||
auto hwInfo = *platformDevices[0];
|
auto hwInfo = *platformDevices[0];
|
||||||
@@ -135,13 +145,13 @@ struct WddmResidencyControllerWithGdiAndMemoryManagerTest : ::testing::Test {
|
|||||||
const uint32_t osContextId = 0u;
|
const uint32_t osContextId = 0u;
|
||||||
|
|
||||||
void SetUp() {
|
void SetUp() {
|
||||||
wddm = static_cast<WddmMock *>(Wddm::createWddm());
|
executionEnvironment = platform()->peekExecutionEnvironment();
|
||||||
|
wddm = static_cast<WddmMock *>(Wddm::createWddm(*executionEnvironment->rootDeviceEnvironments[0].get()));
|
||||||
auto hwInfo = *platformDevices[0];
|
auto hwInfo = *platformDevices[0];
|
||||||
wddm->init(hwInfo);
|
wddm->init(hwInfo);
|
||||||
gdi = new MockGdi();
|
gdi = new MockGdi();
|
||||||
wddm->gdi.reset(gdi);
|
wddm->gdi.reset(gdi);
|
||||||
|
|
||||||
executionEnvironment = platform()->peekExecutionEnvironment();
|
|
||||||
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||||
executionEnvironment->osInterface->get()->setWddm(wddm);
|
executionEnvironment->osInterface->get()->setWddm(wddm);
|
||||||
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||||
@@ -170,8 +180,9 @@ struct WddmResidencyControllerWithGdiAndMemoryManagerTest : ::testing::Test {
|
|||||||
|
|
||||||
TEST(WddmResidencyController, givenWddmResidencyControllerWhenItIsConstructedThenDoNotRegisterTrimCallback) {
|
TEST(WddmResidencyController, givenWddmResidencyControllerWhenItIsConstructedThenDoNotRegisterTrimCallback) {
|
||||||
ExecutionEnvironment executionEnvironment;
|
ExecutionEnvironment executionEnvironment;
|
||||||
|
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||||
auto gdi = new MockGdi();
|
auto gdi = new MockGdi();
|
||||||
auto wddm = std::unique_ptr<WddmMock>{static_cast<WddmMock *>(Wddm::createWddm())};
|
auto wddm = std::unique_ptr<WddmMock>{static_cast<WddmMock *>(Wddm::createWddm(*executionEnvironment.rootDeviceEnvironments[0].get()))};
|
||||||
wddm->gdi.reset(gdi);
|
wddm->gdi.reset(gdi);
|
||||||
auto hwInfo = *platformDevices[0];
|
auto hwInfo = *platformDevices[0];
|
||||||
wddm->init(hwInfo);
|
wddm->init(hwInfo);
|
||||||
@@ -189,8 +200,9 @@ TEST(WddmResidencyController, givenWddmResidencyControllerWhenItIsConstructedThe
|
|||||||
|
|
||||||
TEST(WddmResidencyController, givenWddmResidencyControllerWhenRegisterCallbackThenCallbackIsSetUpProperly) {
|
TEST(WddmResidencyController, givenWddmResidencyControllerWhenRegisterCallbackThenCallbackIsSetUpProperly) {
|
||||||
ExecutionEnvironment executionEnvironment;
|
ExecutionEnvironment executionEnvironment;
|
||||||
|
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||||
auto gdi = new MockGdi();
|
auto gdi = new MockGdi();
|
||||||
auto wddm = std::unique_ptr<WddmMock>{static_cast<WddmMock *>(Wddm::createWddm())};
|
auto wddm = std::unique_ptr<WddmMock>{static_cast<WddmMock *>(Wddm::createWddm(*executionEnvironment.rootDeviceEnvironments[0].get()))};
|
||||||
wddm->gdi.reset(gdi);
|
wddm->gdi.reset(gdi);
|
||||||
auto hwInfo = *platformDevices[0];
|
auto hwInfo = *platformDevices[0];
|
||||||
wddm->init(hwInfo);
|
wddm->init(hwInfo);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ struct EnqueueBufferWindowsTest : public HardwareParse,
|
|||||||
|
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
DebugManager.flags.EnableBlitterOperationsForReadWriteBuffers.set(0);
|
DebugManager.flags.EnableBlitterOperationsForReadWriteBuffers.set(0);
|
||||||
executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown() override {
|
void TearDown() override {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class CommandStreamReceiverWithActiveDebuggerTest : public ::testing::Test {
|
|||||||
hwInfo = nullptr;
|
hwInfo = nullptr;
|
||||||
EnvironmentWithCsrWrapper environment;
|
EnvironmentWithCsrWrapper environment;
|
||||||
environment.setCsrType<MockCsrHw2<FamilyType>>();
|
environment.setCsrType<MockCsrHw2<FamilyType>>();
|
||||||
executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||||
hwInfo->capabilityTable = platformDevices[0]->capabilityTable;
|
hwInfo->capabilityTable = platformDevices[0]->capabilityTable;
|
||||||
hwInfo->capabilityTable.sourceLevelDebuggerSupported = true;
|
hwInfo->capabilityTable.sourceLevelDebuggerSupported = true;
|
||||||
|
|
||||||
|
|||||||
@@ -491,7 +491,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenDeviceImplIsCreate
|
|||||||
VariableBackup<bool> backup(&overrideCommandStreamReceiverCreation, true);
|
VariableBackup<bool> backup(&overrideCommandStreamReceiverCreation, true);
|
||||||
|
|
||||||
HardwareInfo *hwInfo = nullptr;
|
HardwareInfo *hwInfo = nullptr;
|
||||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
|
||||||
|
|
||||||
hwInfo->capabilityTable.instrumentationEnabled = true;
|
hwInfo->capabilityTable.instrumentationEnabled = true;
|
||||||
unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, 0));
|
unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, 0));
|
||||||
|
|||||||
@@ -5,16 +5,20 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "core/execution_environment/root_device_environment.h"
|
||||||
#include "core/helpers/hw_info.h"
|
#include "core/helpers/hw_info.h"
|
||||||
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
|
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
|
||||||
#include "runtime/os_interface/windows/wddm/wddm.h"
|
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
#include "unit_tests/mocks/mock_execution_environment.h"
|
||||||
|
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
|
||||||
using namespace NEO;
|
using namespace NEO;
|
||||||
|
|
||||||
TEST(wddmCreateTests, givenInputVersionWhenCreatingThenCreateRequestedObject) {
|
TEST(wddmCreateTests, givenInputVersionWhenCreatingThenCreateRequestedObject) {
|
||||||
std::unique_ptr<Wddm> wddm(Wddm::createWddm());
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
|
||||||
|
std::unique_ptr<Wddm> wddm(Wddm::createWddm(rootDeviceEnvironment));
|
||||||
EXPECT_EQ(typeid(*wddm.get()), typeid(Wddm));
|
EXPECT_EQ(typeid(*wddm.get()), typeid(Wddm));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user