• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef SF_SKIARENDERENGINE_H_
18 #define SF_SKIARENDERENGINE_H_
19 
20 #include <renderengine/RenderEngine.h>
21 #include <sys/types.h>
22 
23 namespace android {
24 
25 namespace renderengine {
26 
27 class Mesh;
28 class Texture;
29 
30 namespace skia {
31 
32 class BlurFilter;
33 
34 // TODO: Put common skia stuff here that can be shared between the GL & Vulkan backends
35 // Currently mostly just handles all the no-op / missing APIs
36 class SkiaRenderEngine : public RenderEngine {
37 public:
38     static std::unique_ptr<SkiaRenderEngine> create(const RenderEngineCreationArgs& args);
39     SkiaRenderEngine(RenderEngineType type);
~SkiaRenderEngine()40     ~SkiaRenderEngine() override {}
41 
primeCache()42     virtual std::future<void> primeCache() override { return {}; };
genTextures(size_t,uint32_t *)43     virtual void genTextures(size_t /*count*/, uint32_t* /*names*/) override{};
deleteTextures(size_t,uint32_t const *)44     virtual void deleteTextures(size_t /*count*/, uint32_t const* /*names*/) override{};
isProtected()45     virtual bool isProtected() const override { return false; } // mInProtectedContext; }
supportsProtectedContent()46     virtual bool supportsProtectedContent() const override { return false; };
getContextPriority()47     virtual int getContextPriority() override { return 0; }
reportShadersCompiled()48     virtual int reportShadersCompiled() { return 0; }
49     virtual void setEnableTracing(bool tracingEnabled) override;
50 
51 protected:
52     virtual void mapExternalTextureBuffer(const sp<GraphicBuffer>& /*buffer*/,
53                                           bool /*isRenderable*/) override = 0;
54     virtual void unmapExternalTextureBuffer(const sp<GraphicBuffer>& /*buffer*/) override = 0;
55 
drawLayersInternal(const std::shared_ptr<std::promise<RenderEngineResult>> && resultPromise,const DisplaySettings & display,const std::vector<LayerSettings> & layers,const std::shared_ptr<ExternalTexture> & buffer,const bool useFramebufferCache,base::unique_fd && bufferFence)56     virtual void drawLayersInternal(
57             const std::shared_ptr<std::promise<RenderEngineResult>>&& resultPromise,
58             const DisplaySettings& display, const std::vector<LayerSettings>& layers,
59             const std::shared_ptr<ExternalTexture>& buffer, const bool useFramebufferCache,
60             base::unique_fd&& bufferFence) override {
61         resultPromise->set_value({NO_ERROR, base::unique_fd()});
62     };
63 };
64 
65 } // namespace skia
66 } // namespace renderengine
67 } // namespace android
68 
69 #endif /* SF_GLESRENDERENGINE_H_ */
70