Bug 1924578 - Disable DMABUF_WEBGL on Nvidia driver. r=aosmond

This adds a DMABUF_WEBGL feature that can be independently blocklisted from DMABUF itself.

After that, this adds a blocklist entry for the Nvidia driver which gives incorrect rendering.

Differential Revision: https://phabricator.services.mozilla.com/D227598
This commit is contained in:
Lee Salzman 2024-11-02 03:50:17 +00:00
parent 071417e883
commit 2bd331f236
7 changed files with 46 additions and 12 deletions

View File

@ -53,6 +53,7 @@ namespace gfx {
_(H264_HW_DECODE, Feature, "H.264 hardware decoding") \
_(AV1_HW_DECODE, Feature, "AV1 hardware decoding") \
_(REMOTE_CANVAS, Feature, "Remote canvas") \
_(DMABUF_WEBGL, Feature, "DMABuf for WebGL") \
/* Add new entries above this comment */
enum class Feature : uint32_t {

View File

@ -82,6 +82,7 @@ class gfxVarReceiver;
_(UseEGL, bool, false) \
_(DrmRenderDevice, nsCString, nsCString()) \
_(UseDMABuf, bool, false) \
_(UseDMABufWebGL, bool, true) \
_(DMABufModifiersXRGB, ArrayOfuint64_t, nsTArray<uint64_t>()) \
_(DMABufModifiersARGB, ArrayOfuint64_t, nsTArray<uint64_t>()) \
_(CodecSupportInfo, nsCString, nsCString()) \

View File

@ -3118,22 +3118,41 @@ void gfxPlatform::InitWebGLConfig() {
}
}
#ifdef MOZ_WIDGET_GTK
if (kIsLinux) {
nsCString discardFailureId;
int32_t status;
FeatureState& feature =
gfxConfig::GetFeature(Feature::DMABUF_SURFACE_EXPORT);
feature.EnableByDefault();
nsCString discardFailureId;
int32_t status;
if (NS_FAILED(
gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DMABUF_SURFACE_EXPORT,
discardFailureId, &status)) ||
status != nsIGfxInfo::FEATURE_STATUS_OK) {
feature.DisableByDefault(FeatureStatus::Blocked, "Blocklisted by gfxInfo",
discardFailureId);
gfxVars::SetUseDMABufSurfaceExport(false);
} else {
feature.EnableByDefault();
feature.Disable(FeatureStatus::Blocked, "Blocklisted by gfxInfo",
discardFailureId);
}
gfxVars::SetUseDMABufSurfaceExport(feature.IsEnabled());
}
if (kIsLinux) {
FeatureState& feature = gfxConfig::GetFeature(Feature::DMABUF_WEBGL);
feature.EnableByDefault();
if (!StaticPrefs::widget_dmabuf_webgl_enabled_AtStartup()) {
feature.UserDisable("Disabled by pref",
"FEATURE_FAILURE_DISABLED_BY_PREF"_ns);
}
nsCString discardFailureId;
int32_t status;
if (NS_FAILED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DMABUF_WEBGL,
discardFailureId, &status)) ||
status != nsIGfxInfo::FEATURE_STATUS_OK) {
feature.Disable(FeatureStatus::Blocked, "Blocklisted by gfxInfo",
discardFailureId);
}
gfxVars::SetUseDMABufWebGL(feature.IsEnabled());
}
#endif
}
void gfxPlatform::InitWebGPUConfig() {

View File

@ -17474,9 +17474,9 @@
# Use DMABuf backend for WebGL.
- name: widget.dmabuf-webgl.enabled
type: RelaxedAtomicBool
type: bool
value: true
mirror: always
mirror: once
# Use gdk_window_move_to_rect to move Wayland popups when available.
- name: widget.wayland.use-move-to-rect

View File

@ -111,3 +111,5 @@ GFXINFO_FEATURE(WEBGL_USE_HARDWARE, "WEBGL_USE_HARDWARE", "webgl-use-hardware")
GFXINFO_FEATURE(OVERLAY_VP_AUTO_HDR, "FEATURE_OVERLAY_VP_AUTO_HDR", "overlay-vp-auto-hdr")
/* Whether overlay is allowed to VideoProcessor Super Resolution, starting in 125. */
GFXINFO_FEATURE(OVERLAY_VP_SUPER_RESOLUTION, "FEATURE_OVERLAY_VP_SUPER_RESOLUTION", "overlay-vp-super-resolution")
/* Whether DMABUF is supported when using WebGL, starting in 88. */
GFXINFO_FEATURE(DMABUF_WEBGL, "DMABUF_WEBGL", "dmabuf-webgl")

View File

@ -235,11 +235,11 @@ bool DMABufDevice::IsDMABufWebGLEnabled() {
LOGDMABUF(
("DMABufDevice::IsDMABufWebGLEnabled: UseDMABuf %d "
"sUseWebGLDmabufBackend %d "
"widget_dmabuf_webgl_enabled %d\n",
"UseDMABufWebGL %d\n",
gfx::gfxVars::UseDMABuf(), sUseWebGLDmabufBackend,
StaticPrefs::widget_dmabuf_webgl_enabled()));
gfx::gfxVars::UseDMABufWebGL()));
return gfx::gfxVars::UseDMABuf() && sUseWebGLDmabufBackend &&
StaticPrefs::widget_dmabuf_webgl_enabled();
gfx::gfxVars::UseDMABufWebGL();
}
#ifdef MOZ_WAYLAND

View File

@ -1052,6 +1052,17 @@ const nsTArray<GfxDriverInfo>& GfxInfo::GetGfxDriverInfo() {
nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_COMPARISON_IGNORED,
V(0, 0, 0, 0), "FEATURE_FAILURE_BROKEN_DRIVER", "");
////////////////////////////////////
// FEATURE_DMABUF_WEBGL
// Disabled due to DMABuf rendering/correctness with WebGL on Nvidia driver,
// tracked in bug 1924578.
APPEND_TO_DRIVER_BLOCKLIST_EXT(
OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
WindowProtocol::All, DriverVendor::NonMesaAll, DeviceFamily::NvidiaAll,
nsIGfxInfo::FEATURE_DMABUF_WEBGL, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
DRIVER_COMPARISON_IGNORED, V(0, 0, 0, 0), "FEATURE_FAILURE_BUG_1924578",
"");
////////////////////////////////////
// FEATURE_HARDWARE_VIDEO_DECODING
APPEND_TO_DRIVER_BLOCKLIST_EXT(