2006-02-22 04:44:31 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
2012-05-21 15:12:37 +04:00
|
|
|
* 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/. */
|
2006-02-22 04:44:31 +03:00
|
|
|
|
|
|
|
#ifndef GFX_PLATFORM_MAC_H
|
|
|
|
#define GFX_PLATFORM_MAC_H
|
|
|
|
|
2013-10-08 03:15:59 +04:00
|
|
|
#include "nsTArrayForwardDeclare.h"
|
2006-02-22 04:44:31 +03:00
|
|
|
#include "gfxPlatform.h"
|
2015-10-08 09:04:08 +03:00
|
|
|
#include "mozilla/LookAndFeel.h"
|
2006-02-22 04:44:31 +03:00
|
|
|
|
2014-12-18 19:30:06 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
class DrawTarget;
|
|
|
|
class VsyncSource;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace gfx
|
|
|
|
} // namespace mozilla
|
2009-03-30 04:31:51 +04:00
|
|
|
|
2013-05-30 01:59:24 +04:00
|
|
|
class gfxPlatformMac : public gfxPlatform {
|
2006-02-22 04:44:31 +03:00
|
|
|
public:
|
|
|
|
gfxPlatformMac();
|
2009-03-30 04:31:51 +04:00
|
|
|
virtual ~gfxPlatformMac();
|
2006-02-22 04:44:31 +03:00
|
|
|
|
|
|
|
static gfxPlatformMac *GetPlatform() {
|
|
|
|
return (gfxPlatformMac*) gfxPlatform::GetPlatform();
|
|
|
|
}
|
|
|
|
|
Create a PaintWorker thread pool and dispatch tiles to it (bug 1425056, r=bas)
This commit adds a paint worker thread pool to PaintThread, and dispatches
tiled paints to it. The thread pool is only created if tiling is enabled,
and its size is set by 'layers.omtp.paint-workers' and defaults to 1. If
-1 is specified, it will be sized to 'max((cpu_cores * 3) / 4, 1)'.
The one tricky part of dispatching tiled paints to a thread pool is the
AsyncEndLayerTransaction message that must execute once all paints are
finished. Previously, this runnable would be queued after all the paints
had been queued, ensuring it would be run after they had all completed.
With a thread pool, there is no guarantee. Instead this commit, uses
a flag on CompositorBridgeChild to signify whether all of the paints
have been queued ('mOutstandingAsyncEndLayerTransaction'), and after
every tiled paint it is examined to see if that paint was the last
paint, and if it is to run AsyncEndLayerTransaction. In addition,
if the async paints complete before we even mark the end of the
layer transaction, we queue it like normal.
The profiler markers are also complicated by using a thread pool.
I don't know of a great way to keep them working as they are per
thread, so for now I've removed them. I may have been the only
one using them anyway.
MozReview-Commit-ID: 5LIJ9GWSfCn
--HG--
extra : rebase_source : 0c26806f337a1b4b1511945f9c72e787b426c5ba
2017-12-08 10:18:05 +03:00
|
|
|
bool UsesTiling() const override;
|
|
|
|
|
2014-02-09 12:04:38 +04:00
|
|
|
virtual already_AddRefed<gfxASurface>
|
2015-07-07 04:21:47 +03:00
|
|
|
CreateOffscreenSurface(const IntSize& aSize,
|
|
|
|
gfxImageFormat aFormat) override;
|
2014-02-09 12:04:38 +04:00
|
|
|
|
2014-06-06 10:09:23 +04:00
|
|
|
gfxFontGroup*
|
|
|
|
CreateFontGroup(const mozilla::FontFamilyList& aFontFamilyList,
|
|
|
|
const gfxFontStyle *aStyle,
|
2015-09-11 07:24:33 +03:00
|
|
|
gfxTextPerfMetrics* aTextPerf,
|
2015-11-20 16:01:12 +03:00
|
|
|
gfxUserFontSet *aUserFontSet,
|
|
|
|
gfxFloat aDevToCssSize) override;
|
2008-10-01 07:01:53 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual gfxPlatformFontList* CreatePlatformFontList() override;
|
2009-08-16 17:52:12 +04:00
|
|
|
|
2016-11-15 16:58:29 +03:00
|
|
|
void
|
2017-11-02 23:29:33 +03:00
|
|
|
ReadSystemFontList(InfallibleTArray<mozilla::dom::SystemFontListEntry>*
|
|
|
|
aFontList) override;
|
2016-11-15 16:58:29 +03:00
|
|
|
|
2017-07-08 09:17:23 +03:00
|
|
|
bool IsFontFormatSupported(uint32_t aFormatFlags) override;
|
2006-11-22 03:52:09 +03:00
|
|
|
|
2014-09-30 10:27:55 +04:00
|
|
|
virtual void GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
|
2016-04-21 20:58:59 +03:00
|
|
|
Script aRunScript,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsTArray<const char*>& aFontList) override;
|
2012-03-09 06:05:24 +04:00
|
|
|
|
2015-10-08 09:04:08 +03:00
|
|
|
// lookup the system font for a particular system font type and set
|
|
|
|
// the name and style characteristics
|
|
|
|
static void
|
|
|
|
LookupSystemFont(mozilla::LookAndFeel::FontID aSystemFontID,
|
|
|
|
nsAString& aSystemFontName,
|
|
|
|
gfxFontStyle &aFontStyle,
|
|
|
|
float aDevPixPerCSSPixel);
|
|
|
|
|
2015-04-19 23:12:14 +03:00
|
|
|
virtual bool SupportsApzWheelInput() const override {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-04-19 02:41:50 +03:00
|
|
|
bool RespectsFontStyleSmoothing() const override {
|
|
|
|
// gfxMacFont respects the font smoothing hint.
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-12-23 18:22:55 +03:00
|
|
|
bool RequiresAcceleratedGLContextForCompositorOGL() const override {
|
|
|
|
// On OS X in a VM, unaccelerated CompositorOGL shows black flashes, so we
|
|
|
|
// require accelerated GL for CompositorOGL but allow unaccelerated GL for
|
|
|
|
// BasicCompositor.
|
|
|
|
return true;
|
2015-07-17 01:18:05 +03:00
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource() override;
|
2014-07-25 04:49:45 +04:00
|
|
|
|
2008-05-01 13:07:17 +04:00
|
|
|
// lower threshold on font anti-aliasing
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t GetAntiAliasingThreshold() { return mFontAntiAliasingThreshold; }
|
2009-03-30 04:31:51 +04:00
|
|
|
|
2015-07-17 01:18:05 +03:00
|
|
|
protected:
|
|
|
|
bool AccelerateLayersByDefault() override;
|
|
|
|
|
2018-03-15 08:48:54 +03:00
|
|
|
BackendPrefsData GetBackendPrefs() override;
|
|
|
|
|
2007-07-24 02:02:17 +04:00
|
|
|
private:
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void GetPlatformCMSOutputProfile(void* &mem, size_t &size) override;
|
2013-03-29 00:11:58 +04:00
|
|
|
|
2008-05-01 13:07:17 +04:00
|
|
|
// read in the pref value for the lower threshold on font anti-aliasing
|
2013-03-29 00:11:58 +04:00
|
|
|
static uint32_t ReadAntiAliasingThreshold();
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mFontAntiAliasingThreshold;
|
2006-02-22 04:44:31 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* GFX_PLATFORM_MAC_H */
|