From a314f0963a6d91f5619ad8fa12c1743a7422cab8 Mon Sep 17 00:00:00 2001 From: Yang Gu Date: Fri, 23 Jul 2021 06:48:00 +0000 Subject: [PATCH] Use last 2 fields as Intel graphics driver build number After discussion with driver team, there is no need to differentiate new driver and legacy driver for build number, so the last 2 fields are used consistently. Bug: None Change-Id: I43ac2b484f84ed209d46dd9283830930908b05ee Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/59121 Reviewed-by: Jiawei Shao Reviewed-by: Austin Eng Reviewed-by: Corentin Wallez Commit-Queue: Yang Gu --- src/common/GPUInfo.cpp | 18 +++++------------- src/tests/unittests/GPUInfoTests.cpp | 8 +++++--- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/common/GPUInfo.cpp b/src/common/GPUInfo.cpp index fde1603e66..6068b9da04 100644 --- a/src/common/GPUInfo.cpp +++ b/src/common/GPUInfo.cpp @@ -41,20 +41,12 @@ namespace gpu_info { {0x9B21, 0x9BA0, 0x9BA2, 0x9BA4, 0x9BA5, 0x9BA8, 0x9BAA, 0x9BAB, 0x9BAC, 0x9B41, 0x9BC0, 0x9BC2, 0x9BC4, 0x9BC5, 0x9BC6, 0x9BC8, 0x9BCA, 0x9BCB, 0x9BCC, 0x9BE6, 0x9BF6}}; - // The Intel graphics driver version schema has had a change since the Windows 10 April - // 2018 Update release. The last two parts are build number in new driver, while only the - // last part is build number in legacy driver. - // See https://www.intel.com/content/www/us/en/support/articles/000005654/graphics.html - // for more details. - bool IsOldIntelD3DDriver(const D3DDriverVersion& driverVersion) { - return driverVersion[2] < 100u; - } + // According to Intel graphics driver version schema, build number is generated from the + // last two fields. + // See https://www.intel.com/content/www/us/en/support/articles/000005654/graphics.html for + // more details. uint32_t GetIntelD3DDriverBuildNumber(const D3DDriverVersion& driverVersion) { - uint32_t buildNumber = driverVersion[3]; - if (!IsOldIntelD3DDriver(driverVersion)) { - buildNumber += driverVersion[2] * 10000; - } - return buildNumber; + return driverVersion[2] * 10000 + driverVersion[3]; } } // anonymous namespace diff --git a/src/tests/unittests/GPUInfoTests.cpp b/src/tests/unittests/GPUInfoTests.cpp index 41a974099a..d7bf44124d 100644 --- a/src/tests/unittests/GPUInfoTests.cpp +++ b/src/tests/unittests/GPUInfoTests.cpp @@ -18,12 +18,14 @@ namespace { const PCIVendorID vendorID = 0x8086; - const gpu_info::D3DDriverVersion version1 = {21, 20, 16, 5077}; - const gpu_info::D3DDriverVersion version2 = {27, 20, 100, 9946}; - const gpu_info::D3DDriverVersion version3 = {27, 20, 101, 2003}; + const gpu_info::D3DDriverVersion version1 = {20, 19, 15, 5107}; + const gpu_info::D3DDriverVersion version2 = {21, 20, 16, 5077}; + const gpu_info::D3DDriverVersion version3 = {27, 20, 100, 9946}; + const gpu_info::D3DDriverVersion version4 = {27, 20, 101, 2003}; } // anonymous namespace TEST(GPUInfo, CompareD3DDriverVersion) { EXPECT_EQ(gpu_info::CompareD3DDriverVersion(vendorID, version1, version2), -1); EXPECT_EQ(gpu_info::CompareD3DDriverVersion(vendorID, version2, version3), -1); + EXPECT_EQ(gpu_info::CompareD3DDriverVersion(vendorID, version3, version4), -1); }