Extend Intel graphics driver version to 2 fields
The 4th field of Intel new graphics driver will overflow soon. For example, the lastest driver version is 27.20.100.9466 and the 4th field, 9466, will meet the maximum 9999 soon. Future driver will bump the 3rd field from 100 to 101. This CL extends driver version check from 4th field to both 3rd and 4th fields. Check below 2 documents for more details. https://www.intel.com/content/www/us/en/support/articles/000005654/graphics.html https://docs.google.com/document/d/1Xm4afyGR3Ow3W2G-uig9fLQR01XzmSXeanM9OXDVhlg/edit#heading=h.k8onwbxk2ig Bug: None Change-Id: I0ce59ca81b1edd4c63b9f3b0128788c2bf6ade17 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/57180 Reviewed-by: Jiawei Shao <jiawei.shao@intel.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
4a811043cc
commit
c45c7a415c
|
@ -41,11 +41,21 @@ namespace gpu_info {
|
|||
{0x9B21, 0x9BA0, 0x9BA2, 0x9BA4, 0x9BA5, 0x9BA8, 0x9BAA, 0x9BAB, 0x9BAC, 0x9B41, 0x9BC0,
|
||||
0x9BC2, 0x9BC4, 0x9BC5, 0x9BC6, 0x9BC8, 0x9BCA, 0x9BCB, 0x9BCC, 0x9BE6, 0x9BF6}};
|
||||
|
||||
bool IsOldIntelD3DVersionScheme(const D3DDriverVersion& driverVersion) {
|
||||
// See https://www.intel.com/content/www/us/en/support/articles/000005654/graphics.html
|
||||
// for more details
|
||||
// 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;
|
||||
}
|
||||
uint32_t GetIntelD3DDriverBuildNumber(const D3DDriverVersion& driverVersion) {
|
||||
uint32_t buildNumber = driverVersion[3];
|
||||
if (!IsOldIntelD3DDriver(driverVersion)) {
|
||||
buildNumber += driverVersion[2] * 10000;
|
||||
}
|
||||
return buildNumber;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
@ -78,21 +88,9 @@ namespace gpu_info {
|
|||
const D3DDriverVersion& version1,
|
||||
const D3DDriverVersion& version2) {
|
||||
if (IsIntel(vendorId)) {
|
||||
// The Intel graphics driver version schema has had a change since the Windows 10 April
|
||||
// 2018 Update release. In the new schema the 3rd number of the driver version is always
|
||||
// 100, while on the older drivers it is always less than 100. For the drivers using the
|
||||
// same driver version schema, the newer driver always has the bigger 4th number.
|
||||
// See https://www.intel.com/content/www/us/en/support/articles/000005654/graphics.html
|
||||
// for more details.
|
||||
bool isOldIntelDriver1 = IsOldIntelD3DVersionScheme(version1);
|
||||
bool isOldIntelDriver2 = IsOldIntelD3DVersionScheme(version2);
|
||||
if (isOldIntelDriver1 && !isOldIntelDriver2) {
|
||||
return -1;
|
||||
} else if (!isOldIntelDriver1 && isOldIntelDriver2) {
|
||||
return 1;
|
||||
} else {
|
||||
return static_cast<int32_t>(version1[3]) - static_cast<int32_t>(version2[3]);
|
||||
}
|
||||
uint32_t buildNumber1 = GetIntelD3DDriverBuildNumber(version1);
|
||||
uint32_t buildNumber2 = GetIntelD3DDriverBuildNumber(version2);
|
||||
return buildNumber1 < buildNumber2 ? -1 : (buildNumber1 == buildNumber2 ? 0 : 1);
|
||||
}
|
||||
|
||||
// TODO(crbug.com/dawn/823): support other GPU vendors
|
||||
|
|
|
@ -48,8 +48,8 @@ namespace gpu_info {
|
|||
|
||||
// Do comparison between two driver versions. Currently we only support the comparison between
|
||||
// Intel D3D driver versions.
|
||||
// - Return a negative value if version1 is older
|
||||
// - Return a positive value if version1 is newer
|
||||
// - Return -1 if build number of version1 is smaller
|
||||
// - Return 1 if build number of version1 is bigger
|
||||
// - Return 0 if version1 and version2 represent same driver version
|
||||
int CompareD3DDriverVersion(PCIVendorID vendorId,
|
||||
const D3DDriverVersion& version1,
|
||||
|
|
|
@ -163,6 +163,7 @@ test("dawn_unittests") {
|
|||
"unittests/EnumMaskIteratorTests.cpp",
|
||||
"unittests/ErrorTests.cpp",
|
||||
"unittests/ExtensionTests.cpp",
|
||||
"unittests/GPUInfoTests.cpp",
|
||||
"unittests/GetProcAddressTests.cpp",
|
||||
"unittests/ITypArrayTests.cpp",
|
||||
"unittests/ITypBitsetTests.cpp",
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
// Copyright 2021 The Dawn Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "common/GPUInfo.h"
|
||||
|
||||
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};
|
||||
} // anonymous namespace
|
||||
|
||||
TEST(GPUInfo, CompareD3DDriverVersion) {
|
||||
EXPECT_EQ(gpu_info::CompareD3DDriverVersion(vendorID, version1, version2), -1);
|
||||
EXPECT_EQ(gpu_info::CompareD3DDriverVersion(vendorID, version2, version3), -1);
|
||||
}
|
Loading…
Reference in New Issue