Add support for querying intel device types in GrVkCaps.

These querries aren't actually used in this CL but will be used in the
follow up CL that adds newer intel bots.

Bug: skia:13401
Change-Id: I67b8e07fc66d0515e41e9a66616964235ace6568
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/556598
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Greg Daniel 2022-07-07 14:10:21 -04:00 committed by SkCQ
parent 20402a69d0
commit bde135f0bc
2 changed files with 60 additions and 27 deletions

View File

@ -1916,6 +1916,43 @@ VkShaderStageFlags GrVkCaps::getPushConstantStageFlags() const {
return stageFlags;
}
template <size_t N>
static bool intel_deviceID_present(const std::array<uint32_t, N>& array, uint32_t deviceID) {
return std::find(array.begin(), array.end(), deviceID) != array.end();
}
GrVkCaps::IntelGPUType GrVkCaps::GetIntelGPUType(uint32_t deviceID) {
// Some common Intel GPU models, currently we cover ICL/RKL/TGL/ADL
// Referenced from the following Mesa source files:
// https://github.com/mesa3d/mesa/blob/master/include/pci_ids/i965_pci_ids.h
// https://github.com/mesa3d/mesa/blob/master/include/pci_ids/iris_pci_ids.h
static constexpr std::array<uint32_t, 14> kIceLakeIDs = {
{0x8A50, 0x8A51, 0x8A52, 0x8A53, 0x8A54, 0x8A56, 0x8A57,
0x8A58, 0x8A59, 0x8A5A, 0x8A5B, 0x8A5C, 0x8A5D, 0x8A71}};
static constexpr std::array<uint32_t, 5> kRocketLakeIDs = {
{0x4c8a, 0x4c8b, 0x4c8c, 0x4c90, 0x4c9a}};
static constexpr std::array<uint32_t, 11> kTigerLakeIDs = {
{0x9A40, 0x9A49, 0x9A59, 0x9A60, 0x9A68, 0x9A70,
0x9A78, 0x9AC0, 0x9AC9, 0x9AD9, 0x9AF8}};
static constexpr std::array<uint32_t, 10> kAlderLakeIDs = {
{0x4680, 0x4681, 0x4682, 0x4683, 0x4690,
0x4691, 0x4692, 0x4693, 0x4698, 0x4699}};
if (intel_deviceID_present(kIceLakeIDs, deviceID)) {
return IntelGPUType::kIceLake;
}
if (intel_deviceID_present(kRocketLakeIDs, deviceID)) {
return IntelGPUType::kRocketLake;
}
if (intel_deviceID_present(kTigerLakeIDs, deviceID)) {
return IntelGPUType::kTigerLake;
}
if (intel_deviceID_present(kAlderLakeIDs, deviceID)) {
return IntelGPUType::kAlderLake;
}
return IntelGPUType::kOther;
}
#if GR_TEST_UTILS
std::vector<GrCaps::TestFormatColorTypeCombination> GrVkCaps::getTestingCombinations() const {
std::vector<GrCaps::TestFormatColorTypeCombination> combos = {

View File

@ -281,40 +281,36 @@ private:
kQualcomm_VkVendor = 20803,
};
// Some common Intel GPU models, currently we cover ICL/RKL/TGL/ADL
// Referenced from the following Mesa source files:
// https://github.com/mesa3d/mesa/blob/master/include/pci_ids/i965_pci_ids.h
// https://github.com/mesa3d/mesa/blob/master/include/pci_ids/iris_pci_ids.h
struct VkIntelGPUInfo {
// IceLake
const std::array<uint32_t, 14> IceLake = {
{0x8A50, 0x8A51, 0x8A52, 0x8A53, 0x8A54, 0x8A56, 0x8A57,
0x8A58, 0x8A59, 0x8A5A, 0x8A5B, 0x8A5C, 0x8A5D, 0x8A71}};
// RocketLake
const std::array<uint32_t, 5> RocketLake = {
{0x4c8a, 0x4c8b, 0x4c8c, 0x4c90, 0x4c9a}};
// TigerLake
const std::array<uint32_t, 11> TigerLake = {
{0x9A40, 0x9A49, 0x9A59, 0x9A60, 0x9A68, 0x9A70,
0x9A78, 0x9AC0, 0x9AC9, 0x9AD9, 0x9AF8}};
// Alderlake
const std::array<uint32_t, 10> Alderlake = {
{0x4680, 0x4681, 0x4682, 0x4683, 0x4690,
0x4691, 0x4692, 0x4693, 0x4698, 0x4699}};
};
enum class VkIntelGPUType {
enum class IntelGPUType {
// 11th gen
kIntelIceLake,
kIceLake,
// 12th gen
kIntelRocketLake,
kIntelTigerLake,
kIntelAlderLake,
kRocketLake,
kTigerLake,
kAlderLake,
kOther
};
static IntelGPUType GetIntelGPUType(uint32_t deviceID);
static int GetIntelGen(IntelGPUType type) {
switch (type) {
case IntelGPUType::kIceLake:
return 11;
case IntelGPUType::kRocketLake:
case IntelGPUType::kTigerLake:
case IntelGPUType::kAlderLake:
return 12;
case IntelGPUType::kOther:
// For now all our workaround checks are in the form of "if gen > some_value". So
// we can return 0 for kOther which means we won't put in the new workaround for
// older gens which is fine. If we stay on top of adding support for new gen
// intel devices we shouldn't hit cases where we'd need to change this pattern.
return 0;
}
}
void init(const GrContextOptions& contextOptions, const GrVkInterface* vkInterface,
VkPhysicalDevice device, const VkPhysicalDeviceFeatures2&,
uint32_t physicalDeviceVersion, const GrVkExtensions&, GrProtected isProtected);