Remove template parameter from Wddm methods

Change-Id: Icd700c7215184d4c0f9564c61868a1f9f29a75e5
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2018-08-23 11:29:39 +02:00
committed by sys_ocldev
parent e6131293d1
commit 9ac3529c6b
25 changed files with 421 additions and 470 deletions

View File

@@ -74,17 +74,13 @@ set(RUNTIME_SRCS_OS_INTERFACE_WINDOWS
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm.h
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm.inl
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm_interface.h
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm_interface.cpp
)
if(WIN32)
file(GLOB RUNTIME_SRCS_WDDM_INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm2[0-9]\.*")
target_sources(${NEO_STATIC_LIB_NAME} PRIVATE
${RUNTIME_SRCS_OS_INTERFACE_WINDOWS}
${RUNTIME_SRCS_WDDM_INTERFACE}
)
endif()

View File

@@ -30,6 +30,7 @@
#include "runtime/gmm_helper/page_table_mngr.h"
#include "runtime/os_interface/windows/wddm/wddm.h"
#include "runtime/os_interface/hw_info_config.h"
#include "runtime/os_interface/windows/gdi_interface.h"
#include "runtime/os_interface/windows/os_context_win.h"
#include "runtime/os_interface/windows/wddm_allocation.h"
#include "runtime/os_interface/windows/registry_reader.h"
@@ -893,4 +894,50 @@ MonitoredFence &Wddm::getMonitoredFence() { return osContext->getMonitoredFence(
D3DKMT_HANDLE Wddm::getOsDeviceContext() const {
return osContext->getContext();
}
bool Wddm::configureDeviceAddressSpace() {
SYSTEM_INFO sysInfo;
Wddm::getSystemInfo(&sysInfo);
maximumApplicationAddress = reinterpret_cast<uintptr_t>(sysInfo.lpMaximumApplicationAddress);
return gmmMemory->configureDevice(adapter, device, gdi->escape,
maximumApplicationAddress + 1u,
featureTable->ftrL3IACoherency,
gfxPartition, minAddress);
}
bool Wddm::init() {
if (gdi != nullptr && gdi->isInitialized() && !initialized) {
if (!openAdapter()) {
return false;
}
if (!queryAdapterInfo()) {
return false;
}
if (!wddmInterface) {
if (featureTable->ftrWddmHwQueues) {
wddmInterface = std::make_unique<WddmInterface23>(*this);
} else {
wddmInterface = std::make_unique<WddmInterface20>(*this);
}
}
if (!createDevice()) {
return false;
}
if (!createPagingQueue()) {
return false;
}
if (!gmmMemory) {
gmmMemory.reset(GmmMemory::create());
}
if (!configureDeviceAddressSpace()) {
return false;
}
osContext = std::make_unique<OsContextWin>(*this);
initialized = osContext->isInitialized();
}
return initialized;
}
} // namespace OCLRT

View File

@@ -98,10 +98,8 @@ class Wddm {
MOCKABLE_VIRTUAL void *virtualAlloc(void *inPtr, size_t size, unsigned long flags, unsigned long type);
MOCKABLE_VIRTUAL int virtualFree(void *ptr, size_t size, unsigned long flags);
template <typename GfxFamily>
bool configureDeviceAddressSpace();
template <typename GfxFamily>
bool init();
bool isInitialized() const {

View File

@@ -1,76 +0,0 @@
/*
* Copyright (c) 2017 - 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "runtime/os_interface/windows/gdi_interface.h"
#include "runtime/os_interface/windows/wddm/wddm.h"
#include "runtime/os_interface/windows/os_context_win.h"
namespace OCLRT {
template <typename GfxFamily>
bool Wddm::configureDeviceAddressSpace() {
SYSTEM_INFO sysInfo;
Wddm::getSystemInfo(&sysInfo);
maximumApplicationAddress = reinterpret_cast<uintptr_t>(sysInfo.lpMaximumApplicationAddress);
minAddress = windowsMinAddress;
return gmmMemory->configureDeviceAddressSpace(adapter, device, gdi->escape,
maximumApplicationAddress + 1u,
0, 0, featureTable->ftrL3IACoherency, 0, 0);
}
template <typename GfxFamily>
bool Wddm::init() {
if (gdi != nullptr && gdi->isInitialized() && !initialized) {
if (!openAdapter()) {
return false;
}
if (!queryAdapterInfo()) {
return false;
}
if (!wddmInterface) {
if (featureTable->ftrWddmHwQueues) {
wddmInterface = std::make_unique<WddmInterface23>(*this);
} else {
wddmInterface = std::make_unique<WddmInterface20>(*this);
}
}
if (!createDevice()) {
return false;
}
if (!createPagingQueue()) {
return false;
}
if (!gmmMemory) {
gmmMemory.reset(GmmMemory::create());
}
if (!configureDeviceAddressSpace<GfxFamily>()) {
return false;
}
osContext = std::make_unique<OsContextWin>(*this);
initialized = osContext->isInitialized();
}
return initialized;
}
} // namespace OCLRT

View File

@@ -75,7 +75,7 @@ WddmCommandStreamReceiver<GfxFamily>::WddmCommandStreamReceiver(const HardwareIn
this->dispatchMode = (DispatchMode)DebugManager.flags.CsrDispatchMode.get();
}
bool success = this->wddm->init<GfxFamily>();
bool success = this->wddm->init();
DEBUG_BREAK_IF(!success);
}