Skip to content

Commit

Permalink
Bug 1776563 - Remove nsDMABufDevice::IsDMABufEnabled(), r=stransky
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rmader committed Jun 27, 2022
1 parent 45bca69 commit 4e1ef97
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
23 changes: 6 additions & 17 deletions widget/gtk/DMABufLibWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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; }
Expand Down
2 changes: 0 additions & 2 deletions widget/gtk/DMABufLibWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,6 @@ class nsDMABufDevice {
bool mUseWebGLDmabufBackend;

private:
bool IsDMABufEnabled();

GbmFormat mXRGBFormat;
GbmFormat mARGBFormat;

Expand Down

0 comments on commit 4e1ef97

Please sign in to comment.