|
30 | 30 | #include "runtime/gmm_helper/page_table_mngr.h" |
31 | 31 | #include "runtime/os_interface/windows/wddm/wddm.h" |
32 | 32 | #include "runtime/os_interface/hw_info_config.h" |
| 33 | +#include "runtime/os_interface/windows/gdi_interface.h" |
33 | 34 | #include "runtime/os_interface/windows/os_context_win.h" |
34 | 35 | #include "runtime/os_interface/windows/wddm_allocation.h" |
35 | 36 | #include "runtime/os_interface/windows/registry_reader.h" |
@@ -893,4 +894,50 @@ MonitoredFence &Wddm::getMonitoredFence() { return osContext->getMonitoredFence( |
893 | 894 | D3DKMT_HANDLE Wddm::getOsDeviceContext() const { |
894 | 895 | return osContext->getContext(); |
895 | 896 | } |
| 897 | + |
| 898 | +bool Wddm::configureDeviceAddressSpace() { |
| 899 | + SYSTEM_INFO sysInfo; |
| 900 | + Wddm::getSystemInfo(&sysInfo); |
| 901 | + maximumApplicationAddress = reinterpret_cast<uintptr_t>(sysInfo.lpMaximumApplicationAddress); |
| 902 | + |
| 903 | + return gmmMemory->configureDevice(adapter, device, gdi->escape, |
| 904 | + maximumApplicationAddress + 1u, |
| 905 | + featureTable->ftrL3IACoherency, |
| 906 | + gfxPartition, minAddress); |
| 907 | +} |
| 908 | + |
| 909 | +bool Wddm::init() { |
| 910 | + if (gdi != nullptr && gdi->isInitialized() && !initialized) { |
| 911 | + if (!openAdapter()) { |
| 912 | + return false; |
| 913 | + } |
| 914 | + if (!queryAdapterInfo()) { |
| 915 | + return false; |
| 916 | + } |
| 917 | + |
| 918 | + if (!wddmInterface) { |
| 919 | + if (featureTable->ftrWddmHwQueues) { |
| 920 | + wddmInterface = std::make_unique<WddmInterface23>(*this); |
| 921 | + } else { |
| 922 | + wddmInterface = std::make_unique<WddmInterface20>(*this); |
| 923 | + } |
| 924 | + } |
| 925 | + |
| 926 | + if (!createDevice()) { |
| 927 | + return false; |
| 928 | + } |
| 929 | + if (!createPagingQueue()) { |
| 930 | + return false; |
| 931 | + } |
| 932 | + if (!gmmMemory) { |
| 933 | + gmmMemory.reset(GmmMemory::create()); |
| 934 | + } |
| 935 | + if (!configureDeviceAddressSpace()) { |
| 936 | + return false; |
| 937 | + } |
| 938 | + osContext = std::make_unique<OsContextWin>(*this); |
| 939 | + initialized = osContext->isInitialized(); |
| 940 | + } |
| 941 | + return initialized; |
| 942 | +} |
896 | 943 | } // namespace OCLRT |
0 commit comments