Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 342d394c authored by Nolan Scobie's avatar Nolan Scobie
Browse files

Move SkiaGpuContext creation in SkiaVkRenderEngine to virtual function

Making GaneshVkRenderEngine / GraphiteVkRenderEngine handle this reduces
the need for higher-level branching.

Test: boots successfully with skiavkthreaded
Bug: b/293371537
Change-Id: I5685cb9dd7b0dc1ce3a2d538a729c255fbd6c52b
parent 1e06f2da
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -34,6 +34,12 @@ static void unref_semaphore(void* semaphore) {
    info->unref();
}

std::unique_ptr<SkiaGpuContext> GaneshVkRenderEngine::createContext(
        VulkanInterface& vulkanInterface) {
    return SkiaGpuContext::MakeVulkan_Ganesh(vulkanInterface.getGaneshBackendContext(),
                                             mSkSLCacheMonitor);
}

void GaneshVkRenderEngine::waitFence(SkiaGpuContext* context, base::borrowed_fd fenceFd) {
    if (fenceFd.get() < 0) return;

+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ class GaneshVkRenderEngine : public SkiaVkRenderEngine {
protected:
    GaneshVkRenderEngine(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;
};
+2 −5
Original line number Diff line number Diff line
@@ -112,12 +112,9 @@ SkiaRenderEngine::Contexts SkiaVkRenderEngine::createContexts() {
    sSetupVulkanInterface();

    SkiaRenderEngine::Contexts contexts;
    contexts.first = SkiaGpuContext::MakeVulkan_Ganesh(sVulkanInterface.getGaneshBackendContext(),
                                                       mSkSLCacheMonitor);
    contexts.first = createContext(sVulkanInterface);
    if (supportsProtectedContentImpl()) {
        contexts.second = SkiaGpuContext::MakeVulkan_Ganesh(sProtectedContentVulkanInterface
                                                                    .getGaneshBackendContext(),
                                                            mSkSLCacheMonitor);
        contexts.second = createContext(sProtectedContentVulkanInterface);
    }

    return contexts;
+1 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ public:
    };

protected:
    virtual std::unique_ptr<SkiaGpuContext> createContext(VulkanInterface& vulkanInterface) = 0;
    // Redeclare parent functions that Ganesh vs. Graphite subclasses must implement.
    virtual void waitFence(SkiaGpuContext* context, base::borrowed_fd fenceFd) override = 0;
    virtual base::unique_fd flushAndSubmit(SkiaGpuContext* context,