зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1578380 - [Wayland] Provide gfxPlatformGtk::IsX11Display() and gfxPlatformGtk::UseWaylandDMABufSurfaces(), r=sotaro
Let's use single Wayland configuration point at gfxPlatformGtk instead of various GDK_IS_X11_DISPLAY() calls. Also provide info about enabled DMABuf surfaces when Wayland backend is used. Depends on D46842 Differential Revision: https://phabricator.services.mozilla.com/D46843 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
a33bdb4e60
Коммит
06bc3c7598
|
@ -54,6 +54,7 @@
|
||||||
|
|
||||||
# ifdef MOZ_WAYLAND
|
# ifdef MOZ_WAYLAND
|
||||||
# include <gdk/gdkwayland.h>
|
# include <gdk/gdkwayland.h>
|
||||||
|
# include "mozilla/widget/nsWaylandDisplay.h"
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#endif /* MOZ_X11 */
|
#endif /* MOZ_X11 */
|
||||||
|
@ -80,11 +81,11 @@ gfxPlatformGtk::gfxPlatformGtk() {
|
||||||
}
|
}
|
||||||
|
|
||||||
mMaxGenericSubstitutions = UNINITIALIZED_VALUE;
|
mMaxGenericSubstitutions = UNINITIALIZED_VALUE;
|
||||||
|
mIsX11Display = GDK_IS_X11_DISPLAY(gdk_display_get_default());
|
||||||
|
|
||||||
#ifdef MOZ_X11
|
#ifdef MOZ_X11
|
||||||
if (!gfxPlatform::IsHeadless() && XRE_IsParentProcess()) {
|
if (!gfxPlatform::IsHeadless() && XRE_IsParentProcess()) {
|
||||||
if (GDK_IS_X11_DISPLAY(gdk_display_get_default()) &&
|
if (mIsX11Display && mozilla::Preferences::GetBool("gfx.xrender.enabled")) {
|
||||||
mozilla::Preferences::GetBool("gfx.xrender.enabled")) {
|
|
||||||
gfxVars::SetUseXRender(true);
|
gfxVars::SetUseXRender(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,8 +94,7 @@ gfxPlatformGtk::gfxPlatformGtk() {
|
||||||
InitBackendPrefs(GetBackendPrefs());
|
InitBackendPrefs(GetBackendPrefs());
|
||||||
|
|
||||||
#ifdef MOZ_X11
|
#ifdef MOZ_X11
|
||||||
if (gfxPlatform::IsHeadless() &&
|
if (gfxPlatform::IsHeadless() && mIsX11Display) {
|
||||||
GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
|
|
||||||
mCompositorDisplay = XOpenDisplay(nullptr);
|
mCompositorDisplay = XOpenDisplay(nullptr);
|
||||||
MOZ_ASSERT(mCompositorDisplay, "Failed to create compositor display!");
|
MOZ_ASSERT(mCompositorDisplay, "Failed to create compositor display!");
|
||||||
} else {
|
} else {
|
||||||
|
@ -132,7 +132,7 @@ void gfxPlatformGtk::FlushContentDrawing() {
|
||||||
|
|
||||||
void gfxPlatformGtk::InitPlatformGPUProcessPrefs() {
|
void gfxPlatformGtk::InitPlatformGPUProcessPrefs() {
|
||||||
#ifdef MOZ_WAYLAND
|
#ifdef MOZ_WAYLAND
|
||||||
if (!GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
|
if (!mIsX11Display) {
|
||||||
FeatureState& gpuProc = gfxConfig::GetFeature(Feature::GPU_PROCESS);
|
FeatureState& gpuProc = gfxConfig::GetFeature(Feature::GPU_PROCESS);
|
||||||
gpuProc.ForceDisable(FeatureStatus::Blocked,
|
gpuProc.ForceDisable(FeatureStatus::Blocked,
|
||||||
"Wayland does not work in the GPU process",
|
"Wayland does not work in the GPU process",
|
||||||
|
@ -353,7 +353,7 @@ void gfxPlatformGtk::GetPlatformCMSOutputProfile(void*& mem, size_t& size) {
|
||||||
|
|
||||||
#ifdef MOZ_X11
|
#ifdef MOZ_X11
|
||||||
GdkDisplay* display = gdk_display_get_default();
|
GdkDisplay* display = gdk_display_get_default();
|
||||||
if (!GDK_IS_X11_DISPLAY(display)) return;
|
if (!mIsX11Display) return;
|
||||||
|
|
||||||
const char EDID1_ATOM_NAME[] = "XFree86_DDC_EDID1_RAWDATA";
|
const char EDID1_ATOM_NAME[] = "XFree86_DDC_EDID1_RAWDATA";
|
||||||
const char ICC_PROFILE_ATOM_NAME[] = "_ICC_PROFILE";
|
const char ICC_PROFILE_ATOM_NAME[] = "_ICC_PROFILE";
|
||||||
|
@ -745,7 +745,7 @@ class GtkVsyncSource final : public VsyncSource {
|
||||||
|
|
||||||
already_AddRefed<gfx::VsyncSource> gfxPlatformGtk::CreateHardwareVsyncSource() {
|
already_AddRefed<gfx::VsyncSource> gfxPlatformGtk::CreateHardwareVsyncSource() {
|
||||||
# ifdef MOZ_WAYLAND
|
# ifdef MOZ_WAYLAND
|
||||||
if (!GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
|
if (!mIsX11Display) {
|
||||||
RefPtr<VsyncSource> vsyncSource = new GtkVsyncSource();
|
RefPtr<VsyncSource> vsyncSource = new GtkVsyncSource();
|
||||||
VsyncSource::Display& display = vsyncSource->GetGlobalDisplay();
|
VsyncSource::Display& display = vsyncSource->GetGlobalDisplay();
|
||||||
static_cast<GtkVsyncSource::GLXDisplay&>(display).SetupWayland();
|
static_cast<GtkVsyncSource::GLXDisplay&>(display).SetupWayland();
|
||||||
|
@ -773,3 +773,12 @@ already_AddRefed<gfx::VsyncSource> gfxPlatformGtk::CreateHardwareVsyncSource() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MOZ_WAYLAND
|
||||||
|
bool gfxPlatformGtk::UseWaylandDMABufSurfaces() {
|
||||||
|
if (mIsX11Display) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return widget::nsWaylandDisplay::IsDMABufEnabled();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -101,8 +101,11 @@ class gfxPlatformGtk : public gfxPlatform {
|
||||||
mWaylandFrameDelay = aFrameDelay;
|
mWaylandFrameDelay = aFrameDelay;
|
||||||
}
|
}
|
||||||
int64_t GetWaylandFrameDelay() { return mWaylandFrameDelay; }
|
int64_t GetWaylandFrameDelay() { return mWaylandFrameDelay; }
|
||||||
|
bool UseWaylandDMABufSurfaces();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool IsX11Display() { return mIsX11Display; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void InitPlatformGPUProcessPrefs() override;
|
void InitPlatformGPUProcessPrefs() override;
|
||||||
bool CheckVariationFontSupport() override;
|
bool CheckVariationFontSupport() override;
|
||||||
|
@ -112,6 +115,7 @@ class gfxPlatformGtk : public gfxPlatform {
|
||||||
private:
|
private:
|
||||||
void GetPlatformCMSOutputProfile(void*& mem, size_t& size) override;
|
void GetPlatformCMSOutputProfile(void*& mem, size_t& size) override;
|
||||||
|
|
||||||
|
bool mIsX11Display;
|
||||||
#ifdef MOZ_X11
|
#ifdef MOZ_X11
|
||||||
Display* mCompositorDisplay;
|
Display* mCompositorDisplay;
|
||||||
#endif
|
#endif
|
||||||
|
|
Загрузка…
Ссылка в новой задаче