зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1557266 - [Wayland] Use widget.wayland_dmabuf_backend.enabled preference to enable wayland dmabuf backend, r=jhorak
- Add widget.wayland_dmabuf_backend.enabled - Expose it to Wayland backend by WaylandDisplay object - Add more logging to Wayland DMABuf backend Differential Revision: https://phabricator.services.mozilla.com/D33919 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
355ef12f87
Коммит
5d9ce4b333
|
@ -5070,6 +5070,11 @@ pref("gfx.xrender.enabled",false);
|
|||
pref("widget.content.allow-gtk-dark-theme", false);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef MOZ_WAYLAND
|
||||
#ifdef HAVE_LIBDRM
|
||||
pref("widget.wayland_dmabuf_backend.enabled", false);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
pref("widget.window-transforms.disabled", false);
|
||||
|
||||
|
|
|
@ -420,6 +420,9 @@ WindowBackBufferDMABuf::WindowBackBufferDMABuf(
|
|||
nsWaylandDisplay* aWaylandDisplay, int aWidth, int aHeight)
|
||||
: WindowBackBuffer(aWaylandDisplay) {
|
||||
mDMAbufSurface.Create(aWidth, aHeight);
|
||||
|
||||
LOGWAYLAND(("%s [%p] Created DMABuf buffer [%d x %d]\n", __PRETTY_FUNCTION__,
|
||||
(void*)this, aWidth, aHeight));
|
||||
}
|
||||
|
||||
WindowBackBufferDMABuf::~WindowBackBufferDMABuf() { mDMAbufSurface.Release(); }
|
||||
|
@ -533,8 +536,8 @@ bool WindowSurfaceWayland::UseDMABufBackend() {
|
|||
if (!mUseDMABufInitialized) {
|
||||
#ifdef HAVE_LIBDRM
|
||||
if (WaylandDMABufSurface::IsAvailable()) {
|
||||
mUseDMABuf =
|
||||
Preferences::GetBool("gfx.wayland_dmabuf_backend.enabled", false);
|
||||
mUseDMABuf = nsWaylandDisplay::IsDMABufEnabled();
|
||||
LOGWAYLAND(("%s DMABuf state %d\n", __PRETTY_FUNCTION__, mUseDMABuf));
|
||||
}
|
||||
#endif
|
||||
mUseDMABufInitialized = true;
|
||||
|
|
|
@ -10,6 +10,11 @@
|
|||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
#ifdef HAVE_LIBDRM
|
||||
bool nsWaylandDisplay::mIsDMABufEnabled;
|
||||
bool nsWaylandDisplay::mIsDMABufPrefLoaded;
|
||||
#endif
|
||||
|
||||
// nsWaylandDisplay needs to be created for each calling thread(main thread,
|
||||
// compositor thread and render thread)
|
||||
#define MAX_DISPLAY_CONNECTIONS 3
|
||||
|
@ -288,16 +293,23 @@ nsWaylandDisplay::nsWaylandDisplay(wl_display* aDisplay)
|
|||
,
|
||||
mGbmDevice(nullptr),
|
||||
mGbmFd(-1),
|
||||
mGdmConfigured(false),
|
||||
mExplicitSync(false),
|
||||
mXRGBFormat({false, false, -1, nullptr, 0}),
|
||||
mARGBFormat({false, false, -1, nullptr, 0})
|
||||
mARGBFormat({false, false, -1, nullptr, 0}),
|
||||
mGdmConfigured(false),
|
||||
mExplicitSync(false)
|
||||
#endif
|
||||
{
|
||||
mRegistry = wl_display_get_registry(mDisplay);
|
||||
wl_registry_add_listener(mRegistry, ®istry_listener, this);
|
||||
|
||||
if (NS_IsMainThread()) {
|
||||
#ifdef HAVE_LIBDRM
|
||||
if (!mIsDMABufPrefLoaded) {
|
||||
mIsDMABufPrefLoaded = true;
|
||||
mIsDMABufEnabled =
|
||||
Preferences::GetBool("widget.wayland_dmabuf_backend.enabled", false);
|
||||
}
|
||||
#endif
|
||||
// Use default event queue in main thread operated by Gtk+.
|
||||
mEventQueue = nullptr;
|
||||
wl_display_roundtrip(mDisplay);
|
||||
|
|
|
@ -68,16 +68,14 @@ class nsWaylandDisplay {
|
|||
#ifdef HAVE_LIBDRM
|
||||
void SetDmabuf(zwp_linux_dmabuf_v1* aDmabuf);
|
||||
zwp_linux_dmabuf_v1* GetDmabuf() { return mDmabuf; };
|
||||
|
||||
gbm_device* GetGbmDevice();
|
||||
|
||||
// Returns -1 if we fails to gbm device file descriptor.
|
||||
int GetGbmDeviceFd();
|
||||
|
||||
bool IsExplicitSyncEnabled() { return mExplicitSync; }
|
||||
GbmFormat* GetGbmFormat(bool aHasAlpha);
|
||||
void AddFormatModifier(bool aHasAlpha, int aFormat, uint32_t mModifierHi,
|
||||
uint32_t mModifierLo);
|
||||
static bool IsDMABufEnabled() { return mIsDMABufEnabled; };
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -99,10 +97,12 @@ class nsWaylandDisplay {
|
|||
zwp_linux_dmabuf_v1* mDmabuf;
|
||||
gbm_device* mGbmDevice;
|
||||
int mGbmFd;
|
||||
bool mGdmConfigured;
|
||||
bool mExplicitSync;
|
||||
GbmFormat mXRGBFormat;
|
||||
GbmFormat mARGBFormat;
|
||||
bool mGdmConfigured;
|
||||
bool mExplicitSync;
|
||||
static bool mIsDMABufEnabled;
|
||||
static bool mIsDMABufPrefLoaded;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче