Skip to content

Commit c6acad1

Browse files
committed
Add r/w opt-in rollout flag for RenderEngine on Graphite
This flag will allow some devices to opt in to RE-Graphite as a preview rollout progresses. Making it a R/W flag will allow for A/B comparison. Test: manual validation of aconfig flag / sysprop combos Bug: b/293371537 Flag: com.android.graphics.surfaceflinger.flags.graphite_renderengine_preview_rollout Change-Id: I30a59986d1da2dc8355c2b3cf2da436c6cc64120
1 parent 887598b commit c6acad1

5 files changed

Lines changed: 28 additions & 5 deletions

File tree

libs/renderengine/include/renderengine/RenderEngine.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@
3737
*/
3838
#define PROPERTY_DEBUG_RENDERENGINE_BACKEND "debug.renderengine.backend"
3939

40+
/**
41+
* Allows opting particular devices into an initial preview rollout of RenderEngine on Graphite.
42+
*
43+
* Only applicable within SurfaceFlinger, and if relevant aconfig flags are enabled.
44+
*/
45+
#define PROPERTY_DEBUG_RENDERENGINE_GRAPHITE_PREVIEW_OPTIN \
46+
"debug.renderengine.graphite_preview_optin"
47+
4048
/**
4149
* Turns on recording of skia commands in SkiaGL version of the RE. This property
4250
* defines number of milliseconds for the recording to take place. A non zero value

services/surfaceflinger/SurfaceFlinger.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,12 @@ void SurfaceFlinger::bootFinished() {
797797
}));
798798
}
799799

800+
bool shouldUseGraphiteIfCompiledAndSupported() {
801+
return FlagManager::getInstance().graphite_renderengine() ||
802+
(FlagManager::getInstance().graphite_renderengine_preview_rollout() &&
803+
base::GetBoolProperty(PROPERTY_DEBUG_RENDERENGINE_GRAPHITE_PREVIEW_OPTIN, false));
804+
}
805+
800806
void chooseRenderEngineType(renderengine::RenderEngineCreationArgs::Builder& builder) {
801807
char prop[PROPERTY_VALUE_MAX];
802808
property_get(PROPERTY_DEBUG_RENDERENGINE_BACKEND, prop, "");
@@ -825,14 +831,13 @@ void chooseRenderEngineType(renderengine::RenderEngineCreationArgs::Builder& bui
825831
// is used by layertracegenerator (which also needs SurfaceFlinger.cpp). :)
826832
#if COM_ANDROID_GRAPHICS_SURFACEFLINGER_FLAGS_GRAPHITE_RENDERENGINE || \
827833
COM_ANDROID_GRAPHICS_SURFACEFLINGER_FLAGS_FORCE_COMPILE_GRAPHITE_RENDERENGINE
828-
const bool useGraphite = FlagManager::getInstance().graphite_renderengine() &&
834+
const bool useGraphite = shouldUseGraphiteIfCompiledAndSupported() &&
829835
renderengine::RenderEngine::canSupport(kVulkan);
830836
#else
831837
const bool useGraphite = false;
832-
if (FlagManager::getInstance().graphite_renderengine()) {
833-
ALOGE("RenderEngine's Graphite Skia backend was requested with the "
834-
"debug.renderengine.graphite system property, but it is not compiled in this "
835-
"build! Falling back to Ganesh backend selection logic.");
838+
if (shouldUseGraphiteIfCompiledAndSupported()) {
839+
ALOGE("RenderEngine's Graphite Skia backend was requested, but it is not compiled in "
840+
"this build! Falling back to Ganesh backend selection logic.");
836841
}
837842
#endif
838843
const bool useVulkan = useGraphite ||

services/surfaceflinger/common/FlagManager.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ void FlagManager::dump(std::string& result) const {
115115
DUMP_ACONFIG_FLAG(adpf_gpu_sf);
116116
DUMP_ACONFIG_FLAG(adpf_native_session_manager);
117117
DUMP_ACONFIG_FLAG(adpf_use_fmq_channel);
118+
DUMP_ACONFIG_FLAG(graphite_renderengine_preview_rollout);
118119

119120
/// Trunk stable readonly flags ///
120121
DUMP_ACONFIG_FLAG(adpf_fmq_sf);
@@ -265,6 +266,7 @@ FLAG_MANAGER_ACONFIG_FLAG(begone_bright_hlg, "debug.sf.begone_bright_hlg");
265266
FLAG_MANAGER_ACONFIG_FLAG(refresh_rate_overlay_on_external_display, "")
266267
FLAG_MANAGER_ACONFIG_FLAG(adpf_gpu_sf, "")
267268
FLAG_MANAGER_ACONFIG_FLAG(adpf_native_session_manager, "");
269+
FLAG_MANAGER_ACONFIG_FLAG(graphite_renderengine_preview_rollout, "");
268270

269271
/// Trunk stable server (R/W) flags from outside SurfaceFlinger ///
270272
FLAG_MANAGER_ACONFIG_FLAG_IMPORTED(adpf_use_fmq_channel, "", android::os)

services/surfaceflinger/common/include/common/FlagManager.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class FlagManager {
5353
bool adpf_use_fmq_channel() const;
5454
bool adpf_native_session_manager() const;
5555
bool adpf_use_fmq_channel_fixed() const;
56+
bool graphite_renderengine_preview_rollout() const;
5657

5758
/// Trunk stable readonly flags ///
5859
bool adpf_fmq_sf() const;

services/surfaceflinger/surfaceflinger_flags_new.aconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,13 @@ flag {
172172
}
173173
} # frame_rate_category_mrr
174174

175+
flag {
176+
name: "graphite_renderengine_preview_rollout"
177+
namespace: "core_graphics"
178+
description: "R/W flag to enable Skia's Graphite Vulkan backend in RenderEngine, IF it is already compiled with force_compile_graphite_renderengine, AND the debug.renderengine.graphite_preview_optin sysprop is set to true."
179+
bug: "293371537"
180+
} # graphite_renderengine_preview_rollout
181+
175182
flag {
176183
name: "latch_unsignaled_with_auto_refresh_changed"
177184
namespace: "core_graphics"

0 commit comments

Comments
 (0)