From 50b102dff88d96f433f8dfe586dabaf122270e87 Mon Sep 17 00:00:00 2001 From: Brad Werth Date: Fri, 16 Jun 2023 20:45:22 +0000 Subject: [PATCH] Bug 1815481: Disable hardware WebRender on Mesa drivers in Virtual Machines. r=rmader We classify anything with 'mesa/vmgfx' as a Virtual Machine driver and block it for Linux. Differential Revision: https://phabricator.services.mozilla.com/D179864 --- widget/GfxDriverInfo.cpp | 1 + widget/GfxDriverInfo.h | 2 ++ widget/gtk/GfxInfo.cpp | 12 ++++++++++++ 3 files changed, 15 insertions(+) diff --git a/widget/GfxDriverInfo.cpp b/widget/GfxDriverInfo.cpp index d9565f6a39f2..d0afb0dca531 100644 --- a/widget/GfxDriverInfo.cpp +++ b/widget/GfxDriverInfo.cpp @@ -773,6 +773,7 @@ const nsAString& GfxDriverInfo::GetDriverVendor(DriverVendor id) { DECLARE_DRIVER_VENDOR_ID(SoftwareMesaAll, "mesa/sw-all"); DECLARE_DRIVER_VENDOR_ID(MesaNonIntelNvidiaAtiAll, "mesa/non-intel-nvidia-ati-all"); + DECLARE_DRIVER_VENDOR_ID(MesaVM, "mesa/vmwgfx"); case DriverVendor::Max: // Suppress a warning. DECLARE_DRIVER_VENDOR_ID(All, ""); } diff --git a/widget/GfxDriverInfo.h b/widget/GfxDriverInfo.h index de5df9c0a5d2..404b23b60989 100644 --- a/widget/GfxDriverInfo.h +++ b/widget/GfxDriverInfo.h @@ -243,6 +243,8 @@ enum DriverVendor : uint8_t { SoftwareMesaAll, // Wildcard for all non-Intel/NVIDIA/ATI Mesa drivers. MesaNonIntelNvidiaAtiAll, + // Running in VM. + MesaVM, Max }; diff --git a/widget/gtk/GfxInfo.cpp b/widget/gtk/GfxInfo.cpp index 1a338d418c83..61275d2a7a66 100644 --- a/widget/gtk/GfxInfo.cpp +++ b/widget/gtk/GfxInfo.cpp @@ -377,6 +377,10 @@ void GfxInfo::GetData() { CopyUTF16toUTF8(GfxDriverInfo::GetDriverVendor(DriverVendor::MesaSWRast), mDriverVendor); mIsAccelerated = false; + } else if (strcasestr(driDriver.get(), "vmwgfx")) { + CopyUTF16toUTF8(GfxDriverInfo::GetDriverVendor(DriverVendor::MesaVM), + mDriverVendor); + mIsAccelerated = false; } else if (!mIsAccelerated) { CopyUTF16toUTF8( GfxDriverInfo::GetDriverVendor(DriverVendor::MesaSWUnknown), @@ -958,6 +962,14 @@ const nsTArray& GfxInfo::GetGfxDriverInfo() { V(21, 0, 0, 0), "FEATURE_FAILURE_WEBRENDER_BUG_1635186", "Mesa 21.0.0.0"); + // Bug 1815481 - Disable mesa drivers in virtual machines. + APPEND_TO_DRIVER_BLOCKLIST_EXT( + OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All, + WindowProtocol::All, DriverVendor::MesaVM, DeviceFamily::All, + nsIGfxInfo::FEATURE_WEBRENDER, nsIGfxInfo::FEATURE_BLOCKED_DEVICE, + DRIVER_COMPARISON_IGNORED, V(0, 0, 0, 0), + "FEATURE_FAILURE_WEBRENDER_MESA_VM", ""); + //////////////////////////////////// // FEATURE_WEBRENDER_COMPOSITOR APPEND_TO_DRIVER_BLOCKLIST(