Bug 1776563 - Remove nsDMABufDevice::IsDMABufEnabled(), r=stransky

We do not need a GBM device any more in child processes and in several
cases we're also not allowed to open it any more by the sandbox.

For remaining cases were we do need it in the parent process (the
fallback path in `SharedSurface_DMABUF::Create`, used for WebGL and the
experimental `widget.dmabuf-textures.enabled` feature, as well as in
`WaylandBufferDMABUF::Create` used by `gfx.webrender.compositor`), we
already call `Configure()` in `gfxPlatformGtk::InitDmabufConfig()` and set
`gfx::gfxVars::UseDMABuf` accordingly, making
`nsDMABufDevice::IsDMABufWebGLEnabled()` still return the correct value.

Differential Revision: https://phabricator.services.mozilla.com/D150324
This commit is contained in:
Robert Mader 2022-06-27 09:00:36 +00:00
parent 45bca692f9
commit 4e1ef97a03
2 changed files with 6 additions and 19 deletions

View File

@ -122,9 +122,7 @@ bool nsGbmLib::Load() {
return sLoaded;
}
gbm_device* nsDMABufDevice::GetGbmDevice() {
return IsDMABufEnabled() ? mGbmDevice : nullptr;
}
gbm_device* nsDMABufDevice::GetGbmDevice() { return mGbmDevice; }
static void dmabuf_modifiers(void* data,
struct zwp_linux_dmabuf_v1* zwp_linux_dmabuf,
@ -263,18 +261,9 @@ bool nsDMABufDevice::Configure(nsACString& aFailureId) {
return true;
}
bool nsDMABufDevice::IsDMABufEnabled() {
if (!mInitialized) {
MOZ_ASSERT(!XRE_IsParentProcess());
nsCString failureId;
return Configure(failureId);
}
return !!mGbmDevice;
}
#ifdef NIGHTLY_BUILD
bool nsDMABufDevice::IsDMABufTexturesEnabled() {
return gfx::gfxVars::UseDMABuf() && IsDMABufEnabled() &&
return gfx::gfxVars::UseDMABuf() &&
StaticPrefs::widget_dmabuf_textures_enabled();
}
#else
@ -292,13 +281,13 @@ bool nsDMABufDevice::IsDMABufVAAPIEnabled() {
}
bool nsDMABufDevice::IsDMABufWebGLEnabled() {
LOGDMABUF(
("nsDMABufDevice::IsDMABufWebGLEnabled: EGL %d mUseWebGLDmabufBackend %d "
"DMABufEnabled %d "
("nsDMABufDevice::IsDMABufWebGLEnabled: UseDMABuf %d "
"mUseWebGLDmabufBackend %d "
"widget_dmabuf_webgl_enabled %d\n",
gfx::gfxVars::UseEGL(), mUseWebGLDmabufBackend, IsDMABufEnabled(),
gfx::gfxVars::UseDMABuf(), mUseWebGLDmabufBackend,
StaticPrefs::widget_dmabuf_webgl_enabled()));
return gfx::gfxVars::UseDMABuf() && mUseWebGLDmabufBackend &&
IsDMABufEnabled() && StaticPrefs::widget_dmabuf_webgl_enabled();
StaticPrefs::widget_dmabuf_webgl_enabled();
}
void nsDMABufDevice::DisableDMABufWebGL() { mUseWebGLDmabufBackend = false; }

View File

@ -208,8 +208,6 @@ class nsDMABufDevice {
bool mUseWebGLDmabufBackend;
private:
bool IsDMABufEnabled();
GbmFormat mXRGBFormat;
GbmFormat mARGBFormat;