Add support for enabling GraphiteVkRenderEngine in SurfaceFlinger
Predicated on just the graphite_renderengine flag (overridable with
the debug.renderengine.graphite sysprops), which inherently implies
GraphicsApi::VK.
As currently implemented, setting the old debug.renderengine.backend
sysprop (e.g. "skiavkthreaded") will fully override this logic,
preventing Graphite from being enabled. This approach is simpler, but
also maintains backwards compatibility, and distances the new approach
from that restrictive terminology.
Note that the approach for actually instantiating a RenderEngine
instance extends the existing RenderEngine::create(args) model, forcing
the caller to know exactly which concrete subclass they wish to
instantiate. This could be reworked in the future.
Test: local validation (sysprops + logs)
Bug: b/293371537
Change-Id: Iff0a8894725fc45e679074ddc2e4af56cca318c6
diff --git a/libs/renderengine/skia/GraphiteVkRenderEngine.h b/libs/renderengine/skia/GraphiteVkRenderEngine.h
index 90933ab..cf24a3b 100644
--- a/libs/renderengine/skia/GraphiteVkRenderEngine.h
+++ b/libs/renderengine/skia/GraphiteVkRenderEngine.h
@@ -23,17 +23,17 @@
namespace android::renderengine::skia {
class GraphiteVkRenderEngine : public SkiaVkRenderEngine {
- friend std::unique_ptr<SkiaVkRenderEngine> SkiaVkRenderEngine::create(
- const RenderEngineCreationArgs& args);
+public:
+ static std::unique_ptr<GraphiteVkRenderEngine> create(const RenderEngineCreationArgs& args);
protected:
- GraphiteVkRenderEngine(const RenderEngineCreationArgs& args) : SkiaVkRenderEngine(args) {}
-
std::unique_ptr<SkiaGpuContext> createContext(VulkanInterface& vulkanInterface) override;
void waitFence(SkiaGpuContext* context, base::borrowed_fd fenceFd) override;
base::unique_fd flushAndSubmit(SkiaGpuContext* context, sk_sp<SkSurface> dstSurface) override;
private:
+ GraphiteVkRenderEngine(const RenderEngineCreationArgs& args) : SkiaVkRenderEngine(args) {}
+
std::vector<graphite::BackendSemaphore> mStagedWaitSemaphores;
};