Skip to content

Commit b4a81cb

Browse files
author
Jonah Williams
authored
[Impeller] disable older xclipse gpu driver. (flutter#161981)
Fixes flutter#161334 The first version of the Xclipse series GPU has reported bugs, unfortunately all versions of this GPU report the same driver version. Instead we use the Vulkan version as a proxy, assuming that any newer devices would not lower the supported Vulkan API level. https://vulkan.gpuinfo.org/listreports.php?devicename=samsung+SM-S906B&platform=android
1 parent 299e157 commit b4a81cb

File tree

3 files changed

+46
-2
lines changed

3 files changed

+46
-2
lines changed

engine/src/flutter/impeller/renderer/backend/vulkan/driver_info_vk.cc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ constexpr VendorVK IdentifyVendor(uint32_t vendor) {
166166
return VendorVK::kApple;
167167
case 0x19E5:
168168
return VendorVK::kHuawei;
169+
case 0x144D:
170+
return VendorVK::kSamsung;
169171
}
170172
// Check if the ID is a known Khronos vendor.
171173
switch (vendor) {
@@ -201,6 +203,8 @@ constexpr const char* VendorToString(VendorVK vendor) {
201203
return "Apple";
202204
case VendorVK::kHuawei:
203205
return "Huawei";
206+
case VendorVK::kSamsung:
207+
return "Samsung";
204208
}
205209
FML_UNREACHABLE();
206210
}
@@ -334,6 +338,19 @@ bool DriverInfoVK::IsKnownBadDriver() const {
334338
if (vendor_ == VendorVK::kHuawei) {
335339
return true;
336340
}
341+
342+
if (vendor_ == VendorVK::kSamsung) {
343+
// The first version of the Xclipse series GPU has reported
344+
// bugs, unfortunately all versions of this GPU report the
345+
// same driver version. Instead we use the Vulkan version
346+
// as a proxy, assuming that any newer devices would not
347+
// lower the supported Vulkan API level.
348+
// See
349+
// https://vulkan.gpuinfo.org/listreports.php?devicename=samsung+SM-S906B&platform=android
350+
// https://github.com/flutter/flutter/issues/161334
351+
return !api_version_.IsAtLeast(Version{1, 3, 0});
352+
}
353+
337354
// https://github.com/flutter/flutter/issues/161122
338355
// https://github.com/flutter/flutter/issues/160960
339356
// https://github.com/flutter/flutter/issues/160866

engine/src/flutter/impeller/renderer/backend/vulkan/driver_info_vk.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ enum class VendorVK {
122122
kNvidia,
123123
kIntel,
124124
kHuawei,
125+
kSamsung,
125126
//----------------------------------------------------------------------------
126127
/// Includes the LLVM Pipe CPU implementation.
127128
///

engine/src/flutter/impeller/renderer/backend/vulkan/driver_info_vk_unittests.cc

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,34 @@ TEST(DriverInfoVKTest, CanUseFramebufferFetch) {
222222
EXPECT_TRUE(CanUseFramebufferFetch("Mali-G51", false));
223223
}
224224

225+
TEST(DriverInfoVKTest, DisableOldXclipseDriver) {
226+
auto context =
227+
MockVulkanContextBuilder()
228+
.SetPhysicalPropertiesCallback(
229+
[](VkPhysicalDevice device, VkPhysicalDeviceProperties* prop) {
230+
prop->vendorID = 0x144D; // Samsung
231+
prop->deviceType = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU;
232+
// Version 1.1.0
233+
prop->apiVersion = (1 << 22) | (1 << 12);
234+
})
235+
.Build();
236+
237+
EXPECT_TRUE(context->GetDriverInfo()->IsKnownBadDriver());
238+
239+
context =
240+
MockVulkanContextBuilder()
241+
.SetPhysicalPropertiesCallback(
242+
[](VkPhysicalDevice device, VkPhysicalDeviceProperties* prop) {
243+
prop->vendorID = 0x144D; // Samsung
244+
prop->deviceType = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU;
245+
// Version 1.3.0
246+
prop->apiVersion = (1 << 22) | (3 << 12);
247+
})
248+
.Build();
249+
250+
EXPECT_FALSE(context->GetDriverInfo()->IsKnownBadDriver());
251+
}
252+
225253
TEST(DriverInfoVKTest, AllPowerVRDisabled) {
226254
auto const context =
227255
MockVulkanContextBuilder()
@@ -231,8 +259,6 @@ TEST(DriverInfoVKTest, AllPowerVRDisabled) {
231259
prop->deviceType = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU;
232260
})
233261
.Build();
234-
235-
EXPECT_TRUE(context->GetDriverInfo()->IsKnownBadDriver());
236262
}
237263

238264
} // namespace impeller::testing

0 commit comments

Comments
 (0)