mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 23:56:39 +08:00
feature: enable direct submission on Windows for WDDM 2.0
Related-To: NEO-4843 Signed-off-by: Igor Venevtsev <igor.venevtsev@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
907f41529c
commit
386e7e5259
@@ -11,6 +11,7 @@
|
|||||||
#include "shared/source/execution_environment/root_device_environment.h"
|
#include "shared/source/execution_environment/root_device_environment.h"
|
||||||
#include "shared/source/os_interface/debug_env_reader.h"
|
#include "shared/source/os_interface/debug_env_reader.h"
|
||||||
#include "shared/source/os_interface/os_interface.h"
|
#include "shared/source/os_interface/os_interface.h"
|
||||||
|
#include "shared/source/os_interface/product_helper.h"
|
||||||
#include "shared/source/os_interface/windows/wddm/wddm.h"
|
#include "shared/source/os_interface/windows/wddm/wddm.h"
|
||||||
#include "shared/source/os_interface/windows/wddm/wddm_interface.h"
|
#include "shared/source/os_interface/windows/wddm/wddm_interface.h"
|
||||||
|
|
||||||
@@ -90,6 +91,12 @@ uint64_t OsContextWin::getOfflineDumpContextId(uint32_t deviceIndex) const {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OsContextWin::isDirectSubmissionSupported(const HardwareInfo &hwInfo) const {
|
||||||
|
auto &productHelper = wddm.getRootDeviceEnvironment().getHelper<ProductHelper>();
|
||||||
|
|
||||||
|
return wddm.getWddmVersion() == WddmVersion::WDDM_2_0 && productHelper.isDirectSubmissionSupported(hwInfo);
|
||||||
|
}
|
||||||
|
|
||||||
OsContextWin::~OsContextWin() {
|
OsContextWin::~OsContextWin() {
|
||||||
if (contextInitialized && (false == this->wddm.skipResourceCleanup())) {
|
if (contextInitialized && (false == this->wddm.skipResourceCleanup())) {
|
||||||
wddm.getWddmInterface()->destroyHwQueue(hardwareQueue.handle);
|
wddm.getWddmInterface()->destroyHwQueue(hardwareQueue.handle);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class OsContextWin : public OsContext {
|
|||||||
void setWddmContextHandle(D3DKMT_HANDLE wddmContextHandle) { this->wddmContextHandle = wddmContextHandle; }
|
void setWddmContextHandle(D3DKMT_HANDLE wddmContextHandle) { this->wddmContextHandle = wddmContextHandle; }
|
||||||
HardwareQueue getHwQueue() const { return hardwareQueue; }
|
HardwareQueue getHwQueue() const { return hardwareQueue; }
|
||||||
void setHwQueue(HardwareQueue hardwareQueue) { this->hardwareQueue = hardwareQueue; }
|
void setHwQueue(HardwareQueue hardwareQueue) { this->hardwareQueue = hardwareQueue; }
|
||||||
|
bool isDirectSubmissionSupported(const HardwareInfo &hwInfo) const override;
|
||||||
Wddm *getWddm() const { return &wddm; }
|
Wddm *getWddm() const { return &wddm; }
|
||||||
MOCKABLE_VIRTUAL WddmResidencyController &getResidencyController() { return residencyController; }
|
MOCKABLE_VIRTUAL WddmResidencyController &getResidencyController() { return residencyController; }
|
||||||
static OsContext *create(OSInterface *osInterface, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor);
|
static OsContext *create(OSInterface *osInterface, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor);
|
||||||
|
|||||||
@@ -74,6 +74,23 @@ TEST_F(OsContextWinTest, givenOsContextWinWhenQueryingForOfflineDumpContextIdThe
|
|||||||
EXPECT_EQ(0u, osContext->getOfflineDumpContextId(0));
|
EXPECT_EQ(0u, osContext->getOfflineDumpContextId(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(OsContextWinTest, givenWddm20AndProductSupportDirectSubmissionThenDirectSubmissionIsSupported) {
|
||||||
|
auto &hwInfo = *this->rootDeviceEnvironment->getHardwareInfo();
|
||||||
|
auto &productHelper = this->rootDeviceEnvironment->getHelper<ProductHelper>();
|
||||||
|
osContext = std::make_unique<OsContextWin>(*osInterface->getDriverModel()->as<Wddm>(), 0, 0u, EngineDescriptorHelper::getDefaultDescriptor(engineTypeUsage, preemptionMode));
|
||||||
|
EXPECT_EQ(productHelper.isDirectSubmissionSupported(hwInfo), osContext->isDirectSubmissionSupported(hwInfo));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(OsContextWinTest, givenWddm23ThenDirectSubmissionIsNotSupported) {
|
||||||
|
struct WddmMock : public Wddm {
|
||||||
|
using Wddm::featureTable;
|
||||||
|
};
|
||||||
|
auto wddm = static_cast<WddmMock *>(osInterface->getDriverModel()->as<Wddm>());
|
||||||
|
wddm->featureTable.get()->flags.ftrWddmHwQueues = 1;
|
||||||
|
osContext = std::make_unique<OsContextWin>(*wddm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor(engineTypeUsage, preemptionMode));
|
||||||
|
EXPECT_FALSE(osContext->isDirectSubmissionSupported(*this->rootDeviceEnvironment->getHardwareInfo()));
|
||||||
|
}
|
||||||
|
|
||||||
struct OsContextWinTestNoCleanup : public WddmTestWithMockGdiDllNoCleanup {
|
struct OsContextWinTestNoCleanup : public WddmTestWithMockGdiDllNoCleanup {
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
WddmTestWithMockGdiDllNoCleanup::SetUp();
|
WddmTestWithMockGdiDllNoCleanup::SetUp();
|
||||||
|
|||||||
Reference in New Issue
Block a user