mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
Wddm interface [4/n]: Make 2.0 default version
- Create Wddm20 interface by default for runtime and ULTs - Add Windows dll test for Wddm creation Change-Id: Id0a1b86e68112c31078b6965c647a5218790150f
This commit is contained in:
@@ -62,7 +62,8 @@ Wddm::Wddm() : initialized(false),
|
||||
pagingFenceAddress(nullptr),
|
||||
currentPagingFenceValue(0),
|
||||
hwContextId(0),
|
||||
trimCallbackHandle(nullptr) {
|
||||
trimCallbackHandle(nullptr),
|
||||
wddmInterfaceVersion(WddmInterfaceVersion::Wddm20) {
|
||||
featureTable.reset(new FeatureTable());
|
||||
waTable.reset(new WorkaroundTable());
|
||||
gtSystemInfo.reset(new GT_SYSTEM_INFO);
|
||||
@@ -97,7 +98,7 @@ bool Wddm::enumAdapters(unsigned int devNum, HardwareInfo &outHardwareInfo) {
|
||||
if (devNum > 0)
|
||||
return false;
|
||||
|
||||
std::unique_ptr<Wddm> wddm(createWddm());
|
||||
std::unique_ptr<Wddm> wddm(createWddm(WddmInterfaceVersion::Wddm20));
|
||||
DEBUG_BREAK_IF(wddm == nullptr);
|
||||
|
||||
if (wddm->gdi->isInitialized()) {
|
||||
|
||||
@@ -49,16 +49,21 @@ struct FeatureTable;
|
||||
struct WorkaroundTable;
|
||||
struct KmDafListener;
|
||||
|
||||
namespace WddmInterfaceVersion {
|
||||
constexpr uint32_t Wddm20 = 20;
|
||||
} // namespace WddmInterfaceVersion
|
||||
|
||||
class Wddm {
|
||||
public:
|
||||
typedef HRESULT(WINAPI *CreateDXGIFactoryFcn)(REFIID riid, void **ppFactory);
|
||||
typedef void(WINAPI *GetSystemInfoFcn)(SYSTEM_INFO *pSystemInfo);
|
||||
typedef BOOL(WINAPI *VirtualFreeFcn)(LPVOID ptr, SIZE_T size, DWORD flags);
|
||||
typedef LPVOID(WINAPI *VirtualAllocFcn)(LPVOID inPtr, SIZE_T size, DWORD flags, DWORD type);
|
||||
const uint32_t wddmInterfaceVersion;
|
||||
|
||||
virtual ~Wddm();
|
||||
|
||||
static Wddm *createWddm();
|
||||
static Wddm *createWddm(uint32_t interfaceVersion);
|
||||
|
||||
static bool enumAdapters(unsigned int devNum, HardwareInfo &outHardwareInfo);
|
||||
|
||||
@@ -219,4 +224,6 @@ class Wddm {
|
||||
std::unique_ptr<KmDafListener> kmDafListener;
|
||||
};
|
||||
|
||||
using Wddm20 = Wddm;
|
||||
|
||||
} // namespace OCLRT
|
||||
|
||||
54
runtime/os_interface/windows/wddm/wddm_calls.cpp
Normal file
54
runtime/os_interface/windows/wddm/wddm_calls.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 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/gmm_helper/gmm_helper.h"
|
||||
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||
#include <dxgi.h>
|
||||
|
||||
namespace OCLRT {
|
||||
Wddm::CreateDXGIFactoryFcn getCreateDxgiFactory() {
|
||||
return CreateDXGIFactory;
|
||||
}
|
||||
|
||||
Wddm::GetSystemInfoFcn getGetSystemInfo() {
|
||||
return GetSystemInfo;
|
||||
}
|
||||
|
||||
Wddm::VirtualFreeFcn getVirtualFree() {
|
||||
return VirtualFree;
|
||||
}
|
||||
|
||||
Wddm::VirtualAllocFcn getVirtualAlloc() {
|
||||
return VirtualAlloc;
|
||||
}
|
||||
|
||||
bool Wddm::initGmmContext() {
|
||||
return Gmm::initContext(gfxPlatform.get(),
|
||||
featureTable.get(),
|
||||
waTable.get(),
|
||||
gtSystemInfo.get());
|
||||
}
|
||||
|
||||
void Wddm::destroyGmmContext() {
|
||||
Gmm::destroyContext();
|
||||
}
|
||||
} // namespace OCLRT
|
||||
@@ -20,40 +20,10 @@
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/gmm_helper/gmm_helper.h"
|
||||
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||
#include <dxgi.h>
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
Wddm *Wddm::createWddm() {
|
||||
return new Wddm();
|
||||
Wddm *Wddm::createWddm(uint32_t interfaceVersion) {
|
||||
return new Wddm20();
|
||||
}
|
||||
|
||||
Wddm::CreateDXGIFactoryFcn getCreateDxgiFactory() {
|
||||
return CreateDXGIFactory;
|
||||
}
|
||||
|
||||
Wddm::GetSystemInfoFcn getGetSystemInfo() {
|
||||
return GetSystemInfo;
|
||||
}
|
||||
|
||||
Wddm::VirtualFreeFcn getVirtualFree() {
|
||||
return VirtualFree;
|
||||
}
|
||||
|
||||
Wddm::VirtualAllocFcn getVirtualAlloc() {
|
||||
return VirtualAlloc;
|
||||
}
|
||||
|
||||
bool Wddm::initGmmContext() {
|
||||
return Gmm::initContext(gfxPlatform.get(),
|
||||
featureTable.get(),
|
||||
waTable.get(),
|
||||
gtSystemInfo.get());
|
||||
}
|
||||
|
||||
void Wddm::destroyGmmContext() {
|
||||
Gmm::destroyContext();
|
||||
}
|
||||
|
||||
} // namespace OCLRT
|
||||
|
||||
@@ -52,7 +52,7 @@ WddmCommandStreamReceiver<GfxFamily>::WddmCommandStreamReceiver(const HardwareIn
|
||||
: BaseClass(hwInfoIn) {
|
||||
this->wddm = wddm;
|
||||
if (this->wddm == nullptr) {
|
||||
this->wddm = Wddm::createWddm();
|
||||
this->wddm = Wddm::createWddm(WddmInterfaceVersion::Wddm20);
|
||||
}
|
||||
GPUNODE_ORDINAL nodeOrdinal = GPUNODE_3D;
|
||||
UNRECOVERABLE_IF(!WddmEngineMapper<GfxFamily>::engineNodeMap(hwInfoIn.capabilityTable.defaultEngineType, nodeOrdinal));
|
||||
|
||||
Reference in New Issue
Block a user