Disable the workaround about the T2T copy issue on newer Intel drivers

This patch disables the workaround about the T2T copy issue (the Toggle
UseTempBufferInSmallFormatTextureToTextureCopyFromGreaterToLessMipLevel)
on the latest Intel Gen9 and Gen9.5 D3D driver (27.20.100.9466) which
contains the fix for this issue.

This patch also implements the D3D driver version comparison algorithm
for Intel drivers.

BUG=chromium:1161355
TEST=dawn_end2end_tests

Change-Id: I406598f2c5745214a60bfc43fb732d45360aa1fe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51343
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
Jiawei Shao
2021-05-19 08:43:33 +00:00
committed by Commit Bot service account
parent 3fd2036755
commit ce3d4a5b09
5 changed files with 66 additions and 9 deletions

View File

@@ -14,6 +14,8 @@
#include "common/GPUInfo.h"
#include "common/Assert.h"
#include <algorithm>
#include <array>
@@ -38,6 +40,13 @@ namespace gpu_info {
const std::array<uint32_t, 21> Cometlake = {
{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
return driverVersion[2] < 100u;
}
} // anonymous namespace
bool IsAMD(PCIVendorID vendorId) {
@@ -65,6 +74,32 @@ namespace gpu_info {
return vendorId == kVendorID_Microsoft && deviceId == kDeviceID_WARP;
}
int CompareD3DDriverVersion(PCIVendorID vendorId,
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]);
}
}
// TODO(jiawei.shao@intel.com): support other GPU vendors
UNREACHABLE();
return 0;
}
// Intel GPUs
bool IsSkylake(PCIDeviceID deviceId) {
return std::find(Skylake.cbegin(), Skylake.cend(), deviceId) != Skylake.cend();

View File

@@ -15,6 +15,7 @@
#ifndef COMMON_GPUINFO_H
#define COMMON_GPUINFO_H
#include <array>
#include <cstdint>
using PCIVendorID = uint32_t;
@@ -43,6 +44,17 @@ namespace gpu_info {
bool IsSwiftshader(PCIVendorID vendorId, PCIDeviceID deviceId);
bool IsWARP(PCIVendorID vendorId, PCIDeviceID deviceId);
using D3DDriverVersion = std::array<uint16_t, 4>;
// 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 0 if version1 and version2 represent same driver version
int CompareD3DDriverVersion(PCIVendorID vendorId,
const D3DDriverVersion& version1,
const D3DDriverVersion& version2);
// Intel architectures
bool IsSkylake(PCIDeviceID deviceId);
bool IsKabylake(PCIDeviceID deviceId);