mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Backed out changeset 303b759e886e (bug 1249640)
This commit is contained in:
parent
38e8f42dfb
commit
00a63ca413
@ -795,16 +795,10 @@ CanvasDrawObserver::FrameEnd()
|
||||
// If we don't have enough data, don't bother changing...
|
||||
if (mGPUPreferredCalls > mMinCallsBeforeDecision ||
|
||||
mSoftwarePreferredCalls > mMinCallsBeforeDecision) {
|
||||
CanvasRenderingContext2D::RenderingMode switchToMode;
|
||||
if (mGPUPreferredCalls >= mSoftwarePreferredCalls) {
|
||||
switchToMode = CanvasRenderingContext2D::RenderingMode::OpenGLBackendMode;
|
||||
mCanvasContext->SwitchRenderingMode(CanvasRenderingContext2D::RenderingMode::OpenGLBackendMode);
|
||||
} else {
|
||||
switchToMode = CanvasRenderingContext2D::RenderingMode::SoftwareBackendMode;
|
||||
}
|
||||
if (switchToMode != mCanvasContext->mRenderingMode) {
|
||||
if (!mCanvasContext->SwitchRenderingMode(switchToMode)) {
|
||||
gfxDebug() << "Canvas acceleration failed mode switch to " << switchToMode;
|
||||
}
|
||||
mCanvasContext->SwitchRenderingMode(CanvasRenderingContext2D::RenderingMode::SoftwareBackendMode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -974,11 +968,13 @@ CanvasRenderingContext2D::CanvasRenderingContext2D()
|
||||
sNumLivingContexts++;
|
||||
|
||||
// The default is to use OpenGL mode
|
||||
if (gfxPlatform::GetPlatform()->UseAcceleratedCanvas()) {
|
||||
mDrawObserver = new CanvasDrawObserver(this);
|
||||
} else {
|
||||
if (!gfxPlatform::GetPlatform()->UseAcceleratedSkiaCanvas()) {
|
||||
mRenderingMode = RenderingMode::SoftwareBackendMode;
|
||||
}
|
||||
|
||||
if (gfxPlatform::GetPlatform()->HaveChoiceOfHWAndSWCanvas()) {
|
||||
mDrawObserver = new CanvasDrawObserver(this);
|
||||
}
|
||||
}
|
||||
|
||||
CanvasRenderingContext2D::~CanvasRenderingContext2D()
|
||||
@ -1212,7 +1208,8 @@ bool CanvasRenderingContext2D::SwitchRenderingMode(RenderingMode aRenderingMode)
|
||||
#ifdef USE_SKIA_GPU
|
||||
// Do not attempt to switch into GL mode if the platform doesn't allow it.
|
||||
if ((aRenderingMode == RenderingMode::OpenGLBackendMode) &&
|
||||
!gfxPlatform::GetPlatform()->UseAcceleratedCanvas()) {
|
||||
(!gfxPlatform::GetPlatform()->HaveChoiceOfHWAndSWCanvas() ||
|
||||
!gfxPlatform::GetPlatform()->UseAcceleratedSkiaCanvas())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1419,7 +1416,7 @@ CanvasRenderingContext2D::EnsureTarget(RenderingMode aRenderingMode)
|
||||
|
||||
if (layerManager) {
|
||||
if (mode == RenderingMode::OpenGLBackendMode &&
|
||||
gfxPlatform::GetPlatform()->UseAcceleratedCanvas() &&
|
||||
gfxPlatform::GetPlatform()->UseAcceleratedSkiaCanvas() &&
|
||||
CheckSizeForSkiaGL(size)) {
|
||||
DemoteOldestContextIfNecessary();
|
||||
mBufferProvider = nullptr;
|
||||
|
@ -64,7 +64,7 @@ function IsAcceleratedSkia() {
|
||||
|
||||
try {
|
||||
var props = Cc["@mozilla.org/gfx/info;1"].getService(SpecialPowers.Ci.nsIGfxInfo).getInfo();
|
||||
enabled = props.AzureCanvasBackend == "skia" && props.AzureCanvasAccelerated;
|
||||
enabled = props.AzureCanvasBackend == "skia" && props.AzureSkiaAccelerated;
|
||||
} catch(e) { }
|
||||
|
||||
return enabled;
|
||||
|
@ -1207,24 +1207,22 @@ gfxPlatform::SupportsAzureContentForDrawTarget(DrawTarget* aTarget)
|
||||
return SupportsAzureContentForType(aTarget->GetBackendType());
|
||||
}
|
||||
|
||||
bool gfxPlatform::UseAcceleratedCanvas()
|
||||
bool
|
||||
gfxPlatform::UseAcceleratedSkiaCanvas()
|
||||
{
|
||||
// Allow acceleration on Skia if the preference is set, unless it's blocked
|
||||
if (mPreferredCanvasBackend == BackendType::SKIA && gfxPrefs::CanvasAzureAccelerated()) {
|
||||
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
|
||||
int32_t status;
|
||||
return !gfxInfo ||
|
||||
(NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_CANVAS2D_ACCELERATION,
|
||||
&status)) &&
|
||||
status == nsIGfxInfo::FEATURE_STATUS_OK);
|
||||
}
|
||||
return false;
|
||||
return gfxPrefs::CanvasAzureAccelerated() &&
|
||||
mPreferredCanvasBackend == BackendType::SKIA;
|
||||
}
|
||||
|
||||
bool gfxPlatform::HaveChoiceOfHWAndSWCanvas()
|
||||
{
|
||||
return mPreferredCanvasBackend == BackendType::SKIA;
|
||||
}
|
||||
|
||||
void
|
||||
gfxPlatform::InitializeSkiaCacheLimits()
|
||||
{
|
||||
if (UseAcceleratedCanvas()) {
|
||||
if (UseAcceleratedSkiaCanvas()) {
|
||||
#ifdef USE_SKIA_GPU
|
||||
bool usingDynamicCache = gfxPrefs::CanvasSkiaGLDynamicCache();
|
||||
int cacheItemLimit = gfxPrefs::CanvasSkiaGLCacheItems();
|
||||
@ -1256,7 +1254,7 @@ SkiaGLGlue*
|
||||
gfxPlatform::GetSkiaGLGlue()
|
||||
{
|
||||
#ifdef USE_SKIA_GPU
|
||||
if (!UseAcceleratedCanvas()) {
|
||||
if (!gfxPlatform::GetPlatform()->UseAcceleratedSkiaCanvas()) {
|
||||
gfxCriticalNote << "Accelerated Skia canvas is disabled";
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -252,13 +252,15 @@ public:
|
||||
return BackendTypeBit(aType) & mContentBackendBitmask;
|
||||
}
|
||||
|
||||
/// This function also lets us know if the current preferences/platform
|
||||
/// This function lets us know if the current preferences/platform
|
||||
/// combination allows for both accelerated and not accelerated canvas
|
||||
/// implementations. If it does, and other relevant preferences are
|
||||
/// asking for it, we will examine the commands in the first few seconds
|
||||
/// of the canvas usage, and potentially change to accelerated or
|
||||
/// non-accelerated canvas.
|
||||
virtual bool UseAcceleratedCanvas();
|
||||
virtual bool HaveChoiceOfHWAndSWCanvas();
|
||||
|
||||
virtual bool UseAcceleratedSkiaCanvas();
|
||||
virtual void InitializeSkiaCacheLimits();
|
||||
|
||||
/// These should be used instead of directly accessing the preference,
|
||||
@ -269,7 +271,7 @@ public:
|
||||
|
||||
virtual void GetAzureBackendInfo(mozilla::widget::InfoObject &aObj) {
|
||||
aObj.DefineProperty("AzureCanvasBackend", GetBackendName(mPreferredCanvasBackend));
|
||||
aObj.DefineProperty("AzureCanvasAccelerated", UseAcceleratedCanvas());
|
||||
aObj.DefineProperty("AzureSkiaAccelerated", UseAcceleratedSkiaCanvas());
|
||||
aObj.DefineProperty("AzureFallbackCanvasBackend", GetBackendName(mFallbackCanvasBackend));
|
||||
aObj.DefineProperty("AzureContentBackend", GetBackendName(mContentBackend));
|
||||
}
|
||||
|
@ -654,7 +654,7 @@ function BuildConditionSandbox(aURL) {
|
||||
sandbox.azureQuartz = info.AzureCanvasBackend == "quartz";
|
||||
sandbox.azureSkia = info.AzureCanvasBackend == "skia";
|
||||
sandbox.skiaContent = info.AzureContentBackend == "skia";
|
||||
sandbox.azureSkiaGL = info.AzureCanvasAccelerated; // FIXME: assumes GL right now
|
||||
sandbox.azureSkiaGL = info.AzureSkiaAccelerated; // FIXME: assumes GL right now
|
||||
// true if we are using the same Azure backend for rendering canvas and content
|
||||
sandbox.contentSameGfxBackendAsCanvas = info.AzureContentBackend == info.AzureCanvasBackend
|
||||
|| (info.AzureContentBackend == "none" && info.AzureCanvasBackend == "cairo");
|
||||
|
Loading…
Reference in New Issue
Block a user