Bug 1722454 - Remove --disable-skia. r=firefox-build-system-reviewers,gfx-reviewers,nical,andi

It has been unsupported since bug 1323303, > 4 years ago.

This removes MOZ_ENABLE_SKIA but keeps USE_SKIA for moz2d for now

Differential Revision: https://phabricator.services.mozilla.com/D120933
This commit is contained in:
Mike Hommey 2021-07-29 23:29:43 +00:00
Родитель d489a2044b
Коммит daab1d49e3
15 изменённых файлов: 59 добавлений и 281 удалений

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

@ -113,22 +113,21 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
"ScaledFontFreeType.cpp",
]
if CONFIG["MOZ_ENABLE_SKIA"]:
SOURCES += [
"ConvolutionFilter.cpp",
"DrawTargetSkia.cpp",
"PathSkia.cpp",
"SourceSurfaceSkia.cpp",
]
if CONFIG["CC_TYPE"] == "clang":
# Suppress warnings from Skia header files.
SOURCES["DrawTargetSkia.cpp"].flags += ["-Wno-implicit-fallthrough"]
SOURCES["PathSkia.cpp"].flags += ["-Wno-implicit-fallthrough"]
SOURCES["SourceSurfaceSkia.cpp"].flags += ["-Wno-implicit-fallthrough"]
EXPORTS.mozilla.gfx += [
"ConvolutionFilter.h",
"HelpersSkia.h",
]
SOURCES += [
"ConvolutionFilter.cpp",
"DrawTargetSkia.cpp",
"PathSkia.cpp",
"SourceSurfaceSkia.cpp",
]
if CONFIG["CC_TYPE"] == "clang":
# Suppress warnings from Skia header files.
SOURCES["DrawTargetSkia.cpp"].flags += ["-Wno-implicit-fallthrough"]
SOURCES["PathSkia.cpp"].flags += ["-Wno-implicit-fallthrough"]
SOURCES["SourceSurfaceSkia.cpp"].flags += ["-Wno-implicit-fallthrough"]
EXPORTS.mozilla.gfx += [
"ConvolutionFilter.h",
"HelpersSkia.h",
]
# Are we targeting x86 or x64? If so, build SSE2 files.
if CONFIG["INTEL_ARCHITECTURE"]:

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

