Bug 1724936 - Remove XRender support. r=jrmuizel

This has been deprecated for a long time, and it doesn't work in
conjuction with WebRender.

Differential Revision: https://phabricator.services.mozilla.com/D122368
This commit is contained in:
Andrew Osmond 2021-08-25 19:35:23 +00:00
Родитель 2e351a5376
Коммит 50d789dd6a
18 изменённых файлов: 14 добавлений и 377 удалений

Просмотреть файл

@ -31,7 +31,6 @@ class gfxVarReceiver;
_(ContentBackend, BackendType, BackendType::NONE) \
_(SoftwareBackend, BackendType, BackendType::NONE) \
_(TileSize, IntSize, IntSize(-1, -1)) \
_(UseXRender, bool, false) \
_(OffscreenFormat, gfxImageFormat, \
mozilla::gfx::SurfaceFormat::X8R8G8B8_UINT32) \
_(RequiresAcceleratedGLContextForCompositorOGL, bool, false) \

Просмотреть файл

@ -99,13 +99,6 @@ class ShmemTextureData : public BufferTextureData {
mozilla::ipc::Shmem mShmem;
};
static bool UsingX11Compositor() {
#ifdef MOZ_WIDGET_GTK
return gfx::gfxVars::UseXRender();
#endif
return false;
}
bool ComputeHasIntermediateBuffer(gfx::SurfaceFormat aFormat,
LayersBackend aLayersBackend,
bool aSupportsTextureDirectMapping) {
@ -114,7 +107,7 @@ bool ComputeHasIntermediateBuffer(gfx::SurfaceFormat aFormat,
}
return aLayersBackend != LayersBackend::LAYERS_BASIC ||
UsingX11Compositor() || aFormat == gfx::SurfaceFormat::UNKNOWN;
aFormat == gfx::SurfaceFormat::UNKNOWN;
}
BufferTextureData* BufferTextureData::Create(

Просмотреть файл

@ -1,118 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "X11BasicCompositor.h"
#include "gfxPlatform.h"
#include "gfx2DGlue.h"
#include "gfxXlibSurface.h"
#include "gfxImageSurface.h"
#include "mozilla/X11Util.h"
namespace mozilla {
using namespace mozilla::gfx;
namespace layers {
bool X11DataTextureSourceBasic::Update(gfx::DataSourceSurface* aSurface,
nsIntRegion* aDestRegion,
gfx::IntPoint* aSrcOffset,
gfx::IntPoint* aDstOffset) {
MOZ_RELEASE_ASSERT(aDstOffset == nullptr);
// Reallocate our internal X11 surface if we don't have a DrawTarget yet,
// or if we changed surface size or format since last update.
if (!mBufferDrawTarget ||
(aSurface->GetSize() != mBufferDrawTarget->GetSize()) ||
(aSurface->GetFormat() != mBufferDrawTarget->GetFormat())) {
RefPtr<gfxASurface> surf;
gfxImageFormat imageFormat =
SurfaceFormatToImageFormat(aSurface->GetFormat());
Display* display = DefaultXDisplay();
Screen* screen = DefaultScreenOfDisplay(display);
XRenderPictFormat* xrenderFormat =
gfxXlibSurface::FindRenderFormat(display, imageFormat);
if (xrenderFormat) {
surf = gfxXlibSurface::Create(screen, xrenderFormat, aSurface->GetSize());
}
if (!surf) {
NS_WARNING("Couldn't create native surface, fallback to image surface");
surf = new gfxImageSurface(aSurface->GetSize(), imageFormat);
}
mBufferDrawTarget =
gfxPlatform::CreateDrawTargetForSurface(surf, aSurface->GetSize());
}
// Image contents have changed, upload to our DrawTarget
// If aDestRegion is null, means we're updating the whole surface
// Note : Incremental update with a source offset is only used on Mac.
NS_ASSERTION(!aSrcOffset,
"SrcOffset should not be used with linux OMTC basic");
if (aDestRegion) {
for (auto iter = aDestRegion->RectIter(); !iter.Done(); iter.Next()) {
const IntRect& rect = iter.Get();
IntRect srcRect(rect.X(), rect.Y(), rect.Width(), rect.Height());
IntPoint dstPoint(rect.X(), rect.Y());
// We're uploading regions to our buffer, so let's just copy contents over
mBufferDrawTarget->CopySurface(aSurface, srcRect, dstPoint);
}
} else {
// We're uploading the whole buffer, so let's just copy the full surface
IntSize size = aSurface->GetSize();
mBufferDrawTarget->CopySurface(
aSurface, IntRect(0, 0, size.width, size.height), IntPoint(0, 0));
}
return true;
}
TextureSourceBasic* X11DataTextureSourceBasic::AsSourceBasic() { return this; }
IntSize X11DataTextureSourceBasic::GetSize() const {
if (!mBufferDrawTarget) {
NS_WARNING("Trying to query the size of an uninitialized TextureSource");
return IntSize(0, 0);
}
return mBufferDrawTarget->GetSize();
}
gfx::SurfaceFormat X11DataTextureSourceBasic::GetFormat() const {
if (!mBufferDrawTarget) {
NS_WARNING("Trying to query the format of an uninitialized TextureSource");
return gfx::SurfaceFormat::UNKNOWN;
}
return mBufferDrawTarget->GetFormat();
}
SourceSurface* X11DataTextureSourceBasic::GetSurface(DrawTarget* aTarget) {
RefPtr<gfx::SourceSurface> surface;
if (mBufferDrawTarget) {
surface = mBufferDrawTarget->Snapshot();
return surface.get();
}
return nullptr;
}
void X11DataTextureSourceBasic::DeallocateDeviceData() {
mBufferDrawTarget = nullptr;
}
already_AddRefed<DataTextureSource> X11BasicCompositor::CreateDataTextureSource(
TextureFlags aFlags) {
RefPtr<DataTextureSource> result = new X11DataTextureSourceBasic();
return result.forget();
}
void X11BasicCompositor::EndFrame() {
BasicCompositor::EndFrame();
XFlush(DefaultXDisplay());
}
} // namespace layers
} // namespace mozilla

Просмотреть файл

@ -1,67 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MOZILLA_GFX_X11BASICCOMPOSITOR_H
#define MOZILLA_GFX_X11BASICCOMPOSITOR_H
#include "mozilla/layers/BasicCompositor.h"
#include "mozilla/layers/X11TextureSourceBasic.h"
#include "mozilla/layers/TextureHostBasic.h"
#include "gfxXlibSurface.h"
#include "mozilla/gfx/2D.h"
namespace mozilla {
namespace layers {
// TextureSource for Image-backed surfaces.
class X11DataTextureSourceBasic : public DataTextureSource,
public TextureSourceBasic {
public:
X11DataTextureSourceBasic() = default;
const char* Name() const override { return "X11DataTextureSourceBasic"; }
bool Update(gfx::DataSourceSurface* aSurface,
nsIntRegion* aDestRegion = nullptr,
gfx::IntPoint* aSrcOffset = nullptr,
gfx::IntPoint* aDstOffset = nullptr) override;
TextureSourceBasic* AsSourceBasic() override;
gfx::SourceSurface* GetSurface(gfx::DrawTarget* aTarget) override;
void DeallocateDeviceData() override;
gfx::IntSize GetSize() const override;
gfx::SurfaceFormat GetFormat() const override;
private:
// We are going to buffer layer content on this xlib draw target
RefPtr<mozilla::gfx::DrawTarget> mBufferDrawTarget;
};
class X11BasicCompositor : public BasicCompositor {
public:
explicit X11BasicCompositor(CompositorBridgeParent* aParent,
widget::CompositorWidget* aWidget)
: BasicCompositor(aParent, aWidget) {}
already_AddRefed<DataTextureSource> CreateDataTextureSource(
TextureFlags aFlags = TextureFlags::NO_FLAGS) override;
already_AddRefed<DataTextureSource> CreateDataTextureSourceAround(
gfx::DataSourceSurface* aSurface) override {
return nullptr;
}
void EndFrame() override;
};
} // namespace layers
} // namespace mozilla
#endif /* MOZILLA_GFX_X11BASICCOMPOSITOR_H */

Просмотреть файл

@ -92,11 +92,6 @@ already_AddRefed<ContentClient> ContentClient::CreateContentClient(
useDoubleBuffering = true;
} else
# endif
// We can't use double buffering when using image content with
// Xrender support on Linux, as ContentHostDoubleBuffered is not
// suited for direct uploads to the server.
if (!gfxPlatformGtk::GetPlatform()->UseImageOffscreenSurfaces() ||
!gfxVars::UseXRender())
#endif
{
useDoubleBuffering = backend == LayersBackend::LAYERS_BASIC;

Просмотреть файл

@ -72,9 +72,6 @@
#include "mozilla/ProfilerLabels.h"
#include "mozilla/ProfilerMarkers.h"
#include "mozilla/Telemetry.h"
#ifdef MOZ_WIDGET_GTK
# include "basic/X11BasicCompositor.h" // for X11BasicCompositor
#endif
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsDebug.h" // for NS_ASSERTION, etc
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
@ -1394,14 +1391,7 @@ RefPtr<Compositor> CompositorBridgeParent::NewCompositor(
new CompositorOGL(this, mWidget, mEGLSurfaceSize.width,
mEGLSurfaceSize.height, mUseExternalSurfaceSize);
} else if (aBackendHints[i] == LayersBackend::LAYERS_BASIC) {
#ifdef MOZ_WIDGET_GTK
if (gfxVars::UseXRender()) {
compositor = new X11BasicCompositor(this, mWidget);
} else
#endif
{
compositor = new BasicCompositor(this, mWidget);
}
compositor = new BasicCompositor(this, mWidget);
#ifdef XP_WIN
} else if (aBackendHints[i] == LayersBackend::LAYERS_D3D11) {
compositor = new CompositorD3D11(this, mWidget);

Просмотреть файл

@ -272,7 +272,6 @@ if CONFIG["MOZ_X11"]:
]
SOURCES += [
"basic/TextureClientX11.cpp",
"basic/X11BasicCompositor.cpp",
"basic/X11TextureSourceBasic.cpp",
"composite/X11TextureHost.cpp",
"ipc/ShadowLayerUtilsX11.cpp",

Просмотреть файл

@ -312,7 +312,7 @@ class gfxPlatform : public mozilla::layers::MemoryPressureListener {
const char* GetAzureCanvasBackend() const;
const char* GetAzureContentBackend() const;
virtual void GetAzureBackendInfo(mozilla::widget::InfoObject& aObj);
void GetAzureBackendInfo(mozilla::widget::InfoObject& aObj);
void GetApzSupportInfo(mozilla::widget::InfoObject& aObj);
void GetTilesSupportInfo(mozilla::widget::InfoObject& aObj);
void GetFrameStats(mozilla::widget::InfoObject& aObj);

Просмотреть файл

@ -222,16 +222,6 @@ void gfxPlatformGtk::InitWebRenderConfig() {
return;
}
#ifdef MOZ_X11
// We only support XRender if the user has disabled both WebRender and
// Software WebRender.
if (mIsX11Display && mozilla::Preferences::GetBool("gfx.xrender.enabled") &&
!(gfxConfig::IsEnabled(Feature::WEBRENDER) ||
gfxConfig::IsEnabled(Feature::WEBRENDER_SOFTWARE))) {
gfxVars::SetUseXRender(true);
}
#endif
FeatureState& feature = gfxConfig::GetFeature(Feature::WEBRENDER_COMPOSITOR);
if (feature.IsEnabled()) {
if (!(gfxConfig::IsEnabled(Feature::WEBRENDER) ||
@ -287,24 +277,10 @@ already_AddRefed<gfxASurface> gfxPlatformGtk::CreateOffscreenSurface(
// we should try to match
GdkScreen* gdkScreen = gdk_screen_get_default();
if (gdkScreen) {
// When forcing PaintedLayers to use image surfaces for content,
// force creation of gfxImageSurface surfaces.
if (gfxVars::UseXRender() && !UseImageOffscreenSurfaces()) {
Screen* screen = gdk_x11_screen_get_xscreen(gdkScreen);
XRenderPictFormat* xrenderFormat =
gfxXlibSurface::FindRenderFormat(DisplayOfScreen(screen), aFormat);
if (xrenderFormat) {
newSurface = gfxXlibSurface::Create(screen, xrenderFormat, aSize);
}
} else {
// We're not going to use XRender, so we don't need to
// search for a render format
newSurface = new gfxImageSurface(aSize, aFormat);
// The gfxImageSurface ctor zeroes this for us, no need to
// waste time clearing again
needsClear = false;
}
newSurface = new gfxImageSurface(aSize, aFormat);
// The gfxImageSurface ctor zeroes this for us, no need to
// waste time clearing again
needsClear = false;
}
#endif

Просмотреть файл

@ -42,13 +42,6 @@ class gfxPlatformGtk final : public gfxPlatform {
static int32_t GetFontScaleDPI();
static double GetFontScaleFactor();
#ifdef MOZ_X11
void GetAzureBackendInfo(mozilla::widget::InfoObject& aObj) override {
gfxPlatform::GetAzureBackendInfo(aObj);
aObj.DefineProperty("CairoUseXRender", mozilla::gfx::gfxVars::UseXRender());
}
#endif
bool UseImageOffscreenSurfaces();
gfxImageFormat GetOffscreenFormat() override;

Просмотреть файл

@ -3712,7 +3712,6 @@ pref("network.tcp.keepalive.idle_time", 600); // seconds; 10 mins
pref("network.psl.onUpdate_notify", false);
#ifdef MOZ_WIDGET_GTK
pref("gfx.xrender.enabled",false);
pref("widget.content.gtk-theme-override", "");
pref("widget.disable-workspace-management", false);
pref("widget.titlebar-x11-use-shape-mask", false);

Просмотреть файл

@ -20,7 +20,6 @@
# include "mozilla/X11Util.h"
# include "WindowSurfaceX11Image.h"
# include "WindowSurfaceX11SHM.h"
# include "WindowSurfaceXRender.h"
#endif
#undef LOG
@ -93,15 +92,8 @@ RefPtr<WindowSurface> WindowSurfaceProvider::CreateWindowSurface() {
#ifdef MOZ_X11
if (GdkIsX11Display()) {
// Blit to the window with the following priority:
// 1. XRender (iff XRender is enabled && we are in-process)
// 2. MIT-SHM
// 3. XPutImage
if (!mIsShaped && gfx::gfxVars::UseXRender()) {
LOG(("Drawing to Window 0x%lx will use XRender\n", mXWindow));
return MakeRefPtr<WindowSurfaceXRender>(DefaultXDisplay(), mXWindow,
mXVisual, mXDepth);
}
// 1. MIT-SHM
// 2. XPutImage
# ifdef MOZ_HAVE_SHMIMAGE
if (!mIsShaped && nsShmImage::UseShm()) {
LOG(("Drawing to Window 0x%lx will use MIT-SHM\n", mXWindow));

Просмотреть файл

@ -1,75 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "WindowSurfaceXRender.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/Types.h"
#include "gfxPlatform.h"
namespace mozilla {
namespace widget {
WindowSurfaceXRender::WindowSurfaceXRender(Display* aDisplay, Window aWindow,
Visual* aVisual, unsigned int aDepth)
: WindowSurfaceX11(aDisplay, aWindow, aVisual, aDepth),
mXlibSurface(nullptr),
mGC(X11None) {}
WindowSurfaceXRender::~WindowSurfaceXRender() {
if (mGC != X11None) {
XFreeGC(mDisplay, mGC);
}
}
already_AddRefed<gfx::DrawTarget> WindowSurfaceXRender::Lock(
const LayoutDeviceIntRegion& aRegion) {
gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect();
gfx::IntSize size(bounds.XMost(), bounds.YMost());
if (!mXlibSurface || mXlibSurface->CairoStatus() ||
!(size <= mXlibSurface->GetSize())) {
mXlibSurface = gfxXlibSurface::Create(DefaultScreenOfDisplay(mDisplay),
mVisual, size, mWindow);
}
if (!mXlibSurface || mXlibSurface->CairoStatus()) {
return nullptr;
}
return gfxPlatform::CreateDrawTargetForSurface(mXlibSurface, size);
}
void WindowSurfaceXRender::Commit(const LayoutDeviceIntRegion& aInvalidRegion) {
AutoTArray<XRectangle, 32> xrects;
xrects.SetCapacity(aInvalidRegion.GetNumRects());
for (auto iter = aInvalidRegion.RectIter(); !iter.Done(); iter.Next()) {
const LayoutDeviceIntRect& r = iter.Get();
XRectangle xrect = {(short)r.x, (short)r.y, (unsigned short)r.width,
(unsigned short)r.height};
xrects.AppendElement(xrect);
}
if (!mGC) {
mGC = XCreateGC(mDisplay, mWindow, 0, nullptr);
if (!mGC) {
NS_WARNING("Couldn't create X11 graphics context for window!");
return;
}
}
XSetClipRectangles(mDisplay, mGC, 0, 0, xrects.Elements(), xrects.Length(),
YXBanded);
MOZ_ASSERT(mXlibSurface && mXlibSurface->CairoStatus() == 0,
"Attempted to commit invalid surface!");
gfx::IntRect bounds = aInvalidRegion.GetBounds().ToUnknownRect();
gfx::IntSize size(bounds.XMost(), bounds.YMost());
XCopyArea(mDisplay, mXlibSurface->XDrawable(), mWindow, mGC, bounds.x,
bounds.y, size.width, size.height, bounds.x, bounds.y);
}
} // namespace widget
} // namespace mozilla

Просмотреть файл

@ -1,37 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _MOZILLA_WIDGET_GTK_WINDOW_SURFACE_XRENDER_H
#define _MOZILLA_WIDGET_GTK_WINDOW_SURFACE_XRENDER_H
#ifdef MOZ_X11
# include "WindowSurfaceX11.h"
# include "gfxXlibSurface.h"
namespace mozilla {
namespace widget {
class WindowSurfaceXRender : public WindowSurfaceX11 {
public:
WindowSurfaceXRender(Display* aDisplay, Window aWindow, Visual* aVisual,
unsigned int aDepth);
~WindowSurfaceXRender();
already_AddRefed<gfx::DrawTarget> Lock(
const LayoutDeviceIntRegion& aRegion) override;
void Commit(const LayoutDeviceIntRegion& aInvalidRegion) override;
private:
RefPtr<gfxXlibSurface> mXlibSurface;
GC mGC;
};
} // namespace widget
} // namespace mozilla
#endif // MOZ_X11
#endif // _MOZILLA_WIDGET_GTK_WINDOW_SURFACE_XRENDER_H

Просмотреть файл

@ -111,7 +111,6 @@ if CONFIG["MOZ_X11"]:
"WindowSurfaceX11.cpp",
"WindowSurfaceX11Image.cpp",
"WindowSurfaceX11SHM.cpp",
"WindowSurfaceXRender.cpp",
]
EXPORTS.mozilla.widget += [
"CompositorWidgetChild.h",

Просмотреть файл

@ -46,9 +46,9 @@ struct AsyncClipboardData {
ClipboardDataType mDataType;
};
static void wayland_clipboard_contents_received(
static void wayland_clipboard_contents_received_async(
GtkClipboard* clipboard, GtkSelectionData* selection_data, gpointer data) {
LOGCLIP(("wayland_clipboard_contents_received() selection_data = %p\n",
LOGCLIP(("wayland_clipboard_contents_received_async() selection_data = %p\n",
selection_data));
AsyncClipboardData* fastTrack = static_cast<AsyncClipboardData*>(data);
fastTrack->mRetrievalContex->TransferAsyncClipboardData(
@ -157,7 +157,7 @@ GdkAtom* nsRetrievalContextWaylandAsync::GetTargets(int32_t aWhichClipboard,
mClipboardRequestNumber++;
gtk_clipboard_request_contents(
gtk_clipboard_get(selection), gdk_atom_intern("TARGETS", FALSE),
wayland_clipboard_contents_received,
wayland_clipboard_contents_received_async,
new AsyncClipboardData(CLIPBOARD_TARGETS, mClipboardRequestNumber, this));
if (!WaitForClipboardContent()) {
@ -196,7 +196,7 @@ const char* nsRetrievalContextWaylandAsync::GetClipboardData(
mClipboardRequestNumber++;
gtk_clipboard_request_contents(
gtk_clipboard_get(selection), gdk_atom_intern(aMimeType, FALSE),
wayland_clipboard_contents_received,
wayland_clipboard_contents_received_async,
new AsyncClipboardData(CLIPBOARD_DATA, mClipboardRequestNumber, this));
if (!WaitForClipboardContent()) {

Просмотреть файл

@ -874,7 +874,7 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
break;
}
case IntID::TouchDeviceSupportPresent:
aResult = WidgetUtilsGTK::IsTouchDeviceSupportPresent() ? 1 : 0;
aResult = widget::WidgetUtilsGTK::IsTouchDeviceSupportPresent() ? 1 : 0;
break;
default:
aResult = 0;

Просмотреть файл

@ -108,7 +108,6 @@
# include "GLContextEGL.h" // for GLContextEGL::FindVisual()
# include "WindowSurfaceX11Image.h"
# include "WindowSurfaceX11SHM.h"
# include "WindowSurfaceXRender.h"
#endif
#ifdef MOZ_WAYLAND
# include "nsIClipboard.h"