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:
Igor Venevtsev 2023-06-15 15:01:53 +00:00 committed by Compute-Runtime-Automation
parent 907f41529c
commit 386e7e5259
3 changed files with 25 additions and 0 deletions

View File

@ -11,6 +11,7 @@
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/os_interface/debug_env_reader.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_interface.h"
@ -90,6 +91,12 @@ uint64_t OsContextWin::getOfflineDumpContextId(uint32_t deviceIndex) const {
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() {
if (contextInitialized && (false == this->wddm.skipResourceCleanup())) {
wddm.getWddmInterface()->destroyHwQueue(hardwareQueue.handle);

View File

@ -31,6 +31,7 @@ class OsContextWin : public OsContext {
void setWddmContextHandle(D3DKMT_HANDLE wddmContextHandle) { this->wddmContextHandle = wddmContextHandle; }
HardwareQueue getHwQueue() const { return hardwareQueue; }
void setHwQueue(HardwareQueue hardwareQueue) { this->hardwareQueue = hardwareQueue; }
bool isDirectSubmissionSupported(const HardwareInfo &hwInfo) const override;
Wddm *getWddm() const { return &wddm; }
MOCKABLE_VIRTUAL WddmResidencyController &getResidencyController() { return residencyController; }
static OsContext *create(OSInterface *osInterface, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor);

View File

@ -74,6 +74,23 @@ TEST_F(OsContextWinTest, givenOsContextWinWhenQueryingForOfflineDumpContextIdThe
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 {
void SetUp() override {
WddmTestWithMockGdiDllNoCleanup::SetUp();