@ -77,9 +77,7 @@
#include "TreeTraversal.h" // for ForEachNode
#include "CompositionRecorder.h"
#ifdef USE_SKIA
# include "PaintCounter.h" // For PaintCounter
#endif
#include "PaintCounter.h" // For PaintCounter
class gfxContext;
@ -172,9 +170,7 @@ LayerManagerComposite::LayerManagerComposite(Compositor* aCompositor)
MOZ_RELEASE_ASSERT(mSurfacePoolHandle);
}
#ifdef USE_SKIA
mPaintCounter = nullptr;
#endif
}
LayerManagerComposite::~LayerManagerComposite() { Destroy(); }
@ -211,9 +207,7 @@ void LayerManagerComposite::Destroy() {
}
mDestroyed = true;
#ifdef USE_SKIA
mPaintCounter = nullptr;
#endif
}
}
@ -692,15 +686,12 @@ void LayerManagerComposite::InvalidateDebugOverlay(nsIntRegion& aInvalidRegion,
aInvalidRegion.Or(aInvalidRegion, nsIntRect(0, 0, 10, aBounds.Height()));
}
#ifdef USE_SKIA
bool drawPaintTimes = StaticPrefs::gfx_content_always_paint();
if (drawPaintTimes) {
aInvalidRegion.Or(aInvalidRegion, nsIntRect(PaintCounter::GetPaintRect()));
}
#endif
}
#ifdef USE_SKIA
void LayerManagerComposite::DrawPaintTimes(Compositor* aCompositor) {
if (!mPaintCounter) {
mPaintCounter = new PaintCounter();
@ -709,7 +700,6 @@ void LayerManagerComposite::DrawPaintTimes(Compositor* aCompositor) {
TimeDuration compositeTime = TimeStamp::Now() - mRenderStartTime;
mPaintCounter->Draw(aCompositor, mLastPaintTime, compositeTime);
}
#endif
static Rect RectWithEdges(int32_t aTop, int32_t aRight, int32_t aBottom,
int32_t aLeft) {
@ -824,12 +814,10 @@ void LayerManagerComposite::RenderDebugOverlay(const IntRect& aBounds) {
sFrameCount++;
}
#ifdef USE_SKIA
bool drawPaintTimes = StaticPrefs::gfx_content_always_paint();
if (drawPaintTimes) {
DrawPaintTimes(mCompositor);
}
#endif
}
void LayerManagerComposite::UpdateDebugOverlayNativeLayers() {

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

@ -505,13 +505,11 @@ class LayerManagerComposite final : public HostLayerManager {
RefPtr<NativeLayer> mUnusedTransformWarningLayer;
RefPtr<NativeLayer> mDisabledApzWarningLayer;
#ifdef USE_SKIA
/**
* Render paint and composite times above the frame.
*/
void DrawPaintTimes(Compositor* aCompositor);
RefPtr<PaintCounter> mPaintCounter;
#endif
#if defined(MOZ_WIDGET_ANDROID)
public:
virtual void RequestScreenPixels(

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

@ -627,10 +627,9 @@ if CONFIG["CC_TYPE"] in ("clang", "gcc"):
# Suppress warnings in third-party code.
CXXFLAGS += ["-Wno-maybe-uninitialized"]
if CONFIG["MOZ_ENABLE_SKIA"]:
UNIFIED_SOURCES += [
"composite/PaintCounter.cpp",
]
UNIFIED_SOURCES += [
"composite/PaintCounter.cpp",
]
if CONFIG["FUZZING"] and CONFIG["FUZZING_INTERFACES"]:
TEST_DIRS += ["ipc/fuzztest"]

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

@ -30,11 +30,9 @@ DIRS += [
"config",
"webrender_bindings",
"wgpu_bindings",
"skia",
]
if CONFIG["MOZ_ENABLE_SKIA"]:
DIRS += ["skia"]
if CONFIG["ENABLE_TESTS"]:
DIRS += ["tests/gtest"]

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

@ -116,22 +116,19 @@
#include "GLContextProvider.h"
#include "mozilla/gfx/Logging.h"
#ifdef USE_SKIA
# ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wshadow"
# endif
# include "skia/include/core/SkGraphics.h"
# ifdef MOZ_ENABLE_FREETYPE
# include "skia/include/ports/SkTypeface_cairo.h"
# endif
# include "mozilla/gfx/SkMemoryReporter.h"
# ifdef __GNUC__
# pragma GCC diagnostic pop // -Wshadow
# endif
static const uint32_t kDefaultGlyphCacheSize = -1;
#ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wshadow"
#endif
#include "skia/include/core/SkGraphics.h"
#ifdef MOZ_ENABLE_FREETYPE
# include "skia/include/ports/SkTypeface_cairo.h"
#endif
#include "mozilla/gfx/SkMemoryReporter.h"
#ifdef __GNUC__
# pragma GCC diagnostic pop // -Wshadow
#endif
static const uint32_t kDefaultGlyphCacheSize = -1;
#include "mozilla/Preferences.h"
#include "mozilla/Assertions.h"
@ -617,10 +614,9 @@ static void WebRenderBatchingPrefChangeCallback(const char* aPrefName, void*) {
gfx::gfxVars::SetWebRenderBatchingLookback(count);
}
#if defined(USE_SKIA)
static uint32_t GetSkiaGlyphCacheSize() {
// Only increase font cache size on non-android to save memory.
# if !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
// 10mb as the default pref cache size on desktop due to talos perf tweaking.
// Chromium uses 20mb and skia default uses 2mb.
// We don't need to change the font cache count since we usually
@ -633,11 +629,10 @@ static uint32_t GetSkiaGlyphCacheSize() {
}
return cacheSize;
# else
#else
return kDefaultGlyphCacheSize;
# endif // MOZ_WIDGET_ANDROID
#endif // MOZ_WIDGET_ANDROID
}
#endif
class WebRenderMemoryReporter final : public nsIMemoryReporter {
public:
@ -961,11 +956,9 @@ void gfxPlatform::Init() {
// off the main thread so we want to avoid a race condition.
InitializeCMS();
#ifdef USE_SKIA
SkGraphics::Init();
# ifdef MOZ_ENABLE_FREETYPE
#ifdef MOZ_ENABLE_FREETYPE
SkInitCairoFT(gPlatform->FontHintingEnabled());
# endif
#endif
InitLayersIPC();
@ -1026,16 +1019,12 @@ void gfxPlatform::Init() {
RegisterStrongAsyncMemoryReporter(new WebRenderMemoryReporter());
}
#ifdef USE_SKIA
RegisterStrongMemoryReporter(new SkMemoryReporter());
#endif
#ifdef USE_SKIA
uint32_t skiaCacheSize = GetSkiaGlyphCacheSize();
if (skiaCacheSize != kDefaultGlyphCacheSize) {
SkGraphics::SetFontCacheLimit(skiaCacheSize);
}
#endif
InitNullMetadata();
InitOpenGLConfig();
@ -1385,12 +1374,10 @@ void gfxPlatform::WillShutdown() {
mScreenReferenceSurface = nullptr;
mScreenReferenceDrawTarget = nullptr;
#ifdef USE_SKIA
// Always clear out the Skia font cache here, in case it is referencing any
// SharedFTFaces that would otherwise outlive destruction of the FT_Library
// that owns them.
SkGraphics::PurgeFontCache();
#endif
// The cairo folks think we should only clean up in debug builds,
// but we're generally in the habit of trying to shut down as
@ -1660,12 +1647,10 @@ bool gfxPlatform::SupportsAzureContentForDrawTarget(DrawTarget* aTarget) {
}
void gfxPlatform::PurgeSkiaFontCache() {
#ifdef USE_SKIA
if (gfxPlatform::GetPlatform()->GetDefaultContentBackend() ==
BackendType::SKIA) {
SkGraphics::PurgeFontCache();
}
#endif
}
already_AddRefed<DrawTarget> gfxPlatform::CreateDrawTargetForBackend(
@ -1740,11 +1725,7 @@ already_AddRefed<DrawTarget> gfxPlatform::CreateSimilarSoftwareDrawTarget(
if (Factory::DoesBackendSupportDataDrawtarget(aDT->GetBackendType())) {
dt = aDT->CreateSimilarDrawTarget(aSize, aFormat);
} else {
#ifdef USE_SKIA
BackendType backendType = BackendType::SKIA;
#else
BackendType backendType = BackendType::CAIRO;
#endif
dt = Factory::CreateDrawTarget(backendType, aSize, aFormat);
}
@ -1759,11 +1740,7 @@ already_AddRefed<DrawTarget> gfxPlatform::CreateDrawTargetForData(
NS_ASSERTION(backendType != BackendType::NONE, "No backend.");
if (!Factory::DoesBackendSupportDataDrawtarget(backendType)) {
#ifdef USE_SKIA
backendType = BackendType::SKIA;
#else
backendType = BackendType::CAIRO;
#endif
}
RefPtr<DrawTarget> dt = Factory::CreateDrawTargetForData(

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

@ -73,8 +73,7 @@ EXPORTS.mozilla.gfx += [
"ThebesRLBox.h",
]
if CONFIG["MOZ_ENABLE_SKIA"]:
EXPORTS.mozilla.gfx += ["SkMemoryReporter.h"]
EXPORTS.mozilla.gfx += ["SkMemoryReporter.h"]
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
EXPORTS += [
@ -227,10 +226,9 @@ UNIFIED_SOURCES += [
"VsyncSource.cpp",
]
if CONFIG["MOZ_ENABLE_SKIA"]:
UNIFIED_SOURCES += [
"SkMemoryReporter.cpp",
]
UNIFIED_SOURCES += [
"SkMemoryReporter.cpp",
]
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
UNIFIED_SOURCES += [

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

@ -16,9 +16,7 @@
#include "mozilla/UniquePtr.h"
#include "gfxPoint.h"
#include "nsRect.h"
#ifdef MOZ_ENABLE_SKIA
# include "mozilla/gfx/ConvolutionFilter.h"
#endif
#include "mozilla/gfx/ConvolutionFilter.h"
namespace mozilla {
namespace image {
@ -32,8 +30,6 @@ struct DownscalerInvalidRect {
nsIntRect mTargetSizeRect;
};
#ifdef MOZ_ENABLE_SKIA
/**
* Downscaler is a high-quality, streaming image downscaler based upon Skia's
* scaling implementation.
@ -143,45 +139,6 @@ class Downscaler {
bool mFlipVertically : 1;
};
#else
/**
* Downscaler requires Skia to work, so we provide a dummy implementation if
* Skia is disabled that asserts if constructed.
*/
class Downscaler {
public:
explicit Downscaler(const nsIntSize&) : mScale(1.0, 1.0) {
MOZ_RELEASE_ASSERT(false, "Skia is not enabled");
}
const nsIntSize& OriginalSize() const { return mSize; }
const nsIntSize& TargetSize() const { return mSize; }
const gfxSize& Scale() const { return mScale; }
nsresult BeginFrame(const nsIntSize&, const Maybe<nsIntRect>&, uint8_t*, bool,
bool = false) {
return NS_ERROR_FAILURE;
}
bool IsFrameComplete() const { return false; }
uint8_t* RowBuffer() { return nullptr; }
void ClearRow() {}
void ClearRestOfRow(uint32_t) {}
void CommitRow() {}
bool HasInvalidation() const { return false; }
DownscalerInvalidRect TakeInvalidRect() { return DownscalerInvalidRect(); }
void ResetForNextProgressivePass() {}
const nsIntSize FrameSize() const { return nsIntSize(0, 0); }
private:
nsIntSize mSize;
gfxSize mScale;
};
#endif // MOZ_ENABLE_SKIA
} // namespace image
} // namespace mozilla

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

@ -24,9 +24,7 @@
#include "mozilla/UniquePtr.h"
#include "mozilla/gfx/2D.h"
#ifdef MOZ_ENABLE_SKIA
# include "mozilla/gfx/ConvolutionFilter.h"
#endif
#include "mozilla/gfx/ConvolutionFilter.h"
#include "SurfacePipe.h"
@ -53,43 +51,6 @@ struct DownscalingConfig {
/// slightly better performance.)
};
#ifndef MOZ_ENABLE_SKIA
/**
* DownscalingFilter requires Skia. This is a fallback implementation for
* non-Skia builds that fails when Configure() is called (which will prevent
* SurfacePipeFactory from returning an instance of it) and crashes if a caller
* manually constructs an instance and attempts to actually use it. Callers
* should avoid this by ensuring that they do not request downscaling in
* non-Skia builds.
*/
template <typename Next>
class DownscalingFilter final : public SurfaceFilter {
public:
Maybe<SurfaceInvalidRect> TakeInvalidRect() override { return Nothing(); }
template <typename... Rest>
nsresult Configure(const DownscalingConfig& aConfig, const Rest&... aRest) {
return NS_ERROR_FAILURE;
}
protected:
uint8_t* DoResetToFirstRow() override {
MOZ_CRASH();
return nullptr;
}
uint8_t* DoAdvanceRowFromBuffer(const uint8_t* aInputRow) override {
MOZ_CRASH();
return nullptr;
}
uint8_t* DoAdvanceRow() override {
MOZ_CRASH();
return nullptr;
}
};
#else
/**
* DownscalingFilter performs Lanczos downscaling, taking image input data at
* one size and outputting it rescaled to a different size.
@ -344,8 +305,6 @@ class DownscalingFilter final : public SurfaceFilter {
bool mHasAlpha; /// If true, the image has transparency.
};
#endif
} // namespace image
} // namespace mozilla

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

@ -1345,20 +1345,12 @@ void RasterImage::RecoverFromInvalidFrames(const UnorientedIntSize& aSize,
Decode(aSize, aFlags, PlaybackType::eStatic, unused1, unused2);
}
static bool HaveSkia() {
#ifdef MOZ_ENABLE_SKIA
return true;
#else
return false;
#endif
}
bool RasterImage::CanDownscaleDuringDecode(const UnorientedIntSize& aSize,
uint32_t aFlags) {
// Check basic requirements: downscale-during-decode is enabled, Skia is
// available, this image isn't transient, we have all the source data and know
// our size, and the flags allow us to do it.
if (!LoadHasSize() || LoadTransient() || !HaveSkia() ||
if (!LoadHasSize() || LoadTransient() ||
!StaticPrefs::image_downscale_during_decode_enabled() ||
!(aFlags & imgIContainer::FLAG_HIGH_QUALITY_SCALING)) {
return false;

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

@ -105,8 +105,8 @@ UNIFIED_SOURCES += [
"SVGDocumentWrapper.cpp",
"VectorImage.cpp",
]
if CONFIG["MOZ_ENABLE_SKIA"]:
UNIFIED_SOURCES += ["Downscaler.cpp"]
UNIFIED_SOURCES += ["Downscaler.cpp"]
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
SOURCES += ["DecodePool.cpp"]

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

@ -1,55 +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 "gtest/gtest.h"
#include "mozilla/gfx/2D.h"
#include "Decoder.h"
#include "DecoderFactory.h"
#include "SourceBuffer.h"
#include "SurfacePipe.h"
// We want to ensure that we're testing the non-Skia fallback version of
// DownscalingFilter, but there are two issues:
// (1) We don't know whether Skia is currently enabled.
// (2) If we force disable it, the disabled version will get linked into the
// binary and will cause the tests in TestDownscalingFilter to fail.
// To avoid these problems, we ensure that MOZ_ENABLE_SKIA is defined when
// including DownscalingFilter.h, and we use the preprocessor to redefine the
// DownscalingFilter class to DownscalingFilterNoSkia.
#define DownscalingFilter DownscalingFilterNoSkia
#ifdef MOZ_ENABLE_SKIA
# undef MOZ_ENABLE_SKIA
# include "Common.h"
# include "DownscalingFilter.h"
# define MOZ_ENABLE_SKIA
#else
# include "Common.h"
# include "DownscalingFilter.h"
#endif
#undef DownscalingFilter
using namespace mozilla;
using namespace mozilla::gfx;
using namespace mozilla::image;
TEST(ImageDownscalingFilter, NoSkia)
{
RefPtr<image::Decoder> decoder = CreateTrivialDecoder();
ASSERT_TRUE(bool(decoder));
// Configuring a DownscalingFilter should fail without Skia.
AssertConfiguringPipelineFails(
decoder, DownscalingConfig{IntSize(100, 100), SurfaceFormat::OS_RGBA},
SurfaceConfig{decoder, IntSize(50, 50), SurfaceFormat::OS_RGBA, false});
}

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

@ -33,15 +33,9 @@ if not (CONFIG["OS_TARGET"] == "WINNT" and CONFIG["CPU_ARCH"] == "aarch64"):
"TestSurfaceCache.cpp",
]
if CONFIG["MOZ_ENABLE_SKIA"]:
UNIFIED_SOURCES += [
"TestDownscalingFilter.cpp",
"TestSurfacePipeIntegration.cpp",
]
SOURCES += [
# Can't be unified because it manipulates the preprocessor environment.
"TestDownscalingFilterNoSkia.cpp",
UNIFIED_SOURCES += [
"TestDownscalingFilter.cpp",
"TestSurfacePipeIntegration.cpp",
]
TEST_HARNESS_FILES.gtest += [

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

@ -937,34 +937,17 @@ set_config("MOZ_IPDL_TESTS", depends_if("--enable-ipdl-tests")(lambda _: True))
# Graphics
# ==============================================================
option("--disable-skia", help="Disable use of Skia")
@depends("--disable-skia")
def skia(value):
if not value:
die("--disable-skia is not supported anymore")
else:
return True
set_config("MOZ_ENABLE_SKIA", skia)
set_define("MOZ_ENABLE_SKIA", skia)
set_define("USE_SKIA", skia)
set_define("USE_SKIA", True)
option("--enable-skia-pdf", help="Enable Skia PDF")
@depends("--enable-skia-pdf", skia, target, milestone)
def skia_pdf(value, skia, target, milestone):
@depends("--enable-skia-pdf", target, milestone)
def skia_pdf(value, target, milestone):
if value.origin == "default":
if not skia:
return None
if milestone.is_nightly and target.os != "WINNT":
return True
elif value and not skia:
die("Cannot enable Skia PDF without enabling Skia")
if skia and value:
if value:
return True
@ -972,18 +955,13 @@ set_config("MOZ_ENABLE_SKIA_PDF", skia_pdf)
set_define("MOZ_ENABLE_SKIA_PDF", skia_pdf)
@depends(skia)
def skia_includes(skia):
includes = []
if skia:
includes += [
"/gfx/skia",
"/gfx/skia/skia",
]
return includes
set_config("SKIA_INCLUDES", skia_includes)
set_config(
"SKIA_INCLUDES",
[
"/gfx/skia",
"/gfx/skia/skia",
],
)
system_lib_option(
"--with-system-webp", help="Use system libwebp (located with pkgconfig)"

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

@ -92,11 +92,7 @@ already_AddRefed<gfx::DrawTarget> WindowSurfaceX11Image::Lock(
if (format == gfx::SurfaceFormat::X8R8G8B8_UINT32) {
gfx::BackendType backend = gfxVars::ContentBackend();
if (!gfx::Factory::DoesBackendSupportDataDrawtarget(backend)) {
#ifdef USE_SKIA
backend = gfx::BackendType::SKIA;
#else
backend = gfx::BackendType::CAIRO;
#endif
}
if (backend != gfx::BackendType::CAIRO) {
format = gfx::SurfaceFormat::A8R8G8B8_UINT32;