diff options
| author | 2024-06-05 18:34:42 +0000 | |
|---|---|---|
| committer | 2024-06-05 18:34:42 +0000 | |
| commit | c497a09eb5d2eea5999915a7163e6e44d5185dfd (patch) | |
| tree | 299b3d13567f1aa090d782b52b1973652e20c11f /libs/renderengine/RenderEngine.cpp | |
| parent | e32f5f0113958b29846021f0b9fdc993771c6209 (diff) | |
| parent | 488101bf891623780e2f4d0eaacadc6d02e268f9 (diff) | |
Merge "[RenderEngine] Only compile Graphite if either Graphite flag is enabled" into main
Diffstat (limited to 'libs/renderengine/RenderEngine.cpp')
| -rw-r--r-- | libs/renderengine/RenderEngine.cpp | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/libs/renderengine/RenderEngine.cpp b/libs/renderengine/RenderEngine.cpp index 1c60563b25..bc3976d9f1 100644 --- a/libs/renderengine/RenderEngine.cpp +++ b/libs/renderengine/RenderEngine.cpp @@ -22,24 +22,49 @@ #include "skia/SkiaGLRenderEngine.h" #include "threaded/RenderEngineThreaded.h" +#include <com_android_graphics_surfaceflinger_flags.h> #include <cutils/properties.h> #include <log/log.h> +// TODO: b/341728634 - Clean up conditional compilation. +#if COM_ANDROID_GRAPHICS_SURFACEFLINGER_FLAGS(GRAPHITE_RENDERENGINE) || \ + COM_ANDROID_GRAPHICS_SURFACEFLINGER_FLAGS(FORCE_COMPILE_GRAPHITE_RENDERENGINE) +#define COMPILE_GRAPHITE_RENDERENGINE 1 +#else +#define COMPILE_GRAPHITE_RENDERENGINE 0 +#endif + namespace android { namespace renderengine { std::unique_ptr<RenderEngine> RenderEngine::create(const RenderEngineCreationArgs& args) { threaded::CreateInstanceFactory createInstanceFactory; +// TODO: b/341728634 - Clean up conditional compilation. +#if COMPILE_GRAPHITE_RENDERENGINE + const RenderEngine::SkiaBackend actualSkiaBackend = args.skiaBackend; +#else + if (args.skiaBackend == RenderEngine::SkiaBackend::GRAPHITE) { + ALOGE("RenderEngine with Graphite Skia backend was requested, but Graphite was not " + "included in the build. Falling back to Ganesh (%s)", + args.graphicsApi == RenderEngine::GraphicsApi::GL ? "GL" : "Vulkan"); + } + const RenderEngine::SkiaBackend actualSkiaBackend = RenderEngine::SkiaBackend::GANESH; +#endif + ALOGD("%sRenderEngine with %s Backend (%s)", args.threaded == Threaded::YES ? "Threaded " : "", args.graphicsApi == GraphicsApi::GL ? "SkiaGL" : "SkiaVK", - args.skiaBackend == SkiaBackend::GANESH ? "Ganesh" : "Graphite"); + actualSkiaBackend == SkiaBackend::GANESH ? "Ganesh" : "Graphite"); - if (args.skiaBackend == SkiaBackend::GRAPHITE) { +// TODO: b/341728634 - Clean up conditional compilation. +#if COMPILE_GRAPHITE_RENDERENGINE + if (actualSkiaBackend == SkiaBackend::GRAPHITE) { createInstanceFactory = [args]() { return android::renderengine::skia::GraphiteVkRenderEngine::create(args); }; - } else { // GANESH + } else +#endif + { // GANESH if (args.graphicsApi == GraphicsApi::VK) { createInstanceFactory = [args]() { return android::renderengine::skia::GaneshVkRenderEngine::create(args); |