Always explicitly allocate except in Android Framework

This will turn on explicit allocation (w/o opList sorting) in Chrome. It leaves the old allocation system in place in Android Framework and some of Skia's older bots.


Change-Id: Idc02985e52f074894a251c7335ef00b009c72ccd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/199725
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2019-03-11 12:48:33 -04:00 committed by Skia Commit-Bot
parent a36541ab83
commit e157745dfc
7 changed files with 17 additions and 34 deletions

View File

@ -3,7 +3,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
flutter_defines = [
"SK_DISABLE_EXPLICIT_GPU_RESOURCE_ALLOCATION",
"SK_LEGACY_SKCODEC_NONE_ENUM",
# Flutter always wants this https://github.com/flutter/flutter/issues/11402

View File

@ -144,16 +144,9 @@ struct SK_API GrContextOptions {
*/
Enable fUseDrawInsteadOfClear = Enable::kDefault;
/**
* Allow Ganesh to explicitly allocate resources at flush time rather than incrementally while
* drawing. This will eventually just be the way it is but, for now, it is optional.
*/
Enable fExplicitlyAllocateGPUResources = Enable::kDefault;
/**
* Allow Ganesh to sort the opLists prior to allocating resources. This is an optional
* behavior that is only relevant when 'fExplicitlyAllocateGPUResources' is enabled.
* Eventually this will just be what is done and will not be optional.
* behavior but, eventually, this will just be what is done and will not be optional.
*/
Enable fSortRenderTargets = Enable::kDefault;

View File

@ -8,6 +8,16 @@
#ifndef GrContext_Base_DEFINED
#define GrContext_Base_DEFINED
// Perform old-style (non-explicit) allocation in the Android Framework and on older
// (non-Vulkan supporting) Android devices. The latter is to, at least, have some of
// Skia's bots exercise the old allocation scheme.
#if !defined(SK_OLD_STYLE_RESOURCE_ALLOCATION)
#if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) || \
(defined(SK_BUILD_FOR_ANDROID) && !defined(SK_VULKAN))
#define SK_OLD_STYLE_RESOURCE_ALLOCATION
#endif
#endif
#include "SkRefCnt.h"
#include "GrContextOptions.h"
#include "GrTypes.h"

View File

@ -11,12 +11,6 @@
#include "GrCaps.h"
#include "GrSkSLFPFactoryCache.h"
#ifdef SK_DISABLE_EXPLICIT_GPU_RESOURCE_ALLOCATION
static const bool kDefaultExplicitlyAllocateGPUResources = false;
#else
static const bool kDefaultExplicitlyAllocateGPUResources = true;
#endif
static int32_t next_id() {
static std::atomic<int32_t> nextID{1};
int32_t id;
@ -45,15 +39,11 @@ bool GrContext_Base::init(sk_sp<const GrCaps> caps, sk_sp<GrSkSLFPFactoryCache>
}
bool GrContext_Base::explicitlyAllocateGPUResources() const {
if (GrContextOptions::Enable::kNo == fOptions.fExplicitlyAllocateGPUResources) {
return false;
}
if (GrContextOptions::Enable::kYes == fOptions.fExplicitlyAllocateGPUResources) {
return true;
}
return kDefaultExplicitlyAllocateGPUResources;
#ifdef SK_OLD_STYLE_RESOURCE_ALLOCATION
return false;
#else
return true;
#endif
}
const GrCaps* GrContext_Base::caps() const { return fCaps.get(); }

View File

@ -53,8 +53,7 @@ protected:
}
// DDL contexts/drawing managers always sort the oplists. This, in turn, implies that
// explicit resource allocation is always on (regardless of whatever the client specified
// in their context options).
// explicit resource allocation is always on (regardless of how Skia is compiled).
this->setupDrawingManager(true, true);
SkASSERT(this->caps());

View File

@ -166,7 +166,6 @@ DEFINE_string(pr, "all",
"[~]none [~]dashline [~]nvpr [~]ccpr [~]aahairline [~]aaconvex [~]aalinearizing "
"[~]small [~]tess] [~]all");
DEFINE_bool(disableExplicitAlloc, false, "Disable explicit allocation of GPU resources");
DEFINE_bool(reduceOpListSplitting, false, "Improve opList sorting");
void SetCtxOptionsFromCommonFlags(GrContextOptions* ctxOptions) {
@ -178,12 +177,6 @@ void SetCtxOptionsFromCommonFlags(GrContextOptions* ctxOptions) {
ctxOptions->fGpuPathRenderers = CollectGpuPathRenderersFromFlags();
ctxOptions->fDisableDriverCorrectnessWorkarounds = FLAGS_disableDriverCorrectnessWorkarounds;
if (FLAGS_disableExplicitAlloc) {
ctxOptions->fExplicitlyAllocateGPUResources = GrContextOptions::Enable::kNo;
// Can't have sorting enabled when explicit allocation is disabled.
ctxOptions->fSortRenderTargets = GrContextOptions::Enable::kNo;
}
if (FLAGS_reduceOpListSplitting) {
ctxOptions->fReduceOpListSplitting = GrContextOptions::Enable::kYes;
}

View File

@ -16,7 +16,6 @@ DECLARE_int32(gpuThreads);
DECLARE_bool(cachePathMasks);
DECLARE_bool(noGS);
DECLARE_string(pr);
DECLARE_bool(disableExplicitAlloc);
DECLARE_bool(reduceOpListSplitting);
inline GpuPathRenderers get_named_pathrenderers_flags(const char* name) {